mirror of
https://github.com/Mailu/Mailu.git
synced 2024-12-14 10:53:30 +02:00
2c5f977117
Before it only outputted a pem-file with the server-certificate — however, it seems some clients want the fullchain delivered, as it’s common with letsencrypt. closes #847
27 lines
786 B
Bash
Executable File
27 lines
786 B
Bash
Executable File
#!/bin/bash
|
|
|
|
function dump() {
|
|
echo "$(date) Dumping certificates"
|
|
bash dumpcerts.sh /traefik/acme.json /tmp/work/ || return
|
|
|
|
# private-keys are rsa, we need pem though
|
|
for key_file in $(ls /tmp/work/private/*); do
|
|
pem_file=$(echo $key_file | sed 's/private/pem/g' | sed 's/.key/-private.pem/g')
|
|
openssl rsa -in $key_file -text > $pem_file
|
|
done
|
|
|
|
echo "$(date) Copying certificates"
|
|
cp -v /tmp/work/pem/${DOMAIN}-private.pem /output/key.pem
|
|
# the .crt is a chained-pem, as common for letsencrypt
|
|
cp -v /tmp/work/certs/${DOMAIN}.crt /output/cert.pem
|
|
}
|
|
|
|
mkdir -p /tmp/work/pem /tmp/work/certs
|
|
# run once on start to make sure we have any old certs
|
|
dump
|
|
|
|
while true; do
|
|
inotifywait -e modify /traefik/acme.json && \
|
|
dump
|
|
done
|