Open freephile opened 4 years ago
Note that for any existing installs, the fail2ban service should be stopped and the fail2ban.service file in ./build/ should be copied
cp build/fail2ban.service /lib/systemd/system/fail2ban.service
systemctl stop fail2ban
# Run 'systemctl daemon-reload' to reload units.
systemctl daemon-reload
Update the configuration
wget -q -O- "https://raw.githubusercontent.com/mitchellkrogza/apache-ultimate-bad-bot-blocker/master/_generator_lists/bad-user-agents.list" | uniq | sed -e 's/\\ / /g' | sed -e 's/\([.\:|()+]\)/\\\1/g' | tr '\n' '|' | sed -e 's/|$//g'
copy the results into /etc/fail2ban/filter.d/apache-badbots.conf
To confirm installation
fail2ban-client version
To confirm operation
fail2ban-regex --print-all-matched /var/log/apache2/access_log /etc/fail2ban/filter.d/apache-badbots.conf
Currently fail2ban is installed and configured manually on each host.
Create a role to install and configure it with Ansible - or possibly use https://github.com/mitchellkrogza/apache-ultimate-bad-bot-blocker as a replacement (creating role for that)