Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create role for Fail2ban #27

Open
freephile opened this issue Nov 4, 2020 · 2 comments
Open

Create role for Fail2ban #27

freephile opened this issue Nov 4, 2020 · 2 comments

Comments

@freephile
Copy link
Owner

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)

@freephile
Copy link
Owner Author

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

@freephile
Copy link
Owner Author

freephile commented Nov 4, 2020

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant