Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 14 additions & 9 deletions lib/rdk/start_ssh.sh
Original file line number Diff line number Diff line change
Expand Up @@ -95,14 +95,21 @@ isMOCASSHEnable=$(/usr/bin/tr181Set -d Device.DeviceInfo.X_RDKCENTRAL-COM_RFC.F
echo "RFC_ENABLE_MOCASSH:$isMOCASSHEnable"

if [ "$COMMUNITY_BUILDS" = "true" ]; then
EXTRA_ARGS=" -B "
DROPBEAR_KEY_DIR="/opt/dropbear"
if [ ! -f ${DROPBEAR_KEY_DIR}/dropbear_rsa_host_key ] ; then
# Source Dropbear configuration
[ -f /etc/default/dropbear ] && . /etc/default/dropbear

if [ ! -z "${DROPBEAR_EXTRA_ARGS}" ]; then
EXTRA_ARGS=" ${DROPBEAR_EXTRA_ARGS} "
fi
Comment thread
leenaS-d marked this conversation as resolved.

if [ -z "${DROPBEAR_RSAKEY_DIR}" ]; then
echo "DROPBEAR_RSAKEY_DIR is not set"
exit 1
elif [ ! -f "${DROPBEAR_RSAKEY_DIR}/dropbear_rsa_host_key" ]; then
systemctl start dropbearkey.service
fi
DROPBEAR_PARAMS="${DROPBEAR_KEY_DIR}/dropbear_rsa_host_key"
else
EXTRA_ARGS=" -s -a"
fi

DROPBEAR_PARAMS="${DROPBEAR_RSAKEY_DIR}/dropbear_rsa_host_key ${EXTRA_ARGS}"
fi
loop=1
address=""
Expand Down Expand Up @@ -145,7 +152,6 @@ if [ "$DEVICE_TYPE" = "mediaclient" ]; then
else
/bin/systemctl set-environment DROPBEAR_PARAMS="-r $DROPBEAR_PARAMS_1 -r $DROPBEAR_PARAMS_2"
fi
/bin/systemctl set-environment DROPBEAR_EXTRA_ARGS="$EXTRA_ARGS"
/bin/systemctl set-environment IP_ADDRESS_PARAM="$IP_ADDRESS_PARAM"
else
dropbear -s -b /etc/sshbanner.txt -s -a -r $DROPBEAR_PARAMS_1 -r $DROPBEAR_PARAMS_2 $IP_ADDRESS_PARAM $USE_DEVKEYS &
Expand All @@ -165,7 +171,6 @@ startDropbear()
else
/bin/systemctl set-environment DROPBEAR_PARAMS="-r $DROPBEAR_PARAMS_1 -r $DROPBEAR_PARAMS_2"
fi
/bin/systemctl set-environment DROPBEAR_EXTRA_ARGS="$EXTRA_ARGS"
else
dropbear -b /etc/sshbanner.txt -s -a -r $DROPBEAR_PARAMS_1 -r $DROPBEAR_PARAMS_2 -p $ipAddress:22 $USE_DEVKEYS &
fi
Expand Down
2 changes: 1 addition & 1 deletion systemd_units/dropbear.service
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ EnvironmentFile=-/etc/default/dropbear
EnvironmentFile=/etc/device.properties
ExecStartPre=/bin/sh /lib/rdk/start_ssh.sh
ExecStartPre=/bin/systemctl import-environment USE_DEVKEYS
ExecStart=/bin/sh -c '/usr/sbin/dropbear -s -b /etc/sshbanner.txt ${DROPBEAR_PARAMS} ${DROPBEAR_EXTRA_ARGS} ${IP_ADDRESS_PARAM} ${USE_DEVKEYS}'
ExecStart=/bin/sh -c '/usr/sbin/dropbear -s -b /etc/sshbanner.txt ${DROPBEAR_PARAMS} ${IP_ADDRESS_PARAM} ${USE_DEVKEYS}'
Comment thread
leenaS-d marked this conversation as resolved.
ExecStartPost=/bin/sh -c "rm -rf /tmp/.dropbear"
RestartSec=5s
KillSignal=SIGHUP
Expand Down