forked from Celti/lets-nfsn.sh
-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathnfsn-hook.sh
executable file
·49 lines (33 loc) · 1.07 KB
/
nfsn-hook.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#!/usr/bin/env bash
set -o errexit -o nounset -o pipefail
function deploy_challenge {
local DOMAIN="${1}" TOKEN_FILENAME="${2}" TOKEN_VALUE="${3}"
#echo " + No hook enabled for deploying challenges."
}
function clean_challenge {
local DOMAIN="${1}" TOKEN_FILENAME="${2}" TOKEN_VALUE="${3}"
#echo " + No hook enabled for cleaning challenges."
}
function deploy_cert {
local DOMAIN="${1}" KEYFILE="${2}" CERTFILE="${3}" FULLCHAINFILE="${4}" CHAINFILE="${5}" TIMESTAMP="${6}"
echo " + Installing new certificate for ${DOMAIN}..."
cat "${CERTFILE}" "${CHAINFILE}" "${KEYFILE}" | nfsn -i set-tls
}
function invalid_challenge {
local DOMAIN="${1}" RESULT="${2}"
echo " + Certificate for ${DOMAIN} had invalid challenge. Result follows:"
printf '%s\n' "${RESULT}"
}
function unchanged_cert {
local DOMAIN="${1}" #KEYFILE="${2}" CERTFILE="${3}" FULLCHAINFILE="${4}" CHAINFILE="${5}"
echo " + Certificate for ${DOMAIN} unchanged."
}
function function_exists() {
declare -f "${1}" >/dev/null
return $?
}
HANDLER="$1"; shift;
if function_exists "$HANDLER"
then
"$HANDLER" "$@"
fi