san domain handling centralised
This commit is contained in:
parent
f6b4c20e4a
commit
51cc43c11d
@ -17,6 +17,6 @@ RUN chmod 775 /run/postgresql
|
|||||||
|
|
||||||
ADD /rootfs /
|
ADD /rootfs /
|
||||||
|
|
||||||
VOLUME /var/lib/postgresql/data
|
VOLUME /var/lib/postgresql/data /var/lib/postgresql/.lego
|
||||||
|
|
||||||
EXPOSE 5432
|
EXPOSE 5432
|
||||||
|
11
rootfs/bin/concat-sans
Executable file
11
rootfs/bin/concat-sans
Executable file
@ -0,0 +1,11 @@
|
|||||||
|
#!/usr/bin/with-contenv sh
|
||||||
|
|
||||||
|
SAN_DOMAINS=""
|
||||||
|
|
||||||
|
export IFS=";"
|
||||||
|
for SAN in ${POSTGRES_SAN}
|
||||||
|
do
|
||||||
|
SAN_DOMAINS="${SAN_DOMAINS} --domains=\"${SAN}\""
|
||||||
|
done
|
||||||
|
|
||||||
|
echo ${SAN_DOMAINS}
|
@ -2,13 +2,15 @@
|
|||||||
|
|
||||||
cd /var/lib/postgresql
|
cd /var/lib/postgresql
|
||||||
|
|
||||||
|
SAN_DOMAINS=$(/bin/concat-sans)
|
||||||
|
|
||||||
OLD_MOD=$(stat -c %y /var/lib/postgresql/.lego/certificates/${POSTGRES_DOMAIN}.crt)
|
OLD_MOD=$(stat -c %y /var/lib/postgresql/.lego/certificates/${POSTGRES_DOMAIN}.crt)
|
||||||
|
|
||||||
lego \
|
lego \
|
||||||
--accept-tos \
|
--accept-tos \
|
||||||
--server="${POSTGRES_CA}" \
|
--server="${POSTGRES_CA}" \
|
||||||
--email="${POSTGRES_ACME_EMAIL}" \
|
--email="${POSTGRES_ACME_EMAIL}" \
|
||||||
--domains="${POSTGRES_DOMAIN}" \
|
--domains="${POSTGRES_DOMAIN}" ${SAN_DOMAINS} \
|
||||||
--dns="${POSTGRES_DNS_PROVIDER}" \
|
--dns="${POSTGRES_DNS_PROVIDER}" \
|
||||||
renew --days 30
|
renew --days 30
|
||||||
|
|
||||||
|
@ -2,13 +2,7 @@
|
|||||||
|
|
||||||
cd /var/lib/postgresql
|
cd /var/lib/postgresql
|
||||||
|
|
||||||
SAN_DOMAINS=""
|
SAN_DOMAINS=$(/bin/concat-sans)
|
||||||
|
|
||||||
export IFS=";"
|
|
||||||
for SAN in ${POSTGRES_SAN}
|
|
||||||
do
|
|
||||||
SAN_DOMAINS="${SAN_DOMAINS} --domains=\"${SAN}\""
|
|
||||||
done
|
|
||||||
|
|
||||||
if [ ! -f /var/lib/postgresql/.lego/certificates/${POSTGRES_DOMAIN}.crt ]; then
|
if [ ! -f /var/lib/postgresql/.lego/certificates/${POSTGRES_DOMAIN}.crt ]; then
|
||||||
chown -R postgres /var/lib/postgresql/.lego
|
chown -R postgres /var/lib/postgresql/.lego
|
||||||
@ -24,7 +18,7 @@ else
|
|||||||
--accept-tos \
|
--accept-tos \
|
||||||
--server="${POSTGRES_CA}" \
|
--server="${POSTGRES_CA}" \
|
||||||
--email="${POSTGRES_ACME_EMAIL}" \
|
--email="${POSTGRES_ACME_EMAIL}" \
|
||||||
--domains="${POSTGRES_DOMAIN}" \
|
--domains="${POSTGRES_DOMAIN}" ${SAN_DOMAINS} \
|
||||||
--dns="${POSTGRES_DNS_PROVIDER}" \
|
--dns="${POSTGRES_DNS_PROVIDER}" \
|
||||||
renew --days 30
|
renew --days 30
|
||||||
fi
|
fi
|
||||||
|
Loading…
Reference in New Issue
Block a user