mirror of
https://github.com/mitchellkrogza/nginx-ultimate-bad-bot-blocker.git
synced 2025-09-01 18:19:55 +00:00
Merge pull request #148 from itoffshore/alpine
setup-ngxblocker: add option to configure all files in $VHOST_DIR
This commit is contained in:
commit
efde777b6c
1 changed files with 15 additions and 8 deletions
|
@ -79,9 +79,7 @@ update_paths() {
|
|||
}
|
||||
|
||||
check_config() {
|
||||
local files="$*"
|
||||
|
||||
if [ -z "$files" ]; then
|
||||
if [ -z "$FILE_LIST" ]; then
|
||||
printf "${BOLDGREEN}using a file extension for vhost files allows multiple domains to be included with a single directive in nginx.conf:\n\n"
|
||||
printf "${BOLDWHITE}include /etc/nginx/sites-enabled/*.vhost;\n\n"
|
||||
printf "${BOLDYELLOW}see command line switches below: ${BOLDGREEN}-e ${RESET}to customise the vhost file extension\n\n"
|
||||
|
@ -97,7 +95,16 @@ check_config() {
|
|||
}
|
||||
|
||||
find_vhosts() {
|
||||
find $VHOST_DIR -type f -name "*.$VHOST_EXT"
|
||||
local ans=
|
||||
FILE_LIST=$(find $VHOST_DIR -type f -name "*.$VHOST_EXT")
|
||||
|
||||
if [ -z "$FILE_LIST" ]; then
|
||||
find $VHOST_DIR -type f
|
||||
printf "\n${BOLDWHITE}Configure every file above as a vhost ? [Y/N] : "; read ans
|
||||
case "$ans" in
|
||||
y*|Y*) FILE_LIST=$(find $VHOST_DIR -type f);;
|
||||
esac
|
||||
fi
|
||||
}
|
||||
|
||||
whitelist_ips() {
|
||||
|
@ -330,7 +337,7 @@ check_online() {
|
|||
}
|
||||
|
||||
main() {
|
||||
local include_url= file= line= file_list= col_size= blacklist=
|
||||
local include_url= file= line= col_size= blacklist=
|
||||
local CONF_FILES= VHOST_INCLUDES=
|
||||
local REPO=https://raw.githubusercontent.com/mitchellkrogza/nginx-ultimate-bad-bot-blocker/master
|
||||
|
||||
|
@ -345,8 +352,8 @@ main() {
|
|||
check_depends
|
||||
|
||||
# check vhosts
|
||||
file_list=$(find_vhosts)
|
||||
check_config $file_list
|
||||
find_vhosts
|
||||
check_config
|
||||
|
||||
# check repo is online & source includes
|
||||
include_url=$REPO/include_filelist.txt
|
||||
|
@ -394,7 +401,7 @@ main() {
|
|||
fi
|
||||
|
||||
# update vhosts
|
||||
for file in $file_list; do
|
||||
for file in $FILE_LIST; do
|
||||
line=$(find_includes $file include last server_ last location first )
|
||||
|
||||
if [ -n "$(check_wildcard $file $BOTS_DIR)" ]; then
|
||||
|
|
Loading…
Add table
Reference in a new issue