41 lines
1.2 KiB
Bash
41 lines
1.2 KiB
Bash
#!/bin/sh
|
|
set -e
|
|
set -x
|
|
|
|
IFS=";"
|
|
|
|
apk add curl
|
|
for group in $LETSCONSUL_DOMAINS
|
|
do
|
|
echo
|
|
echo "-----------------------"
|
|
IFS=" "
|
|
domains=""
|
|
domain_main=""
|
|
for domain in $group
|
|
do
|
|
if [ "$domain_main" = "" ]
|
|
then
|
|
domain_main="$domain"
|
|
fi
|
|
domains="$domains -d $domain"
|
|
done
|
|
|
|
echo certbot certonly \
|
|
-vvv \
|
|
--test-cert \
|
|
--preferred-challenges dns \
|
|
--authenticator dns-duckdns \
|
|
--dns-duckdns-token e4b5ca33-1f4d-494b-b06d-6dd4600df662 \
|
|
--dns-duckdns-propagation-seconds 120 \
|
|
--non-interactive \
|
|
--agree-tos \
|
|
--renew-by-default \
|
|
$domains --email "stuart.stent@gmail.com"
|
|
|
|
echo curl -XPUT --data-bin "@/etc/letsencrypt/live/\*.${domain_main}/privkey.pem" http://$LETSCONSUL_CONSUL_URL:8500/v1/kv/letsconsul/$domain_main/privkey
|
|
echo curl -XPUT --data-bin "@/etc/letsencrypt/live/\*.${domain_main}/fullchain.pem" http://$LETSCONSUL_CONSUL_URL:8500/v1/kv/letsconsul/$domain_main/fullchain
|
|
done
|
|
|
|
echo curl -XPUT --data-bin @/var/log/letsencrypt/letsencrypt.log http://$LETSCONSUL_CONSUL_URL:8500/v1/kv/letsconsul/letsencrypt.log
|