add hook script template

This commit is contained in:
David Kilias 2021-02-10 23:27:06 +01:00 committed by Gitea
parent 379ee5dd66
commit 44f03354d2

View file

@ -22,7 +22,7 @@ deploy_challenge() {
# Simple example: Use nsupdate with local named # Simple example: Use nsupdate with local named
# printf 'server 127.0.0.1\nupdate add _acme-challenge.%s 300 IN TXT "%s"\nsend\n' "${DOMAIN}" "${TOKEN_VALUE}" | nsupdate -k /var/run/named/session.key # printf 'server 127.0.0.1\nupdate add _acme-challenge.%s 300 IN TXT "%s"\nsend\n' "${DOMAIN}" "${TOKEN_VALUE}" | nsupdate -k /var/run/named/session.key
{{ dehydrated_deploy_challenge_hook }} {{ item.deploy_challenge_hook }}
} }
clean_challenge() { clean_challenge() {
@ -36,7 +36,7 @@ clean_challenge() {
# Simple example: Use nsupdate with local named # Simple example: Use nsupdate with local named
# printf 'server 127.0.0.1\nupdate delete _acme-challenge.%s TXT "%s"\nsend\n' "${DOMAIN}" "${TOKEN_VALUE}" | nsupdate -k /var/run/named/session.key # printf 'server 127.0.0.1\nupdate delete _acme-challenge.%s TXT "%s"\nsend\n' "${DOMAIN}" "${TOKEN_VALUE}" | nsupdate -k /var/run/named/session.key
{{ dehydrated_clean_challenge_hook }} {{ item.clean_challenge_hook }}
} }
sync_cert() { sync_cert() {
@ -63,7 +63,7 @@ sync_cert() {
# Simple example: sync the files before symlinking them # Simple example: sync the files before symlinking them
# sync "${KEYFILE}" "${CERTFILE}" "${FULLCHAINFILE}" "${CHAINFILE}" "${REQUESTFILE}" # sync "${KEYFILE}" "${CERTFILE}" "${FULLCHAINFILE}" "${CHAINFILE}" "${REQUESTFILE}"
{{ dehydrated_sync_cert_hook }} {{ item.sync_cert_hook }}
} }
deploy_cert() { deploy_cert() {
@ -91,7 +91,7 @@ deploy_cert() {
# Simple example: Copy file to nginx config # Simple example: Copy file to nginx config
# cp "${KEYFILE}" "${FULLCHAINFILE}" /etc/nginx/ssl/; chown -R nginx: /etc/nginx/ssl # cp "${KEYFILE}" "${FULLCHAINFILE}" /etc/nginx/ssl/; chown -R nginx: /etc/nginx/ssl
# systemctl reload nginx # systemctl reload nginx
{{ dehydrated_deploy_cert_hook }} {{ item.deploy_cert_hook }}
} }
deploy_ocsp() { deploy_ocsp() {
@ -113,7 +113,7 @@ deploy_ocsp() {
# Simple example: Copy file to nginx config # Simple example: Copy file to nginx config
# cp "${OCSPFILE}" /etc/nginx/ssl/; chown -R nginx: /etc/nginx/ssl # cp "${OCSPFILE}" /etc/nginx/ssl/; chown -R nginx: /etc/nginx/ssl
# systemctl reload nginx # systemctl reload nginx
{{ dehydrated_deploy_ocsp_hook }} {{ item.deploy_ocsp_hook }}
} }
@ -135,7 +135,7 @@ unchanged_cert() {
# The path of the file containing the full certificate chain. # The path of the file containing the full certificate chain.
# - CHAINFILE # - CHAINFILE
# The path of the file containing the intermediate certificate(s). # The path of the file containing the intermediate certificate(s).
{{ dehydrated_unchanged_cert_hook }} {{ item.unchanged_cert_hook }}
} }
invalid_challenge() { invalid_challenge() {
@ -153,7 +153,7 @@ invalid_challenge() {
# Simple example: Send mail to root # Simple example: Send mail to root
# printf "Subject: Validation of ${DOMAIN} failed!\n\nOh noez!" | sendmail root # printf "Subject: Validation of ${DOMAIN} failed!\n\nOh noez!" | sendmail root
{{ dehydrated_invalid_challenge_hook }} {{ item.invalid_challenge_hook }}
} }
request_failure() { request_failure() {
@ -176,7 +176,7 @@ request_failure() {
# Simple example: Send mail to root # Simple example: Send mail to root
# printf "Subject: HTTP request failed failed!\n\nA http request failed with status ${STATUSCODE}!" | sendmail root # printf "Subject: HTTP request failed failed!\n\nA http request failed with status ${STATUSCODE}!" | sendmail root
{{ dehydrated_request_failure_hook }} {{ item.request_failure_hook }}
} }
generate_csr() { generate_csr() {
@ -202,14 +202,14 @@ generate_csr() {
# if [ -e "${CERTDIR}/pre-generated.csr" ]; then # if [ -e "${CERTDIR}/pre-generated.csr" ]; then
# cat "${CERTDIR}/pre-generated.csr" # cat "${CERTDIR}/pre-generated.csr"
# fi # fi
{{ dehydrated_startup_hook }} {{ item.startup_hook }}
} }
startup_hook() { startup_hook() {
# This hook is called before the cron command to do some initial tasks # This hook is called before the cron command to do some initial tasks
# (e.g. starting a webserver). # (e.g. starting a webserver).
{{ dehydrated_startup_hook }} {{ item.startup_hook }}
: :
} }
@ -221,7 +221,7 @@ exit_hook() {
# Parameters: # Parameters:
# - ERROR # - ERROR
# Contains error message if dehydrated exits with error # Contains error message if dehydrated exits with error
{{ dehydrated_exit_hook }} {{ item.exit_hook }}
} }
HANDLER="$1"; shift HANDLER="$1"; shift