diff options
Diffstat (limited to 'frontends/scripts')
| -rw-r--r-- | frontends/scripts/acme.sh.tpl | 31 |
1 files changed, 21 insertions, 10 deletions
diff --git a/frontends/scripts/acme.sh.tpl b/frontends/scripts/acme.sh.tpl index 8039168..45be254 100644 --- a/frontends/scripts/acme.sh.tpl +++ b/frontends/scripts/acme.sh.tpl @@ -5,18 +5,29 @@ our $prefix = $primary ? '' : 'www.'; -%> +function handle_cert { + host=$1 + # Create symlink, so that relayd also can read it. + crt_path=/etc/ssl/$host + if [ -e $crt_path.crt ]; then + rm $crt_path.crt + fi + ln -s $crt_path.fullchain.pem $crt_path.crt + # Requesting and renewing certificate. + /usr/sbin/acme-client -v $host +} + +has_update=no <% for my $host (@$acme_hosts) { -%> -# Requesting and renewing certificate. -/usr/sbin/acme-client -v <%= $prefix.$host %> -# Create symlink, so that relayd also can read it. -crt_path=/etc/ssl/<%= $prefix.$host %> -if [ -e $crt_path.crt ]; then - rm $crt_path.crt +handle_cert <%= $prefix.$host %> +if [ $? -eq 0 ]; then + has_update=yes fi -ln -s $crt_path.fullchain.pem $crt_path.crt - <% } -%> # Pick up the new certs. -/usr/sbin/rcctl reload httpd -/usr/sbin/rcctl reload relayd +if [ $has_update = yes ]; then + /usr/sbin/rcctl reload httpd + /usr/sbin/rcctl reload relayd + /usr/sbin/rcctl restart smtpd +fi |
