Files
Defame1297andClaude Opus 5.5 915f588533 feat(sshd): add the sshd role
Copied from the environment repository's local role. The files are
identical except: galaxy namespace mortis; comments, the README and the
guard failure messages scrubbed of environment references (issue numbers,
playbooks, inventory groups, the caller role's fallback, history of the
old vars/ files and of the variable renames), with the technical
explanation kept; the README's run order now asks for the ansible_user key
to be installed first instead of naming the environment's playbooks; the
molecule scenario calls the role by its FQCN (mortis.kamino.sshd), follows
the Kamino scenario conventions (kamino-molecule header,
scenario.test_sequence) and no longer sets ANSIBLE_COLLECTIONS_PATH or
ANSIBLE_ROLES_PATH. No variable, default, argument_specs type or task
logic changed; the test coverage is the same. The role uses
ansible.builtin only, so galaxy.yml's dependencies are unchanged.

The README Roadmap no longer lists sshd.

Not verified locally: the molecule scenario (it runs on the
kamino-molecule runner in CI) and ansible-test sanity (runs on push).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01MmzvM9skAvYcph2c9EiPcm
2026-11-15 22:08:10 +00:00

80 lines
2.7 KiB
YAML

---
# 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: "[email protected],[email protected]"
MACs: "[email protected],[email protected]"
# 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/<node>/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