xoxys.lego/templates/cron-lego-renew.sh.j2
Robert Kaussow cf5373f595
Some checks failed
ci/woodpecker/push/lint Pipeline was successful
ci/woodpecker/push/test Pipeline failed
ci/woodpecker/push/docs unknown status
ci/woodpecker/push/notify Pipeline was successful
add dns resolver option
2024-09-28 00:38:17 +02:00

14 lines
794 B
Django/Jinja

#!/bin/env bash
# run this script daily to renew any letsencrypt certs that need renewing
# renew cert if it expires within 30 days
export LEGO_SERVER="{{ lego_acme_server }}/directory"
export LEGO_PATH="{{ __lego_base_dir }}/.lego"
export CLOUDFLARE_DNS_API_TOKEN="{{ lego_cloudflare_api_token }}"
{% for cert in lego_certificates %}
echo "$(date) checking for cert update for {{ ', '.join(cert.domains) }}."
{{ __lego_bin_file }} --email="{{ lego_acme_account_email }}" --domains {{ ' --domains '.join(cert.domains) }} --key-type="{{ lego_key_type }}" --dns="cloudflare" {{ '--dns.resolvers="' + lego_dns_resolvers | join(',') + '"' if lego_dns_resolvers | length > 0 else '' }} renew {{ '--renew-hook="hook-' + cert.name + '.sh"' if cert.hook is defined else '' }} --days 30
{% endfor %}