mirror of
https://github.com/mitchellkrogza/nginx-ultimate-bad-bot-blocker.git
synced 2025-09-12 16:19:49 +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
|
@ -22,11 +22,13 @@
|
|||
|
||||
echo "Tests Starting"
|
||||
|
||||
echo "Set Whitelisting to Default"
|
||||
#sudo cp ${TRAVIS_BUILD_DIR}/.dev-tools/blacklist-user-agents-none.conf /etc/nginx/bots.d/blacklist-user-agents.conf
|
||||
echo "Disable any User Whitelisting and set to Default"
|
||||
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"
|
||||
#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"
|
||||
|
@ -361,6 +363,24 @@ for line in ${lines}; do
|
|||
done
|
||||
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"
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue