summaryrefslogtreecommitdiff
path: root/dehydrated/cron.weekly/local-dehydrated
blob: 26cbd4a4f700953182333b76b8511878b1a4ce6a (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. fqdn=$(hostname --fqdn)
  8. [ -z "$fqdn" ] \
  9. || [ "$maildomain" = "$fqdn" ] \
  10. || extradomains=${extradomains:+$extradomains }$fqdn
  11. domain=$(hostname --domain)
  12. [ -z "$domain" ] \
  13. || [ "$maildomain" = "$domain" ] \
  14. || [ "$fqdn" = "$domain" ] \
  15. || extradomains=${extradomains:+$extradomains }$domain
  16. [ -z "$maildomain" ] \
  17. || grep ^"$maildomain" /etc/dehydrated/domains.txt \
  18. || dehydrated --cron --domain "$maildomain $extradomains" --algo rsa
  19. # update certdomain certs
  20. dehydrated --cron