ansible-personal/roles
Alan Orth 0605f70f2e
roles/common: Add support for fail2ban
This is active banning of IPs that are brute forcing login attempts
to SSH, versus the passive banning of 10,000 abusive IPs from the
abuseipdb.com blacklist. For now I am banning IPs that fail to log
in successfully more than twelve times in a one-hour period, but
these settings might change, and I can override them at the group
and host level if needed.

Currently this works for CentOS 7, Ubuntu 16.04, and Ubuntu 18.04,
with minor differences in the systemd configuration due to older
versions on some distributions.

You can see the status of the jail like this:

    # fail2ban-client status sshd
    Status for the jail: sshd
    |- Filter
    |  |- Currently failed: 0
    |  |- Total failed:     0
    |  `- Journal matches:  _SYSTEMD_UNIT=sshd.service + _COMM=sshd
    `- Actions
       |- Currently banned: 1
       |- Total banned:     1
       `- Banned IP list:   106.13.112.20

You can unban IPs like this:

    # fail2ban-client set sshd unbanip 106.13.112.20
2019-10-26 16:36:07 +02:00
..
common roles/common: Add support for fail2ban 2019-10-26 16:36:07 +02:00
mariadb roles/mariadb: Remove login_unix_socket from .my.cnf 2019-09-14 18:32:26 +03:00
munin roles/munin: Don't use loop when installing one package 2018-04-02 15:51:29 +03:00
nginx roles/nginx: Fix hardcoded "stretch" release in sources 2019-09-15 16:03:17 +03:00
php-fpm roles/php-fpm: Fix Ansible template parsing issue 2019-07-23 18:32:27 +03:00