forked from SvenDowideit/traefik-certdumper
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrun_default.sh
executable file
·27 lines (24 loc) · 884 Bytes
/
run_default.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#!/bin/bash
set -e
function dump() {
bash dumpcerts.sh /traefik/acme.json /traefik/ssl/
ln -f /traefik/ssl/certs/* /traefik/ssl/
ln -f /traefik/ssl/private/* /traefik/ssl/
for crt_file in $(ls /traefik/ssl/certs/*); do
pem_file=$(echo $crt_file | sed 's/certs/pem/g' | sed 's/.crt/-public.pem/g')
echo "openssl x509 -inform PEM -in $crt_file > $pem_file"
openssl x509 -inform PEM -in $crt_file > $pem_file
done
for key_file in $(ls /traefik/ssl/private/*); do
pem_file=$(echo $key_file | sed 's/private/pem/g' | sed 's/.key/-private.pem/g')
echo "openssl rsa -in $key_file -text > $pem_file"
openssl rsa -in $key_file -text > $pem_file
done
}
mkdir -p /traefik/ssl/pem/
# run once on start to make sure we have any old certs
dump
while true; do
inotifywait -e modify /traefik/acme.json
dump
done