diff options
author | Aaron LI <aly@aaronly.me> | 2019-09-22 10:18:57 +0800 |
---|---|---|
committer | Aaron LI <aly@aaronly.me> | 2019-09-22 10:22:21 +0800 |
commit | 64cd268f1cf113911bf4472fbb63efe53f6eb760 (patch) | |
tree | c8edd39007557e82fe1758867d8b0404314dd173 /roles/web/templates/acme/deploy.sh.j2 | |
parent | 60c85c56f25e10b9819214507ebd496cc0fbb855 (diff) | |
download | ansible-dfly-vps-64cd268f1cf113911bf4472fbb63efe53f6eb760.tar.bz2 |
web: Use 'acme.sh' to issue and renew certificates
The 'acme-client' seems obsolete and is missing from DPorts.
Diffstat (limited to 'roles/web/templates/acme/deploy.sh.j2')
-rw-r--r-- | roles/web/templates/acme/deploy.sh.j2 | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/roles/web/templates/acme/deploy.sh.j2 b/roles/web/templates/acme/deploy.sh.j2 new file mode 100644 index 0000000..141b112 --- /dev/null +++ b/roles/web/templates/acme/deploy.sh.j2 @@ -0,0 +1,27 @@ +#!/bin/sh +# +# Deploy the issued certificates. +# +# Aaron LI +# 2019-09-21 +# + +SSL_ROOT="{{ web.ssl_root }}" +[ -d "${SSL_ROOT}" ] || mkdir -p -m 0700 ${SSL_ROOT} + +{% for domain in domains %} +CERT_DIR="${SSL_ROOT}/{{ domain.name }}" +[ -d "${CERT_DIR}" ] || mkdir -m 0700 ${CERT_DIR} +acme.sh --install-cert --log /var/log/acme.sh.log \ + --config-home {{ web.acme_home }}/.acme.sh \ + --cert-home {{ web.acme_home }}/certs \ + --domain {{ domain.name }} \ + --key-file ${CERT_DIR}/key \ + --cert-file ${CERT_DIR}/cert \ + --fullchain-file ${CERT_DIR}/fullchain + +{% endfor %} + +echo "Reload relevant services ..." +SCRIPT="{{ web.acme_home }}/deploy.local.sh" +[ -f "${SCRIPT}" ] && sh ${SCRIPT} || exit 0 |