--- # PVE sometimes uses ssh instead of sshd sshd_service_name: sshd sshd_config_dir: /etc/ssh/sshd_config.d sshd_dropin_file: 99-ansible-hardening.conf sshd_settings_defaults: # Authentication PasswordAuthentication: "no" PubkeyAuthentication: "yes" KbdInteractiveAuthentication: "no" ChallengeResponseAuthentication: "no" PermitEmptyPasswords: "no" UsePAM: "yes" # Access control MaxAuthTries: "3" LoginGraceTime: "30" MaxSessions: "5" MaxStartups: "10:30:60" # Connection hardening ClientAliveInterval: "300" ClientAliveCountMax: "2" TCPKeepAlive: "no" # Forwarding / features X11Forwarding: "no" AllowAgentForwarding: "no" AllowTcpForwarding: "no" PermitTunnel: "no" # Crypto hygiene HostKeyAlgorithms: "ssh-ed25519" PubkeyAcceptedAlgorithms: "ssh-ed25519" KexAlgorithms: "curve25519-sha256" Ciphers: "chacha20-poly1305@openssh.com,aes256-gcm@openssh.com" MACs: "hmac-sha2-512-etm@openssh.com,hmac-sha2-256-etm@openssh.com" # Misc PrintMotd: "no" PrintLastLog: "yes" LogLevel: "VERBOSE" # Per-profile settings, layered over sshd_settings_defaults. Selected by sshd_profile (a role # parameter). These are role defaults, so inventory variables override them with normal # Ansible precedence. # Overriding sshd_profiles replaces ALL profiles (dicts are not merged across variable # layers); to change one setting use sshd_settings below. sshd_profiles: pve: # Proxmox cluster SSH logs in as root with keys only (BatchMode). Passwords are already # off through PasswordAuthentication; this also keeps root key-only if they are ever # turned back on. Join nodes through the default API join, not `pvecm add --use_ssh`. PermitRootLogin: "prohibit-password" AllowTcpForwarding: "no" X11Forwarding: "no" AllowAgentForwarding: "no" # Proxmox cluster SSH (migration, console proxy) checks each node's RSA host key against # /etc/pve/nodes//ssh_known_hosts and logs in with root's RSA key, so RSA with SHA-2 # stays allowed here. Never ssh-rsa (SHA-1). Guarded in tasks/validate.yml. HostKeyAlgorithms: "ssh-ed25519,rsa-sha2-512,rsa-sha2-256" PubkeyAcceptedAlgorithms: "ssh-ed25519,rsa-sha2-512,rsa-sha2-256" ubuntu_lxc: PermitRootLogin: "no" ubuntu_vm: PermitRootLogin: "no" # Consumer overrides: merged over the profile, key by key, so one setting can change without # repeating the rest. Values replace; there is no list merging here (all values are strings). sshd_settings: {} # The settings written to the drop-in. Read by the template and by validate.yml. sshd_settings_effective: >- {{ sshd_settings_defaults | combine(sshd_profiles[sshd_profile], sshd_settings) }} # Safety valve sshd_reload: true