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