Skip to content

Commit 6c3513c

Browse files
V3.2019.08.1140 [ci skip]
1 parent dfe543f commit 6c3513c

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+56
-270
lines changed
Lines changed: 0 additions & 107 deletions
Original file line numberDiff line numberDiff line change
@@ -1,107 +0,0 @@
1-
#!/bin/bash
2-
# Bash Script for Auto Updating the Apache Bad Bot Blocker for Apache 2.2 > 2.2
3-
# Copyright - https://github.com/mitchellkrogza
4-
# Project Url: https://github.com/mitchellkrogza/apache-ultimate-bad-bot-blocker
5-
6-
##############################################################################
7-
# ___ __ #
8-
# / _ | ___ ___ _____/ / ___ #
9-
# / __ |/ _ \/ _ `/ __/ _ \/ -_) #
10-
# /_/ |_/ .__/\_,_/\__/_//_/\__/ #
11-
# __/_/ __ ___ __ ___ __ __ #
12-
# / _ )___ ____/ / / _ )___ / /_ / _ )/ /__ ____/ /_____ ____ #
13-
# / _ / _ `/ _ / / _ / _ \/ __/ / _ / / _ \/ __/ '_/ -_) __/ #
14-
# /____/\_,_/\_,_/ /____/\___/\__/ /____/_/\___/\__/_/\_\\__/_/ #
15-
# #
16-
##############################################################################
17-
18-
# MAKE SURE you have your whitelist-ips.conf, whitelist-domains.conf, blacklist-ips.conf and bad-referrer-words.conf files in /etc/custom.d
19-
# A major change to using include files was introduced in
20-
# https://github.com/mitchellkrogza/apache-ultimate-bad-bot-blocker/releases/tag/2017-04-19.Build-173
21-
22-
# PLEASE READ UPDATED CONFIGURATION INSTRUCTIONS BEFORE USING THIS
23-
24-
# Save this file as /usr/sbin/update-apacheblocker.sh
25-
# Make it Executable chmod +x /usr/sbin/update-apacheblocker.sh
26-
27-
# RUN THE UPDATE
28-
# Here our script runs, pulls the latest update, runs a config test then reloads apache and emails you a notification
29-
# Place your own valid email address where it says "[email protected]"
30-
31-
#Update all environment variables to suit your OS/Apache version.
32-
33-
#Major Apache version e.g. 2.2, 2.2
34-
APACHE_VERSION='2.2'
35-
#Directory where bad bot configs are located.
36-
APACHE_CONF='/usr/local/apache2/custom.d'
37-
#location of globalblacklist
38-
BLACKLIST_URL="https://raw.githubusercontent.com/mitchellkrogza/apache-ultimate-bad-bot-blocker/master/Apache_${APACHE_VERSION}/custom.d/globalblacklist.conf"
39-
#Address to send update notifications
40-
41-
#Make backup of globalblacklist.conf when updating true or false.
42-
MAKE_BACKUP=false
43-
#Run /usr/local/apache2/bin/apachectl test before reload true/false
44-
TEST_BEFORE_RELOAD=true
45-
#Curl test to ensure blocking still working after reload true/false.
46-
CURL_TEST_AFTER_RELOAD=true
47-
#Specify if your site uses http or https
48-
CURL_TEST_PROTOCOL=http
49-
#domain name to test against.
50-
CURL_TEST_URL_NAME=localhost
51-
52-
SERVER_NAME=$(hostname)
53-
UPDATE_FAIL="Bad bot failed to update globalblacklist on ${SERVER_NAME}"
54-
UPDATE_SUCCESS="Bad bot globalblacklist successfully updated on ${SERVER_NAME}"
55-
CURL_FAIL="Bad bot curl tests have failed on ${SERVER_NAME}."
56-
WGET_FAIL="Unable to obtain updated globalblacklist. Wget failed on ${SERVER_NAME}."
57-
CONF_ERROR="Bad bot globalblacklist not present. Does not appear to be setup properly. Aborting update on ${SERVER_NAME}"
58-
DATE=$(date +%Y-%m-%d-%H-%M-%S)
59-
60-
if [ ! -f ${APACHE_CONF}/globalblacklist.conf ] ; then
61-
#Aborting update
62-
echo -e "Subject: Bad bot not installed properly \\n\\n ${CONF_ERROR}\\n" | sendmail -t ${EMAIL};
63-
exit 1;
64-
else
65-
diff <(wget -q -O - ${BLACKLIST_URL}) ${APACHE_CONF}/globalblacklist.conf;
66-
DIFF_CHECK=$?
67-
if [ ${DIFF_CHECK} -eq 0 ] ; then
68-
#Nothing changed
69-
echo "Bad bot globalblacklist is already up to date";
70-
exit 0;
71-
else
72-
if [ ${MAKE_BACKUP} = true ] ; then
73-
cp "${APACHE_CONF}/globalblacklist.conf" "${APACHE_CONF}/globalblacklist.${DATE}.backup";
74-
# Delete backups that are older than 5 days
75-
find ${APACHE_CONF} -maxdepth 1 -type f -mtime +5 -name 'globalblacklist.*.backup' -exec rm {} \;
76-
fi
77-
wget -q ${BLACKLIST_URL} -O ${APACHE_CONF}/globalblacklist.tmp && mv ${APACHE_CONF}/globalblacklist.tmp ${APACHE_CONF}/globalblacklist.conf;
78-
if [ -f ${APACHE_CONF}/globalblacklist.tmp ] ; then
79-
echo -e "Subject: Bad bot update WGET FAIL \\n\\n ${WGET_FAIL}\\n" | sendmail -t ${EMAIL};
80-
rm -f ${APACHE_CONF}/globalblacklist.tmp;
81-
exit 1;
82-
fi
83-
if [ ${TEST_BEFORE_RELOAD} = true ] ; then
84-
/usr/local/apache2/bin/apachectl configtest || TESTFAIL=true;
85-
fi
86-
if [ -z ${TESTFAIL} ] ; then
87-
/usr/local/apache2/bin/apachectl graceful;
88-
if [ ${CURL_TEST_AFTER_RELOAD} = true ] ; then
89-
CURL_RESPONSE_BAD=$(curl --location -A "masscan" -Isk -o /dev/null -w %{http_code} ${CURL_TEST_PROTOCOL}://${CURL_TEST_URL_NAME} | tr -dc '[:alnum:]')
90-
CURL_RESPONSE_GOOD=$(curl --location -A "googlebot" -Isk -o /dev/null -w %{http_code} ${CURL_TEST_PROTOCOL}://${CURL_TEST_URL_NAME} | tr -dc '[:alnum:]')
91-
if [ $CURL_RESPONSE_BAD != "403" ] || [ $CURL_RESPONSE_GOOD != "200" ] ; then
92-
echo -e "Subject: Bad bot CURL FAIL \\n\\n ${CURL_FAIL}\\n" | sendmail -t ${EMAIL};
93-
exit 1;
94-
fi
95-
fi
96-
echo -e "Subject: Bad bot updated globalblacklist \\n\\n ${UPDATE_SUCCESS}\\n" | sendmail -t ${EMAIL};
97-
exit 0;
98-
else
99-
echo -e "Subject: Bad bot update FAIL \\n\\n ${UPDATE_FAIL}\\n" | sendmail -t ${EMAIL};
100-
exit 1;
101-
fi
102-
fi
103-
fi
104-
105-
# Add this as a cron to run daily / weekly as you like
106-
# Here's a sample CRON entry to update every day at 10pm
107-
# 00 22 * * * /usr/sbin/update-apacheblocker.sh
Lines changed: 0 additions & 107 deletions
Original file line numberDiff line numberDiff line change
@@ -1,107 +0,0 @@
1-
#!/bin/bash
2-
# Bash Script for Auto Updating the Apache Bad Bot Blocker for Apache 2.2 > 2.4
3-
# Copyright - https://github.com/mitchellkrogza
4-
# Project Url: https://github.com/mitchellkrogza/apache-ultimate-bad-bot-blocker
5-
6-
##############################################################################
7-
# ___ __ #
8-
# / _ | ___ ___ _____/ / ___ #
9-
# / __ |/ _ \/ _ `/ __/ _ \/ -_) #
10-
# /_/ |_/ .__/\_,_/\__/_//_/\__/ #
11-
# __/_/ __ ___ __ ___ __ __ #
12-
# / _ )___ ____/ / / _ )___ / /_ / _ )/ /__ ____/ /_____ ____ #
13-
# / _ / _ `/ _ / / _ / _ \/ __/ / _ / / _ \/ __/ '_/ -_) __/ #
14-
# /____/\_,_/\_,_/ /____/\___/\__/ /____/_/\___/\__/_/\_\\__/_/ #
15-
# #
16-
##############################################################################
17-
18-
# MAKE SURE you have your whitelist-ips.conf, whitelist-domains.conf, blacklist-ips.conf and bad-referrer-words.conf files in /etc/custom.d
19-
# A major change to using include files was introduced in
20-
# https://github.com/mitchellkrogza/apache-ultimate-bad-bot-blocker/releases/tag/2017-04-19.Build-173
21-
22-
# PLEASE READ UPDATED CONFIGURATION INSTRUCTIONS BEFORE USING THIS
23-
24-
# Save this file as /usr/sbin/update-apacheblocker.sh
25-
# Make it Executable chmod +x /usr/sbin/update-apacheblocker.sh
26-
27-
# RUN THE UPDATE
28-
# Here our script runs, pulls the latest update, runs a config test then reloads apache and emails you a notification
29-
# Place your own valid email address where it says "[email protected]"
30-
31-
#Update all environment variables to suit your OS/Apache version.
32-
33-
#Major Apache version e.g. 2.2, 2.4
34-
APACHE_VERSION='2.4'
35-
#Directory where bad bot configs are located.
36-
APACHE_CONF='/etc/apache2/custom.d'
37-
#location of globalblacklist
38-
BLACKLIST_URL="https://raw.githubusercontent.com/mitchellkrogza/apache-ultimate-bad-bot-blocker/master/Apache_${APACHE_VERSION}/custom.d/globalblacklist.conf"
39-
#Address to send update notifications
40-
41-
#Make backup of globalblacklist.conf when updating true or false.
42-
MAKE_BACKUP=false
43-
#Run apachectl test before reload true/false
44-
TEST_BEFORE_RELOAD=true
45-
#Curl test to ensure blocking still working after reload true/false.
46-
CURL_TEST_AFTER_RELOAD=true
47-
#Specify if your site uses http or https
48-
CURL_TEST_PROTOCOL=http
49-
#domain name to test against.
50-
CURL_TEST_URL_NAME=localhost
51-
52-
SERVER_NAME=$(hostname)
53-
UPDATE_FAIL="Bad bot failed to update globalblacklist on ${SERVER_NAME}"
54-
UPDATE_SUCCESS="Bad bot globalblacklist successfully updated on ${SERVER_NAME}"
55-
CURL_FAIL="Bad bot curl tests have failed on ${SERVER_NAME}."
56-
WGET_FAIL="Unable to obtain updated globalblacklist. Wget failed on ${SERVER_NAME}."
57-
CONF_ERROR="Bad bot globalblacklist not present. Does not appear to be setup properly. Aborting update on ${SERVER_NAME}"
58-
DATE=$(date +%Y-%m-%d-%H-%M-%S)
59-
60-
if [ ! -f ${APACHE_CONF}/globalblacklist.conf ] ; then
61-
#Aborting update
62-
echo -e "Subject: Bad bot not installed properly \\n\\n ${CONF_ERROR}\\n" | sendmail -t ${EMAIL};
63-
exit 1;
64-
else
65-
diff <(wget -q -O - ${BLACKLIST_URL}) ${APACHE_CONF}/globalblacklist.conf;
66-
DIFF_CHECK=$?
67-
if [ ${DIFF_CHECK} -eq 0 ] ; then
68-
#Nothing changed
69-
echo "Bad bot globalblacklist is already up to date";
70-
exit 0;
71-
else
72-
if [ ${MAKE_BACKUP} = true ] ; then
73-
cp "${APACHE_CONF}/globalblacklist.conf" "${APACHE_CONF}/globalblacklist.${DATE}.backup";
74-
# Delete backups that are older than 5 days
75-
find ${APACHE_CONF} -maxdepth 1 -type f -mtime +5 -name 'globalblacklist.*.backup' -exec rm {} \;
76-
fi
77-
wget -q ${BLACKLIST_URL} -O ${APACHE_CONF}/globalblacklist.tmp && mv ${APACHE_CONF}/globalblacklist.tmp ${APACHE_CONF}/globalblacklist.conf;
78-
if [ -f ${APACHE_CONF}/globalblacklist.tmp ] ; then
79-
echo -e "Subject: Bad bot update WGET FAIL \\n\\n ${WGET_FAIL}\\n" | sendmail -t ${EMAIL};
80-
rm -f ${APACHE_CONF}/globalblacklist.tmp;
81-
exit 1;
82-
fi
83-
if [ ${TEST_BEFORE_RELOAD} = true ] ; then
84-
apachectl configtest || TESTFAIL=true;
85-
fi
86-
if [ -z ${TESTFAIL} ] ; then
87-
apachectl graceful;
88-
if [ ${CURL_TEST_AFTER_RELOAD} = true ] ; then
89-
CURL_RESPONSE_BAD=$(curl --location -A "masscan" -Isk -o /dev/null -w %{http_code} ${CURL_TEST_PROTOCOL}://${CURL_TEST_URL_NAME} | tr -dc '[:alnum:]')
90-
CURL_RESPONSE_GOOD=$(curl --location -A "googlebot" -Isk -o /dev/null -w %{http_code} ${CURL_TEST_PROTOCOL}://${CURL_TEST_URL_NAME} | tr -dc '[:alnum:]')
91-
if [ $CURL_RESPONSE_BAD != "403" ] || [ $CURL_RESPONSE_GOOD != "200" ] ; then
92-
echo -e "Subject: Bad bot CURL FAIL \\n\\n ${CURL_FAIL}\\n" | sendmail -t ${EMAIL};
93-
exit 1;
94-
fi
95-
fi
96-
echo -e "Subject: Bad bot updated globalblacklist \\n\\n ${UPDATE_SUCCESS}\\n" | sendmail -t ${EMAIL};
97-
exit 0;
98-
else
99-
echo -e "Subject: Bad bot update FAIL \\n\\n ${UPDATE_FAIL}\\n" | sendmail -t ${EMAIL};
100-
exit 1;
101-
fi
102-
fi
103-
fi
104-
105-
# Add this as a cron to run daily / weekly as you like
106-
# Here's a sample CRON entry to update every day at 10pm
107-
# 00 22 * * * /usr/sbin/update-apacheblocker.sh

.dev-tools/_test_results/_conf_files_2.2/globalblacklist.conf

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@
1616

1717
### Version Information #
1818
###################################################
19-
### Version: V3.2019.08.1139
20-
### Updated: Fri Aug 16 12:36:31 SAST 2019
19+
### Version: V3.2019.08.1140
20+
### Updated: Fri Aug 16 12:51:21 SAST 2019
2121
### Bad Referrer Count: 6751
2222
### Bad Bot Count: 557
2323
###################################################
@@ -7615,7 +7615,7 @@ SetEnvIfNoCase Referer ~*zx6\.ru spam_ref
76157615
SetEnvIfNoCase Referer ~*zynax\.ua spam_ref
76167616
SetEnvIfNoCase Referer ~*zytpirwai\.net spam_ref
76177617
SetEnvIfNoCase Referer ~*zzbroya\.com\.ua spam_ref
7618-
SetEnvIfNoCase Referer ~*zzlgxh\.com000free\.us000free\.us000free\.us000free\.us000free\.us000free\.us spam_ref
7618+
SetEnvIfNoCase Referer ~*zzlgxh\.com000free\.us000free\.us000free\.us000free\.us000free\.us000free\.us000free\.us spam_ref
76197619
SetEnvIfNoCase Referer ~*zzlgxh\.com spam_ref
76207620
# END BAD REFERERS ### DO NOT EDIT THIS LINE AT ALL ###
76217621

.dev-tools/_test_results/_conf_files_2.4/globalblacklist.conf

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@
1616

1717
### Version Information #
1818
###################################################
19-
### Version: V3.2019.08.1139
20-
### Updated: Fri Aug 16 12:36:31 SAST 2019
19+
### Version: V3.2019.08.1140
20+
### Updated: Fri Aug 16 12:51:21 SAST 2019
2121
### Bad Referrer Count: 6751
2222
### Bad Bot Count: 557
2323
###################################################
@@ -7611,7 +7611,7 @@ SetEnvIfNoCase Referer ~*zx6\.ru spam_ref
76117611
SetEnvIfNoCase Referer ~*zynax\.ua spam_ref
76127612
SetEnvIfNoCase Referer ~*zytpirwai\.net spam_ref
76137613
SetEnvIfNoCase Referer ~*zzbroya\.com\.ua spam_ref
7614-
SetEnvIfNoCase Referer ~*zzlgxh\.com000free\.us000free\.us000free\.us000free\.us000free\.us000free\.us spam_ref
7614+
SetEnvIfNoCase Referer ~*zzlgxh\.com000free\.us000free\.us000free\.us000free\.us000free\.us000free\.us000free\.us spam_ref
76157615
SetEnvIfNoCase Referer ~*zzlgxh\.com spam_ref
76167616
# END BAD REFERERS ### DO NOT EDIT THIS LINE AT ALL ###
76177617

.dev-tools/_test_results/_curl_tests_2.2/curltest1.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Last Tested: Fri Aug 16 12:39:26 SAST 2019
1+
Last Tested: Fri Aug 16 12:54:10 SAST 2019
22

33
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
44
<html><head>

.dev-tools/_test_results/_curl_tests_2.2/curltest10.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Last Tested: Fri Aug 16 12:39:26 SAST 2019
1+
Last Tested: Fri Aug 16 12:54:10 SAST 2019
22

33
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
44
<html><head>

.dev-tools/_test_results/_curl_tests_2.2/curltest11.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Last Tested: Fri Aug 16 12:39:26 SAST 2019
1+
Last Tested: Fri Aug 16 12:54:10 SAST 2019
22

33
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
44
<html><head>

.dev-tools/_test_results/_curl_tests_2.2/curltest12.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Last Tested: Fri Aug 16 12:39:26 SAST 2019
1+
Last Tested: Fri Aug 16 12:54:10 SAST 2019
22

33
<!DOCTYPE html>
44
<html>

.dev-tools/_test_results/_curl_tests_2.2/curltest2.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Last Tested: Fri Aug 16 12:39:26 SAST 2019
1+
Last Tested: Fri Aug 16 12:54:10 SAST 2019
22

33
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
44
<html><head>
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
Last Tested: Fri Aug 16 12:39:26 SAST 2019
1+
Last Tested: Fri Aug 16 12:54:10 SAST 2019
22

33
HTTP/1.1 403 Forbidden
4-
Date: Fri, 16 Aug 2019 10:39:27 GMT
4+
Date: Fri, 16 Aug 2019 10:54:11 GMT
55
Server: Apache/2.2.25 (Unix) DAV/2
66
Content-Type: text/html; charset=iso-8859-1
77

0 commit comments

Comments
 (0)