Reset sshd host key mode on every start #1

Merged
Jedi_kitten merged 2 commits from fix-sshd-host-key-mode into main 2026-11-16 16:18:04 +00:00
Owner

Problem

In self-service the test API pod is in CrashLoopBackOff (503). sshd exits with Permissions 0660 for '/data/ssh_host_ed25519_key' are too open.

The key is created with umask 077 (0600), but the deployment has fsGroup: 10001, so kubelet makes the files on the PVC group-writable at every mount. The first start works; any restart fails. supervise() stops all children when one exits, so the API goes down with sshd.

Fix

host_key.chmod(0o600) before starting sshd. The file belongs to app, so the chmod works under fsGroup.

Tests

test_main_restores_private_host_key_mode fails without the fix; tests/test_selfservice.py passes (10 passed).

## Problem In self-service the test API pod is in CrashLoopBackOff (503). `sshd` exits with `Permissions 0660 for '/data/ssh_host_ed25519_key' are too open`. The key is created with `umask 077` (0600), but the deployment has `fsGroup: 10001`, so kubelet makes the files on the PVC group-writable at every mount. The first start works; any restart fails. `supervise()` stops all children when one exits, so the API goes down with `sshd`. ## Fix `host_key.chmod(0o600)` before starting `sshd`. The file belongs to `app`, so the chmod works under `fsGroup`. ## Tests `test_main_restores_private_host_key_mode` fails without the fix; `tests/test_selfservice.py` passes (10 passed).
Reset sshd host key mode on every start
Some checks failed
Check, publish and propose deployment / check (pull_request) Failing after 3m14s
Check, publish and propose deployment / publish (pull_request) Has been skipped
Check, publish and propose deployment / deliver (pull_request) Has been skipped
e1acd6bf38
fsGroup makes the key on the PVC 0660 at each mount, so sshd rejected it
after the first restart and the supervisor took the API down with it.
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
culture/cu-clubs-bot!1
No description provided.