Skip to content
19 changes: 10 additions & 9 deletions lib/rdk/start_ssh.sh
Original file line number Diff line number Diff line change
Expand Up @@ -95,14 +95,17 @@ 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_RSAKEY_DIR}" ]; then
echo "DROPBEAR_RSAKEY_DIR is not set"
exit 1
elif [ ! -f "${DROPBEAR_RSAKEY_DIR}/dropbear_rsa_host_key" ]; then
Comment on lines +101 to +104
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"
fi
loop=1
address=""
Expand Down Expand Up @@ -145,7 +148,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 +167,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