Skip to content
Open
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
19 changes: 3 additions & 16 deletions source/scripts/init/service.d/service_sshd.sh
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ WAN_INTERFACE=$(getWanInterfaceName)
DEFAULT_WAN_INTERFACE="erouter0"
LANIPV6Support=`sysevent get LANIPv6GUASupport`
DEVICETYPE=$(dmcli eRT getv Device.DeviceInfo.X_RDKCENTRAL-COM_RFC.Identity.DeviceType | grep value | cut -d ":" -f 3 | tr -d ' ' | tr -s ' ' | tr '[:lower:]' '[:upper:]')
if [ "$DEVICETYPE" = "TEST" ] && [ "$USE_DYNAMICKEYING" = "TRUE" ]; then
if [ $DEVICETYPE = "TEST" ] && [ $USE_DYNAMICKEYING = "TRUE" ]; then
Copy link

Copilot AI Dec 18, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The removal of quotes around variable comparisons makes the script vulnerable to errors when variables are empty or contain spaces. Shell scripts should quote variables in comparisons to prevent word splitting and glob expansion. This pattern is inconsistent with the rest of the file which consistently uses quoted variables (e.g., line 59: [ "$BOX_TYPE" = "HUB4" ]).

Suggested change
if [ $DEVICETYPE = "TEST" ] && [ $USE_DYNAMICKEYING = "TRUE" ]; then
if [ "$DEVICETYPE" = "TEST" ] && [ "$USE_DYNAMICKEYING" = "TRUE" ]; then

Copilot uses AI. Check for mistakes.
USE_DEVKEYS="-f authorized_keys_dev"
echo_t "[utopia]: dropbear using dev authorization keys"
else
Expand Down Expand Up @@ -207,19 +207,6 @@ do_start() {
if [ ! -z "$CM_IPV4" ]; then
commandString="$commandString -p [$CM_IPV4]:22"
fi
elif [ "$BOX_TYPE" = "WNXL11BWL" ]; then
CM_IP=`ip -4 addr show dev $CMINTERFACE scope global | awk '/inet/{print $2}' | cut -d '/' -f1 | head -n1`
if [ ! -z $CM_IP ]; then
commandString="$commandString -p [$CM_IP]:22"
fi
CM_IPv6=`ip -6 addr show dev wwan0 scope global | awk '/inet/{print $2}' | cut -d '/' -f1 | head -n1`
if [ ! -z $CM_IPv6 ]; then
commandString="$commandString -p [$CM_IPv6]:22"
fi
CM_IPv4=`ip -4 addr show dev wwan0 scope global | awk '/inet/{print $2}' | cut -d '/' -f1 | head -n1`
if [ ! -z $CM_IPv4 ]; then
commandString="$commandString -p [$CM_IPv4]:22"
fi
else
CM_IP=""
if ([ "$BOX_TYPE" = "rpi" ] || [ "$BOX_TYPE" = "bpi" ]) ;then
Expand Down Expand Up @@ -267,8 +254,8 @@ do_start() {
echo_t "utopia: dropbear could not be started on erouter0 IPv6 interface."
fi
else
if ([ "$MANUFACTURE" = "Technicolor" ] || [ "$MODEL_NUM" = "SG417DBCT" ] || [ "$BOX_TYPE" = "WNXL11BWL" ]) ; then
echo_t "dropbear -E -s -K 60 -b /etc/sshbanner.txt ${commandString} -r ${DROPBEAR_PARAMS_1} -r ${DROPBEAR_PARAMS_2} -a -P ${PID_FILE}"
if ([ "$MANUFACTURE" = "Technicolor" ] || [ "$MODEL_NUM" = "SG417DBCT" ]) ; then
echo dropbear -E -s -K 60 -b /etc/sshbanner.txt ${commandString} -r ${DROPBEAR_PARAMS_1} -r ${DROPBEAR_PARAMS_2} -a -P ${PID_FILE}
Copy link

Copilot AI Dec 18, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The change from echo_t to plain echo is inconsistent with the rest of the file. Throughout this script, echo_t is used for logging purposes (see lines 53, 56, 242, 246, 248, 252, 254, 270, 273, 275, etc.). Using plain echo here means this debug statement won't be properly logged with timestamps like other messages in the script.

Suggested change
echo dropbear -E -s -K 60 -b /etc/sshbanner.txt ${commandString} -r ${DROPBEAR_PARAMS_1} -r ${DROPBEAR_PARAMS_2} -a -P ${PID_FILE}
echo_t dropbear -E -s -K 60 -b /etc/sshbanner.txt ${commandString} -r ${DROPBEAR_PARAMS_1} -r ${DROPBEAR_PARAMS_2} -a -P ${PID_FILE}

Copilot uses AI. Check for mistakes.
dropbear -E -s -b /etc/sshbanner.txt $commandString -r $DROPBEAR_PARAMS_1 -r $DROPBEAR_PARAMS_2 -a -P $PID_FILE -K 60 $USE_DEVKEYS 2>>$CONSOLEFILE
elif [ "$BOX_TYPE" = "SCER11BEL" -a "$LANIPV6Support" = "true" ]; then
dropbear -E -s -b /etc/sshbanner.txt $commandString -r $DROPBEAR_PARAMS_1 -r $DROPBEAR_PARAMS_2 -a -P $PID_FILE -K 60 $USE_DEVKEYS 2>>$CONSOLEFILE
Expand Down