summaryrefslogtreecommitdiff
path: root/dehydrated/cron.weekly/local-dehydrated
blob: 2aa495dee73f9e3a9908b0c941f99bb32f0e4ebe (plain)
  1. #!/bin/sh
  2. #
  3. # Renew letsencrypt certificates
  4. set -eu
  5. # update non-EC maildomain cert if resolvable and not a certdomain
  6. maildomain=$(cat /etc/local-REDPILL/$(cat /etc/local-ORG/realm)/mailhost) || true
  7. mailname=$(cat /etc/mailname) || true
  8. fqdn=$(hostname --fqdn)
  9. [ -z "$fqdn" ] \
  10. || [ "$maildomain" = "$fqdn" ] \
  11. || extradomains=${extradomains:+$extradomains }$fqdn
  12. domain=$(hostname --domain)
  13. [ -z "$domain" ] \
  14. || [ "$maildomain" = "$domain" ] \
  15. || [ "$fqdn" = "$domain" ] \
  16. || extradomains=${extradomains:+$extradomains }$domain
  17. [ -z "$maildomain" ] \
  18. || [ "$maildomain" != "$mailname" ] \
  19. || grep ^"$maildomain" /etc/dehydrated/domains.txt \
  20. || dehydrated --cron --domain "$maildomain $extradomains" --algo rsa
  21. # update certdomain certs
  22. dehydrated --cron "$@"