fixing bugs - run as GID 101 instead of 0, different permissions checks in swarm mode and disable including server confs in swarm mode
This commit is contained in:
parent
ba7524a419
commit
74417abc9c
@ -20,6 +20,6 @@ VOLUME /www /http-confs /server-confs /modsec-confs /modsec-crs-confs /cache /pr
|
|||||||
|
|
||||||
EXPOSE 8080/tcp 8443/tcp
|
EXPOSE 8080/tcp 8443/tcp
|
||||||
|
|
||||||
USER nginx
|
USER nginx:nginx
|
||||||
|
|
||||||
ENTRYPOINT ["/opt/entrypoint/entrypoint.sh"]
|
ENTRYPOINT ["/opt/entrypoint/entrypoint.sh"]
|
||||||
|
|||||||
@ -20,6 +20,6 @@ VOLUME /www /http-confs /server-confs /modsec-confs /modsec-crs-confs /cache /pr
|
|||||||
|
|
||||||
EXPOSE 8080/tcp 8443/tcp
|
EXPOSE 8080/tcp 8443/tcp
|
||||||
|
|
||||||
USER nginx
|
USER nginx:nginx
|
||||||
|
|
||||||
ENTRYPOINT ["/opt/entrypoint/entrypoint.sh"]
|
ENTRYPOINT ["/opt/entrypoint/entrypoint.sh"]
|
||||||
|
|||||||
@ -27,6 +27,6 @@ VOLUME /www /http-confs /server-confs /modsec-confs /modsec-crs-confs /cache /pr
|
|||||||
|
|
||||||
EXPOSE 8080/tcp 8443/tcp
|
EXPOSE 8080/tcp 8443/tcp
|
||||||
|
|
||||||
USER nginx
|
USER nginx:nginx
|
||||||
|
|
||||||
ENTRYPOINT ["/opt/entrypoint/entrypoint.sh"]
|
ENTRYPOINT ["/opt/entrypoint/entrypoint.sh"]
|
||||||
|
|||||||
@ -27,6 +27,6 @@ VOLUME /www /http-confs /server-confs /modsec-confs /modsec-crs-confs /cache /pr
|
|||||||
|
|
||||||
EXPOSE 8080/tcp 8443/tcp
|
EXPOSE 8080/tcp 8443/tcp
|
||||||
|
|
||||||
USER nginx
|
USER nginx:nginx
|
||||||
|
|
||||||
ENTRYPOINT ["/opt/entrypoint/entrypoint.sh"]
|
ENTRYPOINT ["/opt/entrypoint/entrypoint.sh"]
|
||||||
|
|||||||
@ -20,6 +20,6 @@ VOLUME /www /http-confs /server-confs /modsec-confs /modsec-crs-confs /cache /pr
|
|||||||
|
|
||||||
EXPOSE 8080/tcp 8443/tcp
|
EXPOSE 8080/tcp 8443/tcp
|
||||||
|
|
||||||
USER nginx
|
USER nginx:nginx
|
||||||
|
|
||||||
ENTRYPOINT ["/opt/entrypoint/entrypoint.sh"]
|
ENTRYPOINT ["/opt/entrypoint/entrypoint.sh"]
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
bla<p align="center">
|
<p align="center">
|
||||||
<img src="https://github.com/bunkerity/bunkerized-nginx/blob/master/logo.png?raw=true" width="425" />
|
<img src="https://github.com/bunkerity/bunkerized-nginx/blob/master/logo.png?raw=true" width="425" />
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
|
|||||||
@ -53,7 +53,11 @@ if [ ! -f "/opt/installed" ] ; then
|
|||||||
echo "[*] Configuring bunkerized-nginx ..."
|
echo "[*] Configuring bunkerized-nginx ..."
|
||||||
|
|
||||||
# check permissions
|
# check permissions
|
||||||
/opt/entrypoint/permissions.sh
|
if [ "$SWARM_MODE" = "no" ] ; then
|
||||||
|
/opt/entrypoint/permissions.sh
|
||||||
|
else
|
||||||
|
/opt/entrypoint/permissions-swarm.sh
|
||||||
|
fi
|
||||||
if [ "$?" -ne 0 ] ; then
|
if [ "$?" -ne 0 ] ; then
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|||||||
@ -10,14 +10,18 @@
|
|||||||
cp /opt/confs/global/* /etc/nginx/
|
cp /opt/confs/global/* /etc/nginx/
|
||||||
|
|
||||||
# include server block(s)
|
# include server block(s)
|
||||||
if [ "$MULTISITE" = "yes" ] ; then
|
if [ "$SWARM_MODE" = "no" ] ; then
|
||||||
includes=""
|
if [ "$MULTISITE" = "yes" ] ; then
|
||||||
for server in $SERVER_NAME ; do
|
includes=""
|
||||||
includes="${includes}include /etc/nginx/${server}/server.conf;\n"
|
for server in $SERVER_NAME ; do
|
||||||
done
|
includes="${includes}include /etc/nginx/${server}/server.conf;\n"
|
||||||
replace_in_file "/etc/nginx/nginx.conf" "%INCLUDE_SERVER%" "$includes"
|
done
|
||||||
|
replace_in_file "/etc/nginx/nginx.conf" "%INCLUDE_SERVER%" "$includes"
|
||||||
|
else
|
||||||
|
replace_in_file "/etc/nginx/nginx.conf" "%INCLUDE_SERVER%" "include /etc/nginx/server.conf;"
|
||||||
|
fi
|
||||||
else
|
else
|
||||||
replace_in_file "/etc/nginx/nginx.conf" "%INCLUDE_SERVER%" "include /etc/nginx/server.conf;"
|
replace_in_file "/etc/nginx/nginx.conf" "%INCLUDE_SERVER%" ""
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# setup default server block if multisite
|
# setup default server block if multisite
|
||||||
|
|||||||
25
entrypoint/permissions-swarm.sh
Normal file
25
entrypoint/permissions-swarm.sh
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# /etc/letsencrypt
|
||||||
|
if [ ! -r "/etc/letsencrypt" ] || [ ! -x "/etc/letsencrypt" ] ; then
|
||||||
|
echo "[!] WARNING - 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 [ ! -r "/etc/nginx" ] || [ ! -x "/etc/nginx" ] ; then
|
||||||
|
echo "[!] ERROR - wrong permissions on /etc/nginx"
|
||||||
|
exit 3
|
||||||
|
fi
|
||||||
|
|
||||||
|
# /acme-challenge
|
||||||
|
if [ ! -r "/acme-challenge" ] || [ ! -x "/acme-challenge" ] ; then
|
||||||
|
echo "[!] ERROR - wrong permissions on /acme-challenge"
|
||||||
|
exit 4
|
||||||
|
fi
|
||||||
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
# /etc/letsencrypt
|
# /etc/letsencrypt
|
||||||
if [ ! -w "/etc/letsencrypt" ] || [ ! -r "/etc/letsencrypt" ] || [ ! -x "/etc/letsencrypt" ] ; then
|
if [ ! -w "/etc/letsencrypt" ] || [ ! -r "/etc/letsencrypt" ] || [ ! -x "/etc/letsencrypt" ] ; then
|
||||||
echo "[!] ERROR - wrong permissions on /etc/letsencrypt"
|
echo "[!] WARNING - wrong permissions on /etc/letsencrypt"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user