diff options
Diffstat (limited to 'net/acme-acmesh/files/hook.sh')
-rw-r--r-- | net/acme-acmesh/files/hook.sh | 40 |
1 files changed, 23 insertions, 17 deletions
diff --git a/net/acme-acmesh/files/hook.sh b/net/acme-acmesh/files/hook.sh index cd92cec9d..e736dc599 100644 --- a/net/acme-acmesh/files/hook.sh +++ b/net/acme-acmesh/files/hook.sh @@ -4,6 +4,7 @@ ACME=/usr/lib/acme/client/acme.sh LOG_TAG=acme-acmesh # webroot option deprecated, use the hardcoded value directly in the next major version WEBROOT=${webroot:-/var/run/acme/challenge} +NOTIFY=/usr/lib/acme/notify # shellcheck source=net/acme/files/functions.sh . /usr/lib/acme/functions.sh @@ -12,9 +13,7 @@ WEBROOT=${webroot:-/var/run/acme/challenge} export CURL_CA_BUNDLE=/etc/ssl/certs/ca-certificates.crt export NO_TIMESTAMP=1 -cmd="$1" - -case $cmd in +case $1 in get) set -- [ "$debug" = 1 ] && set -- "$@" --debug @@ -38,20 +37,25 @@ get) staging_moved=1 else set -- "$@" --renew --home "$state_dir" -d "$main_domain" - log info "$*" - trap 'ACTION=renewed-failed hotplug-call acme;exit 1' INT - "$ACME" "$@" + log info "$ACME $*" + trap '$NOTIFY renew-failed;exit 1' INT + $ACME "$@" status=$? trap - INT case $status in - 0) ;; # renewed ok, handled by acme.sh hook, ignore. - 2) ;; # renew skipped, ignore. + 0) + $NOTIFY renewed + exit;; + 2) + # renew skipped, ignore. + exit + ;; *) - ACTION=renew-failed hotplug-call acme + $NOTIFY renew-failed + exit 1 ;; esac - return 0 fi fi @@ -83,6 +87,9 @@ get) elif [ "$calias" ]; then set -- "$@" --challenge-alias "$calias" fi + if [ "$dns_wait" ]; then + set -- "$@" --dnssleep "$dns_wait" + fi elif [ "$standalone" = 1 ]; then set -- "$@" --standalone --listen-v6 else @@ -92,11 +99,11 @@ get) set -- "$@" --issue --home "$state_dir" - log info "$*" - trap 'ACTION=issue-failed hotplug-call acme;exit 1' INT + log info "$ACME $*" + trap '$NOTIFY issue-failed;exit 1' INT "$ACME" "$@" \ - --pre-hook 'ACTION=prepare hotplug-call acme' \ - --renew-hook 'ACTION=renewed hotplug-call acme' + --pre-hook "$NOTIFY prepare" \ + --renew-hook "$NOTIFY renewed" status=$? trap - INT @@ -106,7 +113,7 @@ get) ln -s "$domain_dir/$main_domain.key" /etc/ssl/acme ln -s "$domain_dir/fullchain.cer" "/etc/ssl/acme/$main_domain.fullchain.cer" ln -s "$domain_dir/ca.cer" "/etc/ssl/acme/$main_domain.chain.cer" - ACTION=issued hotplug-call acme + $NOTIFY issued ;; *) if [ "$staging_moved" = 1 ]; then @@ -117,8 +124,7 @@ get) mv "$domain_dir" "$failed_dir" log err "State moved to $failed_dir" fi - ACTION=issue-failed hotplug-call acme - return 0 + $NOTIFY issue-failed ;; esac ;; |