Last active
January 17, 2017 19:57
-
-
Save webee/3b56820e991714a6b5515e279e002a04 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
########### | |
# add crontab | |
# 0 0 1 * * /root/src/renew_ssl_cert.sh <site> 2>>/var/log/acme_tiny.log | |
########### | |
site=$1 | |
domains=$2 | |
if [ -n "${domains}" ]; then | |
# init | |
cur_dir=$(dir readlink -f $0) | |
${cur_dir}/init_ssl_cert.sh ${site} ${domains} | |
fi | |
# renew | |
mkdir -p /etc/nginx/www/challenges | |
site_dir=/etc/nginx/ssl/${site} | |
mkdir -p ${site_dir} | |
cd ${site_dir} | |
python $HOME/src/acme-tiny/acme_tiny.py --account-key ../account.key --csr ./domain.csr --acme-dir /etc/nginx/www/challenges/ > /tmp/signed.crt || exit | |
wget -O - https://letsencrypt.org/certs/lets-encrypt-x3-cross-signed.pem > ./intermediate.pem | |
cat /tmp/signed.crt ./intermediate.pem > ./chained.pem | |
systemctl reload nginx.service |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment