2.1 KiB
2.1 KiB
sshd
A hardened OpenSSH server role for Debian/Ubuntu and RHEL/Rocky systems.
This role installs and configures the sshd server with secure defaults and a small set of tunable options for authentication and forwarding.
Requirements
- Target hosts must be Debian-family or RedHat-family Linux systems
Supported Platforms
- Debian
- Ubuntu
- RHEL 9+
- Rocky Linux 9+
Role Variables
Authentication
sshd_disable_pam: disable PAM support insshd_config. Default:falsesshd_password_auth: allow password authentication. Default:falsesshd_challenge_response_auth: allow challenge-response authentication. Default:falsesshd_gss_api_auth: allow GSSAPI authentication. Default:false
Forwarding & tunneling
sshd_allow_agent_forwarding: allow SSH agent forwarding. Default:falsesshd_allow_tcp_forwarding: allow TCP forwarding. Default:falsesshd_gateway_ports: allow gateway ports. Default:falsesshd_permit_tunnel: allow SSH tunneling. Default:false
Access control
sshd_allow_users: optional space-separated list of users permitted to log in via SSHsshd_allow_groups: optional space-separated list of groups permitted to log in via SSH
Behavior
By default this role:
- installs
openssh-server - enforces
Protocol 2 - disables
PermitRootLogin - disables
X11Forwarding,HostbasedAuthentication,KbdInteractiveAuthentication, andPermitUserEnvironment - disables weak(-er) host keys (
ecdsa,dsa) - disables empty passwords
- sets
LogLevel VERBOSE - restricts
/etc/ssh/sshd_configto0600
Compatibility Notes
- The role uses
sshdvalidation via/usr/sbin/sshd -t -f %s. - Debian/Ubuntu systems use the
sshservice name; RHEL/Rocky systems usesshd. - The role is intentionally conservative with forwarding and tunneling defaults.
Example Playbook
See: converge.yml
Dependencies
None
License
BSD