diff options
Diffstat (limited to 'dehydrated/cron.weekly/local-dehydrated')
-rwxr-xr-x | dehydrated/cron.weekly/local-dehydrated | 23 |
1 files changed, 12 insertions, 11 deletions
diff --git a/dehydrated/cron.weekly/local-dehydrated b/dehydrated/cron.weekly/local-dehydrated index 24ca7e7..43ab94d 100755 --- a/dehydrated/cron.weekly/local-dehydrated +++ b/dehydrated/cron.weekly/local-dehydrated @@ -7,19 +7,20 @@ 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) -[ -z "$fqdn" ] \ - || [ "$mailhost" = "$fqdn" ] \ - || extradomains=${extradomains:+$extradomains }$fqdn +if [ -n "$fqdn" ] && [ "$mailhost" != "$fqdn" ]; then + extradomains=${extradomains:+$extradomains }$fqdn +fi + domain=$(hostname --domain) -[ -z "$domain" ] \ - || [ "$mailhost" = "$domain" ] \ - || [ "$fqdn" = "$domain" ] \ - || extradomains=${extradomains:+$extradomains }$domain -[ -z "$mailhost" ] \ - || [ "$mailhost" != "$mailname" ] \ - || grep ^"$mailhost" /etc/dehydrated/domains.txt \ - || dehydrated --cron --domain "$mailhost $extradomains" --algo rsa +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 "$@" |