blob: 43ab94df881aa5fa597cb50f6ebf5e38272b9798 (
plain)
- #!/bin/sh
- #
- # Renew letsencrypt certificates
- set -eu
- # update non-EC mailhost cert if resolvable and not a certdomain
- mailhost=$(cat /etc/local-REDPILL/$(cat /etc/local-ORG/realm)/mailhost) || true
- mailname=$(cat /etc/mailname) || true
- fqdn=$(hostname --fqdn)
- if [ -n "$fqdn" ] && [ "$mailhost" != "$fqdn" ]; then
- extradomains=${extradomains:+$extradomains }$fqdn
- fi
- domain=$(hostname --domain)
- if [ -n "$domain" ] && [ "$mailhost" != "$domain" ] && [ "$fqdn" != "$domain" ]; then
- extradomains=${extradomains:+$extradomains }$domain
- fi
- if [ -n "$mailhost" ] && [ "$mailhost" = "$mailname" ] && ! grep ^"$mailhost" /etc/dehydrated/domains.txt; then
- dehydrated --cron --domain "$mailhost $extradomains" --algo rsa
- fi
- # update certdomain certs
- dehydrated --cron "$@"
|