Skip to content

RDKB-64870: [Spike/POC] Evaluate OpenSSH usage in place of dropbear#325

Open
MonekaLakshmi wants to merge 1 commit into
developfrom
topic/RDKB-64796
Open

RDKB-64870: [Spike/POC] Evaluate OpenSSH usage in place of dropbear#325
MonekaLakshmi wants to merge 1 commit into
developfrom
topic/RDKB-64796

Conversation

@MonekaLakshmi
Copy link
Copy Markdown
Contributor

Reason for change: TESTING PURPOSE

Copilot AI review requested due to automatic review settings May 21, 2026 06:42
@MonekaLakshmi MonekaLakshmi requested review from a team as code owners May 21, 2026 06:42
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR updates the sshd service wrapper to run OpenSSH sshd (POC/spike) instead of the prior implementation, integrating it into the existing Utopia sysevent/PMON service model.

Changes:

  • Replaces the start/stop logic with OpenSSH sshd invocation, PID handling, and basic startup validation.
  • Adds OpenSSH host key generation and directory setup.
  • Expands event handling (e.g., sshd-restart, combined lan-status|wan-status, current_wan_ifname) and updates PMON integration.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

[ -z "${SSHD_PID}" ] && ${SSHD} -f /etc/sshd.conf
sysevent set ssh_daemon_state up
SSHD="/usr/sbin/sshd"
SSHD_CONFIG="/etc/ssh/sshd_config_readonly"
Comment on lines +52 to +66
PID_FILE="/var/run/sshd.pid"
KEY_DIR="/var/run/ssh"
PMON="/etc/utopia/service.d/pmon.sh"

generate_openssh_keys()
{
mkdir -p "${KEY_DIR}"
chmod 0755 "${KEY_DIR}"

[ -f "${KEY_DIR}/ssh_host_rsa_key" ] || ssh-keygen -q -t rsa -N '' -C '' -f "${KEY_DIR}/ssh_host_rsa_key"
[ -f "${KEY_DIR}/ssh_host_ecdsa_key" ] || ssh-keygen -q -t ecdsa -N '' -C '' -f "${KEY_DIR}/ssh_host_ecdsa_key"
[ -f "${KEY_DIR}/ssh_host_ed25519_key" ] || ssh-keygen -q -t ed25519 -N '' -C '' -f "${KEY_DIR}/ssh_host_ed25519_key"

chmod 600 "${KEY_DIR}"/ssh_host_*_key 2>/dev/null || true
chmod 644 "${KEY_DIR}"/ssh_host_*_key.pub 2>/dev/null || true
Comment on lines +107 to +113
do_stop()
{
sysevent set ssh_daemon_state down

if [ -f "${PID_FILE}" ] && [ -s "${PID_FILE}" ]; then
kill "`cat ${PID_FILE}`" 2>/dev/null
sleep 1
Comment on lines +107 to +117
do_stop()
{
sysevent set ssh_daemon_state down

if [ -f "${PID_FILE}" ] && [ -s "${PID_FILE}" ]; then
kill "`cat ${PID_FILE}`" 2>/dev/null
sleep 1
fi

if pidof sshd >/dev/null 2>&1; then
killall sshd 2>/dev/null
Comment on lines 71 to +77
SSHD_PID=`pidof sshd`
[ ! "${SSHD_PID}" ] && return 0
kill "${SSHD_PID}"
sysevent set ssh_daemon_state down

if [ "${SSHD_PID}" ]; then
echo "${SSHD_PID}" | awk '{print $1}' > "${PID_FILE}"
sysevent set ssh_daemon_state up
echo_t "[utopia] OpenSSH already running. PID: `cat ${PID_FILE}`"
return 0
Reason for change: TESTING PURPOSE

Signed-off-by: plaksh175_comcast <PiramanayagamMoneka_Lakshmi@comcast.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants