Applicable to:
- Plesk for Linux
Question
How to block custom bots on Plesk server?
Answer
It is possible to add the required bots into Fail2ban "apache-badbot" jail:
-
Go to Tools & Settings > IP Address Banning (Fail2Ban) > Jails and click on Manage Filters
-
Select apache-badbots.
-
Edit the existing filter by adding the required custom bots in the "badbotscustom" value separated by a pipe, e.g.:
Fail2ban will start blocking access from both Nginx and Apache. The settings can be checked at Tools & Settings > IP Address Banning (Fail2Ban) > Jails > plesk-apache-badbot:
CONFIG_TEXT: [plesk-apache-badbot]
enabled = true
filter = apache-badbots
action = iptables-multiport[name=BadBots, port="http,https,7080,7081"]
logpath = /var/www/vhosts/system/*/logs/*access*log
/var/log/httpd/*access_log
maxretry = 1
To ensure the jail is working, check Tools & Settings > IP Address Banning (Fail2Ban) > Banned IP addresses or fail2ban log /var/log/fail2ban.log
.
Comments
1 comment
Hello,
I entered the above code.
However I get an error message.
What am I doing wrong?
Does anyone know another solution?
------
Error: Unable to add the jail filter: f2bmng failed: ERROR:__main__:File contains no section headers.
file: '<stdin>', line: 1
'badbotscustom = SputnikBot|omgili|socialmediascanner|Jooblebot|SeznamBot|Scrapy|CCBot|linkfluence|veoozbot|Leikibot'.
------
Thanx
Please sign in to leave a comment.