initial commit

This commit is contained in:
Riedel
2026-08-19 09:51:43 +02:00
commit d777c1e975
79 changed files with 2263 additions and 0 deletions

View File

@@ -0,0 +1,5 @@
---
- name: restart sshd
ansible.builtin.systemd:
name: sshd
state: restarted

View File

@@ -0,0 +1,27 @@
---
- name: Deploy sshd_config
ansible.builtin.template:
src: sshd_config.j2
dest: /etc/ssh/sshd_config
owner: root
group: root
mode: "0600"
validate: "/usr/sbin/sshd -t -f %s"
notify: restart sshd
tags: [ssh_hardening]
- name: Create sshd_config.d drop-in directory for future exceptions
ansible.builtin.file:
path: /etc/ssh/sshd_config.d
state: directory
owner: root
group: root
mode: "0755"
tags: [ssh_hardening]
- name: Enable and start sshd
ansible.builtin.systemd:
name: sshd
enabled: true
state: started
tags: [ssh_hardening]

View File

@@ -0,0 +1,34 @@
# {{ ansible_managed }}
Port {{ ssh_port }}
Protocol 2
PermitRootLogin no
PasswordAuthentication no
PubkeyAuthentication yes
ChallengeResponseAuthentication no
KbdInteractiveAuthentication no
UsePAM yes
MaxAuthTries {{ ssh_max_auth_tries }}
AllowGroups {{ ssh_allow_groups }}
ClientAliveInterval {{ ssh_client_alive_interval }}
ClientAliveCountMax {{ ssh_client_alive_count_max }}
LoginGraceTime 30
MaxSessions 4
MaxStartups 10:30:60
X11Forwarding no
AllowTcpForwarding no
AllowAgentForwarding no
PermitTunnel no
GatewayPorts no
Ciphers chacha20-poly1305@openssh.com,aes256-gcm@openssh.com,aes128-gcm@openssh.com,aes256-ctr,aes192-ctr,aes128-ctr
MACs hmac-sha2-512-etm@openssh.com,hmac-sha2-256-etm@openssh.com,umac-128-etm@openssh.com
KexAlgorithms curve25519-sha256,curve25519-sha256@libssh.org,diffie-hellman-group16-sha512
Banner /etc/issue.net
LogLevel VERBOSE
SyslogFacility AUTHPRIV
Include /etc/ssh/sshd_config.d/*.conf