certbot-scrypts/own/ssl_add-domain

22 lines
735 B
Plaintext
Raw Permalink Normal View History

2018-05-07 20:25:38 +00:00
#!/bin/bash
domains=$1
lxc-attach -n c_proxy -- /etc/init.d/nginx stop
for i in `echo $domains | tr ";" " "`; do
lxc-attach -n c_proxy -- [ -d /etc/letsencrypt/live/$i/ ] && lxc-attach -n c_proxy -- rm -R /etc/letsencrypt/live/$i/
lxc-attach -n c_proxy -- [ -d /etc/letsencrypt/archive/$i/ ] && lxc-attach -n c_proxy -- rm -R /etc/letsencrypt/archive/$i/
done
lxc-attach -n c_proxy -- /opt/letsencrypt/letsencrypt-auto certonly -d $domains --standalone
lxc-attach -n c_proxy -- /etc/init.d/nginx start
for i in `echo $domains | tr ";" " "`; do
mkdir -p ./ssl_certs/$i
for j in privkey.pem fullchain.pem chain.pem cert.pem; do
lxc-attach -n c_proxy -- cat /etc/letsencrypt/live/$i/$j > ./ssl_certs/$i/$j
done
done