RDK-61784: Bind authorized_keys based on DeviceType RFC in prod builds alone - #577
RDK-61784: Bind authorized_keys based on DeviceType RFC in prod builds alone #577NareshM1702 wants to merge 3 commits into
Conversation
There was a problem hiding this comment.
Pull request overview
This PR updates start_ssh.sh to select which authorized_keys file Dropbear uses based on the DeviceType RFC, but only for production builds (per the PR title).
Changes:
- Adds a build-type guard intended to apply the RFC-based DeviceType check only in non-dev vs dev builds.
- Adds a “prod vs dev keys” selection branch based on the RFC DeviceType value.
- Sets
USE_DEVKEYSviasystemctl set-environmentfor downstream Dropbear startup behavior.
Comments suppressed due to low confidence (2)
lib/rdk/start_ssh.sh:78
DEVICETYPEis currently assigned with2>&1 > /dev/null, which discards stdout (the value) and captures stderr instead. That makes$DEVICETYPEempty on success, so theTESTcomparison never matches.
DEVICETYPE=$(tr181 -d Device.DeviceInfo.X_RDKCENTRAL-COM_RFC.Identity.DeviceType 2>&1 > /dev/null)
lib/rdk/start_ssh.sh:89
- In the non-prod branch, the log says "use dev authorization keys by default" but
USE_DEVKEYSis set to empty (prod keys). This likely inverts the intended behavior for dev/non-prod builds.
else
USE_DEVKEYS=""
echo " Build type is dev , use dev authorization keys by default"
fi
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
Comments suppressed due to low confidence (1)
lib/rdk/start_ssh.sh:81
- The BUILD_TYPE check is comparing the literal string "BUILD_TYPE" (so this branch will always run), and the dev-build branch sets USE_DEVKEYS to empty while the log says it will use dev keys. Also, the PR title says this DeviceType-based selection should apply to prod builds only, but the current condition applies to all non-dev build types.
if [ "BUILD_TYPE" != "dev" ]; then
DEVICETYPE=$(tr181 -d Device.DeviceInfo.X_RDKCENTRAL-COM_RFC.Identity.DeviceType 2>&1 > /dev/null)
if [ "$DEVICETYPE" = "TEST" ]; then
USE_DEVKEYS="-f authorized_keys_dev"
echo " dropbear using dev authorization keys"
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 2 out of 2 changed files in this pull request and generated no new comments.
Comments suppressed due to low confidence (4)
lib/rdk/start_ssh.sh:77
- The BUILD_TYPE comparison is using the literal string "BUILD_TYPE" instead of the BUILD_TYPE variable, so this condition will always be true and the dev-build branch will never run.
if [ "BUILD_TYPE" != "dev" ]; then
lib/rdk/start_ssh.sh:78
- This command substitution redirects stdout to /dev/null, so DEVICETYPE won’t contain the DeviceType value (it may capture stderr instead). That makes the TEST/prod selection unreliable.
DEVICETYPE=$(tr181 -d Device.DeviceInfo.X_RDKCENTRAL-COM_RFC.Identity.DeviceType 2>&1 > /dev/null)
lib/rdk/Start_MaintenanceTasks.sh:105
- The marker file "/tmp/.RFCsynccomplete" is created even when rfcMgr is missing or returns an error (result=-1 or other non-0/1). Given the name, this can incorrectly signal successful RFC sync completion.
touch /tmp/.RFCsynccomplete
# Handle both success (0) and acceptable warning (1) exit codes, flag other results as errors
if [ "$result" -ne 0 ] && [ "$result" -ne 1 ]; then
eventSender "MaintenanceMGR" "$MAINT_RFC_ERROR"
fi
lib/rdk/start_ssh.sh:88
- In the dev-build branch the log says dev authorization keys will be used, but USE_DEVKEYS is set to empty (prod keys). This is inconsistent with the intent (and with the prod-only DeviceType check).
else
USE_DEVKEYS=""
echo " Build type is dev , use dev authorization keys by default"
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 1 out of 1 changed files in this pull request and generated 1 comment.
Comments suppressed due to low confidence (1)
lib/rdk/start_ssh.sh:77
- The BUILD_TYPE comparison is using the literal string "BUILD_TYPE" rather than the $BUILD_TYPE variable, so this condition will always be true and the dev-build branch will never run.
if [ "BUILD_TYPE" != "dev" ]; then
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 1 out of 1 changed files in this pull request and generated no new comments.
Comments suppressed due to low confidence (1)
lib/rdk/start_ssh.sh:81
- The build-type guard currently uses
"$BUILD_TYPE" != "dev", which applies the RFC DeviceType gating to all non-dev builds (e.g., VBN/other), but the PR title says this behavior should be for prod builds only. Also, the DeviceType comparison is case-sensitive, while other scripts (e.g., lib/rdk/startStunnel.sh) treattest/TESTequivalently—so a lowercase value would incorrectly select prod keys.
USE_DEVKEYS="-f authorized_keys_dev"
DEVICETYPE=$(tr181 -d Device.DeviceInfo.X_RDKCENTRAL-COM_RFC.Identity.DeviceType 2>/dev/null)
if [ "$BUILD_TYPE" != "dev" ] && [ "$DEVICETYPE" != "TEST" ]; then
USE_DEVKEYS=""
fi
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
98b3d52 to
13eaadd
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 2 out of 2 changed files in this pull request and generated no new comments.
Comments suppressed due to low confidence (1)
lib/rdk/start_ssh.sh:80
DEVICETYPEis read withtr181 -d, but elsewhere in this repo the same TR-181 parameter is read withtr181 -g(e.g.,lib/rdk/startStunnel.sh:117). If-ddoes not return the raw value, the comparison againstTESTmay fail and prod builds will always fall back to prod keys. Also,startStunnel.shhandles bothTESTandtest, so normalizing case here avoids surprises if the value is lowercased.
USE_DEVKEYS="-f authorized_keys_dev"
DEVICETYPE=$(tr181 -d Device.DeviceInfo.X_RDKCENTRAL-COM_RFC.Identity.DeviceType 2>/dev/null)
if [ "$BUILD_TYPE" != "dev" ] && [ "$DEVICETYPE" != "TEST" ]; then
USE_DEVKEYS=""
No description provided.