linux/docker - common /opt/bunkerized-nginx folder

This commit is contained in:
bunkerity
2021-06-21 14:56:48 +02:00
parent bbb5134a39
commit 1e02368e8a
24 changed files with 236 additions and 97 deletions

View File

@@ -1,7 +1,7 @@
#!/bin/sh
# load some functions
. /opt/entrypoint/utils.sh
. /opt/bunkerized-nginx/entrypoint/utils.sh
if [ "$(grep "^SWARM_MODE=yes$" /etc/nginx/global.env)" != "" ] && [ -f /usr/sbin/nginx ] ; then
exit 0
@@ -36,7 +36,7 @@ if [ "$lines" -gt 1 ] ; then
$RELOAD > /dev/null 2>&1
# new config is ok : save it in the cache
if [ "$?" -eq 0 ] ; then
cp /tmp/abusers.list /cache
cp /tmp/abusers.list /opt/bunkerized-nginx/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"
@@ -44,7 +44,7 @@ if [ "$lines" -gt 1 ] ; then
$RELOAD > /dev/null 2>&1
fi
else
cp /tmp/abusers.list /cache
cp /tmp/abusers.list /opt/bunkerized-nginx/cache
fi
else
job_log "[BLACKLIST] can't update abusers list"

View File

@@ -1,7 +1,7 @@
#!/bin/sh
# generate certificate
certbot certonly --webroot -w /acme-challenge -n -d "$1" --email "$2" --agree-tos
certbot certonly --webroot -w /opt/bunkerized-nginx/acme-challenge -n -d "$1" --email "$2" --agree-tos
if [ "$?" -ne 0 ] ; then
exit 1
fi

View File

@@ -1,7 +1,7 @@
#!/bin/sh
# load some functions
. /opt/entrypoint/utils.sh
. /opt/bunkerized-nginx/entrypoint/utils.sh
job_log "[CERTBOT] certificates have been renewed"

View File

@@ -1,7 +1,7 @@
#!/bin/sh
# load some functions
. /opt/entrypoint/utils.sh
. /opt/bunkerized-nginx/entrypoint/utils.sh
if [ "$(grep "^SWARM_MODE=yes$" /etc/nginx/global.env)" != "" ] && [ -f /usr/sbin/nginx ] ; then
exit 0
@@ -12,7 +12,7 @@ if [ "$(has_value AUTO_LETS_ENCRYPT yes)" = "" ] ; then
fi
# ask new certificates if needed
certbot renew --deploy-hook /opt/scripts/certbot-renew-hook.sh
certbot renew --deploy-hook /opt/bunkerized-nginx/scripts/certbot-renew-hook.sh
if [ "$?" -eq 0 ] ; then
job_log "[CERTBOT] renew operation done"

View File

@@ -1,7 +1,7 @@
#!/bin/sh
# load some functions
. /opt/entrypoint/utils.sh
. /opt/bunkerized-nginx/entrypoint/utils.sh
if [ "$(grep "^SWARM_MODE=yes$" /etc/nginx/global.env)" != "" ] && [ -f /usr/sbin/nginx ] ; then
exit 0
@@ -36,7 +36,7 @@ if [ "$lines" -gt 1 ] ; then
$RELOAD > /dev/null 2>&1
# new config is ok : save it in the cache
if [ "$?" -eq 0 ] ; then
cp /tmp/tor-exit-nodes.list /cache
cp /tmp/tor-exit-nodes.list /opt/bunkerized-nginx/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"
@@ -44,7 +44,7 @@ if [ "$lines" -gt 1 ] ; then
$RELOAD > /dev/null 2>&1
fi
else
cp /tmp/tor-exit-nodes.list /cache
cp /tmp/tor-exit-nodes.list /opt/bunkerized-nginx/cache
fi
else
job_log "[BLACKLIST] can't update TOR exit node list"

View File

@@ -1,7 +1,7 @@
#!/bin/sh
# load some functions
. /opt/entrypoint/utils.sh
. /opt/bunkerized-nginx/entrypoint/utils.sh
if [ "$(grep "^SWARM_MODE=yes$" /etc/nginx/global.env)" != "" ] && [ -f /usr/sbin/nginx ] ; then
exit 0
@@ -32,17 +32,17 @@ if [ "$?" -eq 0 ] && [ -f /tmp/geoip.mmdb.gz ] ; then
if [ "$RELOAD" != "" ] ; then
$RELOAD > /dev/null 2>&1
if [ "$?" -eq 0 ] ; then
cp /etc/nginx/geoip.mmdb /cache
cp /etc/nginx/geoip.mmdb /opt/bunkerized-nginx/cache
job_log "[NGINX] successfull nginx reload after GeoIP DB update"
else
job_log "[NGINX] failed nginx reload after GeoIP DB update"
if [ -f /cache/geoip.mmdb ] ; then
cp /cache/geoip.mmdb /etc/nginx/geoip.mmdb
if [ -f /opt/bunkerized-nginx/cache/geoip.mmdb ] ; then
cp /opt/bunkerized-nginx/cache/geoip.mmdb /etc/nginx/geoip.mmdb
$RELOAD > /dev/null 2>&1
fi
fi
else
cp /etc/nginx/geoip.mmdb /cache
cp /etc/nginx/geoip.mmdb /opt/bunkerized-nginx/cache
fi
else
job_log "[GEOIP] can't download DB from $URL"

View File

@@ -1,7 +1,7 @@
#!/bin/sh
# load some functions
. /opt/entrypoint/utils.sh
. /opt/bunkerized-nginx/entrypoint/utils.sh
if [ "$(grep "^SWARM_MODE=yes$" /etc/nginx/global.env)" != "" ] && [ -f /usr/sbin/nginx ] ; then
exit 0
@@ -36,7 +36,7 @@ if [ "$lines" -gt 1 ] ; then
$RELOAD > /dev/null 2>&1
# new config is ok : save it in the cache
if [ "$?" -eq 0 ] ; then
cp /tmp/proxies.list /cache
cp /tmp/proxies.list /opt/bunkerized-nginx/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"
@@ -44,7 +44,7 @@ if [ "$lines" -gt 1 ] ; then
$RELOAD > /dev/null 2>&1
fi
else
cp /tmp/proxies.list /cache
cp /tmp/proxies.list /opt/bunkerized-nginx/cache
fi
else
job_log "[BLACKLIST] can't update proxies list"

View File

@@ -1,7 +1,7 @@
#!/bin/sh
# load some functions
. /opt/entrypoint/utils.sh
. /opt/bunkerized-nginx/entrypoint/utils.sh
if [ "$(grep "^SWARM_MODE=yes$" /etc/nginx/global.env)" != "" ] && [ -f /usr/sbin/nginx ] ; then
exit 0
@@ -39,7 +39,7 @@ if [ "$lines" -gt 1 ] ; then
if [ "$RELOAD" != "" ] ; then
$RELOAD > /dev/null 2>&1
if [ "$?" -eq 0 ] ; then
cp /tmp/referrers.list /cache
cp /tmp/referrers.list /opt/bunkerized-nginx/cache
job_log "[NGINX] successfull nginx reload after referrers list update"
else
#cp /tmp/referrers.list.bak /etc/nginx
@@ -47,7 +47,7 @@ if [ "$lines" -gt 1 ] ; then
$RELOAD > /dev/null 2>&1
fi
else
cp /tmp/referrers.list /cache
cp /tmp/referrers.list /opt/bunkerized-nginx/cache
fi
else
job_log "[BLACKLIST] can't update referrers list"

View File

@@ -1,7 +1,7 @@
#!/bin/sh
# load some functions
. /opt/entrypoint/utils.sh
. /opt/bunkerized-nginx/entrypoint/utils.sh
if [ "$(grep "^SWARM_MODE=yes$" /etc/nginx/global.env)" != "" ] && [ -f /usr/sbin/nginx ] ; then
exit 0
@@ -39,7 +39,7 @@ if [ "$lines" -gt 1 ] ; then
if [ "$RELOAD" != "" ] ; then
$RELOAD > /dev/null 2>&1
if [ "$?" -eq 0 ] ; then
cp /tmp/user-agents.list /cache
cp /tmp/user-agents.list /opt/bunkerized-nginx/cache
job_log "[NGINX] successfull nginx reload after user-agent list update"
else
#cp /tmp/user-agents.list.bak /etc/nginx
@@ -47,7 +47,7 @@ if [ "$lines" -gt 1 ] ; then
$RELOAD > /dev/null 2>&1
fi
else
cp /tmp/user-agents.list /cache
cp /tmp/user-agents.list /opt/bunkerized-nginx/cache
fi
else
job_log "[BLACKLIST] can't update user-agent list"