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
61 lines
2.8 KiB
YAML
61 lines
2.8 KiB
YAML
---
|
|
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), and when the C(pve)
|
|
profile does not permit root key login (C(PermitRootLogin) must be C(prohibit-password), C(without-password) or C(yes)).
|
|
- 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.
|