FINALISE Install Nginx Mainstream / Test Insert Includes into .vhost with no location block

Reduce verbosity of some tests
This commit is contained in:
Mitchell Krog 2019-06-29 14:41:01 +02:00
parent 81be9da3ea
commit 33d2dbe175
No known key found for this signature in database
GPG key ID: C243C388553EDE5D
6 changed files with 33 additions and 31 deletions

View file

@ -287,7 +287,7 @@ 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 ${bold}${green}ALLOWED"
echo "${bold}${green}PASSED - ${green}${line} was ${bold}${green}ALLOWED and ${bold}${red}RATE LIMITED"
else
echo "${bold}${green}FAILED - ${red}${line} was ${bold}${red}BLOCKED"
fi

View file

@ -75,7 +75,6 @@ printf "\n"
sleep 10s
}
installNginxMainstream (){
sudo rm -rfv /etc/nginx/mybots.d/
sudo rm -rfv /etc/nginx/myconf.d/
@ -251,6 +250,10 @@ runupdatengxblocker
runsetupngxblocker1
reloadNginX
waitforReload
activateVHost2
runsetupngxblocker1
reloadNginX
waitforReload
activateLatestBlacklist
runsetupngxblocker1
reloadNginX

View file

@ -84,7 +84,7 @@ sleep 10s
}
run_curltest1 () {
if curl -v -A "80legs" http://localhost:9000 2>&1 | grep -i '(52)'; then
if curl -A "80legs" http://localhost:9000 2>&1 | grep -i '(52)'; then
echo "${bold}${green}PASSED - ${red}80legs BAD BOT DETECTED"
else
echo "${bold}${red}FAILED - ${red}80legs BAD BOT NOT DETECTED"
@ -93,7 +93,7 @@ fi
}
run_curltest2 () {
if curl -v -A "Nutch" http://localhost:9000 2>&1 | grep -i '(52)'; then
if curl -A "Nutch" http://localhost:9000 2>&1 | grep -i '(52)'; then
echo "${bold}${green}PASSED - ${red}Nutch BAD BOT DETECTED"
else
echo "${bold}${red}FAILED - ${red}Nutch BAD BOT NOT DETECTED"
@ -120,7 +120,7 @@ fi
}
run_curltest5 () {
if curl -v -A "GoogleBot" http://localhost:9000 2>&1 | grep -i 'Welcome'; then
if curl -A "GoogleBot" http://localhost:9000 2>&1 | grep -i 'Welcome'; then
echo "${bold}${green}PASSED - ${green}GoogleBot GOOD BOT ALLOWED THROUGH"
else
echo "${bold}${red}FAILED - ${red}GoogleBot GOOD BOT NOT ALLOWED THROUGH"
@ -129,7 +129,7 @@ fi
}
run_curltest6 () {
if curl -v -A "BingBot" http://localhost:9000 2>&1 | grep -i 'Welcome'; then
if curl -A "BingBot" http://localhost:9000 2>&1 | grep -i 'Welcome'; then
echo "${bold}${green}PASSED - ${green}BingBot GOOD BOT ALLOWED THROUGH"
else
echo "${bold}${red}FAILED - ${red}BingBot GOOD BOT NOT ALLOWED THROUGH"
@ -183,7 +183,7 @@ fi
}
run_curltest12 () {
if curl -v -A "Mozilla/5.0 (compatible; Googlebot-Image/Snutch\-/-2.1; +http://www.google.com/bot.html)" http://localhost:9000 2>&1 | grep -i 'Welcome'; then
if curl -A "Mozilla/5.0 (compatible; Googlebot-Image/Snutch\-/-2.1; +http://www.google.com/bot.html)" http://localhost:9000 2>&1 | grep -i 'Welcome'; then
echo "${bold}${green}PASSED - NO FALSE POSITIVE on Googlebot-Image/Snutch\-/-2.1"
else
echo "${bold}${red}FAILED - FALSE POSITIVE FOUND on Googlebot-Image/Snutch\-/-2.1"
@ -192,7 +192,7 @@ fi
}
run_curltest13 () {
if curl -v -A "SnutchMozilla/5.0 (compatible; Googlebot-Image/SMutch\-/-2.1; +http://www.google.com/bot.html)" http://localhost:9000 2>&1 | grep -i 'Welcome'; then
if curl -A "SnutchMozilla/5.0 (compatible; Googlebot-Image/SMutch\-/-2.1; +http://www.google.com/bot.html)" http://localhost:9000 2>&1 | grep -i 'Welcome'; then
echo "${bold}${green}PASSED - NO FALSE POSITIVE on SnutchMozilla/5.0"
else
echo "${bold}${red}FAILED - FALSE POSITIVE FOUND on SnutchMozilla/5.0"
@ -201,7 +201,7 @@ fi
}
run_curltest14 () {
if curl -v -A "Mozilla/5.0 (X11; Linux x86_64; rv:67.0) Gecko/20100101 Firefox/67.0" http://localhost:9000 2>&1 | grep -i 'Welcome'; then
if curl -A "Mozilla/5.0 (X11; Linux x86_64; rv:67.0) Gecko/20100101 Firefox/67.0" http://localhost:9000 2>&1 | grep -i 'Welcome'; then
echo "${bold}${green}PASSED - NO FALSE POSITIVE on Mozilla/5.0"
else
echo "${bold}${red}FAILED - FALSE POSITIVE FOUND on Mozilla/5.0"
@ -210,7 +210,7 @@ fi
}
run_curltest15 () {
if curl -v -A "Mozilla/5.0 (iPhone; CPU iPhone OS 12_2 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/12.1 Mobile/15E148 Safari/604.1" http://localhost:9000 2>&1 | grep -i 'Welcome'; then
if curl -A "Mozilla/5.0 (iPhone; CPU iPhone OS 12_2 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/12.1 Mobile/15E148 Safari/604.1" http://localhost:9000 2>&1 | grep -i 'Welcome'; then
echo "${bold}${green}PASSED - NO FALSE POSITIVE on Safari"
else
echo "${bold}${red}FAILED - FALSE POSITIVE FOUND on Safari"
@ -232,7 +232,7 @@ file=${TRAVIS_BUILD_DIR}/.dev-tools/test_units/random-bots-for-test-quick.list
lines=$(cat ${file})
for line in ${lines}; do
if
curl -v -A "${line}" http://localhost:9000 2>&1 | grep -i '(52)'; then
curl -A "${line}" -I http://localhost:9000 2>&1 | grep -i '(52)'; then
echo "${bold}${green}PASSED - ${red}${line} was ${bold}${red}BLOCKED"
else
echo "${bold}${red}FAILED - ${red}${line} was ${bold}${red}NOT BLOCKED"
@ -252,7 +252,7 @@ file=${TRAVIS_BUILD_DIR}/.dev-tools/test_units/good-bots-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
curl -A "${line}" http://localhost:9000 2>&1 | grep -i 'Welcome'; then
echo "${bold}${green}PASSED - ${green}${line} was ${bold}${green}ALLOWED"
else
echo "${bold}${red}FAILED - ${red}${line} was ${bold}${red}BLOCKED"
@ -272,7 +272,7 @@ file=${TRAVIS_BUILD_DIR}/.dev-tools/test_units/allowed-bots-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
curl -A "${line}" http://localhost:9000 2>&1 | grep -i 'Welcome'; then
echo "${bold}${green}PASSED - ${green}${line} was ${bold}${green}ALLOWED"
else
echo "${bold}${red}FAILED - ${red}${line} was ${bold}${red}BLOCKED"
@ -292,8 +292,8 @@ file=${TRAVIS_BUILD_DIR}/.dev-tools/test_units/limited-bots-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 ${bold}${green}ALLOWED"
curl -A "${line}" http://localhost:9000 2>&1 | grep -i 'Welcome'; then
echo "${bold}${green}PASSED - ${green}${line} was ${bold}${green}ALLOWED and ${bold}${red}RATE LIMITED"
else
echo "${bold}${green}FAILED - ${red}${line} was ${bold}${red}BLOCKED"
fi

View file

@ -293,7 +293,7 @@ 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 ${bold}${green}ALLOWED"
echo "${bold}${green}PASSED - ${green}${line} was ${bold}${green}ALLOWED and ${bold}${red}RATE LIMITED"
else
echo "${bold}${green}FAILED - ${red}${line} was ${bold}${red}BLOCKED"
fi

View file

@ -293,7 +293,7 @@ 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 ${bold}${green}ALLOWED"
echo "${bold}${green}PASSED - ${green}${line} was ${bold}${green}ALLOWED and ${bold}${red}RATE LIMITED"
else
echo "${bold}${green}FAILED - ${red}${line} was ${bold}${red}BLOCKED"
fi

View file

@ -84,17 +84,16 @@ sleep 10s
}
run_curltest1 () {
if curl -v -A "80legs" http://localhost:9000 2>&1 | grep -i '(52)'; then
if curl -A "80legs" http://localhost:9000 2>&1 | grep -i '(52)'; then
echo "${bold}${green}PASSED - ${red}80legs BAD BOT DETECTED"
else
echo "${bold}${red}FAILED - ${red}80legs BAD BOT NOT DETECTED"
curl -v -A "80legs" http://localhost:9000
#exit 1
fi
}
run_curltest2 () {
if curl -v -A "Nutch" http://localhost:9000 2>&1 | grep -i '(52)'; then
if curl -A "Nutch" http://localhost:9000 2>&1 | grep -i '(52)'; then
echo "${bold}${green}PASSED - ${red}Nutch BAD BOT DETECTED"
else
echo "${bold}${red}FAILED - ${red}Nutch BAD BOT NOT DETECTED"
@ -121,7 +120,7 @@ fi
}
run_curltest5 () {
if curl -v -A "GoogleBot" http://localhost:9000 2>&1 | grep -i 'Welcome'; then
if curl -A "GoogleBot" http://localhost:9000 2>&1 | grep -i 'Welcome'; then
echo "${bold}${green}PASSED - ${green}GoogleBot GOOD BOT ALLOWED THROUGH"
else
echo "${bold}${red}FAILED - ${red}GoogleBot GOOD BOT NOT ALLOWED THROUGH"
@ -130,7 +129,7 @@ fi
}
run_curltest6 () {
if curl -v -A "BingBot" http://localhost:9000 2>&1 | grep -i 'Welcome'; then
if curl -A "BingBot" http://localhost:9000 2>&1 | grep -i 'Welcome'; then
echo "${bold}${green}PASSED - ${green}BingBot GOOD BOT ALLOWED THROUGH"
else
echo "${bold}${red}FAILED - ${red}BingBot GOOD BOT NOT ALLOWED THROUGH"
@ -184,7 +183,7 @@ fi
}
run_curltest12 () {
if curl -v -A "Mozilla/5.0 (compatible; Googlebot-Image/Snutch\-/-2.1; +http://www.google.com/bot.html)" http://localhost:9000 2>&1 | grep -i 'Welcome'; then
if curl -A "Mozilla/5.0 (compatible; Googlebot-Image/Snutch\-/-2.1; +http://www.google.com/bot.html)" http://localhost:9000 2>&1 | grep -i 'Welcome'; then
echo "${bold}${green}PASSED - NO FALSE POSITIVE on Googlebot-Image/Snutch\-/-2.1"
else
echo "${bold}${red}FAILED - FALSE POSITIVE FOUND on Googlebot-Image/Snutch\-/-2.1"
@ -193,7 +192,7 @@ fi
}
run_curltest13 () {
if curl -v -A "SnutchMozilla/5.0 (compatible; Googlebot-Image/SMutch\-/-2.1; +http://www.google.com/bot.html)" http://localhost:9000 2>&1 | grep -i 'Welcome'; then
if curl -A "SnutchMozilla/5.0 (compatible; Googlebot-Image/SMutch\-/-2.1; +http://www.google.com/bot.html)" http://localhost:9000 2>&1 | grep -i 'Welcome'; then
echo "${bold}${green}PASSED - NO FALSE POSITIVE on SnutchMozilla/5.0"
else
echo "${bold}${red}FAILED - FALSE POSITIVE FOUND on SnutchMozilla/5.0"
@ -202,7 +201,7 @@ fi
}
run_curltest14 () {
if curl -v -A "Mozilla/5.0 (X11; Linux x86_64; rv:67.0) Gecko/20100101 Firefox/67.0" http://localhost:9000 2>&1 | grep -i 'Welcome'; then
if curl -A "Mozilla/5.0 (X11; Linux x86_64; rv:67.0) Gecko/20100101 Firefox/67.0" http://localhost:9000 2>&1 | grep -i 'Welcome'; then
echo "${bold}${green}PASSED - NO FALSE POSITIVE on Mozilla/5.0"
else
echo "${bold}${red}FAILED - FALSE POSITIVE FOUND on Mozilla/5.0"
@ -211,7 +210,7 @@ fi
}
run_curltest15 () {
if curl -v -A "Mozilla/5.0 (iPhone; CPU iPhone OS 12_2 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/12.1 Mobile/15E148 Safari/604.1" http://localhost:9000 2>&1 | grep -i 'Welcome'; then
if curl -A "Mozilla/5.0 (iPhone; CPU iPhone OS 12_2 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/12.1 Mobile/15E148 Safari/604.1" http://localhost:9000 2>&1 | grep -i 'Welcome'; then
echo "${bold}${green}PASSED - NO FALSE POSITIVE on Safari"
else
echo "${bold}${red}FAILED - FALSE POSITIVE FOUND on Safari"
@ -233,7 +232,7 @@ file=${TRAVIS_BUILD_DIR}/.dev-tools/test_units/random-bots-for-test-quick.list
lines=$(cat ${file})
for line in ${lines}; do
if
curl -v -A "${line}" http://localhost:9000 2>&1 | grep -i '(52)'; then
curl -A "${line}" http://localhost:9000 2>&1 | grep -i '(52)'; then
echo "${bold}${green}PASSED - ${red}${line} was ${bold}${red}BLOCKED"
else
echo "${bold}${red}FAILED - ${red}${line} was ${bold}${red}NOT BLOCKED"
@ -253,7 +252,7 @@ file=${TRAVIS_BUILD_DIR}/.dev-tools/test_units/good-bots-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
curl -A "${line}" http://localhost:9000 2>&1 | grep -i 'Welcome'; then
echo "${bold}${green}PASSED - ${green}${line} was ${bold}${green}ALLOWED"
else
echo "${bold}${red}FAILED - ${red}${line} was ${bold}${red}BLOCKED"
@ -273,7 +272,7 @@ file=${TRAVIS_BUILD_DIR}/.dev-tools/test_units/allowed-bots-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
curl -A "${line}" http://localhost:9000 2>&1 | grep -i 'Welcome'; then
echo "${bold}${green}PASSED - ${green}${line} was ${bold}${green}ALLOWED"
else
echo "${bold}${red}FAILED - ${red}${line} was ${bold}${red}BLOCKED"
@ -293,8 +292,8 @@ file=${TRAVIS_BUILD_DIR}/.dev-tools/test_units/limited-bots-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 ${bold}${green}ALLOWED"
curl -A "${line}" http://localhost:9000 2>&1 | grep -i 'Welcome'; then
echo "${bold}${green}PASSED - ${green}${line} was ${bold}${green}ALLOWED and ${bold}${red}RATE LIMITED"
else
echo "${bold}${green}FAILED - ${red}${line} was ${bold}${red}BLOCKED"
fi