--- argument_specs: main: short_description: Write a hardened sshd drop-in description: - >- Validates the profile and the merged settings, runs C(ssh-keygen -A), installs the drop-in checked with C(sshd -t) and reloads sshd through a handler. - >- Refuses to run when password authentication is off and public key authentication is not C(yes); when the C(pve) profile does not permit root key login (C(PermitRootLogin) must be C(prohibit-password), C(without-password) or C(yes)); when the C(pve) profile's C(HostKeyAlgorithms) or C(PubkeyAcceptedAlgorithms) lacks C(rsa-sha2-512); and when any profile lists SHA-1 C(ssh-rsa) in either. - Reads C(ansible_user), which is not a role input, and sets C(ansible_ssh_user) to it for the rest of the play. - >- C(sshd_settings_effective), the merged result read by the template and tasks/validate.yml, is deliberately not listed: its default indexes C(sshd_profiles[sshd_profile]), and the spec is templated before tasks/validate.yml runs, so an unknown C(sshd_profile) would fail at role entry with a templating error instead of the validation message. options: sshd_profile: type: str required: true description: - >- Key of C(sshd_profiles) that is layered over C(sshd_settings_defaults). With the shipped C(sshd_profiles) it is C(pve), C(ubuntu_lxc) or C(ubuntu_vm). - Not restricted by C(choices) because C(sshd_profiles) can be overridden; an unknown key is refused by tasks/validate.yml. sshd_service_name: type: str default: sshd description: - Service the handler reloads. sshd_config_dir: type: str default: /etc/ssh/sshd_config.d description: - Directory that holds the drop-in. It is created when missing. sshd_dropin_file: type: str default: 99-ansible-hardening.conf description: - File name of the drop-in inside C(sshd_config_dir). sshd_settings_defaults: type: dict description: - Hardening baseline of sshd directives, applied to every profile. Values are strings. - Overriding it replaces the whole baseline; use C(sshd_settings) to change single directives. sshd_profiles: type: dict description: - Per-profile directives merged over C(sshd_settings_defaults), keyed by profile name. - Overriding it replaces all profiles, because dicts are not merged across variable layers. sshd_settings: type: dict default: {} description: - Directives merged over the selected profile key by key. Values replace, lists are not merged. sshd_reload: type: bool default: true description: - When false the handler does not reload sshd after the drop-in changes. The handler is also skipped in check mode.