various bug fixes related to Swarm
This commit is contained in:
@@ -12,7 +12,7 @@ if [ "$(has_value BLOCK_ABUSERS yes)" = "" ] ; then
|
||||
fi
|
||||
|
||||
# copy old conf to cache
|
||||
cp /etc/nginx/abusers.list /cache
|
||||
cp /etc/nginx/abusers.list /tmp/abusers.list.bak
|
||||
|
||||
# generate the new conf
|
||||
curl -s "https://iplists.firehol.org/files/firehol_abusers_30d.netset" | \
|
||||
@@ -31,24 +31,25 @@ lines="$(wc -l /tmp/abusers.list | cut -d ' ' -f 1)"
|
||||
if [ "$lines" -gt 1 ] ; then
|
||||
job_log "[BLACKLIST] abusers list updated ($lines entries)"
|
||||
# reload nginx with the new config
|
||||
mv /tmp/abusers.list /etc/nginx/abusers.list
|
||||
cp /tmp/abusers.list /etc/nginx/abusers.list
|
||||
if [ "$RELOAD" != "" ] ; then
|
||||
$RELOAD > /dev/null 2>&1
|
||||
# new config is ok : save it in the cache
|
||||
if [ "$?" -eq 0 ] ; then
|
||||
cp /etc/nginx/abusers.list /cache
|
||||
cp /tmp/abusers.list /cache
|
||||
job_log "[NGINX] successfull nginx reload after abusers list update"
|
||||
else
|
||||
job_log "[NGINX] failed nginx reload after abusers list update fallback to old list"
|
||||
cp /cache/abusers.list /etc/nginx
|
||||
#cp /tmp/abusers.list.bak /etc/nginx
|
||||
$RELOAD > /dev/null 2>&1
|
||||
fi
|
||||
else
|
||||
cp /etc/nginx/abusers.list /cache
|
||||
cp /tmp/abusers.list /cache
|
||||
fi
|
||||
else
|
||||
job_log "[BLACKLIST] can't update abusers list"
|
||||
fi
|
||||
|
||||
rm -f /tmp/abusers.list 2> /dev/null
|
||||
rm -f /tmp/abusers.list.bak 2> /dev/null
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@ if [ "$(has_value BLOCK_TOR_EXIT_NODE yes)" = "" ] ; then
|
||||
fi
|
||||
|
||||
# copy old conf to cache
|
||||
cp /etc/nginx/tor-exit-nodes.list /cache
|
||||
cp /etc/nginx/tor-exit-nodes.list /tmp/tor-exit-nodes.list.bak
|
||||
|
||||
# generate the new conf
|
||||
curl -s "https://iplists.firehol.org/files/tor_exits.ipset" | \
|
||||
@@ -31,23 +31,24 @@ lines="$(wc -l /tmp/tor-exit-nodes.list | cut -d ' ' -f 1)"
|
||||
if [ "$lines" -gt 1 ] ; then
|
||||
job_log "[BLACKLIST] TOR exit node list updated ($lines entries)"
|
||||
# reload nginx with the new config
|
||||
mv /tmp/tor-exit-nodes.list /etc/nginx/tor-exit-nodes.list
|
||||
cp /tmp/tor-exit-nodes.list /etc/nginx/tor-exit-nodes.list
|
||||
if [ "$RELOAD" != "" ] ; then
|
||||
$RELOAD > /dev/null 2>&1
|
||||
# new config is ok : save it in the cache
|
||||
if [ "$?" -eq 0 ] ; then
|
||||
cp /etc/nginx/tor-exit-nodes.list /cache
|
||||
cp /tmp/tor-exit-nodes.list /cache
|
||||
job_log "[NGINX] successfull nginx reload after TOR exit node list update"
|
||||
else
|
||||
job_log "[NGINX] failed nginx reload after TOR exit node list update fallback to old list"
|
||||
cp /cache/tor-exit-nodes.list /etc/nginx
|
||||
#cp /tmp/tor-exit-nodes.list.bak /etc/nginx/tor-exit-nodes.list
|
||||
$RELOAD > /dev/null 2>&1
|
||||
fi
|
||||
else
|
||||
cp /etc/nginx/tor-exit-nodes.list /cache
|
||||
cp /tmp/tor-exit-nodes.list /cache
|
||||
fi
|
||||
else
|
||||
job_log "[BLACKLIST] can't update TOR exit node list"
|
||||
fi
|
||||
|
||||
rm -f /tmp/tor-exit-nodes.list 2> /dev/null
|
||||
rm -f /tmp/tor-exit-nodes.list.bak 2> /dev/null
|
||||
|
||||
@@ -12,7 +12,7 @@ if [ "$(has_value BLOCK_PROXIES yes)" = "" ] ; then
|
||||
fi
|
||||
|
||||
# copy old conf to cache
|
||||
cp /etc/nginx/proxies.list /cache
|
||||
cp /etc/nginx/proxies.list /tmp/proxies.list.bak
|
||||
|
||||
# generate the new conf
|
||||
curl -s "https://iplists.firehol.org/files/firehol_proxies.netset" | \
|
||||
@@ -31,24 +31,25 @@ lines="$(wc -l /tmp/proxies.list | cut -d ' ' -f 1)"
|
||||
if [ "$lines" -gt 1 ] ; then
|
||||
job_log "[BLACKLIST] proxies list updated ($lines entries)"
|
||||
# reload nginx with the new config
|
||||
mv /tmp/proxies.list /etc/nginx/proxies.list
|
||||
cp /tmp/proxies.list /etc/nginx/proxies.list
|
||||
if [ "$RELOAD" != "" ] ; then
|
||||
$RELOAD > /dev/null 2>&1
|
||||
# new config is ok : save it in the cache
|
||||
if [ "$?" -eq 0 ] ; then
|
||||
cp /etc/nginx/proxies.list /cache
|
||||
cp /tmp/proxies.list /cache
|
||||
job_log "[NGINX] successfull nginx reload after proxies list update"
|
||||
else
|
||||
job_log "[NGINX] failed nginx reload after proxies list update fallback to old list"
|
||||
cp /cache/proxies.list /etc/nginx
|
||||
#cp /tmp/proxies.list.bak /etc/nginx
|
||||
$RELOAD > /dev/null 2>&1
|
||||
fi
|
||||
else
|
||||
cp /etc/nginx/proxies.list /cache
|
||||
cp /tmp/proxies.list /cache
|
||||
fi
|
||||
else
|
||||
job_log "[BLACKLIST] can't update proxies list"
|
||||
fi
|
||||
|
||||
rm -f /tmp/proxies.list 2> /dev/null
|
||||
rm -f /tmp/proxies.list.bak 2> /dev/null
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@ if [ "$(has_value BLOCK_REFERRER yes)" = "" ] ; then
|
||||
fi
|
||||
|
||||
# save old conf
|
||||
cp /etc/nginx/referrers.list /cache
|
||||
cp /etc/nginx/referrers.list /tmp/referrers.list.bak
|
||||
|
||||
# generate new conf
|
||||
BLACKLIST="$(curl -s https://raw.githubusercontent.com/mitchellkrogza/nginx-ultimate-bad-bot-blocker/master/_generator_lists/bad-referrers.list | sed 's:\.:%\.:g;s:\-:%\-:g')"
|
||||
@@ -34,23 +34,24 @@ fi
|
||||
# check number of lines
|
||||
lines="$(wc -l /tmp/referrers.list | cut -d ' ' -f 1)"
|
||||
if [ "$lines" -gt 1 ] ; then
|
||||
mv /tmp/referrers.list /etc/nginx/referrers.list
|
||||
cp /tmp/referrers.list /etc/nginx/referrers.list
|
||||
job_log "[BLACKLIST] referrers list updated ($lines entries)"
|
||||
if [ "$RELOAD" != "" ] ; then
|
||||
$RELOAD > /dev/null 2>&1
|
||||
if [ "$?" -eq 0 ] ; then
|
||||
cp /etc/nginx/referrers.list /cache
|
||||
cp /tmp/referrers.list /cache
|
||||
job_log "[NGINX] successfull nginx reload after referrers list update"
|
||||
else
|
||||
cp /cache/referrers.list /etc/nginx
|
||||
#cp /tmp/referrers.list.bak /etc/nginx
|
||||
job_log "[NGINX] failed nginx reload after referrers list update fallback to old list"
|
||||
$RELOAD > /dev/null 2>&1
|
||||
fi
|
||||
else
|
||||
cp /etc/nginx/referrers.list /cache
|
||||
cp /tmp/referrers.list /cache
|
||||
fi
|
||||
else
|
||||
job_log "[BLACKLIST] can't update referrers list"
|
||||
fi
|
||||
|
||||
rm -f /tmp/referrers.list 2> /dev/null
|
||||
rm -f /tmp/referrers.list.bak 2> /dev/null
|
||||
|
||||
@@ -12,7 +12,7 @@ if [ "$(has_value BLOCK_USER_AGENT yes)" = "" ] ; then
|
||||
fi
|
||||
|
||||
# save old conf
|
||||
cp /etc/nginx/user-agents.list /cache
|
||||
cp /etc/nginx/user-agents.list /tmp/user-agents.list.bak
|
||||
|
||||
# generate new conf
|
||||
BLACKLIST="$( (curl -s https://raw.githubusercontent.com/mitchellkrogza/nginx-ultimate-bad-bot-blocker/master/_generator_lists/bad-user-agents.list ; curl -s https://raw.githubusercontent.com/JayBizzle/Crawler-Detect/master/raw/Crawlers.txt) | sort -u | sed 's:\\ : :g;s:\\\.:%\.:g;s:\\\\:\\:g;s:\\/:/:g;s:\-:%\-:g')"
|
||||
@@ -34,23 +34,24 @@ fi
|
||||
# check number of lines
|
||||
lines="$(wc -l /tmp/user-agents.list | cut -d ' ' -f 1)"
|
||||
if [ "$lines" -gt 1 ] ; then
|
||||
mv /tmp/user-agents.list /etc/nginx/user-agents.list
|
||||
cp /tmp/user-agents.list /etc/nginx/user-agents.list
|
||||
job_log "[BLACKLIST] user-agent list updated ($lines entries)"
|
||||
if [ "$RELOAD" != "" ] ; then
|
||||
$RELOAD > /dev/null 2>&1
|
||||
if [ "$?" -eq 0 ] ; then
|
||||
cp /etc/nginx/user-agents.list /cache
|
||||
cp /tmp/user-agents.list /cache
|
||||
job_log "[NGINX] successfull nginx reload after user-agent list update"
|
||||
else
|
||||
cp /cache/user-agents.list /etc/nginx
|
||||
#cp /tmp/user-agents.list.bak /etc/nginx
|
||||
job_log "[NGINX] failed nginx reload after user-agent list update fallback to old list"
|
||||
$RELOAD > /dev/null 2>&1
|
||||
fi
|
||||
else
|
||||
cp /etc/nginx/user-agents.list /cache
|
||||
cp /tmp/user-agents.list /cache
|
||||
fi
|
||||
else
|
||||
job_log "[BLACKLIST] can't update user-agent list"
|
||||
fi
|
||||
|
||||
rm -f /tmp/user-agents.list 2> /dev/null
|
||||
rm -f /tmp/user-agents.list.bak 2> /dev/null
|
||||
|
||||
Reference in New Issue
Block a user