mirror of
https://github.com/mitchellkrogza/nginx-ultimate-bad-bot-blocker.git
synced 2025-09-03 02:59:57 +00:00
Introduce testing of some good referrers
This commit is contained in:
parent
e5d25cc5c3
commit
b7bf5315dd
6 changed files with 41 additions and 5 deletions
|
@ -19,9 +19,9 @@
|
||||||
echo "Whitelist Tests Starting"
|
echo "Whitelist Tests Starting"
|
||||||
|
|
||||||
echo "Activating Users User-Agents Whitelist/Blacklist"
|
echo "Activating Users User-Agents Whitelist/Blacklist"
|
||||||
sudo cp ${TRAVIS_BUILD_DIR}/.dev-tools/blacklist-user-agents.conf /etc/nginx/bots.d/blacklist-user-agents.conf
|
sudo cp ${TRAVIS_BUILD_DIR}/.dev-tools/test_units/blacklist-user-agents.conf /etc/nginx/bots.d/blacklist-user-agents.conf
|
||||||
echo "Activating Users Referrers Whitelist/Blacklist"
|
echo "Activating Users Referrers Whitelist/Blacklist"
|
||||||
sudo cp ${TRAVIS_BUILD_DIR}/.dev-tools/custom-bad-referrers.conf /etc/nginx/bots.d/custom-bad-referrers.conf
|
sudo cp ${TRAVIS_BUILD_DIR}/.dev-tools/test_units/custom-bad-referrers.conf /etc/nginx/bots.d/custom-bad-referrers.conf
|
||||||
echo "Reloading Nginx"
|
echo "Reloading Nginx"
|
||||||
sudo nginx -t && sudo nginx -s reload
|
sudo nginx -t && sudo nginx -s reload
|
||||||
|
|
||||||
|
|
|
@ -22,11 +22,13 @@
|
||||||
|
|
||||||
echo "Tests Starting"
|
echo "Tests Starting"
|
||||||
|
|
||||||
echo "Set Whitelisting to Default"
|
echo "Disable any User Whitelisting and set to Default"
|
||||||
#sudo cp ${TRAVIS_BUILD_DIR}/.dev-tools/blacklist-user-agents-none.conf /etc/nginx/bots.d/blacklist-user-agents.conf
|
sudo cp ${TRAVIS_BUILD_DIR}/.dev-tools/test_units/blacklist-user-agents-none.conf /etc/nginx/bots.d/blacklist-user-agents.conf
|
||||||
echo "Reloading Nginx"
|
echo "Reloading Nginx"
|
||||||
#sudo nginx -t && sudo nginx -s reload
|
sudo nginx -t && sudo nginx -s reload
|
||||||
|
|
||||||
|
echo "Sleeping for 30 seconds to allow Nginx Properly Reload inside Travis"
|
||||||
|
sleep 30s
|
||||||
|
|
||||||
# *************************************************
|
# *************************************************
|
||||||
# Function Curl Test 1 - Check for Bad Bot "80legs"
|
# Function Curl Test 1 - Check for Bad Bot "80legs"
|
||||||
|
@ -361,6 +363,24 @@ for line in ${lines}; do
|
||||||
done
|
done
|
||||||
IFS=""
|
IFS=""
|
||||||
|
|
||||||
|
# **************************
|
||||||
|
# Test Good Referrer Domains
|
||||||
|
# **************************
|
||||||
|
|
||||||
|
echo "Testing Good Referrers"
|
||||||
|
IFS=$'\n'
|
||||||
|
file=${TRAVIS_BUILD_DIR}/.dev-tools/test_units/good-referrers-for-test.list
|
||||||
|
lines=$(cat ${file})
|
||||||
|
for line in ${lines}; do
|
||||||
|
if
|
||||||
|
curl -v -A "${line}" http://localhost:9000 2>&1 | grep -i 'Welcome'; then
|
||||||
|
echo "${bold}${green}PASSED - ${green}${line} was ALLOWED"
|
||||||
|
else
|
||||||
|
echo "${bold}${green}FAILED - ${red}${line} was BLOCKED"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
IFS=""
|
||||||
|
|
||||||
|
|
||||||
echo "Tests Completed"
|
echo "Tests Completed"
|
||||||
|
|
||||||
|
|
16
.dev-tools/test_units/good-referrers-for-test.list
Normal file
16
.dev-tools/test_units/good-referrers-for-test.list
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
-
|
||||||
|
--
|
||||||
|
bing.com
|
||||||
|
bit.ly
|
||||||
|
google.com
|
||||||
|
is.gd
|
||||||
|
l.facebook.com
|
||||||
|
m.facebook.com
|
||||||
|
t.co
|
||||||
|
www.bing.com
|
||||||
|
www.google.ae
|
||||||
|
www.google.com
|
||||||
|
www.google.com.ar
|
||||||
|
www.google.com.ph
|
||||||
|
www.google.lt
|
||||||
|
www.google.pt
|
Loading…
Add table
Reference in a new issue