How to Install Fail2Ban 0.10 with IPv6 support on Ubuntu 16.04


Ubuntu 16.04 doesn't have Fail2Ban 0.10.x in the distribution repositories, so if you want the newer version with IPv6 support you'll have to do the upgrade manually. Here's how to install Fail2Ban 0.10 on Ubuntu 16.04.

Backup existing settings and remove Fail2Ban completely

service fail2ban stop
cp -a /etc/fail2ban/ /etc/fail2ban_backup/
apt-get remove --auto-remove fail2ban
apt-get purge --auto-remove fail2ban
rm -r /etc/fail2ban/

Download the newer version and install it manually

At the time of writing the latest version is 0.10.4, but you may want to check the release page in case there's a newer one.

wget https://github.com/fail2ban/fail2ban/archive/0.10.4.tar.gz
tar xzf 0.10.4.tar.gz
cd fail2ban-0.10.4/
python setup.py install

Put Ubuntu-specific files into place

cp files/bash-completion /etc/bash_completion.d/fail2ban
cp man/*.5 /usr/share/man/man5
cp man/*.1 /usr/share/man/man1
wget -O /etc/logrotate.d/fail2ban https://raw.githubusercontent.com/fail2ban/fail2ban/debian/debian/fail2ban.logrotate
cp build/fail2ban.service /lib/systemd/system/fail2ban.service
systemctl enable fail2ban
service rsyslog restart

Import your old settings

This will vary depending on your configuration. Consider any changes you made in the backup files at /etc/fail2ban_backup. For example, if you adjusted dbpurgeage in fail2ban.conf you'll want to modify the new file the same. Or if you set up custom filters in filter.d/ or jails in jail.d/ you should copy the files to match. Once that's done it should be okay to simply copy the jail.local file over.

cp /etc/fail2ban_backup/jail.local /etc/fail2ban/jail.local

Start it up!

You may want to monitor /var/log/fail2ban.log while you do this with tail -f /var/log/fail2ban.log in another terminal.

service fail2ban start
service fail2ban status
fail2ban-client version

Provided there are no errors you should be good to go with Fail2Ban 0.10 with IPv6 support on Ubuntu 16.04!