Update test-blocker-rate-limiting.sh

Add test for "Applebot" as a super rate limited bot Ref: #568
This commit is contained in:
Mitchell Krog 2024-04-24 14:32:57 +02:00 committed by GitHub
parent 0a1d5e942b
commit 87e7bba792
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -82,6 +82,10 @@ echo "${bold}${yellow}-----------------------------"
echo "${bold}${yellow}Making GoogleBot ${yellow}RATE LIMITED" echo "${bold}${yellow}Making GoogleBot ${yellow}RATE LIMITED"
echo "${bold}${yellow}-----------------------------" echo "${bold}${yellow}-----------------------------"
printf "\n" printf "\n"
echo "${bold}${yellow}-----------------------------"
echo "${bold}${yellow}Making Applebot ${yellow}SUPER RATE LIMITED"
echo "${bold}${yellow}-----------------------------"
printf "\n"
sudo cp ./dev-tools/test_units/rate-limiting-user-agents.conf /etc/nginx/bots.d/blacklist-user-agents.conf sudo cp ./dev-tools/test_units/rate-limiting-user-agents.conf /etc/nginx/bots.d/blacklist-user-agents.conf
} }
@ -177,6 +181,99 @@ if grep -i 'Unavailable' < ${ratelimittestfile}; then
fi fi
} }
testRateLimiting2 () {
ratelimittestfile=./dev-tools/test_units/ratelimittest-master.txt
truncate -s 0 ${ratelimittestfile}
curl -A "Applebot" http://localhost:80 2>&1 > ${ratelimittestfile} &
curl -A "Applebot" http://localhost:80 2>&1 >> ${ratelimittestfile} &
curl -A "Applebot" http://localhost:80 2>&1 >> ${ratelimittestfile} &
curl -A "Applebot" http://localhost:80 2>&1 >> ${ratelimittestfile} &
curl -A "Applebot" http://localhost:80 2>&1 >> ${ratelimittestfile} &
curl -A "Applebot" http://localhost:80 2>&1 >> ${ratelimittestfile} &
curl -A "Applebot" http://localhost:80 2>&1 >> ${ratelimittestfile} &
curl -A "Applebot" http://localhost:80 2>&1 >> ${ratelimittestfile} &
curl -A "Applebot" http://localhost:80 2>&1 >> ${ratelimittestfile} &
curl -A "Applebot" http://localhost:80 2>&1 >> ${ratelimittestfile} &
curl -A "Applebot" http://localhost:80 2>&1 >> ${ratelimittestfile} &
curl -A "Applebot" http://localhost:80 2>&1 >> ${ratelimittestfile} &
curl -A "Applebot" http://localhost:80 2>&1 >> ${ratelimittestfile} &
curl -A "Applebot" http://localhost:80 2>&1 >> ${ratelimittestfile} &
curl -A "Applebot" http://localhost:80 2>&1 >> ${ratelimittestfile} &
curl -A "Applebot" http://localhost:80 2>&1 >> ${ratelimittestfile} &
curl -A "Applebot" http://localhost:80 2>&1 >> ${ratelimittestfile} &
curl -A "Applebot" http://localhost:80 2>&1 >> ${ratelimittestfile} &
curl -A "Applebot" http://localhost:80 2>&1 >> ${ratelimittestfile} &
curl -A "Applebot" http://localhost:80 2>&1 >> ${ratelimittestfile} &
curl -A "Applebot" http://localhost:80 2>&1 >> ${ratelimittestfile} &
curl -A "Applebot" http://localhost:80 2>&1 >> ${ratelimittestfile} &
curl -A "Applebot" http://localhost:80 2>&1 >> ${ratelimittestfile} &
curl -A "Applebot" http://localhost:80 2>&1 >> ${ratelimittestfile} &
curl -A "Applebot" http://localhost:80 2>&1 >> ${ratelimittestfile} &
curl -A "Applebot" http://localhost:80 2>&1 >> ${ratelimittestfile} &
curl -A "Applebot" http://localhost:80 2>&1 >> ${ratelimittestfile} &
curl -A "Applebot" http://localhost:80 2>&1 >> ${ratelimittestfile} &
curl -A "Applebot" http://localhost:80 2>&1 >> ${ratelimittestfile} &
curl -A "Applebot" http://localhost:80 2>&1 >> ${ratelimittestfile} &
curl -A "Applebot" http://localhost:80 2>&1 >> ${ratelimittestfile} &
curl -A "Applebot" http://localhost:80 2>&1 >> ${ratelimittestfile} &
curl -A "Applebot" http://localhost:80 2>&1 >> ${ratelimittestfile} &
curl -A "Applebot" http://localhost:80 2>&1 >> ${ratelimittestfile} &
curl -A "Applebot" http://localhost:80 2>&1 >> ${ratelimittestfile} &
curl -A "Applebot" http://localhost:80 2>&1 >> ${ratelimittestfile} &
curl -A "Applebot" http://localhost:80 2>&1 >> ${ratelimittestfile} &
curl -A "Applebot" http://localhost:80 2>&1 >> ${ratelimittestfile} &
curl -A "Applebot" http://localhost:80 2>&1 >> ${ratelimittestfile} &
curl -A "Applebot" http://localhost:80 2>&1 >> ${ratelimittestfile} &
curl -A "Applebot" http://localhost:80 2>&1 >> ${ratelimittestfile} &
curl -A "Applebot" http://localhost:80 2>&1 >> ${ratelimittestfile} &
curl -A "Applebot" http://localhost:80 2>&1 >> ${ratelimittestfile} &
curl -A "Applebot" http://localhost:80 2>&1 >> ${ratelimittestfile} &
curl -A "Applebot" http://localhost:80 2>&1 >> ${ratelimittestfile} &
curl -A "Applebot" http://localhost:80 2>&1 >> ${ratelimittestfile} &
curl -A "Applebot" http://localhost:80 2>&1 >> ${ratelimittestfile} &
curl -A "Applebot" http://localhost:80 2>&1 >> ${ratelimittestfile} &
curl -A "Applebot" http://localhost:80 2>&1 >> ${ratelimittestfile} &
curl -A "Applebot" http://localhost:80 2>&1 >> ${ratelimittestfile} &
curl -A "Applebot" http://localhost:80 2>&1 >> ${ratelimittestfile} &
curl -A "Applebot" http://localhost:80 2>&1 >> ${ratelimittestfile} &
curl -A "Applebot" http://localhost:80 2>&1 >> ${ratelimittestfile} &
curl -A "Applebot" http://localhost:80 2>&1 >> ${ratelimittestfile} &
curl -A "Applebot" http://localhost:80 2>&1 >> ${ratelimittestfile} &
curl -A "Applebot" http://localhost:80 2>&1 >> ${ratelimittestfile} &
curl -A "Applebot" http://localhost:80 2>&1 >> ${ratelimittestfile} &
curl -A "Applebot" http://localhost:80 2>&1 >> ${ratelimittestfile} &
curl -A "Applebot" http://localhost:80 2>&1 >> ${ratelimittestfile} &
curl -A "Applebot" http://localhost:80 2>&1 >> ${ratelimittestfile} &
curl -A "Applebot" http://localhost:80 2>&1 >> ${ratelimittestfile} &
curl -A "Applebot" http://localhost:80 2>&1 >> ${ratelimittestfile} &
curl -A "Applebot" http://localhost:80 2>&1 >> ${ratelimittestfile} &
curl -A "Applebot" http://localhost:80 2>&1 >> ${ratelimittestfile} &
curl -A "Applebot" http://localhost:80 2>&1 >> ${ratelimittestfile} &
curl -A "Applebot" http://localhost:80 2>&1 >> ${ratelimittestfile} &
curl -A "Applebot" http://localhost:80 2>&1 >> ${ratelimittestfile} &
curl -A "Applebot" http://localhost:80 2>&1 >> ${ratelimittestfile} &
curl -A "Applebot" http://localhost:80 2>&1 >> ${ratelimittestfile} &
curl -A "Applebot" http://localhost:80 2>&1 >> ${ratelimittestfile} &
curl -A "Applebot" http://localhost:80 2>&1 >> ${ratelimittestfile} &
curl -A "Applebot" http://localhost:80 2>&1 >> ${ratelimittestfile} &
curl -A "Applebot" http://localhost:80 2>&1 >> ${ratelimittestfile} &
curl -A "Applebot" http://localhost:80 2>&1 >> ${ratelimittestfile} &
curl -A "Applebot" http://localhost:80 2>&1 >> ${ratelimittestfile} &
curl -A "Applebot" http://localhost:80 2>&1 >> ${ratelimittestfile} &
curl -A "Applebot" http://localhost:80 2>&1 >> ${ratelimittestfile} &
curl -A "Applebot" http://localhost:80 2>&1 >> ${ratelimittestfile} &
curl -A "Applebot" http://localhost:80 2>&1 >> ${ratelimittestfile} &
curl -A "Applebot" http://localhost:80 2>&1 >> ${ratelimittestfile}
if grep -i 'Unavailable' < ${ratelimittestfile}; then
echo "${bold}${green}PASSED - ${red}Applebot was ${bold}${red}SUPER RATE LIMITED"
else
echo "${bold}${red}FAILED - ${red}Applebot was ${bold}${red}NOT SUPER RATE LIMITED"
#exit 1
fi
}
backupConfFiles () { backupConfFiles () {
printf "\n" printf "\n"
echo "${bold}${green}-------------------------------------------------------" echo "${bold}${green}-------------------------------------------------------"
@ -203,6 +300,7 @@ ratelimitGoogle
reloadNginX reloadNginX
waitforReload waitforReload
testRateLimiting testRateLimiting
testRateLimiting2
backupConfFiles backupConfFiles
printf "\n" printf "\n"