Repository navigation
Validate key-only SSH setup before exposing the service - #14910
thebytorsnowdog wants to merge 1 commit into
Conversation
|
|
|
||
| prepare_case preserve-customization | ||
| printf '%s' "$old_key" >"$case_home/.ssh/authorized_keys" | ||
| printf '# administrator additions\nPasswordAuthentication yes\nAllowUsers existing\n' >"$config" |
There was a problem hiding this comment.
Match rules lack test coverage
The new preservation test has no Match block, so it never checks that administrator-specific authentication rules survive setup. A future change could erase those rules without failing these tests. Add a fixture with global authentication settings followed by a Match User block. Check that setup changes the global settings, keeps the block unchanged, and does not duplicate settings on a second run.
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
|
Good fix for the #8363 class: validate keys + effective key-only policy before starting/enabling sshd and opening the firewall, with rollback of a rejected candidate config. Overlapping open PRs aiming at the same bug: #14667 (omarchybot), #9463 (OM-SEC-08), #14781 (host-key generation tests on Suggested labels: |
|
Read the diff at 67190dd against current The classification is not settled yet: the second model (Codex Medium) was not asked, because today's review budget is spent. So this pull request has no class label, and nothing was run on a worker; the reproduction and test suite wait for a pass where both models can look at it. Two things for whoever picks this up:
|
|
Closing this as #14667 merged today with the core ordering fix: sshd is only enabled, started and opened in ufw once a key is authorized and the key-only drop-in validates. It's on quattro and on Two things this PR handles that #14667 doesn't, and I'd happily take them as a small follow-up on top of quattro:
Thanks @thebytorsnowdog. If you open that follow-up, keep it to those two so it's quick to review. |
SSH setup currently starts the service and opens the firewall before key collection and authentication configuration succeed. Validate every supplied or fetched key and the effective key-only defaults before activating SSH, then open UFW last.
The configuration update stages and validates the hardening drop-in, restoring the previous file on validation failure. Existing authorized keys, unrelated directives and administrator
Matchrules are preserved. Running servers reload the validated policy; stopped servers start afterward. A later service or firewall failure reports incomplete setup while retaining the validated keys and hardening.Validation: all eight groups in
test/shell.d/setup-security-sshd-test.shpass, covering cancellation, failed/mixed key downloads, configuration rollback, existing/symlinked drop-ins, repeated execution, and service/firewall failures. Privileged operations use disposable paths and strict stubs; Bash syntax and command-style checks pass.Before release, verify real SSH login, effective authentication policy, reload failures and firewall ordering in a disposable Omarchy VM. No live SSH daemon or firewall was changed during these tests.