mirror of
https://github.com/mitchellkrogza/nginx-ultimate-bad-bot-blocker.git
synced 2025-09-01 10:09:49 +00:00
Reduce Line Breaks in Tests 1-2
This commit is contained in:
parent
a7e94b6023
commit
effe919337
30 changed files with 59 additions and 81 deletions
|
@ -84,7 +84,7 @@ sudo dos2unix ${TRAVIS_BUILD_DIR}/.dev-tools/referrers-regex-format.txt
|
|||
echo "${bold}${green}-------------------------"
|
||||
echo "${bold}${green}File Generation Completed"
|
||||
echo "${bold}${green}-------------------------"
|
||||
printf "\n\n"
|
||||
printf "\n"
|
||||
}
|
||||
|
||||
# -----------------
|
||||
|
|
|
@ -74,7 +74,7 @@ done < ${_input1}
|
|||
echo "${bold}${green}-----------------------"
|
||||
echo "${bold}${green}Creating Google Disavow"
|
||||
echo "${bold}${green}-----------------------"
|
||||
printf "\n\n"
|
||||
printf "\n"
|
||||
}
|
||||
|
||||
# -----------------
|
||||
|
|
|
@ -98,7 +98,7 @@ sudo cp ${_tmprobots} ${TRAVIS_BUILD_DIR}/robots.txt/robots.txt
|
|||
echo "${bold}${green}-------------------------------"
|
||||
echo "${bold}${green}robots.txt Generation Completed"
|
||||
echo "${bold}${green}-------------------------------"
|
||||
printf "\n\n"
|
||||
printf "\n"
|
||||
}
|
||||
|
||||
# ----------------
|
||||
|
|
|
@ -116,7 +116,6 @@ sudo chmod +x /usr/sbin/install-ngxblocker
|
|||
}
|
||||
|
||||
runinstallngxblocker () {
|
||||
printf "\n"
|
||||
echo "${bold}${magenta}--------------------------"
|
||||
echo "${bold}${magenta}Execute install-ngxblocker"
|
||||
echo "${bold}${magenta}--------------------------"
|
||||
|
@ -155,7 +154,6 @@ sudo cp ${TRAVIS_BUILD_DIR}/.dev-tools/globalblacklist-dummy.conf /etc/nginx/con
|
|||
}
|
||||
|
||||
forceUpdateTest2 () {
|
||||
printf "\n"
|
||||
echo "${bold}${yellow}--------------------------------------"
|
||||
echo "${bold}${yellow}Delete Files to test update-ngxblocker"
|
||||
echo "${bold}${yellow}--------------------------------------"
|
||||
|
@ -183,7 +181,6 @@ sudo bash ./update-ngxblocker -n
|
|||
}
|
||||
|
||||
activateLatestBlacklist () {
|
||||
printf "\n"
|
||||
echo "${bold}${yellow}------------------------------------------------------------"
|
||||
echo "${bold}${yellow}Make sure we test with latest generated globalblacklist.conf"
|
||||
echo "${bold}${yellow}------------------------------------------------------------"
|
||||
|
@ -192,9 +189,9 @@ sudo cp ${TRAVIS_BUILD_DIR}/conf.d/globalblacklist.conf /etc/nginx/conf.d/global
|
|||
|
||||
backupConfFiles () {
|
||||
printf "\n"
|
||||
echo "${bold}${green}------------------------------------------------------------"
|
||||
echo "${bold}${green}Make Backup all conf files and folders used during this test"
|
||||
echo "${bold}${green}------------------------------------------------------------"
|
||||
echo "${bold}${green}-------------------------------------------------------"
|
||||
echo "${bold}${green}Backup all conf files and folders used during this test"
|
||||
echo "${bold}${green}-------------------------------------------------------"
|
||||
sudo cp /etc/nginx/bots.d/* ${TRAVIS_BUILD_DIR}/.dev-tools/_conf_files_test1/bots.d/
|
||||
sudo cp /etc/nginx/conf.d/* ${TRAVIS_BUILD_DIR}/.dev-tools/_conf_files_test1/conf.d/
|
||||
sudo cp /etc/nginx/sites-available/default.vhost ${TRAVIS_BUILD_DIR}/.dev-tools/_conf_files_test1/default.vhost
|
||||
|
@ -209,7 +206,6 @@ printf "\n"
|
|||
echo "${bold}${green}------------------"
|
||||
echo "${bold}${green}Start Nginx Test 1"
|
||||
echo "${bold}${green}------------------"
|
||||
printf "\n"
|
||||
|
||||
backupNginxConf
|
||||
prepareVhost
|
||||
|
|
|
@ -110,7 +110,6 @@ printf "\n"
|
|||
}
|
||||
|
||||
getinstallngxblocker () {
|
||||
printf "\n"
|
||||
echo "${bold}${magenta}--------------------------------------"
|
||||
echo "${bold}${magenta}Fetch install-ngxblocker from the repo"
|
||||
echo "${bold}${magenta}--------------------------------------"
|
||||
|
@ -129,6 +128,7 @@ sudo bash ./install-ngxblocker -x -c /usr/local/nginx/conf.d -b /usr/local/nginx
|
|||
}
|
||||
|
||||
runsetupngxblocker1 () {
|
||||
printf "\n"
|
||||
echo "${bold}${magenta}------------------------"
|
||||
echo "${bold}${magenta}Execute setup-ngxblocker"
|
||||
echo "${bold}${magenta}------------------------"
|
||||
|
@ -144,18 +144,18 @@ sudo chmod +x /usr/sbin/update-ngxblocker
|
|||
}
|
||||
|
||||
copyNginxConf () {
|
||||
printf "\n"
|
||||
echo "${bold}${magenta}------------------------------"
|
||||
echo "${bold}${magenta}Copy nginx.conf to /etc/nginx/"
|
||||
echo "${bold}${magenta}------------------------------"
|
||||
printf "\n"
|
||||
sudo cp ${TRAVIS_BUILD_DIR}/.dev-tools/test_units/nginx.conf-newformat /etc/nginx/nginx.conf
|
||||
}
|
||||
|
||||
loadNginxConf () {
|
||||
printf "\n"
|
||||
echo "${bold}${magenta}---------------"
|
||||
echo "${bold}${magenta}Load nginx.conf"
|
||||
echo "${bold}${magenta}---------------"
|
||||
printf "\n"
|
||||
sudo nginx -c /etc/nginx/nginx.conf
|
||||
}
|
||||
|
||||
|
@ -164,12 +164,10 @@ printf "\n"
|
|||
echo "${bold}${yellow}----------------------------------------------------"
|
||||
echo "${bold}${yellow}Copy older globalblacklist.conf file to force update"
|
||||
echo "${bold}${yellow}----------------------------------------------------"
|
||||
printf "\n"
|
||||
sudo cp ${TRAVIS_BUILD_DIR}/.dev-tools/globalblacklist-dummy.conf /usr/local/nginx/conf.d/globalblacklist.conf
|
||||
}
|
||||
|
||||
forceUpdateTest2 () {
|
||||
printf "\n"
|
||||
echo "${bold}${yellow}--------------------------------------"
|
||||
echo "${bold}${yellow}Delete Files to test update-ngxblocker"
|
||||
echo "${bold}${yellow}--------------------------------------"
|
||||
|
@ -185,13 +183,11 @@ printf "\n"
|
|||
echo "${bold}${magenta}-------------------------"
|
||||
echo "${bold}${magenta}Execute update-ngxblocker"
|
||||
echo "${bold}${magenta}-------------------------"
|
||||
printf "\n"
|
||||
cd /usr/sbin
|
||||
sudo bash ./update-ngxblocker -c /usr/local/nginx/conf.d -b /usr/local/nginx/bots.d -n
|
||||
}
|
||||
|
||||
activateLatestBlacklist () {
|
||||
printf "\n"
|
||||
echo "${bold}${yellow}------------------------------------------------------------"
|
||||
echo "${bold}${yellow}Make sure we test with latest generated globalblacklist.conf"
|
||||
echo "${bold}${yellow}------------------------------------------------------------"
|
||||
|
@ -201,9 +197,9 @@ sudo cp ${TRAVIS_BUILD_DIR}/conf.d/globalblacklist.conf /usr/local/nginx/conf.d/
|
|||
|
||||
backupConfFiles () {
|
||||
printf "\n"
|
||||
echo "${bold}${green}------------------------------------------------------------"
|
||||
echo "${bold}${green}Make Backup all conf files and folders used during this test"
|
||||
echo "${bold}${green}------------------------------------------------------------"
|
||||
echo "${bold}${green}-------------------------------------------------------"
|
||||
echo "${bold}${green}Backup all conf files and folders used during this test"
|
||||
echo "${bold}${green}-------------------------------------------------------"
|
||||
printf "\n"
|
||||
sudo cp /usr/local/nginx/bots.d/* ${TRAVIS_BUILD_DIR}/.dev-tools/conf_files_test2/bots.d/
|
||||
sudo cp /usr/local/nginx/conf.d/* ${TRAVIS_BUILD_DIR}/.dev-tools/conf_files_test2/conf.d/
|
||||
|
|
|
@ -177,7 +177,7 @@ updateGoogleGhostSpam
|
|||
echo "${bold}${green}------------------------"
|
||||
echo "${bold}${green}All README Files Updated"
|
||||
echo "${bold}${green}------------------------"
|
||||
printf "\n\n"
|
||||
printf "\n"
|
||||
|
||||
# ----------------------
|
||||
# Exit With Error Number
|
||||
|
|
|
@ -73,7 +73,7 @@ sort -u ${_output} -o ${_output}
|
|||
echo "${bold}${green}--------------------------------"
|
||||
echo "${bold}${green}robots.txt Preparation Completed"
|
||||
echo "${bold}${green}--------------------------------"
|
||||
printf "\n\n"
|
||||
printf "\n"
|
||||
}
|
||||
|
||||
# ----------------
|
||||
|
|
|
@ -60,10 +60,10 @@ defaultcolor=$(tput setaf default)
|
|||
# ---------
|
||||
|
||||
reloadNginX () {
|
||||
printf "\n"
|
||||
echo "${bold}${green}---------------"
|
||||
echo "${bold}${green}Reloading Nginx"
|
||||
echo "${bold}${green}---------------"
|
||||
printf "\n\n"
|
||||
sudo nginx -t && sudo nginx -s reload
|
||||
}
|
||||
|
||||
|
@ -71,7 +71,7 @@ waitforReload () {
|
|||
echo "${bold}${yellow}-----------------------------------------------------------------------"
|
||||
echo "${bold}${yellow}Sleeping for 10 seconds to allow Nginx to Properly Reload inside Travis"
|
||||
echo "${bold}${yellow}-----------------------------------------------------------------------"
|
||||
printf "\n\n"
|
||||
printf "\n"
|
||||
sleep 10s
|
||||
}
|
||||
|
||||
|
@ -79,7 +79,7 @@ activateBadWords () {
|
|||
echo "${bold}${green}----------------------------------------"
|
||||
echo "${bold}${green}Activating Users bad-referrer-words.conf"
|
||||
echo "${bold}${green}----------------------------------------"
|
||||
printf "\n\n"
|
||||
printf "\n"
|
||||
sudo cp ${TRAVIS_BUILD_DIR}/.dev-tools/test_units/bad-referrer-words.conf /etc/nginx/bots.d/bad-referrer-words.conf
|
||||
}
|
||||
|
||||
|
@ -104,7 +104,7 @@ fi
|
|||
echo "${bold}${green}--------------------------------"
|
||||
echo "${bold}${green}Bad Referrer Words Test Starting"
|
||||
echo "${bold}${green}--------------------------------"
|
||||
printf "\n\n"
|
||||
printf "\n"
|
||||
|
||||
activateBadWords
|
||||
reloadNginX
|
||||
|
@ -115,7 +115,7 @@ run_curltest2
|
|||
echo "${bold}${green}--------------------------------"
|
||||
echo "${bold}${green}Bad Referrer Words Test Complete"
|
||||
echo "${bold}${green}--------------------------------"
|
||||
printf "\n\n"
|
||||
printf "\n"
|
||||
|
||||
# ----------------------
|
||||
# Exit With Error Number
|
||||
|
|
|
@ -64,7 +64,6 @@ resetNginx () {
|
|||
echo "${bold}${green}------------------------------------------------"
|
||||
echo "${bold}${green}Disable any User Whitelisting and set to Default"
|
||||
echo "${bold}${green}------------------------------------------------"
|
||||
printf "\n"
|
||||
sudo cp ${TRAVIS_BUILD_DIR}/.dev-tools/test_units/blacklist-user-agents-none.conf /etc/nginx/bots.d/blacklist-user-agents.conf
|
||||
}
|
||||
|
||||
|
@ -224,10 +223,10 @@ shuf -n 10 ${TRAVIS_BUILD_DIR}/_generator_lists/bad-user-agents.list > ${TRAVIS_
|
|||
sed 's/\\//g' ${TRAVIS_BUILD_DIR}/.dev-tools/test_units/random-bots-for-test-quick.tmp > ${TRAVIS_BUILD_DIR}/.dev-tools/test_units/random-bots-for-test-quick.list
|
||||
sudo rm ${TRAVIS_BUILD_DIR}/.dev-tools/test_units/random-bots-for-test-quick.tmp
|
||||
sort -u ${TRAVIS_BUILD_DIR}/.dev-tools/test_units/random-bots-for-test-quick.list -o ${TRAVIS_BUILD_DIR}/.dev-tools/test_units/random-bots-for-test-quick.list
|
||||
printf "\n"
|
||||
echo "${bold}${magenta}---------------------------"
|
||||
echo "${bold}${magenta}Testing 10 Random Bad Bots"
|
||||
echo "${bold}${magenta}---------------------------"
|
||||
printf "\n"
|
||||
IFS=$'\n'
|
||||
file=${TRAVIS_BUILD_DIR}/.dev-tools/test_units/random-bots-for-test-quick.list
|
||||
lines=$(cat ${file})
|
||||
|
@ -244,10 +243,10 @@ IFS=""
|
|||
|
||||
testGoodUserAgents () {
|
||||
sed 's/\\//g' ${TRAVIS_BUILD_DIR}/_generator_lists/good-user-agents.list > ${TRAVIS_BUILD_DIR}/.dev-tools/test_units/good-bots-for-test.list
|
||||
printf "\n"
|
||||
echo "${bold}${magenta}---------------------"
|
||||
echo "${bold}${magenta}Testing All Good Bots"
|
||||
echo "${bold}${magenta}---------------------"
|
||||
printf "\n"
|
||||
IFS=$'\n'
|
||||
file=${TRAVIS_BUILD_DIR}/.dev-tools/test_units/good-bots-for-test.list
|
||||
lines=$(cat ${file})
|
||||
|
@ -264,10 +263,10 @@ IFS=""
|
|||
|
||||
testAllowedUserAgents () {
|
||||
sed 's/\\//g' ${TRAVIS_BUILD_DIR}/_generator_lists/allowed-user-agents.list > ${TRAVIS_BUILD_DIR}/.dev-tools/test_units/allowed-bots-for-test.list
|
||||
printf "\n"
|
||||
echo "${bold}${magenta}------------------------"
|
||||
echo "${bold}${magenta}Testing All Allowed Bots"
|
||||
echo "${bold}${magenta}------------------------"
|
||||
printf "\n"
|
||||
IFS=$'\n'
|
||||
file=${TRAVIS_BUILD_DIR}/.dev-tools/test_units/allowed-bots-for-test.list
|
||||
lines=$(cat ${file})
|
||||
|
@ -284,10 +283,10 @@ IFS=""
|
|||
|
||||
testLimitedUserAgents () {
|
||||
sed 's/\\//g' ${TRAVIS_BUILD_DIR}/_generator_lists/limited-user-agents.list > ${TRAVIS_BUILD_DIR}/.dev-tools/test_units/limited-bots-for-test.list
|
||||
printf "\n"
|
||||
echo "${bold}${magenta}------------------------"
|
||||
echo "${bold}${magenta}Testing All Limited Bots"
|
||||
echo "${bold}${magenta}------------------------"
|
||||
printf "\n"
|
||||
IFS=$'\n'
|
||||
file=${TRAVIS_BUILD_DIR}/.dev-tools/test_units/limited-bots-for-test.list
|
||||
lines=$(cat ${file})
|
||||
|
@ -305,10 +304,10 @@ IFS=""
|
|||
testRandomReferrers () {
|
||||
shuf -n 10 ${TRAVIS_BUILD_DIR}/_generator_lists/bad-referrers.list > ${TRAVIS_BUILD_DIR}/.dev-tools/test_units/random-referrers-for-test-quick.list
|
||||
sort -u ${TRAVIS_BUILD_DIR}/.dev-tools/test_units/random-referrers-for-test-quick.list -o ${TRAVIS_BUILD_DIR}/.dev-tools/test_units/random-referrers-for-test-quick.list
|
||||
printf "\n"
|
||||
echo "${bold}${magenta}---------------------------------"
|
||||
echo "${bold}${magenta}Testing 10 Random Bad Referrers"
|
||||
echo "${bold}${magenta}---------------------------------"
|
||||
printf "\n"
|
||||
IFS=$'\n'
|
||||
file=${TRAVIS_BUILD_DIR}/.dev-tools/test_units/random-referrers-for-test-quick.list
|
||||
lines=$(cat ${file})
|
||||
|
@ -324,10 +323,10 @@ IFS=""
|
|||
}
|
||||
|
||||
testGoodReferrers () {
|
||||
printf "\n"
|
||||
echo "${bold}${magenta}----------------------"
|
||||
echo "${bold}${magenta}Testing Good Referrers"
|
||||
echo "${bold}${magenta}----------------------"
|
||||
printf "\n"
|
||||
IFS=$'\n'
|
||||
file=${TRAVIS_BUILD_DIR}/.dev-tools/test_units/good-referrers-for-test.list
|
||||
lines=$(cat ${file})
|
||||
|
|
|
@ -60,10 +60,10 @@ defaultcolor=$(tput setaf default)
|
|||
# ---------
|
||||
|
||||
reloadNginX () {
|
||||
printf "\n"
|
||||
echo "${bold}${green}---------------"
|
||||
echo "${bold}${green}Reloading Nginx"
|
||||
echo "${bold}${green}---------------"
|
||||
printf "\n\n"
|
||||
sudo nginx -t && sudo nginx -s reload
|
||||
}
|
||||
|
||||
|
@ -71,7 +71,7 @@ waitforReload () {
|
|||
echo "${bold}${yellow}-----------------------------------------------------------------------"
|
||||
echo "${bold}${yellow}Sleeping for 10 seconds to allow Nginx to Properly Reload inside Travis"
|
||||
echo "${bold}${yellow}-----------------------------------------------------------------------"
|
||||
printf "\n\n"
|
||||
printf "\n"
|
||||
sleep 10s
|
||||
}
|
||||
|
||||
|
@ -79,7 +79,7 @@ ratelimitGoogle () {
|
|||
echo "${bold}${yellow}-----------------------------"
|
||||
echo "${bold}${yellow}Making GoogleBot ${yellow}RATE LIMITED"
|
||||
echo "${bold}${yellow}-----------------------------"
|
||||
printf "\n\n"
|
||||
printf "\n"
|
||||
sudo cp ${TRAVIS_BUILD_DIR}/.dev-tools/test_units/rate-limiting-user-agents.conf /etc/nginx/bots.d/blacklist-user-agents.conf
|
||||
}
|
||||
|
||||
|
@ -111,14 +111,14 @@ if grep -i 'Unavailable' < ${ratelimittestfile}; then
|
|||
|
||||
backupConfFiles () {
|
||||
printf "\n"
|
||||
echo "${bold}${green}------------------------------------------------------------"
|
||||
echo "${bold}${green}Make Backup all conf files and folders used during this test"
|
||||
echo "${bold}${green}------------------------------------------------------------"
|
||||
echo "${bold}${green}-------------------------------------------------------"
|
||||
echo "${bold}${green}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/_conf_files_ratelimiting/bots.d/
|
||||
sudo cp /etc/nginx/conf.d/* ${TRAVIS_BUILD_DIR}/.dev-tools/_conf_files_ratelimiting/conf.d/
|
||||
sudo cp /etc/nginx/sites-available/default.vhost ${TRAVIS_BUILD_DIR}/.dev-tools/_conf_files_ratelimiting/default.vhost
|
||||
sudo cp /etc/nginx/nginx.conf ${TRAVIS_BUILD_DIR}/.dev-tools/_conf_files_ratelimiting/nginx.conf
|
||||
sudo cp /etc/nginx/bots.d/* ${TRAVIS_BUILD_DIR}/.dev-tools/conf_files_ratelimiting/bots.d/
|
||||
sudo cp /etc/nginx/conf.d/* ${TRAVIS_BUILD_DIR}/.dev-tools/conf_files_ratelimiting/conf.d/
|
||||
sudo cp /etc/nginx/sites-available/default.vhost ${TRAVIS_BUILD_DIR}/.dev-tools/conf_files_ratelimiting/default.vhost
|
||||
sudo cp /etc/nginx/nginx.conf ${TRAVIS_BUILD_DIR}/.dev-tools/conf_files_ratelimiting/nginx.conf
|
||||
}
|
||||
|
||||
# -----------
|
||||
|
@ -129,7 +129,7 @@ printf "\n"
|
|||
echo "${bold}${green}---------------------------"
|
||||
echo "${bold}${green}Starting Rate Limiting Test"
|
||||
echo "${bold}${green}---------------------------"
|
||||
printf "\n\n"
|
||||
printf "\n"
|
||||
|
||||
ratelimitGoogle
|
||||
reloadNginX
|
||||
|
|
|
@ -60,10 +60,10 @@ defaultcolor=$(tput setaf default)
|
|||
# ---------
|
||||
|
||||
reloadNginX () {
|
||||
printf "\n"
|
||||
echo "${bold}${green}---------------"
|
||||
echo "${bold}${green}Reloading Nginx"
|
||||
echo "${bold}${green}---------------"
|
||||
printf "\n\n"
|
||||
sudo nginx -t && sudo nginx -s reload
|
||||
}
|
||||
|
||||
|
@ -71,7 +71,7 @@ waitforReload () {
|
|||
echo "${bold}${yellow}-----------------------------------------------------------------------"
|
||||
echo "${bold}${yellow}Sleeping for 10 seconds to allow Nginx to Properly Reload inside Travis"
|
||||
echo "${bold}${yellow}-----------------------------------------------------------------------"
|
||||
printf "\n\n"
|
||||
printf "\n"
|
||||
sleep 10s
|
||||
}
|
||||
|
||||
|
@ -79,7 +79,7 @@ whitelistOwnDomain () {
|
|||
echo "${bold}${green}---------------------------------------"
|
||||
echo "${bold}${green}Activating Users whitelist-domains.conf"
|
||||
echo "${bold}${green}---------------------------------------"
|
||||
printf "\n\n"
|
||||
printf "\n"
|
||||
sudo cp ${TRAVIS_BUILD_DIR}/.dev-tools/test_units/whitelist-domains.conf /etc/nginx/bots.d/whitelist-domains.conf
|
||||
}
|
||||
|
||||
|
@ -108,7 +108,7 @@ fi
|
|||
echo "${bold}${green}-------------------------------"
|
||||
echo "${bold}${green}Whitelist Domains Test Starting"
|
||||
echo "${bold}${green}-------------------------------"
|
||||
printf "\n\n"
|
||||
printf "\n"
|
||||
|
||||
whitelistOwnDomain
|
||||
reloadNginX
|
||||
|
@ -120,7 +120,7 @@ run_curltest2
|
|||
echo "${bold}${green}-------------------------------"
|
||||
echo "${bold}${green}Whitelist Domains Test Complete"
|
||||
echo "${bold}${green}-------------------------------"
|
||||
printf "\n\n"
|
||||
printf "\n"
|
||||
|
||||
# ----------------------
|
||||
# Exit With Error Number
|
||||
|
|
|
@ -64,7 +64,6 @@ reloadNginX () {
|
|||
echo "${bold}${green}---------------"
|
||||
echo "${bold}${green}Reloading Nginx"
|
||||
echo "${bold}${green}---------------"
|
||||
printf "\n\n"
|
||||
sudo nginx -t && sudo nginx -s reload
|
||||
}
|
||||
|
||||
|
@ -72,7 +71,7 @@ waitforReload () {
|
|||
echo "${bold}${yellow}-----------------------------------------------------------------------"
|
||||
echo "${bold}${yellow}Sleeping for 10 seconds to allow Nginx to Properly Reload inside Travis"
|
||||
echo "${bold}${yellow}-----------------------------------------------------------------------"
|
||||
printf "\n\n"
|
||||
printf "\n"
|
||||
sleep 10s
|
||||
}
|
||||
|
||||
|
@ -130,42 +129,32 @@ sudo cp ${TRAVIS_BUILD_DIR}/.dev-tools/test_units/botblocker-nginx-settings.conf
|
|||
echo "${bold}${green}--------------------------"
|
||||
echo "${bold}${green}Whitelist IP Test Starting"
|
||||
echo "${bold}${green}--------------------------"
|
||||
printf "\n\n"
|
||||
printf "\n"
|
||||
|
||||
echo "${bold}${green}-------------------------"
|
||||
echo "${bold}${green}Blacklisting own IP First"
|
||||
echo "${bold}${green}-------------------------"
|
||||
printf "\n\n"
|
||||
printf "\n"
|
||||
|
||||
blacklistOwnIP
|
||||
reloadNginX
|
||||
waitforReload
|
||||
|
||||
# *************************************************
|
||||
# Function Curl Test 1 - Test our IP is Blacklisted
|
||||
# *************************************************
|
||||
|
||||
run_curltest1
|
||||
|
||||
echo "${bold}${green}--------------------"
|
||||
echo "${bold}${green}Now Whitelist own IP"
|
||||
echo "${bold}${green}--------------------"
|
||||
printf "\n\n"
|
||||
printf "\n"
|
||||
|
||||
whitelistOwnIP
|
||||
reloadNginX
|
||||
waitforReload
|
||||
|
||||
# *************************************************
|
||||
# Function Curl Test 2 - Test our IP is Whitelisted
|
||||
# *************************************************
|
||||
|
||||
run_curltest2
|
||||
|
||||
echo "${bold}${green}-----------------------------"
|
||||
echo "${bold}${green}Whitelisting IP Test Complete"
|
||||
echo "${bold}${green}-----------------------------"
|
||||
printf "\n\n"
|
||||
printf "\n"
|
||||
|
||||
# *************************************************************
|
||||
# Copy all .conf files used in Testing to a folder for checking
|
||||
|
|
|
@ -60,10 +60,10 @@ defaultcolor=$(tput setaf default)
|
|||
# ---------
|
||||
|
||||
reloadNginX () {
|
||||
printf "\n"
|
||||
echo "${bold}${green}---------------"
|
||||
echo "${bold}${green}Reloading Nginx"
|
||||
echo "${bold}${green}---------------"
|
||||
printf "\n\n"
|
||||
sudo nginx -t && sudo nginx -s reload
|
||||
}
|
||||
|
||||
|
@ -71,7 +71,7 @@ waitforReload () {
|
|||
echo "${bold}${yellow}-----------------------------------------------------------------------"
|
||||
echo "${bold}${yellow}Sleeping for 10 seconds to allow Nginx to Properly Reload inside Travis"
|
||||
echo "${bold}${yellow}-----------------------------------------------------------------------"
|
||||
printf "\n\n"
|
||||
printf "\n"
|
||||
sleep 10s
|
||||
}
|
||||
|
||||
|
@ -99,7 +99,7 @@ generateCustomBlacklists () {
|
|||
echo "${bold}${magenta}-----------------------------------------------------------------"
|
||||
echo "${bold}${magenta}Generating blacklist-user-agents.conf & custom-bad-referrers.conf"
|
||||
echo "${bold}${magenta}-----------------------------------------------------------------"
|
||||
printf "\n\n"
|
||||
printf "\n"
|
||||
# --------------------------------------------------------------------------
|
||||
# Generate our custom test units turning all good to bad and all bad to good
|
||||
# --------------------------------------------------------------------------
|
||||
|
@ -122,7 +122,7 @@ _action1="0;"
|
|||
echo "${bold}${yellow}------------------------"
|
||||
echo "${bold}${green}Making all ${red}Bad Bots ${green}GOOD"
|
||||
echo "${bold}${yellow}------------------------"
|
||||
printf "\n\n"
|
||||
printf "\n"
|
||||
|
||||
printf '%s\n' "$_start1" >> ${_tmpnginx1}
|
||||
while IFS= read -r LINE
|
||||
|
@ -151,7 +151,7 @@ rm ${_inputdb1}
|
|||
echo "${bold}${yellow}-----------------------------"
|
||||
echo "${bold}${green}Making all ${red}Bad Referrers ${green}GOOD"
|
||||
echo "${bold}${yellow}-----------------------------"
|
||||
printf "\n\n"
|
||||
printf "\n"
|
||||
|
||||
|
||||
printf '%s\n' "$_start2" >> ${_tmpnginx2}
|
||||
|
@ -179,12 +179,12 @@ activateCustomBlacklists () {
|
|||
echo "${bold}${green}------------------------------------------------"
|
||||
echo "${bold}${green}Activating Users User-Agents Whitelist/Blacklist"
|
||||
echo "${bold}${green}------------------------------------------------"
|
||||
printf "\n\n"
|
||||
printf "\n"
|
||||
sudo cp ${TRAVIS_BUILD_DIR}/.dev-tools/test_units/blacklist-user-agents.conf /etc/nginx/bots.d/blacklist-user-agents.conf
|
||||
echo "${bold}${green}----------------------------------------------"
|
||||
echo "${bold}${green}Activating Users Referrers Whitelist/Blacklist"
|
||||
echo "${bold}${green}----------------------------------------------"
|
||||
printf "\n\n"
|
||||
printf "\n"
|
||||
sudo cp ${TRAVIS_BUILD_DIR}/.dev-tools/test_units/custom-bad-referrers.conf /etc/nginx/bots.d/custom-bad-referrers.conf
|
||||
}
|
||||
|
||||
|
@ -193,11 +193,10 @@ shuf -n 100 ${TRAVIS_BUILD_DIR}/_generator_lists/bad-user-agents.list > ${TRAVIS
|
|||
sed 's/\\//g' ${TRAVIS_BUILD_DIR}/.dev-tools/test_units/random-bots-for-whitelist-test.tmp > ${TRAVIS_BUILD_DIR}/.dev-tools/test_units/random-bots-for-whitelist-test.list
|
||||
sudo rm ${TRAVIS_BUILD_DIR}/.dev-tools/test_units/random-bots-for-whitelist-test.tmp
|
||||
sort -u ${TRAVIS_BUILD_DIR}/.dev-tools/test_units/random-bots-for-whitelist-test.list -o ${TRAVIS_BUILD_DIR}/.dev-tools/test_units/random-bots-for-whitelist-test.list
|
||||
printf "\n\n"
|
||||
printf "\n"
|
||||
echo "${bold}${magenta}---------------------------"
|
||||
echo "${bold}${magenta}Testing 100 Random Bad Bots"
|
||||
echo "${bold}${magenta}---------------------------"
|
||||
printf "\n\n"
|
||||
IFS=$'\n'
|
||||
file=${TRAVIS_BUILD_DIR}/.dev-tools/test_units/random-bots-for-whitelist-test.list
|
||||
lines=$(cat ${file})
|
||||
|
@ -217,11 +216,10 @@ shuf -n 100 ${TRAVIS_BUILD_DIR}/_generator_lists/bad-referrers.list > ${TRAVIS_B
|
|||
sed 's/\\//g' ${TRAVIS_BUILD_DIR}/.dev-tools/test_units/random-referrers-for-whitelist-test.tmp > ${TRAVIS_BUILD_DIR}/.dev-tools/test_units/random-referrers-for-whitelist-test.list
|
||||
sudo rm ${TRAVIS_BUILD_DIR}/.dev-tools/test_units/random-referrers-for-whitelist-test.tmp
|
||||
sort -u ${TRAVIS_BUILD_DIR}/.dev-tools/test_units/random-referrers-for-whitelist-test.list -o ${TRAVIS_BUILD_DIR}/.dev-tools/test_units/random-referrers-for-whitelist-test.list
|
||||
printf "\n\n"
|
||||
printf "\n"
|
||||
echo "${bold}${magenta}----------------------------"
|
||||
echo "${bold}${magenta}Testing 100 Random Referrers"
|
||||
echo "${bold}${magenta}----------------------------"
|
||||
printf "\n\n"
|
||||
IFS=$'\n'
|
||||
file=${TRAVIS_BUILD_DIR}/.dev-tools/test_units/random-referrers-for-whitelist-test.list
|
||||
lines=$(cat ${file})
|
||||
|
@ -255,7 +253,7 @@ sudo cp /etc/nginx/nginx.conf ${TRAVIS_BUILD_DIR}/.dev-tools/_conf_files_whiteli
|
|||
echo "${bold}${green}--------------------------"
|
||||
echo "${bold}${green}Whitelisting Test Starting"
|
||||
echo "${bold}${green}--------------------------"
|
||||
printf "\n\n"
|
||||
printf "\n"
|
||||
|
||||
generateCustomBlacklists
|
||||
activateCustomBlacklists
|
||||
|
@ -270,7 +268,7 @@ backupConfFiles
|
|||
echo "${bold}${green}--------------------------"
|
||||
echo "${bold}${green}Whitelisting Test Complete"
|
||||
echo "${bold}${green}--------------------------"
|
||||
printf "\n\n"
|
||||
printf "\n"
|
||||
|
||||
# ----------------------
|
||||
# Exit With Error Number
|
||||
|
|
|
@ -58,7 +58,7 @@ fetchBadIPs () {
|
|||
echo "${bold}${green}----------------------------"
|
||||
echo "${bold}${green}Fetching Latest BAD IPs List"
|
||||
echo "${bold}${green}----------------------------"
|
||||
printf "\n\n"
|
||||
printf "\n"
|
||||
}
|
||||
|
||||
prepareBadIPs () {
|
||||
|
@ -69,7 +69,7 @@ prepareBadIPs () {
|
|||
echo "${bold}${green}-----------------------------"
|
||||
echo "${bold}${green}Preparing Latest BAD IPs List"
|
||||
echo "${bold}${green}-----------------------------"
|
||||
printf "\n\n"
|
||||
printf "\n"
|
||||
}
|
||||
|
||||
# -----------------
|
||||
|
|
Loading…
Add table
Reference in a new issue