roles/common: Wire up fail2ban
The nftables support works easily and creates the table, chains, and sets on demand.
This commit is contained in:
parent
3b053167b1
commit
14814aa5d9
@ -2,8 +2,13 @@
|
|||||||
enabled = true
|
enabled = true
|
||||||
# See: /etc/fail2ban/filter.d/sshd.conf
|
# See: /etc/fail2ban/filter.d/sshd.conf
|
||||||
filter = sshd
|
filter = sshd
|
||||||
|
{% if ansible_distribution == 'Debian' and ansible_distribution_major_version is version('11', '>=') %}
|
||||||
|
# Integrate with nftables
|
||||||
|
banaction=nftables[type=allports]
|
||||||
|
{% else %}
|
||||||
# Integrate with firewalld and ipsets
|
# Integrate with firewalld and ipsets
|
||||||
banaction = firewallcmd-ipset
|
banaction = firewallcmd-ipset
|
||||||
|
{% endif %}
|
||||||
backend = systemd
|
backend = systemd
|
||||||
maxretry = {{ fail2ban_maxretry }}
|
maxretry = {{ fail2ban_maxretry }}
|
||||||
findtime = {{ fail2ban_findtime }}
|
findtime = {{ fail2ban_findtime }}
|
||||||
|
@ -2,14 +2,14 @@
|
|||||||
PrivateDevices=yes
|
PrivateDevices=yes
|
||||||
PrivateTmp=yes
|
PrivateTmp=yes
|
||||||
ProtectHome=read-only
|
ProtectHome=read-only
|
||||||
{% if ansible_distribution == 'Ubuntu' and ansible_distribution_major_version is version('18','>=') %}
|
{% if (ansible_distribution == 'Ubuntu' and ansible_distribution_major_version is version('18','>=')) or (ansible_distribution == 'Debian' and ansible_distribution_major_version is version('11','>=')) %}
|
||||||
ProtectSystem=strict
|
ProtectSystem=strict
|
||||||
{% else %}
|
{% else %}
|
||||||
{# Older systemd versions don't have ProtectSystem=strict #}
|
{# Older systemd versions don't have ProtectSystem=strict #}
|
||||||
ProtectSystem=full
|
ProtectSystem=full
|
||||||
{% endif %}
|
{% endif %}
|
||||||
NoNewPrivileges=yes
|
NoNewPrivileges=yes
|
||||||
{% if ansible_distribution == 'Ubuntu' and ansible_distribution_major_version is version('18','>=') %}
|
{% if (ansible_distribution == 'Ubuntu' and ansible_distribution_major_version is version('18','>=')) or (ansible_distribution == 'Debian' and ansible_distribution_major_version is version('11','>=')) %}
|
||||||
ReadWritePaths=-/var/run/fail2ban
|
ReadWritePaths=-/var/run/fail2ban
|
||||||
ReadWritePaths=-/var/lib/fail2ban
|
ReadWritePaths=-/var/lib/fail2ban
|
||||||
ReadWritePaths=-/var/log/fail2ban.log
|
ReadWritePaths=-/var/log/fail2ban.log
|
||||||
|
Loading…
Reference in New Issue
Block a user