#!/bin/sh
+deploy_cert() {
+ local DOMAIN="${1}" KEYFILE="${2}" CERTFILE="${3}" FULLCHAINFILE="${4}" CHAINFILE="${5}" TIMESTAMP="${6}"
+ if [[ -n "${HOOKS_D}" ]]; then
+ if [[ ! -d "${HOOKS_D}" ]]; then
+ echo " + Hook: ${HANDLER}: The path ${HOOKS_D} specified for HOOKS_D does not point to a directory."
+ else
+ if [[ -f "${HOOKS_D}/${DOMAIN}" ]]; then
+ if [[ -r "${HOOKS_D}/${DOMAIN}" ]]; then
+ echo " + Hook: ${HANDLER}: Executing hook script for certificate ${DOMAIN}."
+ . "${HOOKS_D}/${DOMAIN}"
+ else
+ echo " + Hook: ${HANDLER}: Cannot execute hook script for certificate ${DOMAIN}."
+ fi
+ else
+ if [[ -f "${HOOKS_D}/global" ]] && [[ -r "${HOOKS_D}/global" ]]; then
+ echo " + Hook: ${HANDLER}: Executing global hook script"
+ . "${HOOKS_D}/global"
+ else
+ echo " + Hook: ${HANDLER}: Cannot execute global hook script."
+ fi
+ fi
+ fi
+ fi
+}
+
+clean_challenge() {
+ local DOMAIN="${1}" TOKEN_FILENAME="${2}" TOKEN_VALUE="${3}"
+ echo " + Hook: ${HANDLER}: Nothing to do..."
+}
+
+deploy_challenge() {
+ local DOMAIN="${1}" TOKEN_FILENAME="${2}" TOKEN_VALUE="${3}"
+ echo " + Hook: ${HANDLER}: Nothing to do..."
+}
+
+invalid_challenge() {
+ local DOMAIN="${1}" RESPONSE="${2}"
+ echo " + Hook: ${HANDLER}: Nothing to do..."
+}
+
+request_failure() {
+ local STATUSCODE="${1}" REASON="${2}" REQTYPE="${3}"
+ echo " + Hook: ${HANDLER}: Nothing to do..."
+}
+
+unchanged_cert() {
+ local DOMAIN="${1}" KEYFILE="${2}" CERTFILE="${3}" FULLCHAINFILE="${4}" CHAINFILE="${5}"
+ echo " + Hook: ${HANDLER}: Nothing to do..."
+}
+
# concat file atomic way
atomic_concat() {
local file=$1; shift
# certificate is successfully deployed
HOOKS_D="/etc/dehydrated/hooks.d"
-# Predefined functions, ie. for reloading/updating system services
+# Load fucntions
. "/etc/dehydrated/hooks/functions"
HANDLER="${1}"
shift
case "${HANDLER}" in
deploy_cert)
- local DOMAIN="${1}" KEYFILE="${2}" CERTFILE="${3}" FULLCHAINFILE="${4}" CHAINFILE="${5}" TIMESTAMP="${6}"
- if [[ -n "${HOOKS_D}" ]]; then
- if [[ ! -d "${HOOKS_D}" ]]; then
- echo " + Hook: ${HANDLER}: The path ${HOOKS_D} specified for HOOKS_D does not point to a directory."
- else
- if [[ -f "${HOOKS_D}/${DOMAIN}" ]]; then
- if [[ -r "${HOOKS_D}/${DOMAIN}" ]]; then
- echo " + Hook: ${HANDLER}: Executing hook script for certificate ${DOMAIN}."
- . "${HOOKS_D}/${DOMAIN}"
- else
- echo " + Hook: ${HANDLER}: Cannot execute hook script for certificate ${DOMAIN}."
- fi
- else
- if [[ -f "${HOOKS_D}/global" ]] && [[ -r "${HOOKS_D}/global" ]]; then
- echo " + Hook: ${HANDLER}: Executing global hook script"
- . "${HOOKS_D}/global"
- else
- echo " + Hook: ${HANDLER}: Cannot execute global hook script."
- fi
- fi
- fi
- fi
+ deploy_cert "$@"
;;
clean_challenge)
- local DOMAIN="${1}" TOKEN_FILENAME="${2}" TOKEN_VALUE="${3}"
- echo " + Hook: ${HANDLER}: Nothing to do..."
+ clean_challenge "$@"
;;
deploy_challenge)
- local DOMAIN="${1}" TOKEN_FILENAME="${2}" TOKEN_VALUE="${3}"
- echo " + Hook: ${HANDLER}: Nothing to do..."
+ deploy_challenge "$@"
;;
invalid_challenge)
- local DOMAIN="${1}" RESPONSE="${2}"
- echo " + Hook: ${HANDLER}: Nothing to do..."
+ invalid_challenge "$@"
;;
request_failure)
- local STATUSCODE="${1}" REASON="${2}" REQTYPE="${3}"
- echo " + Hook: ${HANDLER}: Nothing to do..."
+ request_failure "$@"
;;
unchanged_cert)
- local DOMAIN="${1}" KEYFILE="${2}" CERTFILE="${3}" FULLCHAINFILE="${4}" CHAINFILE="${5}"
- echo " + Hook: ${HANDLER}: Nothing to do..."
+ unchanged_cert "$@"
;;
*)
echo " + Hook: ${HANDLER}: Nothing to do..."