From d4e562c760b9ac19d5804e237e4d1a5b40cfe797 Mon Sep 17 00:00:00 2001 From: Mitchell Krog Date: Mon, 1 Jul 2019 14:10:19 +0200 Subject: [PATCH] [MASTER][BETA] All Tests to Fail Builds --- .dev-tools/beta-test-blocker-badwords.sh | 4 +- .dev-tools/beta-test-blocker-rate-limiting.sh | 1 + .../beta-test-blocker-whitelist-domains.sh | 4 +- .dev-tools/beta-test-blocker-whitelist-ips.sh | 2 + .dev-tools/beta-test-blocker-whitelist.sh | 2 + .dev-tools/beta-test-blocker.sh | 12 +++- .dev-tools/test-blocker-badwords.sh | 4 +- .dev-tools/test-blocker-quick.sh | 6 ++ .dev-tools/test-blocker-rate-limiting.sh | 1 + .dev-tools/test-blocker-whitelist-domains.sh | 4 +- .dev-tools/test-blocker-whitelist-ips.sh | 2 + .dev-tools/test-blocker-whitelist.sh | 2 + .dev-tools/test-nginx-2.sh | 6 ++ .dev-tools/test-nginx-3.sh | 6 ++ .dev-tools/test-nginx-mainline-nginx.sh | 70 +++++-------------- .dev-tools/test-nginx-mainline-ppa.sh | 70 +++++-------------- 16 files changed, 81 insertions(+), 115 deletions(-) diff --git a/.dev-tools/beta-test-blocker-badwords.sh b/.dev-tools/beta-test-blocker-badwords.sh index c4cf8e3b0..c8c91ef91 100755 --- a/.dev-tools/beta-test-blocker-badwords.sh +++ b/.dev-tools/beta-test-blocker-badwords.sh @@ -88,7 +88,7 @@ if curl -I http://localhost:9000 -e "thisisabadword" 2>&1 | grep -i '(52)'; then echo "${bold}${green}PASSED - User bad-referrer-words.conf working" else echo "${bold}${red}FAILED - User bad-referrer-words.conf NOT working" - #exit 1 + exit 1 fi } @@ -97,7 +97,7 @@ if curl -I http://localhost:9000 -e "thisisanotherbadword" 2>&1 | grep -i '(52)' echo "${bold}${green}PASSED - User bad-referrer-words.conf working" else echo "${bold}${red}FAILED - User bad-referrer-words.conf NOT working" - #exit 1 + exit 1 fi } diff --git a/.dev-tools/beta-test-blocker-rate-limiting.sh b/.dev-tools/beta-test-blocker-rate-limiting.sh index 183e8c76c..20980a1bb 100755 --- a/.dev-tools/beta-test-blocker-rate-limiting.sh +++ b/.dev-tools/beta-test-blocker-rate-limiting.sh @@ -106,6 +106,7 @@ if grep -i 'Unavailable' < ${ratelimittestfile}; then echo "${bold}${green}PASSED - ${red}GoogleBot was ${bold}${red}RATE LIMITED" else echo "${bold}${red}FAILED - ${red}GoogleBot was ${bold}${red}NOT RATE LIMITED" + exit 1 fi } diff --git a/.dev-tools/beta-test-blocker-whitelist-domains.sh b/.dev-tools/beta-test-blocker-whitelist-domains.sh index a48eae442..e4c2df37a 100755 --- a/.dev-tools/beta-test-blocker-whitelist-domains.sh +++ b/.dev-tools/beta-test-blocker-whitelist-domains.sh @@ -88,7 +88,7 @@ if curl http://localhost:9000 -e http://www.myowndomain.com 2>&1 | grep -i 'Welc echo "${bold}${green}PASSED - User whitelist-domains.conf working" else echo "${bold}${red}FAILED - User whitelist-domains.conf NOT working" - #exit 1 + exit 1 fi } @@ -97,7 +97,7 @@ if curl http://localhost:9000 -e http://www.myotherdomain.com 2>&1 | grep -i 'We echo "${bold}${green}PASSED - User whitelist-domains.conf working" else echo "${bold}${red}FAILED - User whitelist-domains.conf NOT working" - #exit 1 + exit 1 fi } diff --git a/.dev-tools/beta-test-blocker-whitelist-ips.sh b/.dev-tools/beta-test-blocker-whitelist-ips.sh index 373be5cbe..00889063a 100755 --- a/.dev-tools/beta-test-blocker-whitelist-ips.sh +++ b/.dev-tools/beta-test-blocker-whitelist-ips.sh @@ -81,6 +81,7 @@ if curl http://localhost:9000 2>&1 | grep -i '(52)'; then echo "${bold}${green}PASSED - ${bold}${red}blacklist own ip is WORKING" else echo "${bold}${red}FAILED - blacklist own ip is NOT working" + exit 1 fi } @@ -90,6 +91,7 @@ if curl http://localhost:9000 2>&1 | grep -i 'Welcome'; then else echo "${bold}${red}FAILED - whitelist own ip is NOT working" curl http://localhost:9000 + exit 1 fi } diff --git a/.dev-tools/beta-test-blocker-whitelist.sh b/.dev-tools/beta-test-blocker-whitelist.sh index 635592341..6271b8ad6 100755 --- a/.dev-tools/beta-test-blocker-whitelist.sh +++ b/.dev-tools/beta-test-blocker-whitelist.sh @@ -204,6 +204,7 @@ for line in ${lines}; do echo "${bold}${green}PASSED - ${red}${line} was ${bold}${green}ALLOWED" else echo "${bold}${red}FAILED - ${red}${line} was ${bold}${red}NOT ALLOWED" + exit 1 fi done IFS="" @@ -228,6 +229,7 @@ for line in ${lines}; do echo "${bold}${green}PASSED - ${red}${line} was ${bold}${green}ALLOWED" else echo "${bold}${red}FAILED - ${red}${line} was ${bold}${red}NOT ALLOWED" + exit 1 fi done IFS="" diff --git a/.dev-tools/beta-test-blocker.sh b/.dev-tools/beta-test-blocker.sh index 6be3e9625..f8076d94e 100755 --- a/.dev-tools/beta-test-blocker.sh +++ b/.dev-tools/beta-test-blocker.sh @@ -154,7 +154,7 @@ if curl -A "Googlebot/Nutch-1.7" http://localhost:9000 2>&1 | grep -i '(52)'; th echo "${bold}${green}PASSED - ${red}Googlebot/Nutch-1.7 BAD BOT DETECTED" else echo "${bold}${red}FAILED - ${red}Googlebot/Nutch-1.7 BAD BOT NOT DETECTED" - #exit 1 + exit 1 fi } @@ -163,7 +163,7 @@ if curl -A "Mozilla/5.0 (X11; Linux x86_64; rv:67.0) Gecko/20100101 Firefox/67.0 echo "${bold}${green}PASSED - NO FALSE POSITIVE on Mozilla/5.0" else echo "${bold}${red}FAILED - FALSE POSITIVE FOUND on Mozilla/5.0" - #exit 1 + exit 1 fi } @@ -172,7 +172,7 @@ if curl -A "Mozilla/5.0 (iPhone; CPU iPhone OS 12_2 like Mac OS X) AppleWebKit/6 echo "${bold}${green}PASSED - NO FALSE POSITIVE on Safari" else echo "${bold}${red}FAILED - FALSE POSITIVE FOUND on Safari" - #exit 1 + exit 1 fi } @@ -194,6 +194,7 @@ for line in ${lines}; do echo "${bold}${green}PASSED - ${red}${line} was ${bold}${red}BLOCKED" else echo "${bold}${red}FAILED - ${red}${line} was ${bold}${red}NOT BLOCKED" + exit 1 fi done IFS="" @@ -214,6 +215,7 @@ for line in ${lines}; do echo "${bold}${green}PASSED - ${green}${line} was ${bold}${green}ALLOWED" else echo "${bold}${red}FAILED - ${red}${line} was ${bold}${red}BLOCKED" + exit 1 fi done IFS="" @@ -234,6 +236,7 @@ for line in ${lines}; do echo "${bold}${green}PASSED - ${green}${line} was ${bold}${green}ALLOWED" else echo "${bold}${red}FAILED - ${red}${line} was ${bold}${red}BLOCKED" + exit 1 fi done IFS="" @@ -254,6 +257,7 @@ for line in ${lines}; do 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" + exit 1 fi done IFS="" @@ -275,6 +279,7 @@ for line in ${lines}; do echo "${bold}${green}PASSED - ${red}${line} was ${bold}${red}BLOCKED" else echo "${bold}${red}FAILED - ${red}${line} was ${bold}${red}NOT BLOCKED" + exit 1 fi done IFS="" @@ -294,6 +299,7 @@ for line in ${lines}; do echo "${bold}${green}PASSED - ${green}${line} was ${bold}${green}ALLOWED" else echo "${bold}${green}FAILED - ${red}${line} was ${bold}${red}BLOCKED" + exit 1 fi done IFS="" diff --git a/.dev-tools/test-blocker-badwords.sh b/.dev-tools/test-blocker-badwords.sh index d19ee8d2b..251f39cb3 100755 --- a/.dev-tools/test-blocker-badwords.sh +++ b/.dev-tools/test-blocker-badwords.sh @@ -88,7 +88,7 @@ if curl -I http://localhost:9000 -e "thisisabadword" 2>&1 | grep -i '(52)'; then echo "${bold}${green}PASSED - User bad-referrer-words.conf working" else echo "${bold}${red}FAILED - User bad-referrer-words.conf NOT working" - #exit 1 + exit 1 fi } @@ -97,7 +97,7 @@ if curl -I http://localhost:9000 -e "thisisanotherbadword" 2>&1 | grep -i '(52)' echo "${bold}${green}PASSED - User bad-referrer-words.conf working" else echo "${bold}${red}FAILED - User bad-referrer-words.conf NOT working" - #exit 1 + exit 1 fi } diff --git a/.dev-tools/test-blocker-quick.sh b/.dev-tools/test-blocker-quick.sh index 4b5f47ccf..167ef97c5 100755 --- a/.dev-tools/test-blocker-quick.sh +++ b/.dev-tools/test-blocker-quick.sh @@ -200,6 +200,7 @@ for line in ${lines}; do echo "${bold}${green}PASSED - ${red}${line} was ${bold}${red}BLOCKED" else echo "${bold}${red}FAILED - ${red}${line} was ${bold}${red}NOT BLOCKED" + exit 1 fi done IFS="" @@ -220,6 +221,7 @@ for line in ${lines}; do echo "${bold}${green}PASSED - ${green}${line} was ${bold}${green}ALLOWED" else echo "${bold}${red}FAILED - ${red}${line} was ${bold}${red}BLOCKED" + exit 1 fi done IFS="" @@ -240,6 +242,7 @@ for line in ${lines}; do echo "${bold}${green}PASSED - ${green}${line} was ${bold}${green}ALLOWED" else echo "${bold}${red}FAILED - ${red}${line} was ${bold}${red}BLOCKED" + exit 1 fi done IFS="" @@ -260,6 +263,7 @@ for line in ${lines}; do 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" + exit 1 fi done IFS="" @@ -281,6 +285,7 @@ for line in ${lines}; do echo "${bold}${green}PASSED - ${red}${line} was ${bold}${red}BLOCKED" else echo "${bold}${red}FAILED - ${red}${line} was ${bold}${red}NOT BLOCKED" + exit 1 fi done IFS="" @@ -300,6 +305,7 @@ for line in ${lines}; do echo "${bold}${green}PASSED - ${green}${line} was ${bold}${green}ALLOWED" else echo "${bold}${green}FAILED - ${red}${line} was ${bold}${red}BLOCKED" + exit 1 fi done IFS="" diff --git a/.dev-tools/test-blocker-rate-limiting.sh b/.dev-tools/test-blocker-rate-limiting.sh index 5fd592650..0d757b1d0 100755 --- a/.dev-tools/test-blocker-rate-limiting.sh +++ b/.dev-tools/test-blocker-rate-limiting.sh @@ -106,6 +106,7 @@ if grep -i 'Unavailable' < ${ratelimittestfile}; then echo "${bold}${green}PASSED - ${red}GoogleBot was ${bold}${red}RATE LIMITED" else echo "${bold}${red}FAILED - ${red}GoogleBot was ${bold}${red}NOT RATE LIMITED" + exit 1 fi } diff --git a/.dev-tools/test-blocker-whitelist-domains.sh b/.dev-tools/test-blocker-whitelist-domains.sh index b97e14c2c..907ecc241 100755 --- a/.dev-tools/test-blocker-whitelist-domains.sh +++ b/.dev-tools/test-blocker-whitelist-domains.sh @@ -88,7 +88,7 @@ if curl http://localhost:9000 -e http://www.myowndomain.com 2>&1 | grep -i 'Welc echo "${bold}${green}PASSED - User whitelist-domains.conf working" else echo "${bold}${red}FAILED - User whitelist-domains.conf NOT working" - #exit 1 + exit 1 fi } @@ -97,7 +97,7 @@ if curl http://localhost:9000 -e http://www.myotherdomain.com 2>&1 | grep -i 'We echo "${bold}${green}PASSED - User whitelist-domains.conf working" else echo "${bold}${red}FAILED - User whitelist-domains.conf NOT working" - #exit 1 + exit 1 fi } diff --git a/.dev-tools/test-blocker-whitelist-ips.sh b/.dev-tools/test-blocker-whitelist-ips.sh index 6011cc280..e9a9e94c8 100755 --- a/.dev-tools/test-blocker-whitelist-ips.sh +++ b/.dev-tools/test-blocker-whitelist-ips.sh @@ -80,6 +80,7 @@ if curl http://localhost:9000 2>&1 | grep -i '(52)'; then echo "${bold}${green}PASSED - ${bold}${red}blacklist own ip is WORKING" else echo "${bold}${red}FAILED - blacklist own ip is NOT working" + exit 1 fi } @@ -89,6 +90,7 @@ if curl http://localhost:9000 2>&1 | grep -i 'Welcome'; then else echo "${bold}${red}FAILED - whitelist own ip is NOT working" curl http://localhost:9000 + exit 1 fi } diff --git a/.dev-tools/test-blocker-whitelist.sh b/.dev-tools/test-blocker-whitelist.sh index 59add072f..0fc7a797c 100755 --- a/.dev-tools/test-blocker-whitelist.sh +++ b/.dev-tools/test-blocker-whitelist.sh @@ -206,6 +206,7 @@ for line in ${lines}; do echo "${bold}${green}PASSED - ${red}${line} was ${bold}${green}ALLOWED" else echo "${bold}${red}FAILED - ${red}${line} was ${bold}${red}NOT ALLOWED" + exit 1 fi done IFS="" @@ -229,6 +230,7 @@ for line in ${lines}; do echo "${bold}${green}PASSED - ${red}${line} was ${bold}${green}ALLOWED" else echo "${bold}${red}FAILED - ${red}${line} was ${bold}${red}NOT ALLOWED" + exit 1 fi done IFS="" diff --git a/.dev-tools/test-nginx-2.sh b/.dev-tools/test-nginx-2.sh index 335faf373..05d01ee09 100755 --- a/.dev-tools/test-nginx-2.sh +++ b/.dev-tools/test-nginx-2.sh @@ -200,6 +200,7 @@ for line in ${lines}; do echo "${bold}${green}PASSED - ${red}${line} was ${bold}${red}BLOCKED" else echo "${bold}${red}FAILED - ${red}${line} was ${bold}${red}NOT BLOCKED" + exit 1 fi done IFS="" @@ -220,6 +221,7 @@ for line in ${lines}; do echo "${bold}${green}PASSED - ${green}${line} was ${bold}${green}ALLOWED" else echo "${bold}${red}FAILED - ${red}${line} was ${bold}${red}BLOCKED" + exit 1 fi done IFS="" @@ -240,6 +242,7 @@ for line in ${lines}; do echo "${bold}${green}PASSED - ${green}${line} was ${bold}${green}ALLOWED" else echo "${bold}${red}FAILED - ${red}${line} was ${bold}${red}BLOCKED" + exit 1 fi done IFS="" @@ -260,6 +263,7 @@ for line in ${lines}; do 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" + exit 1 fi done IFS="" @@ -281,6 +285,7 @@ for line in ${lines}; do echo "${bold}${green}PASSED - ${red}${line} was ${bold}${red}BLOCKED" else echo "${bold}${red}FAILED - ${red}${line} was ${bold}${red}NOT BLOCKED" + exit 1 fi done IFS="" @@ -300,6 +305,7 @@ for line in ${lines}; do echo "${bold}${green}PASSED - ${green}${line} was ${bold}${green}ALLOWED" else echo "${bold}${green}FAILED - ${red}${line} was ${bold}${red}BLOCKED" + exit 1 fi done IFS="" diff --git a/.dev-tools/test-nginx-3.sh b/.dev-tools/test-nginx-3.sh index 4588c4c48..37ddde265 100755 --- a/.dev-tools/test-nginx-3.sh +++ b/.dev-tools/test-nginx-3.sh @@ -200,6 +200,7 @@ for line in ${lines}; do echo "${bold}${green}PASSED - ${red}${line} was ${bold}${red}BLOCKED" else echo "${bold}${red}FAILED - ${red}${line} was ${bold}${red}NOT BLOCKED" + exit 1 fi done IFS="" @@ -220,6 +221,7 @@ for line in ${lines}; do echo "${bold}${green}PASSED - ${green}${line} was ${bold}${green}ALLOWED" else echo "${bold}${red}FAILED - ${red}${line} was ${bold}${red}BLOCKED" + exit 1 fi done IFS="" @@ -240,6 +242,7 @@ for line in ${lines}; do echo "${bold}${green}PASSED - ${green}${line} was ${bold}${green}ALLOWED" else echo "${bold}${red}FAILED - ${red}${line} was ${bold}${red}BLOCKED" + exit 1 fi done IFS="" @@ -260,6 +263,7 @@ for line in ${lines}; do 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" + exit 1 fi done IFS="" @@ -281,6 +285,7 @@ for line in ${lines}; do echo "${bold}${green}PASSED - ${red}${line} was ${bold}${red}BLOCKED" else echo "${bold}${red}FAILED - ${red}${line} was ${bold}${red}NOT BLOCKED" + exit 1 fi done IFS="" @@ -300,6 +305,7 @@ for line in ${lines}; do echo "${bold}${green}PASSED - ${green}${line} was ${bold}${green}ALLOWED" else echo "${bold}${green}FAILED - ${red}${line} was ${bold}${red}BLOCKED" + exit 1 fi done IFS="" diff --git a/.dev-tools/test-nginx-mainline-nginx.sh b/.dev-tools/test-nginx-mainline-nginx.sh index 4b4e206ea..4e6cd193b 100755 --- a/.dev-tools/test-nginx-mainline-nginx.sh +++ b/.dev-tools/test-nginx-mainline-nginx.sh @@ -88,7 +88,7 @@ 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" - #exit 1 + exit 1 fi } @@ -97,7 +97,7 @@ 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" - #exit 1 + exit 1 fi } @@ -106,7 +106,7 @@ if curl -I http://localhost:9000 -e http://100dollars-seo.com 2>&1 | grep -i '(5 echo "${bold}${green}PASSED - ${red}100dollars-seo.com BAD REFERRER DETECTED" else echo "${bold}${red}FAILED - ${red}100dollars-seo.com BAD REFERRER NOT DETECTED" - #exit 1 + exit 1 fi } @@ -115,7 +115,7 @@ if curl -I http://localhost:9000 -e http://zx6.ru 2>&1 | grep -i '(52)'; then echo "${bold}${green}PASSED - ${red}zx6.ru BAD REFERRER DETECTED" else echo "${bold}${red}FAILED - ${red}zx6.ru BAD REFERRER NOT DETECTED" - #exit 1 + exit 1 fi } @@ -124,7 +124,7 @@ 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" - #exit 1 + exit 1 fi } @@ -133,7 +133,7 @@ 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" - #exit 1 + exit 1 fi } @@ -142,7 +142,7 @@ if curl http://localhost:9000 -e http://google.com 2>&1 | grep -i 'Welcome'; the echo "${bold}${green}PASSED - ${green}google.com GOOD REFERRER DETECTED" else echo "${bold}${red}FAILED - ${red}google.com GOOD REFERRER NOT DETECTED" - #exit 1 + exit 1 fi } @@ -151,7 +151,7 @@ if curl http://localhost:9000 -e http://bing.com 2>&1 | grep -i 'Welcome'; then echo "${bold}${green}PASSED - ${red}bing.com GOOD REFERRER DETECTED" else echo "${bold}${red}FAILED - ${red}bing.com GOOD REFERRER NOT DETECTED" - #exit 1 + exit 1 fi } @@ -160,61 +160,25 @@ if curl -A "Googlebot/Nutch-1.7" http://localhost:9000 2>&1 | grep -i '(52)'; th echo "${bold}${green}PASSED - ${red}Googlebot/Nutch-1.7 BAD BOT DETECTED" else echo "${bold}${red}FAILED - ${red}Googlebot/Nutch-1.7 BAD BOT NOT DETECTED" - #exit 1 + exit 1 fi } run_curltest10 () { -if curl -A "Mozilla/5.0 (compatible; Googlebot/Nutch2.1; +http://www.google.com/bot.html)" http://localhost:9000 2>&1 | grep -i '(52)'; then - echo "${bold}${green}PASSED - ${red}Googlebot/Nutch2.1 BAD BOT DETECTED" -else - echo "${bold}${red}FAILED - ${red}Googlebot/Nutch2.1 BAD BOT NOT DETECTED" - #exit 1 -fi -} - -run_curltest11 () { -if curl -A "Mozilla/5.0 (compatible; Googlebot/nutch/-2.1; +http://www.google.com/bot.html)" http://localhost:9000 2>&1 | grep -i '(52)'; then - echo "${bold}${green}PASSED - ${red}Googlebot/nutch/-2.1 BAD BOT DETECTED" -else - echo "${bold}${red}FAILED - Googlebot/nutch/-2.1 BAD BOT NOT DETECTED" - #exit 1 -fi -} - -run_curltest12 () { -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" - #exit 1 -fi -} - -run_curltest13 () { -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" - #exit 1 -fi -} - -run_curltest14 () { 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" - #exit 1 + exit 1 fi } -run_curltest15 () { +run_curltest11 () { 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" - #exit 1 + exit 1 fi } @@ -236,6 +200,7 @@ for line in ${lines}; do echo "${bold}${green}PASSED - ${red}${line} was ${bold}${red}BLOCKED" else echo "${bold}${red}FAILED - ${red}${line} was ${bold}${red}NOT BLOCKED" + exit 1 fi done IFS="" @@ -256,6 +221,7 @@ for line in ${lines}; do echo "${bold}${green}PASSED - ${green}${line} was ${bold}${green}ALLOWED" else echo "${bold}${red}FAILED - ${red}${line} was ${bold}${red}BLOCKED" + exit 1 fi done IFS="" @@ -276,6 +242,7 @@ for line in ${lines}; do echo "${bold}${green}PASSED - ${green}${line} was ${bold}${green}ALLOWED" else echo "${bold}${red}FAILED - ${red}${line} was ${bold}${red}BLOCKED" + exit 1 fi done IFS="" @@ -296,6 +263,7 @@ for line in ${lines}; do 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" + exit 1 fi done IFS="" @@ -317,6 +285,7 @@ for line in ${lines}; do echo "${bold}${green}PASSED - ${red}${line} was ${bold}${red}BLOCKED" else echo "${bold}${red}FAILED - ${red}${line} was ${bold}${red}NOT BLOCKED" + exit 1 fi done IFS="" @@ -336,6 +305,7 @@ for line in ${lines}; do echo "${bold}${green}PASSED - ${green}${line} was ${bold}${green}ALLOWED" else echo "${bold}${green}FAILED - ${red}${line} was ${bold}${red}BLOCKED" + exit 1 fi done IFS="" @@ -364,10 +334,6 @@ run_curltest8 run_curltest9 run_curltest10 run_curltest11 -run_curltest12 -run_curltest13 -run_curltest14 -run_curltest15 testBadUserAgents testGoodUserAgents testAllowedUserAgents diff --git a/.dev-tools/test-nginx-mainline-ppa.sh b/.dev-tools/test-nginx-mainline-ppa.sh index 4b4e206ea..4e6cd193b 100755 --- a/.dev-tools/test-nginx-mainline-ppa.sh +++ b/.dev-tools/test-nginx-mainline-ppa.sh @@ -88,7 +88,7 @@ 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" - #exit 1 + exit 1 fi } @@ -97,7 +97,7 @@ 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" - #exit 1 + exit 1 fi } @@ -106,7 +106,7 @@ if curl -I http://localhost:9000 -e http://100dollars-seo.com 2>&1 | grep -i '(5 echo "${bold}${green}PASSED - ${red}100dollars-seo.com BAD REFERRER DETECTED" else echo "${bold}${red}FAILED - ${red}100dollars-seo.com BAD REFERRER NOT DETECTED" - #exit 1 + exit 1 fi } @@ -115,7 +115,7 @@ if curl -I http://localhost:9000 -e http://zx6.ru 2>&1 | grep -i '(52)'; then echo "${bold}${green}PASSED - ${red}zx6.ru BAD REFERRER DETECTED" else echo "${bold}${red}FAILED - ${red}zx6.ru BAD REFERRER NOT DETECTED" - #exit 1 + exit 1 fi } @@ -124,7 +124,7 @@ 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" - #exit 1 + exit 1 fi } @@ -133,7 +133,7 @@ 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" - #exit 1 + exit 1 fi } @@ -142,7 +142,7 @@ if curl http://localhost:9000 -e http://google.com 2>&1 | grep -i 'Welcome'; the echo "${bold}${green}PASSED - ${green}google.com GOOD REFERRER DETECTED" else echo "${bold}${red}FAILED - ${red}google.com GOOD REFERRER NOT DETECTED" - #exit 1 + exit 1 fi } @@ -151,7 +151,7 @@ if curl http://localhost:9000 -e http://bing.com 2>&1 | grep -i 'Welcome'; then echo "${bold}${green}PASSED - ${red}bing.com GOOD REFERRER DETECTED" else echo "${bold}${red}FAILED - ${red}bing.com GOOD REFERRER NOT DETECTED" - #exit 1 + exit 1 fi } @@ -160,61 +160,25 @@ if curl -A "Googlebot/Nutch-1.7" http://localhost:9000 2>&1 | grep -i '(52)'; th echo "${bold}${green}PASSED - ${red}Googlebot/Nutch-1.7 BAD BOT DETECTED" else echo "${bold}${red}FAILED - ${red}Googlebot/Nutch-1.7 BAD BOT NOT DETECTED" - #exit 1 + exit 1 fi } run_curltest10 () { -if curl -A "Mozilla/5.0 (compatible; Googlebot/Nutch2.1; +http://www.google.com/bot.html)" http://localhost:9000 2>&1 | grep -i '(52)'; then - echo "${bold}${green}PASSED - ${red}Googlebot/Nutch2.1 BAD BOT DETECTED" -else - echo "${bold}${red}FAILED - ${red}Googlebot/Nutch2.1 BAD BOT NOT DETECTED" - #exit 1 -fi -} - -run_curltest11 () { -if curl -A "Mozilla/5.0 (compatible; Googlebot/nutch/-2.1; +http://www.google.com/bot.html)" http://localhost:9000 2>&1 | grep -i '(52)'; then - echo "${bold}${green}PASSED - ${red}Googlebot/nutch/-2.1 BAD BOT DETECTED" -else - echo "${bold}${red}FAILED - Googlebot/nutch/-2.1 BAD BOT NOT DETECTED" - #exit 1 -fi -} - -run_curltest12 () { -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" - #exit 1 -fi -} - -run_curltest13 () { -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" - #exit 1 -fi -} - -run_curltest14 () { 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" - #exit 1 + exit 1 fi } -run_curltest15 () { +run_curltest11 () { 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" - #exit 1 + exit 1 fi } @@ -236,6 +200,7 @@ for line in ${lines}; do echo "${bold}${green}PASSED - ${red}${line} was ${bold}${red}BLOCKED" else echo "${bold}${red}FAILED - ${red}${line} was ${bold}${red}NOT BLOCKED" + exit 1 fi done IFS="" @@ -256,6 +221,7 @@ for line in ${lines}; do echo "${bold}${green}PASSED - ${green}${line} was ${bold}${green}ALLOWED" else echo "${bold}${red}FAILED - ${red}${line} was ${bold}${red}BLOCKED" + exit 1 fi done IFS="" @@ -276,6 +242,7 @@ for line in ${lines}; do echo "${bold}${green}PASSED - ${green}${line} was ${bold}${green}ALLOWED" else echo "${bold}${red}FAILED - ${red}${line} was ${bold}${red}BLOCKED" + exit 1 fi done IFS="" @@ -296,6 +263,7 @@ for line in ${lines}; do 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" + exit 1 fi done IFS="" @@ -317,6 +285,7 @@ for line in ${lines}; do echo "${bold}${green}PASSED - ${red}${line} was ${bold}${red}BLOCKED" else echo "${bold}${red}FAILED - ${red}${line} was ${bold}${red}NOT BLOCKED" + exit 1 fi done IFS="" @@ -336,6 +305,7 @@ for line in ${lines}; do echo "${bold}${green}PASSED - ${green}${line} was ${bold}${green}ALLOWED" else echo "${bold}${green}FAILED - ${red}${line} was ${bold}${red}BLOCKED" + exit 1 fi done IFS="" @@ -364,10 +334,6 @@ run_curltest8 run_curltest9 run_curltest10 run_curltest11 -run_curltest12 -run_curltest13 -run_curltest14 -run_curltest15 testBadUserAgents testGoodUserAgents testAllowedUserAgents