🐛 Exit cleanly when SSH access is disabled#1051
Conversation
When the SSH port is not exposed, the sshd service ran a `sleep 864000` placeholder. On graceful shutdown that placeholder was killed by SIGTERM, causing the finish script to set the container exit code to 143. Disable the sshd service entirely via an `S6_STAGE2_HOOK` script that removes it from the user bundle when no SSH port is configured, matching the pattern used by some official add-ons. The container now exits with 0 on a graceful shutdown. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (3)
💤 Files with no reviewable changes (1)
WalkthroughThis pull request refactors SSH daemon conditional startup by moving disable logic from the sshd/run script to a new S6 stage2 hook. A Dockerfile environment variable now points to enable-check.sh, which runs during container init to conditionally prevent SSH daemon startup if port 22 is not configured. The sshd/run script is simplified because the hook handles the disable. ChangesSSH daemon conditional startup via S6 stage2 hook
🎯 2 (Simple) | ⏱️ ~12 minutes
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Proposed Changes
When the SSH port is not exposed, the sshd service ran a
sleep 864000placeholder. On graceful shutdown that placeholder was killed by SIGTERM, causing the finish script to set the container exit code to 143.Disable the sshd service entirely via an
S6_STAGE2_HOOKscript that removes it from the user bundle when no SSH port is configured, matching the pattern used by some official add-ons. The container now exits with 0 on a graceful shutdown.Related Issues
home-assistant/supervisor#6840
Summary by CodeRabbit
Bug Fixes
New Features
Chores