security: shared user module authorizes one user's SSH key for every account #46

Closed
opened 2026-06-29 12:29:42 +01:00 by lyrathorpe · 0 comments
Owner

Problem

The shared system user module defined a single hardcoded SSH authorized key and applied it to users.users.${username} for whatever user a host declared. The same key was also defined a second time in the sshd hardening module. As a result:

  • Every account authorized that one key regardless of the account's real owner — e.g. the emmathorpe account on the WSL host authorized lyrathorpe@Lyra-MBA.
  • On hosts importing the sshd module the key was listed twice, producing a duplicate authorized_keys entry.

Impact

Cross-user SSH access that does not reflect the account's owner. Latent on hosts without sshd, but incorrect everywhere keys are materialized.

Resolution

Authorized keys now come from the per-user identity registry (users/registry.nix), applied once by modules/users.nix; the sshd module no longer defines keys. Each account authorizes only its own key(s). Fixed by the user-registry refactor.

## Problem The shared system user module defined a single hardcoded SSH authorized key and applied it to `users.users.${username}` for whatever user a host declared. The same key was also defined a second time in the sshd hardening module. As a result: - Every account authorized that one key regardless of the account's real owner — e.g. the `emmathorpe` account on the WSL host authorized `lyrathorpe@Lyra-MBA`. - On hosts importing the sshd module the key was listed twice, producing a duplicate `authorized_keys` entry. ## Impact Cross-user SSH access that does not reflect the account's owner. Latent on hosts without sshd, but incorrect everywhere keys are materialized. ## Resolution Authorized keys now come from the per-user identity registry (`users/registry.nix`), applied once by `modules/users.nix`; the sshd module no longer defines keys. Each account authorizes only its own key(s). Fixed by the user-registry refactor.
Sign in to join this conversation.
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: lyrathorpe/nixfiles#46