Fail2ban and firewall problem [SOLVED]
Fail2ban and firewall problem
But now, Active jails and amount of banned IP addresses: kh-phpmyadmin (0x), sshd (0x)
- No entries available -
Any ideas what can I do for fail2ban to start banning ips again?
Re: Fail2ban and firewall problem
could you determine at first what type of traffic increased in general?
Do you recognize any hints at the logs?
Daniel Marckardt
**************************************************************
Keyweb AG - Die Hosting Marke
Neuwerkstr. 45/46, 99084 Erfurt / Germany
https://www.keyweb.de - https://www.keyhelp.de
**************************************************************
Re: Fail2ban and firewall problem
Re: Fail2ban and firewall problem
is there a potential similarity, like user-agent?
"ClaudeBot" e.g. is currently often around with aggressive crawls.
You could limit them or other "unwanted" user-agents using "rewrite" rules at the virtual host of apache. Or if its too much, implement a countryfilter for 80/443 tcp @iptables/ipset.
Daniel Marckardt
**************************************************************
Keyweb AG - Die Hosting Marke
Neuwerkstr. 45/46, 99084 Erfurt / Germany
https://www.keyweb.de - https://www.keyhelp.de
**************************************************************
Re: Fail2ban and firewall problem [SOLVED]
Re: Fail2ban and firewall problem
there are no rules to turn down legitimate bots that are crawling websites. They are basically seen as normal usertraffic.
Of course its possible to block them with fail2ban, but its very inefficent. Best options are rules according to robots.txt or if they do not comply with, block the user-agents with re-write rules or throttle them with a rate-limit on application layer. WIth nginx done through "limit_req" analogous to apache mod_qos. mod_evasive is not useful since there is no user-agent matching option.
Daniel Marckardt
**************************************************************
Keyweb AG - Die Hosting Marke
Neuwerkstr. 45/46, 99084 Erfurt / Germany
https://www.keyweb.de - https://www.keyhelp.de
**************************************************************
- Jolinar
- Community Moderator
- Posts: 4003
- Joined: Sat 30. Jan 2016, 07:11
- Location: Weimar (Thüringen)
- Contact:
Re: Fail2ban and firewall problem
You could customize the file /etc/fail2ban/filter.d/apache-badbots.conf to suit your needs.
Data Collector für Community Support
___
Ich verwende zwei verschiedene Schriftfarben in meinen Beiträgen /
I use two different font colors in my posts:
- In dieser Farbe schreibe ich als Moderator und gebe moderative Hinweise oder begründe moderative Eingriffe /
In this color, I write as a moderator and provide moderative guidance or justify moderative interventions - In dieser Farbe schreibe ich als Community Mitglied und teile meine private Meinung und persönlichen Ansichten mit /
In this color, I write as a community member and share my personal opinions and views
Re: Fail2ban and firewall problem
You should use a custom filter and expand it accordingly ... will not be overwritten (F2B updates).
e.g.
Code: Select all
nano /etc/fail2ban/filter.d/my-badbots.conf
# add:
# Fail2Ban configuration file
#
# Regexp to catch specific spambots
[Definition]
failregex = ^<HOST>.*ahrefs\.com.*
^<HOST>.*PetalBot.*
^<HOST>.*ClaudeBot.*
^<HOST>.*claudebot.*
^<HOST>.*Bytespider.*
^<HOST>.*bytedance\.com.*
^<HOST>.*BLEXBot.*
^<HOST>.*facebookexternalhit.*
ignoreregex =
Code: Select all
nano /etc/fail2ban/jail.d/my-badbots.local
# add:
[my-badbots]
enabled = true
port = http,https
filter = my-badbots
logpath = /home/users/*/logs/*/access.log
maxretry = 1
findtime = 1800
bantime = 48h