-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathblock_bots.conf
47 lines (35 loc) · 2.08 KB
/
block_bots.conf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#By Josef Meile <jmeile@hotmail.com> @ April, 2021
#This will block bad bots in your Virtual Hosts (ie: download managers)
#You just have to include it in your virtual host:
#Include ${EVIL_HOST_PATH}/block_bots.conf
#Alternatively, you can include it either in your global apache .conf file or
#put it in the configuration files folder, ie:
#/etc/apache2/conf-enabled -> In devian/ubuntu like distros
#/etc/httpd/conf.d -> In RedHad/CentOS like distros
#I opted to linking it into the configuration folder, ie:
#cd /etc/apache2/conf-enabled
#ln -s /usr/local/ApacheHostTrap/block_bots.conf .
#The blocked accesses will be logged to:
#/var/log/apache2/blocked_user_agents.log
#If your bad bots list is big, then you can split it on serveral lines,
#just add a "BrowserMatchNoCase ... BLACK_LISTED_BOT" per line
#Please note that this file will disable any *Require ip* or similar
#instruction inside a posterior *Directory* directive. To cope with this, you
#will have to use *Location* instead (See the VirtualHost example).
<Location />
#Comment this out for Apache 2.2
#Order deny,allow
BrowserMatchNoCase (httrack|scraper|copier|collector|mail|grabber) BLACK_LISTED_BOT
BrowserMatchNoCase (flashget|harvest|loader|walker|scan|record) BLACK_LISTED_BOT
BrowserMatchNoCase (download|reget|siphon|xenu|sucker|stripper|extract|java) BLACK_LISTED_BOT
#Bots which doesn't seem to be bad, but match the rules above, so, they are excluded here
BrowserMatchNoCase (mail.ru_bot|archive.org_bot|AndroidDownloadManager) !BLACK_LISTED_BOT
#You may add exceptions by IP as well, ie: they are internal IPs from your organization, but
#they use java to fetch urls. Since java is banned before, you need to make an exception here,
#eg: for allowing the ip: 192.168.160.133 to use java requests, then add this:
#SetEnvIf Remote_Addr 192.168.160.133 !BLACK_LISTED_BOT
#You may also achieve the same with a host:
#SetEnvIfNoCase Host example\.org !BLACK_LISTED_BOT
Deny from env=BLACK_LISTED_BOT
</Location>
CustomLog ${APACHE_LOG_DIR}/blocked_user_agents.log combined env=BLACK_LISTED_BOT