Skip to content

RDKEMW-10284: Migrate stunnel to use P12 cert#364

Merged
tdeva14 merged 12 commits intodevelopfrom
topic/RDKEMW-10284
Apr 17, 2026
Merged

RDKEMW-10284: Migrate stunnel to use P12 cert#364
tdeva14 merged 12 commits intodevelopfrom
topic/RDKEMW-10284

Conversation

@Lasya-Prakarsha-D-V
Copy link
Copy Markdown
Contributor

Reason for change: To integrate SE based device cert for mTls connectivity in stunnel
Test Procedure: Build and verify SHORTS connectivity
Risks: None
Priority: P1

Reason for change: To integrate SE based device cert for mTls connectivity in stunnel
Test Procedure: Build and verify SHORTS connectivity
Risks: None
Priority: P1

Signed-off-by: ldonth501 <LasyaPrakarsha_DonthiVenkata@comcast.com>
@Lasya-Prakarsha-D-V Lasya-Prakarsha-D-V requested a review from a team as a code owner November 10, 2025 09:43
Copilot AI review requested due to automatic review settings November 10, 2025 09:43
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 refactors the startStunnel.sh script to improve stunnel configuration management, add retry logic for PID file availability, and implement secure file descriptor handling for passcode management.

Key Changes

  • Moved environment variable exports (TERM and HOME) to after sourcing configuration files
  • Enhanced device type detection with case-insensitive checking and additional logging
  • Implemented dynamic file descriptor allocation with named pipe for secure passcode handling
  • Added retry logic for stunnel PID file reading with improved error handling
  • Changed certificate path variable from CERT_FILE to CERT_PATH

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

Comment thread lib/rdk/startStunnel.sh Outdated
Comment thread lib/rdk/startStunnel.sh Outdated
Comment thread lib/rdk/startStunnel.sh
Comment thread lib/rdk/startStunnel.sh
Comment thread lib/rdk/startStunnel.sh
Comment thread lib/rdk/startStunnel.sh Outdated
Comment thread lib/rdk/startStunnel.sh
Comment thread lib/rdk/startStunnel.sh Outdated
Comment thread lib/rdk/startStunnel.sh
Comment thread lib/rdk/startStunnel.sh Outdated
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

Copilot reviewed 1 out of 1 changed files in this pull request and generated 5 comments.


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

Comment thread lib/rdk/startStunnel.sh Outdated
Comment thread lib/rdk/startStunnel.sh
Comment thread lib/rdk/startStunnel.sh
Comment thread lib/rdk/startStunnel.sh
Comment thread lib/rdk/startStunnel.sh Outdated
Copilot AI review requested due to automatic review settings December 16, 2025 13:24
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

Copilot reviewed 1 out of 1 changed files in this pull request and generated 6 comments.


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

Comment thread lib/rdk/startStunnel.sh Outdated
Comment thread lib/rdk/startStunnel.sh
Comment thread lib/rdk/startStunnel.sh
Comment thread lib/rdk/startStunnel.sh Outdated
Comment thread lib/rdk/startStunnel.sh
Comment thread lib/rdk/startStunnel.sh
Copilot AI review requested due to automatic review settings January 19, 2026 10:47
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

Copilot reviewed 1 out of 1 changed files in this pull request and generated 6 comments.


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

Comment thread lib/rdk/startStunnel.sh
Comment thread lib/rdk/startStunnel.sh
Comment thread lib/rdk/startStunnel.sh
Comment thread lib/rdk/startStunnel.sh Outdated
Comment thread lib/rdk/startStunnel.sh Outdated
Comment thread lib/rdk/startStunnel.sh
Copilot AI review requested due to automatic review settings January 22, 2026 08:05
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

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/startStunnel.sh:199

  • The error handling around stunnel startup exits before running the "cleanup sensitive files" section, meaning $STUNNEL_CONF_FILE and any sensitive data referenced by $D_FILE are left on disk whenever /usr/bin/stunnel returns a non‑zero exit code. To preserve the previous behavior and avoid leaking sensitive material, perform the cleanup (or at least remove these files) before exiting on stunnel startup failure.
/usr/bin/stunnel $STUNNEL_CONF_FILE
if [ $? -ne 0 ]; then
    echo_t "STUNNEL: ERROR - Failed to start stunnel process."
    exit 1
fi

# cleanup sensitive files early
rm -f $STUNNEL_CONF_FILE
rm -f $D_FILE

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

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings January 22, 2026 10:55
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

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/startStunnel.sh:199

  • When stunnel exits with a non-zero status, the exit 1 path prevents the subsequent cleanup block from running, so $STUNNEL_CONF_FILE and $D_FILE are left on disk even though they are marked as sensitive. To avoid persisting sensitive configuration or key material on stunnel startup failures, the cleanup of these files should also execute on the error path (for example by moving or duplicating the cleanup before exiting on failure).
/usr/bin/stunnel $STUNNEL_CONF_FILE
if [ $? -ne 0 ]; then
    echo_t "STUNNEL: ERROR - Failed to start stunnel process."
    exit 1
fi

# cleanup sensitive files early
rm -f $STUNNEL_CONF_FILE
rm -f $D_FILE

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

Reason for change: Applying valid co pilot review comments
Test Procedure: Build and verify SHORTS connectivity
Risks: None
Priority: P1

Signed-off-by: ldonth501 <LasyaPrakarsha_DonthiVenkata@comcast.com>
Copilot AI review requested due to automatic review settings April 15, 2026 06:25
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

Copilot reviewed 1 out of 1 changed files in this pull request and generated 5 comments.


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

Comment thread lib/rdk/startStunnel.sh
Comment thread lib/rdk/startStunnel.sh
Comment thread lib/rdk/startStunnel.sh
Comment thread lib/rdk/startStunnel.sh
Comment thread lib/rdk/startStunnel.sh
Copy link
Copy Markdown
Contributor

@tdeva14 tdeva14 left a comment

Choose a reason for hiding this comment

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

LGTM

@tdeva14 tdeva14 merged commit f5f229b into develop Apr 17, 2026
10 checks passed
@github-actions github-actions bot locked and limited conversation to collaborators Apr 17, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants