Our SSL certs are now in their own dir, ensure md5 of certs goes in /tmp/nginx
All checks were successful
Create Docker Image / Build Docker Image (x86_64) (push) Successful in 26s
Create Docker Image / Build Docker Image (arm64) (push) Successful in 1m6s
Create Docker Image / Final Docker Image Manifest (push) Successful in 9s

This commit is contained in:
Deon George 2024-10-14 12:13:21 +11:00
parent a17722df77
commit 06d26faf73
3 changed files with 12 additions and 12 deletions

View File

@ -23,16 +23,16 @@ RUN chmod 444 /etc/nginx/default.d/ssl/* && \
chmod 400 /etc/nginx/default.d/ssl/default.key /etc/nginx/default.d/ssl/dhparams.pem chmod 400 /etc/nginx/default.d/ssl/default.key /etc/nginx/default.d/ssl/dhparams.pem
# Default SSL cert # Default SSL cert
RUN mkdir -p /etc/nginx/conf.d/ssl && \ RUN mkdir -p /etc/nginx/ssl && \
ln -s ../../default.d/ssl/default.crt /etc/nginx/conf.d/ssl/mail.crt && \ ln -s ../default.d/ssl/default.crt /etc/nginx/ssl/mail.crt && \
ln -s ../../default.d/ssl/default.key /etc/nginx/conf.d/ssl/mail.key ln -s ../default.d/ssl/default.key /etc/nginx/ssl/mail.key
COPY ssl.sh /usr/sbin/ COPY ssl.sh /usr/sbin/
COPY docker/init-docker /sbin/ COPY docker/init-docker /sbin/
COPY var/www/maintenance /var/www/maintenance COPY var/www/maintenance /var/www/maintenance
# Expose our web root and log directories log. # Expose our web root and log directories log.
#VOLUME [ "/etc/nginx/conf.d", "/etc/nginx/default.d", "/etc/nginx/include.d" ] #VOLUME [ "/etc/nginx/http.d", "/etc/nginx/default.d", "/etc/nginx/include.d", "/etc/nginx/ssl" ]
# Starting # Starting
EXPOSE 80 443 25 110 143 EXPOSE 80 443 25 110 143

View File

@ -1,9 +1,9 @@
#!/bin/sh #!/bin/sh
TMPDIR=/tmp TMPDIR=/tmp/nginx
LEGODIR=/etc/nginx/conf.d/ssl/lego LEGODIR=/etc/nginx/ssl/lego
# Create our MD5 of our certifcates in /tmp # Create our MD5 of our certifcates in ${TMPDIR}
for cert in $(lego --path ${LEGODIR} list |grep Certificate\ Path|awk '{print $3}'); do for cert in $(lego --path ${LEGODIR} list |grep Certificate\ Path|awk '{print $3}'); do
OUTPUT=$(basename ${cert}) OUTPUT=$(basename ${cert})
echo "- Creating MD5 of [${cert}] in [${TMPDIR}/${OUTPUT}]" echo "- Creating MD5 of [${cert}] in [${TMPDIR}/${OUTPUT}]"

10
ssl.sh
View File

@ -1,14 +1,14 @@
#!/bin/bash #!/bin/bash
TMPDIR=/tmp TMPDIR=/tmp/nginx
if [ "$1" == "certbot" ]; then if [ "$1" == "certbot" ]; then
certbot renew -q --config-dir /etc/nginx/conf.d/ssl/letsencrypt/ --renew-hook "/usr/sbin/nginx -s reload" certbot renew -q --config-dir /etc/nginx/ssl/letsencrypt/ --renew-hook "/usr/sbin/nginx -s reload"
elif [ "$1" == "lego" ]; then elif [ "$1" == "lego" ]; then
CERTDIR=/etc/nginx/conf.d CERTDIR=/etc/nginx/ssl
LEGODIR=${CERTDIR}/ssl/lego LEGODIR=${CERTDIR}/lego
CERTFILE=${CERTDIR}/lego-cert.ssl CERTFILE=${LEGODIR}/lego-cert.ssl
RELOAD="/tmp/nginx.reload" RELOAD="/tmp/nginx.reload"
TLS_PORT=444 TLS_PORT=444