Disable SSH password authentication on all hosts #11

Open
opened 2026-11-16 10:39:01 -05:00 by polen · 0 comments
Owner

Problem

No host sets services.openssh.settings.PasswordAuthentication = false, so the NixOS default (password login allowed) applies everywhere. There is no fail2ban.

  • server: port 22 is also the Forgejo SSH port, so it is likely forwarded from the internet. polen is in wheel.
  • asus, latoure, pi: no openssh.authorizedKeys declared at all, so they are password-only.

Fix

  • Declare authorized keys for the login user on every host.
  • Set PasswordAuthentication = false and KbdInteractiveAuthentication = false on every host (a shared module under modules/ fits).
  • Optional: services.fail2ban.enable = true on the server.
  • Remove the stale 2222 # ssh firewall entry on the server.

Caution

Deploy keys first and confirm key login works before the switch that disables passwords.

## Problem No host sets `services.openssh.settings.PasswordAuthentication = false`, so the NixOS default (password login allowed) applies everywhere. There is no fail2ban. - **server**: port 22 is also the Forgejo SSH port, so it is likely forwarded from the internet. `polen` is in `wheel`. - **asus, latoure, pi**: no `openssh.authorizedKeys` declared at all, so they are password-only. ## Fix - Declare authorized keys for the login user on every host. - Set `PasswordAuthentication = false` and `KbdInteractiveAuthentication = false` on every host (a shared module under `modules/` fits). - Optional: `services.fail2ban.enable = true` on the server. - Remove the stale `2222 # ssh` firewall entry on the server. ## Caution Deploy keys first and confirm key login works before the switch that disables passwords.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
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
polen/nixos#11
No description provided.