genscripts.sh hinzugefügt
This commit is contained in:
parent
46120b4021
commit
5b2264b6a2
1 changed files with 41 additions and 0 deletions
41
genscripts.sh
Normal file
41
genscripts.sh
Normal file
|
@ -0,0 +1,41 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
|
||||||
|
if [ $# -lt 2 ]
|
||||||
|
then
|
||||||
|
echo "------------- Syntax -------------"
|
||||||
|
echo "./genscripts.sh DOMAIN.de CF-TOKEN"
|
||||||
|
exit 2
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
# Generate hook for certbot
|
||||||
|
|
||||||
|
echo """#!/bin/sh
|
||||||
|
cp -Lr /etc/letsencrypt/live/$1 /storage/certs/
|
||||||
|
cat /etc/letsencrypt/live/$1/fullchain.pem /etc/letsencrypt/live/$1/privkey.pem > /etc/haproxy/ssl/$1.pem
|
||||||
|
service haproxy reload
|
||||||
|
""" >> /storage/hooks/$1.sh
|
||||||
|
|
||||||
|
# Make it runable
|
||||||
|
|
||||||
|
chmod +x /storage/hooks/$1.sh
|
||||||
|
|
||||||
|
|
||||||
|
# CF-TOKEN ini File
|
||||||
|
|
||||||
|
echo "dns_cloudflare_api_token = $2" >> /storage/cf-tokens/$1.ini
|
||||||
|
chmod 777 /storage/cf-tokens/$1.ini
|
||||||
|
|
||||||
|
|
||||||
|
# Generate the SSL cert and restart haproxy
|
||||||
|
certbot certonly \
|
||||||
|
--dns-cloudflare \
|
||||||
|
--dns-cloudflare-credentials /storage/cf-tokens/$1.ini \
|
||||||
|
--dns-cloudflare-propagation-seconds 30 \
|
||||||
|
--deploy-hook /storage/hooks/$1.sh \
|
||||||
|
-d $1 \
|
||||||
|
-d *.$1
|
||||||
|
|
||||||
|
# Restart haproxy
|
||||||
|
service haproxy restart
|
Loading…
Reference in a new issue