Fix: Complete SSH bootstrap hardening
This commit is contained in:
@@ -99,10 +99,19 @@ Before it offers SSH hardening, it copies a safe root key when possible or
|
||||
verifies the target key. The target user's `.ssh` must be owned by that user at
|
||||
`0700`, and `authorized_keys` must be owned by that user at `0600`. Without a
|
||||
verified target key, SSH hardening is unavailable and the bootstrap continues.
|
||||
Every non-comment key line must parse with `ssh-keygen`. Root-key destination
|
||||
creation and writing run as the target UID, followed by the same owner, mode,
|
||||
and key checks. Do not replace that with root writes or assume the user's
|
||||
primary group matches the username.
|
||||
|
||||
Accepted hardening uses an atomic same-directory `sshd_config.d` drop-in,
|
||||
runs `sshd -t`, then reloads the detected SSH unit. Validation or reload
|
||||
failure restores the previous drop-in before it retries validation and reload;
|
||||
failed recovery stops the handoff with manual recovery instructions. The
|
||||
fixture contracts exercise those branches. `panama test --safe` never reloads
|
||||
a live daemon, so it is not live-host proof.
|
||||
Accepted hardening uses atomic same-directory `00-panama.conf` with exactly
|
||||
`PermitRootLogin no`, `PasswordAuthentication no`, and
|
||||
`KbdInteractiveAuthentication no`. A pre-existing symlink or non-regular
|
||||
object makes hardening unavailable, as does a missing SSH unit. Panama runs
|
||||
`sshd -t`, then checks effective root and target-user policy with `sshd -T -C`
|
||||
before reloading the detected unit. Validation or reload failure restores a
|
||||
prior regular file with its metadata before it retries validation and reload.
|
||||
Failed recovery stops the handoff with instructions that distinguish a prior
|
||||
file from no prior file. The fixture contracts also cover declined hardening
|
||||
and interrupted preparation. `panama test --safe` never reloads a live daemon,
|
||||
so it is not live-host proof.
|
||||
|
||||
Reference in New Issue
Block a user