From db951dcf378e15a1a81b19a52c629d9fada64439 Mon Sep 17 00:00:00 2001 From: Leena D <74546271+leenaS-d@users.noreply.github.com> Date: Tue, 28 Jul 2026 12:32:43 -0400 Subject: [PATCH 1/2] RDKEMW-22087: Support configurable Dropbear host key files and command-line arguments --- lib/rdk/start_ssh.sh | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/lib/rdk/start_ssh.sh b/lib/rdk/start_ssh.sh index 4b4513a8..685319b1 100755 --- a/lib/rdk/start_ssh.sh +++ b/lib/rdk/start_ssh.sh @@ -90,14 +90,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 + + 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="" @@ -140,7 +147,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 & @@ -160,7 +166,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 From 97641dd88fad32d1ed7d8d1ac36832e422ebce10 Mon Sep 17 00:00:00 2001 From: Leena D <74546271+leenaS-d@users.noreply.github.com> Date: Tue, 28 Jul 2026 12:33:37 -0400 Subject: [PATCH 2/2] RDKEMW-22087: Support configurable Dropbear host key files and command-line arguments --- systemd_units/dropbear.service | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/systemd_units/dropbear.service b/systemd_units/dropbear.service index fee063ab..30268ce5 100644 --- a/systemd_units/dropbear.service +++ b/systemd_units/dropbear.service @@ -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}' ExecStartPost=/bin/sh -c "rm -rf /tmp/.dropbear" RestartSec=5s KillSignal=SIGHUP