{ config, lib, ... }: { options.host.ssh = { enable = lib.mkOption { type = lib.types.bool; default = false; description = "Enable the SSH server with the shared config below."; }; }; config = lib.mkIf config.host.ssh.enable { services.openssh = { enable = true; allowSFTP = true; openFirewall = lib.mkDefault false; hostKeys = [ { path = "/etc/ssh/id_ed25519"; type = "ed25519"; } ]; settings = { PasswordAuthentication = false; # Только ключ: владелец 2026-12-03 — «Пароль запрещаем». # PasswordAuthentication = false ниже остаётся; вместе это даёт # «root только по ключу», без пароля и без запрета входа вовсе. PermitRootLogin = "prohibit-password"; UsePAM = true; }; }; }; }