Skip to content

Commit 16d601d

Browse files
CentOS7 Configuration Instructions
1 parent e6a6568 commit 16d601d

File tree

7 files changed

+5499
-0
lines changed

7 files changed

+5499
-0
lines changed

CentOS7/CONFIGURATION.md

Lines changed: 143 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,143 @@
1+
# CONFIGURATION APACHE BAD BOT BLOCKER FOR CENTOS 7 and APACHE 2.4.6:
2+
### PLEASE READ CONFIGURATION INSTRUCTIONS BELOW THOROUGHLY
3+
4+
##### Created by: https://github.com/mitchellkrogza
5+
##### Copyright Mitchell Krog <[email protected]>
6+
### Version 2.2017.04
7+
8+
# CONFIGURATION OF THE APACHE BAD BOT BLOCKER:
9+
10+
## FOR CENTOS 7 and APACHE 2.4.6 ONLY
11+
12+
##Step 1:
13+
14+
**CREATE THE custom.d folder needed for Apache on CENTOS 7**
15+
16+
**You must create this folder.**
17+
18+
Open Terminal
19+
20+
`su`
21+
22+
`mkdir /etc/httpd/custom.d`
23+
24+
##Step 2:
25+
26+
**COPY THE GLOBALBLACKLIST.CONF FILE FROM THE REPO**
27+
28+
Copy the contents of **globalblacklist.conf** into your /etc/httpd/custom.d folder.
29+
30+
`cd /etc/httpd/custom.d`
31+
32+
`wget https://raw.githubusercontent.com/mitchellkrogza/apache-ultimate-bad-bot-blocker/master/CentOS7/custom.d/globalblacklist.conf -O globalblacklist.conf`
33+
34+
##Step 3:
35+
36+
**WHITELIST ALL YOUR OWN DOMAIN NAMES AND IP ADDRESSES**
37+
38+
Whitelist all your own domain names and IP addresses. **Please note important changes**, this is now done using include files so that you do not have to keep reinserting your whitelisted domains and IP addresses every time you update.
39+
40+
`cd /etc/httpd/custom.d`
41+
42+
- copy the whitelist-ips.conf file into that folder
43+
44+
`wget https://raw.githubusercontent.com/mitchellkrogza/apache-ultimate-bad-bot-blocker/master/CentOS7/custom.d/whitelist-ips.conf -O whitelist-ips.conf`
45+
46+
47+
- copy the whitelist-domains.conf file into the same folder
48+
49+
`wget https://raw.githubusercontent.com/mitchellkrogza/apache-ultimate-bad-bot-blocker/master/CentOS7/custom.d/whitelist-domains.conf -O whitelist-domains.conf`
50+
51+
Use nano, vim or any other text editor to edit both whitelist-ips.conf and whitelist-domains.conf to include all your own domain names and IP addresses that you want to specifically whitelist from the blocker script.
52+
53+
When pulling any future updates now you can simply pull the latest globalblacklist.conf file and it will automatically include your whitelisted domains and IP addresses. No more remembering having to do this yourself.
54+
55+
##Step 4:
56+
57+
**INCLUDE THE GLOBALBLACKLIST.CONF FILE INTO A VIRTUALHOST**
58+
59+
Include the globalblacklist.conf file within a `<Directory>` block just after your opening Options statements and before the rest of your host config example below.
60+
61+
On CentOS to do this, open your httpd.conf file
62+
63+
`nano /etc/httpd/conf/httpd.conf`
64+
65+
At the very bottom where you configure your Virtualhosts you will configure one like this example.
66+
You will need to do this for each Virtualhost you have set up.
67+
** VERY IMPORTANT: The Include Statement MUST be located within a `<Directory></Directory>` Block**
68+
69+
```
70+
<VirtualHost *:80>
71+
ServerAdmin [email protected]
72+
DocumentRoot /var/www/html/mywebsite.com
73+
ServerName mywebsite.com
74+
ErrorLog logs/mywebsite.com-error_log
75+
CustomLog logs/mywebsite.com-access_log common
76+
<Directory "/var/www/html/mywebsite.com">
77+
Include /etc/httpd/custom.d/globalblacklist.conf
78+
</Directory>
79+
</VirtualHost>
80+
```
81+
82+
##Step 5:
83+
84+
**RELOAD YOUR APACHE CONFIGURATION**
85+
86+
`service httpd reload`
87+
88+
If you get no errors you followed my instructions properly.
89+
90+
The blocker is now active and working so now you can run some simple tests from another linux machine to make sure it's working.
91+
92+
##Step 6:
93+
94+
*TESTING**
95+
96+
Run the following commands one by one from a terminal on another linux machine against your own domain name.
97+
**substitute yourdomain.com in the examples below with your REAL domain name**
98+
99+
`curl -A "googlebot" http://yourdomain.com`
100+
101+
Should respond with 200 OK
102+
103+
`curl -A "80legs" http://yourdomain.com`
104+
105+
`curl -A "masscan" http://yourdomain.com`
106+
107+
Should respond with 403 Forbidden
108+
109+
`curl -I http://yourdomain.com -e http://100dollars-seo.com`
110+
111+
`curl -I http://yourdomain.com -e http://zyzzcentral.ru`
112+
113+
Should respond with 403 Forbidden
114+
115+
The Apache Ultimate Bot Blocker is now WORKING and PROTECTING your web sites !!!
116+
117+
##Step 7:
118+
119+
**UPDATING THE APACHE BAD BOT BLOCKER** is now easy thanks to the automatic includes for whitelisting your own domain names.
120+
121+
Updating to the latest version is now as simple as:
122+
123+
`cd /etc/httpd/custom.d`
124+
125+
`su`
126+
127+
`wget https://raw.githubusercontent.com/mitchellkrogza/apache-ultimate-bad-bot-blocker/master/CentOS7/custom.d/globalblacklist.conf -O globalblacklist.conf`
128+
129+
`service httpd reload`
130+
131+
And you will be up to date with all your whitelisted domains included automatically for you now.
132+
133+
# AUTO UPDATING:
134+
135+
See my latest auto updater bash script at:
136+
137+
https://raw.githubusercontent.com/mitchellkrogza/apache-ultimate-bad-bot-blocker/master/CentOS7/updateapacheblocker.sh
138+
139+
140+
Relax now and sleep better at night knowing your site is telling all those baddies FORBIDDEN !!!
141+
142+
143+
### Coding makes me very thirsty [Why not buy me a beer](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=TNCNMH8QVM78J):beer:

0 commit comments

Comments
 (0)