Skip to content

Commit

Permalink
GHA workflow - Beta Tests
Browse files Browse the repository at this point in the history
  • Loading branch information
mitchellkrogza committed Jul 5, 2021
1 parent 515a553 commit 5f0f193
Show file tree
Hide file tree
Showing 4 changed files with 150 additions and 142 deletions.
176 changes: 89 additions & 87 deletions dev-tools/beta-test-blocker-rate-limiting.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
# #
##############################################################################

export TERM=xterm

# ------------------------------------------------------------------------------
# MIT License
# ------------------------------------------------------------------------------
Expand Down Expand Up @@ -64,7 +66,7 @@ echo "${bold}${green}---------------"
echo "${bold}${green}Reloading Nginx"
echo "${bold}${green}---------------"
printf "\n\n"
sudo nginx -t && sudo nginx -s reload
sudo nginx -t && sudo systemctl reload nginx
}

waitforReload () {
Expand All @@ -80,92 +82,92 @@ echo "${bold}${yellow}-----------------------------"
echo "${bold}${yellow}Making GoogleBot ${yellow}RATE LIMITED"
echo "${bold}${yellow}-----------------------------"
printf "\n\n"
sudo cp ${TRAVIS_BUILD_DIR}/.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
}

testRateLimiting () {
ratelimittestfile=${TRAVIS_BUILD_DIR}/.dev-tools/test_units/ratelimittest-beta.txt
ratelimittestfile=./dev-tools/test_units/ratelimittest-beta.txt
truncate -s 0 ${ratelimittestfile}
curl -A "GoogleBot" http:https://localhost:9000 2>&1 > ${ratelimittestfile} &
curl -A "GoogleBot" http:https://localhost:9000 2>&1 >> ${ratelimittestfile} &
curl -A "GoogleBot" http:https://localhost:9000 2>&1 >> ${ratelimittestfile} &
curl -A "GoogleBot" http:https://localhost:9000 2>&1 >> ${ratelimittestfile} &
curl -A "GoogleBot" http:https://localhost:9000 2>&1 >> ${ratelimittestfile} &
curl -A "GoogleBot" http:https://localhost:9000 2>&1 >> ${ratelimittestfile} &
curl -A "GoogleBot" http:https://localhost:9000 2>&1 >> ${ratelimittestfile} &
curl -A "GoogleBot" http:https://localhost:9000 2>&1 >> ${ratelimittestfile} &
curl -A "GoogleBot" http:https://localhost:9000 2>&1 >> ${ratelimittestfile} &
curl -A "GoogleBot" http:https://localhost:9000 2>&1 >> ${ratelimittestfile} &
curl -A "GoogleBot" http:https://localhost:9000 2>&1 >> ${ratelimittestfile} &
curl -A "GoogleBot" http:https://localhost:9000 2>&1 >> ${ratelimittestfile} &
curl -A "GoogleBot" http:https://localhost:9000 2>&1 >> ${ratelimittestfile} &
curl -A "GoogleBot" http:https://localhost:9000 2>&1 >> ${ratelimittestfile} &
curl -A "GoogleBot" http:https://localhost:9000 2>&1 >> ${ratelimittestfile} &
curl -A "GoogleBot" http:https://localhost:9000 2>&1 >> ${ratelimittestfile} &
curl -A "GoogleBot" http:https://localhost:9000 2>&1 >> ${ratelimittestfile} &
curl -A "GoogleBot" http:https://localhost:9000 2>&1 >> ${ratelimittestfile} &
curl -A "GoogleBot" http:https://localhost:9000 2>&1 >> ${ratelimittestfile} &
curl -A "GoogleBot" http:https://localhost:9000 2>&1 >> ${ratelimittestfile} &
curl -A "GoogleBot" http:https://localhost:9000 2>&1 >> ${ratelimittestfile} &
curl -A "GoogleBot" http:https://localhost:9000 2>&1 >> ${ratelimittestfile} &
curl -A "GoogleBot" http:https://localhost:9000 2>&1 >> ${ratelimittestfile} &
curl -A "GoogleBot" http:https://localhost:9000 2>&1 >> ${ratelimittestfile} &
curl -A "GoogleBot" http:https://localhost:9000 2>&1 >> ${ratelimittestfile} &
curl -A "GoogleBot" http:https://localhost:9000 2>&1 >> ${ratelimittestfile} &
curl -A "GoogleBot" http:https://localhost:9000 2>&1 >> ${ratelimittestfile} &
curl -A "GoogleBot" http:https://localhost:9000 2>&1 >> ${ratelimittestfile} &
curl -A "GoogleBot" http:https://localhost:9000 2>&1 >> ${ratelimittestfile} &
curl -A "GoogleBot" http:https://localhost:9000 2>&1 >> ${ratelimittestfile} &
curl -A "GoogleBot" http:https://localhost:9000 2>&1 >> ${ratelimittestfile} &
curl -A "GoogleBot" http:https://localhost:9000 2>&1 >> ${ratelimittestfile} &
curl -A "GoogleBot" http:https://localhost:9000 2>&1 >> ${ratelimittestfile} &
curl -A "GoogleBot" http:https://localhost:9000 2>&1 >> ${ratelimittestfile} &
curl -A "GoogleBot" http:https://localhost:9000 2>&1 >> ${ratelimittestfile} &
curl -A "GoogleBot" http:https://localhost:9000 2>&1 >> ${ratelimittestfile} &
curl -A "GoogleBot" http:https://localhost:9000 2>&1 >> ${ratelimittestfile} &
curl -A "GoogleBot" http:https://localhost:9000 2>&1 >> ${ratelimittestfile} &
curl -A "GoogleBot" http:https://localhost:9000 2>&1 >> ${ratelimittestfile} &
curl -A "GoogleBot" http:https://localhost:9000 2>&1 >> ${ratelimittestfile} &
curl -A "GoogleBot" http:https://localhost:9000 2>&1 >> ${ratelimittestfile} &
curl -A "GoogleBot" http:https://localhost:9000 2>&1 >> ${ratelimittestfile} &
curl -A "GoogleBot" http:https://localhost:9000 2>&1 >> ${ratelimittestfile} &
curl -A "GoogleBot" http:https://localhost:9000 2>&1 >> ${ratelimittestfile} &
curl -A "GoogleBot" http:https://localhost:9000 2>&1 >> ${ratelimittestfile} &
curl -A "GoogleBot" http:https://localhost:9000 2>&1 >> ${ratelimittestfile} &
curl -A "GoogleBot" http:https://localhost:9000 2>&1 >> ${ratelimittestfile} &
curl -A "GoogleBot" http:https://localhost:9000 2>&1 >> ${ratelimittestfile} &
curl -A "GoogleBot" http:https://localhost:9000 2>&1 >> ${ratelimittestfile} &
curl -A "GoogleBot" http:https://localhost:9000 2>&1 >> ${ratelimittestfile} &
curl -A "GoogleBot" http:https://localhost:9000 2>&1 >> ${ratelimittestfile} &
curl -A "GoogleBot" http:https://localhost:9000 2>&1 >> ${ratelimittestfile} &
curl -A "GoogleBot" http:https://localhost:9000 2>&1 >> ${ratelimittestfile} &
curl -A "GoogleBot" http:https://localhost:9000 2>&1 >> ${ratelimittestfile} &
curl -A "GoogleBot" http:https://localhost:9000 2>&1 >> ${ratelimittestfile} &
curl -A "GoogleBot" http:https://localhost:9000 2>&1 >> ${ratelimittestfile} &
curl -A "GoogleBot" http:https://localhost:9000 2>&1 >> ${ratelimittestfile} &
curl -A "GoogleBot" http:https://localhost:9000 2>&1 >> ${ratelimittestfile} &
curl -A "GoogleBot" http:https://localhost:9000 2>&1 >> ${ratelimittestfile} &
curl -A "GoogleBot" http:https://localhost:9000 2>&1 >> ${ratelimittestfile} &
curl -A "GoogleBot" http:https://localhost:9000 2>&1 >> ${ratelimittestfile} &
curl -A "GoogleBot" http:https://localhost:9000 2>&1 >> ${ratelimittestfile} &
curl -A "GoogleBot" http:https://localhost:9000 2>&1 >> ${ratelimittestfile} &
curl -A "GoogleBot" http:https://localhost:9000 2>&1 >> ${ratelimittestfile} &
curl -A "GoogleBot" http:https://localhost:9000 2>&1 >> ${ratelimittestfile} &
curl -A "GoogleBot" http:https://localhost:9000 2>&1 >> ${ratelimittestfile} &
curl -A "GoogleBot" http:https://localhost:9000 2>&1 >> ${ratelimittestfile} &
curl -A "GoogleBot" http:https://localhost:9000 2>&1 >> ${ratelimittestfile} &
curl -A "GoogleBot" http:https://localhost:9000 2>&1 >> ${ratelimittestfile} &
curl -A "GoogleBot" http:https://localhost:9000 2>&1 >> ${ratelimittestfile} &
curl -A "GoogleBot" http:https://localhost:9000 2>&1 >> ${ratelimittestfile} &
curl -A "GoogleBot" http:https://localhost:9000 2>&1 >> ${ratelimittestfile} &
curl -A "GoogleBot" http:https://localhost:9000 2>&1 >> ${ratelimittestfile} &
curl -A "GoogleBot" http:https://localhost:9000 2>&1 >> ${ratelimittestfile} &
curl -A "GoogleBot" http:https://localhost:9000 2>&1 >> ${ratelimittestfile} &
curl -A "GoogleBot" http:https://localhost:9000 2>&1 >> ${ratelimittestfile} &
curl -A "GoogleBot" http:https://localhost:9000 2>&1 >> ${ratelimittestfile} &
curl -A "GoogleBot" http:https://localhost:9000 2>&1 >> ${ratelimittestfile} &
curl -A "GoogleBot" http:https://localhost:9000 2>&1 >> ${ratelimittestfile} &
curl -A "GoogleBot" http:https://localhost:9000 2>&1 >> ${ratelimittestfile}
curl -A "GoogleBot" http:https://localhost:80 2>&1 > ${ratelimittestfile} &
curl -A "GoogleBot" http:https://localhost:80 2>&1 >> ${ratelimittestfile} &
curl -A "GoogleBot" http:https://localhost:80 2>&1 >> ${ratelimittestfile} &
curl -A "GoogleBot" http:https://localhost:80 2>&1 >> ${ratelimittestfile} &
curl -A "GoogleBot" http:https://localhost:80 2>&1 >> ${ratelimittestfile} &
curl -A "GoogleBot" http:https://localhost:80 2>&1 >> ${ratelimittestfile} &
curl -A "GoogleBot" http:https://localhost:80 2>&1 >> ${ratelimittestfile} &
curl -A "GoogleBot" http:https://localhost:80 2>&1 >> ${ratelimittestfile} &
curl -A "GoogleBot" http:https://localhost:80 2>&1 >> ${ratelimittestfile} &
curl -A "GoogleBot" http:https://localhost:80 2>&1 >> ${ratelimittestfile} &
curl -A "GoogleBot" http:https://localhost:80 2>&1 >> ${ratelimittestfile} &
curl -A "GoogleBot" http:https://localhost:80 2>&1 >> ${ratelimittestfile} &
curl -A "GoogleBot" http:https://localhost:80 2>&1 >> ${ratelimittestfile} &
curl -A "GoogleBot" http:https://localhost:80 2>&1 >> ${ratelimittestfile} &
curl -A "GoogleBot" http:https://localhost:80 2>&1 >> ${ratelimittestfile} &
curl -A "GoogleBot" http:https://localhost:80 2>&1 >> ${ratelimittestfile} &
curl -A "GoogleBot" http:https://localhost:80 2>&1 >> ${ratelimittestfile} &
curl -A "GoogleBot" http:https://localhost:80 2>&1 >> ${ratelimittestfile} &
curl -A "GoogleBot" http:https://localhost:80 2>&1 >> ${ratelimittestfile} &
curl -A "GoogleBot" http:https://localhost:80 2>&1 >> ${ratelimittestfile} &
curl -A "GoogleBot" http:https://localhost:80 2>&1 >> ${ratelimittestfile} &
curl -A "GoogleBot" http:https://localhost:80 2>&1 >> ${ratelimittestfile} &
curl -A "GoogleBot" http:https://localhost:80 2>&1 >> ${ratelimittestfile} &
curl -A "GoogleBot" http:https://localhost:80 2>&1 >> ${ratelimittestfile} &
curl -A "GoogleBot" http:https://localhost:80 2>&1 >> ${ratelimittestfile} &
curl -A "GoogleBot" http:https://localhost:80 2>&1 >> ${ratelimittestfile} &
curl -A "GoogleBot" http:https://localhost:80 2>&1 >> ${ratelimittestfile} &
curl -A "GoogleBot" http:https://localhost:80 2>&1 >> ${ratelimittestfile} &
curl -A "GoogleBot" http:https://localhost:80 2>&1 >> ${ratelimittestfile} &
curl -A "GoogleBot" http:https://localhost:80 2>&1 >> ${ratelimittestfile} &
curl -A "GoogleBot" http:https://localhost:80 2>&1 >> ${ratelimittestfile} &
curl -A "GoogleBot" http:https://localhost:80 2>&1 >> ${ratelimittestfile} &
curl -A "GoogleBot" http:https://localhost:80 2>&1 >> ${ratelimittestfile} &
curl -A "GoogleBot" http:https://localhost:80 2>&1 >> ${ratelimittestfile} &
curl -A "GoogleBot" http:https://localhost:80 2>&1 >> ${ratelimittestfile} &
curl -A "GoogleBot" http:https://localhost:80 2>&1 >> ${ratelimittestfile} &
curl -A "GoogleBot" http:https://localhost:80 2>&1 >> ${ratelimittestfile} &
curl -A "GoogleBot" http:https://localhost:80 2>&1 >> ${ratelimittestfile} &
curl -A "GoogleBot" http:https://localhost:80 2>&1 >> ${ratelimittestfile} &
curl -A "GoogleBot" http:https://localhost:80 2>&1 >> ${ratelimittestfile} &
curl -A "GoogleBot" http:https://localhost:80 2>&1 >> ${ratelimittestfile} &
curl -A "GoogleBot" http:https://localhost:80 2>&1 >> ${ratelimittestfile} &
curl -A "GoogleBot" http:https://localhost:80 2>&1 >> ${ratelimittestfile} &
curl -A "GoogleBot" http:https://localhost:80 2>&1 >> ${ratelimittestfile} &
curl -A "GoogleBot" http:https://localhost:80 2>&1 >> ${ratelimittestfile} &
curl -A "GoogleBot" http:https://localhost:80 2>&1 >> ${ratelimittestfile} &
curl -A "GoogleBot" http:https://localhost:80 2>&1 >> ${ratelimittestfile} &
curl -A "GoogleBot" http:https://localhost:80 2>&1 >> ${ratelimittestfile} &
curl -A "GoogleBot" http:https://localhost:80 2>&1 >> ${ratelimittestfile} &
curl -A "GoogleBot" http:https://localhost:80 2>&1 >> ${ratelimittestfile} &
curl -A "GoogleBot" http:https://localhost:80 2>&1 >> ${ratelimittestfile} &
curl -A "GoogleBot" http:https://localhost:80 2>&1 >> ${ratelimittestfile} &
curl -A "GoogleBot" http:https://localhost:80 2>&1 >> ${ratelimittestfile} &
curl -A "GoogleBot" http:https://localhost:80 2>&1 >> ${ratelimittestfile} &
curl -A "GoogleBot" http:https://localhost:80 2>&1 >> ${ratelimittestfile} &
curl -A "GoogleBot" http:https://localhost:80 2>&1 >> ${ratelimittestfile} &
curl -A "GoogleBot" http:https://localhost:80 2>&1 >> ${ratelimittestfile} &
curl -A "GoogleBot" http:https://localhost:80 2>&1 >> ${ratelimittestfile} &
curl -A "GoogleBot" http:https://localhost:80 2>&1 >> ${ratelimittestfile} &
curl -A "GoogleBot" http:https://localhost:80 2>&1 >> ${ratelimittestfile} &
curl -A "GoogleBot" http:https://localhost:80 2>&1 >> ${ratelimittestfile} &
curl -A "GoogleBot" http:https://localhost:80 2>&1 >> ${ratelimittestfile} &
curl -A "GoogleBot" http:https://localhost:80 2>&1 >> ${ratelimittestfile} &
curl -A "GoogleBot" http:https://localhost:80 2>&1 >> ${ratelimittestfile} &
curl -A "GoogleBot" http:https://localhost:80 2>&1 >> ${ratelimittestfile} &
curl -A "GoogleBot" http:https://localhost:80 2>&1 >> ${ratelimittestfile} &
curl -A "GoogleBot" http:https://localhost:80 2>&1 >> ${ratelimittestfile} &
curl -A "GoogleBot" http:https://localhost:80 2>&1 >> ${ratelimittestfile} &
curl -A "GoogleBot" http:https://localhost:80 2>&1 >> ${ratelimittestfile} &
curl -A "GoogleBot" http:https://localhost:80 2>&1 >> ${ratelimittestfile} &
curl -A "GoogleBot" http:https://localhost:80 2>&1 >> ${ratelimittestfile} &
curl -A "GoogleBot" http:https://localhost:80 2>&1 >> ${ratelimittestfile} &
curl -A "GoogleBot" http:https://localhost:80 2>&1 >> ${ratelimittestfile} &
curl -A "GoogleBot" http:https://localhost:80 2>&1 >> ${ratelimittestfile} &
curl -A "GoogleBot" http:https://localhost:80 2>&1 >> ${ratelimittestfile} &
curl -A "GoogleBot" http:https://localhost:80 2>&1 >> ${ratelimittestfile} &
curl -A "GoogleBot" http:https://localhost:80 2>&1 >> ${ratelimittestfile} &
curl -A "GoogleBot" http:https://localhost:80 2>&1 >> ${ratelimittestfile} &
curl -A "GoogleBot" http:https://localhost:80 2>&1 >> ${ratelimittestfile} &
curl -A "GoogleBot" http:https://localhost:80 2>&1 >> ${ratelimittestfile}

if grep -i 'Unavailable' < ${ratelimittestfile}; then
echo "${bold}${green}PASSED - ${red}GoogleBot was ${bold}${red}RATE LIMITED"
Expand All @@ -181,10 +183,10 @@ echo "${bold}${green}-----------------------------------------------------------
echo "${bold}${green}Make Backup all conf files and folders used during this test"
echo "${bold}${green}------------------------------------------------------------"
printf "\n"
sudo cp /etc/nginx/bots.d/* ${TRAVIS_BUILD_DIR}/.dev-tools/beta_conf_files_ratelimiting/bots.d/
sudo cp /etc/nginx/conf.d/* ${TRAVIS_BUILD_DIR}/.dev-tools/beta_conf_files_ratelimiting/conf.d/
sudo cp /etc/nginx/sites-available/default.vhost ${TRAVIS_BUILD_DIR}/.dev-tools/beta_conf_files_ratelimiting/default.vhost
sudo cp /etc/nginx/nginx.conf ${TRAVIS_BUILD_DIR}/.dev-tools/beta_conf_files_ratelimiting/nginx.conf
sudo cp /etc/nginx/bots.d/* ./dev-tools/beta_conf_files_ratelimiting/bots.d/
sudo cp /etc/nginx/conf.d/* ./dev-tools/beta_conf_files_ratelimiting/conf.d/
sudo cp /etc/nginx/sites-available/default.vhost ./dev-tools/beta_conf_files_ratelimiting/default.vhost
sudo cp /etc/nginx/nginx.conf ./dev-tools/beta_conf_files_ratelimiting/nginx.conf
}

# -----------
Expand Down
10 changes: 6 additions & 4 deletions dev-tools/beta-test-blocker-whitelist-domains.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
# #
##############################################################################

export TERM=xterm

# ------------------------------------------------------------------------------
# MIT License
# ------------------------------------------------------------------------------
Expand Down Expand Up @@ -64,7 +66,7 @@ echo "${bold}${green}---------------"
echo "${bold}${green}Reloading Nginx"
echo "${bold}${green}---------------"
printf "\n\n"
sudo nginx -t && sudo nginx -s reload
sudo nginx -t && sudo systemctl reload nginx
}

waitforReload () {
Expand All @@ -80,11 +82,11 @@ echo "${bold}${green}---------------------------------------"
echo "${bold}${green}Activating Users whitelist-domains.conf"
echo "${bold}${green}---------------------------------------"
printf "\n\n"
sudo cp ${TRAVIS_BUILD_DIR}/.dev-tools/test_units/whitelist-domains.conf /etc/nginx/bots.d/whitelist-domains.conf
sudo cp ./dev-tools/test_units/whitelist-domains.conf /etc/nginx/bots.d/whitelist-domains.conf
}

run_curltest1 () {
if curl http:https://localhost:9000 -e http:https://www.myowndomain.com 2>&1 | grep -i 'Welcome'; then
if curl http:https://localhost:80 -e http:https://www.myowndomain.com 2>&1 | grep -i 'Welcome'; then
echo "${bold}${green}PASSED - User whitelist-domains.conf working"
else
echo "${bold}${red}FAILED - User whitelist-domains.conf NOT working"
Expand All @@ -93,7 +95,7 @@ fi
}

run_curltest2 () {
if curl http:https://localhost:9000 -e http:https://www.myotherdomain.com 2>&1 | grep -i 'Welcome'; then
if curl http:https://localhost:80 -e http:https://www.myotherdomain.com 2>&1 | grep -i 'Welcome'; then
echo "${bold}${green}PASSED - User whitelist-domains.conf working"
else
echo "${bold}${red}FAILED - User whitelist-domains.conf NOT working"
Expand Down
Loading

0 comments on commit 5f0f193

Please sign in to comment.