print error when permissions are wrong on common volumes
This commit is contained in:
parent
c03d410b0a
commit
aa614f82f9
@ -2,6 +2,12 @@
|
|||||||
|
|
||||||
echo "[*] Starting autoconf ..."
|
echo "[*] Starting autoconf ..."
|
||||||
|
|
||||||
|
# check permissions
|
||||||
|
su -s "/opt/entrypoint/permissions.sh" nginx
|
||||||
|
if [ "$?" -ne 0 ] ; then
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
if [ "$SWARM_MODE" = "yes" ] ; then
|
if [ "$SWARM_MODE" = "yes" ] ; then
|
||||||
cp -r /opt/confs/nginx/* /etc/nginx
|
cp -r /opt/confs/nginx/* /etc/nginx
|
||||||
chown -R root:nginx /etc/nginx
|
chown -R root:nginx /etc/nginx
|
||||||
|
|||||||
@ -96,6 +96,7 @@ end
|
|||||||
|
|
||||||
-- check if user-agent is allowed
|
-- check if user-agent is allowed
|
||||||
if use_user_agent and ngx.var.bad_user_agent == "yes" then
|
if use_user_agent and ngx.var.bad_user_agent == "yes" then
|
||||||
|
local block = false
|
||||||
for k, v in pairs(whitelist_user_agent) then
|
for k, v in pairs(whitelist_user_agent) then
|
||||||
if string.match(ngx.var.http_user_agent, v) then
|
if string.match(ngx.var.http_user_agent, v) then
|
||||||
ngx.log(ngx.WARN, "[ALLOW] User-Agent " .. ngx.var.http_user_agent .. " is whitelisted")
|
ngx.log(ngx.WARN, "[ALLOW] User-Agent " .. ngx.var.http_user_agent .. " is whitelisted")
|
||||||
|
|||||||
@ -52,6 +52,12 @@ if [ ! -f "/opt/installed" ] ; then
|
|||||||
|
|
||||||
echo "[*] Configuring bunkerized-nginx ..."
|
echo "[*] Configuring bunkerized-nginx ..."
|
||||||
|
|
||||||
|
# check permissions
|
||||||
|
/opt/entrypoint/permissions.sh
|
||||||
|
if [ "$?" -ne 0 ] ; then
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
# logs config
|
# logs config
|
||||||
/opt/entrypoint/logs.sh
|
/opt/entrypoint/logs.sh
|
||||||
|
|
||||||
|
|||||||
25
scripts/permissions.sh
Normal file
25
scripts/permissions.sh
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# /etc/letsencrypt
|
||||||
|
if [ ! -w "/etc/letsencrypt" ] || [ ! -r "/etc/letsencrypt" ] || [ ! -x "/etc/letsencrypt" ] ; then
|
||||||
|
echo "[!] ERROR - wrong permissions on /etc/letsencrypt"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# /www
|
||||||
|
if [ ! -r "/www" ] || [ ! -x "/www" ] ; then
|
||||||
|
echo "[!] ERROR - wrong permissions on /www"
|
||||||
|
exit 2
|
||||||
|
fi
|
||||||
|
|
||||||
|
# /etc/nginx
|
||||||
|
if [ ! -w "/etc/nginx" ] || [ ! -r "/etc/nginx" ] || [ ! -x "/etc/nginx" ] ; then
|
||||||
|
echo "[!] ERROR - wrong permissions on /etc/nginx"
|
||||||
|
exit 3
|
||||||
|
fi
|
||||||
|
|
||||||
|
# /acme-challenge
|
||||||
|
if [ ! -w "/acme-challenge" ] || [ ! -r "/acme-challenge" ] || [ ! -x "/acme-challenge" ] ; then
|
||||||
|
echo "[!] ERROR - wrong permissions on /acme-challenge"
|
||||||
|
exit 4
|
||||||
|
fi
|
||||||
Loading…
x
Reference in New Issue
Block a user