aboutsummaryrefslogtreecommitdiffstats
path: root/lfacme-renew.sh
diff options
context:
space:
mode:
authorLexi Winter <ivy@FreeBSD.org>2025-06-03 10:49:05 +0100
committerLexi Winter <ivy@FreeBSD.org>2025-06-03 10:49:05 +0100
commit99151a2db842a850a2860af3e77532370802ca69 (patch)
treea43f4ff44edd47a267a1a991046b26412dab00c0 /lfacme-renew.sh
parent29d14ef9b7b4c116e3cce031150d848d8e1c14eb (diff)
downloadlfacme-99151a2db842a850a2860af3e77532370802ca69.tar.gz
lfacme-99151a2db842a850a2860af3e77532370802ca69.tar.bz2
make the challenge handler configurable
perhaps one day we'll even support something other than Kerberos!
Diffstat (limited to 'lfacme-renew.sh')
-rw-r--r--lfacme-renew.sh38
1 files changed, 20 insertions, 18 deletions
diff --git a/lfacme-renew.sh b/lfacme-renew.sh
index 0a487d8..787d8da 100644
--- a/lfacme-renew.sh
+++ b/lfacme-renew.sh
@@ -113,6 +113,7 @@ _docert() {
local altnames=""
local hooks=""
local domain=""
+ local challenge=""
# parse arguments for this cert
while ! [ -z "$1" ]; do
@@ -123,6 +124,7 @@ _docert() {
"$identifier" "${1#type=*}"
return 1;;
hook=*) hooks="$hooks ${1#hook=*}";;
+ challenge=*) challenge="${1#challenge=*}";;
*=*) _error "%s: unknown option: %s" \
"$identifier" "$1"
return 1;;
@@ -149,28 +151,28 @@ _docert() {
keytype="ec"
fi
+ # Default challenge is kerberos.
+ if [ -z "$challenge" ]; then
+ challenge="kerberos"
+ fi
+
+ # make sure the challenge is valid.
+ challenge_path="$(_findchallenge "$identifier" "$challenge")"
+ if [ "$?" -ne 0 ]; then
+ return 1
+ fi
+
# make sure all the hook scripts are valid. if the hook name
- # begins with a '/' it's a full path, otherwise it's related to
- # ACME_HOOKDIR.
+ # begins with a '/' it's a full path, otherwise it's relative
+ # to ACME_HOOKDIR.
local _rhooks=""
for hook in $hooks; do
- if [ "${hook#/*}" = "$hook" ]; then
- hook="${ACME_HOOKDIR}/$hook"
- fi
-
- if ! [ -f "$hook" ]; then
- _error "%s: hook does not exist: %s" \
- "$identifier" "$hook"
- return 1
- fi
-
- if ! [ -x "$hook" ]; then
- _error "%s: hook is not executable: %s" \
- "$identifier" "$hook"
+ local _hookpath="$(_findhook "$identifier" "$hook")"
+ if [ "$?" -ne 0 ]; then
return 1
fi
- _rhooks="$_rhooks $hook"
+ _rhooks="$_rhooks $_hookpath"
done
mkdir -p -m0700 "$dir"
@@ -186,8 +188,8 @@ _docert() {
return 1
fi
- _uacme $_uacme_flags \
- -h "${_SHARE}/kerberos-challenge.sh" \
+ _uacme $_uacme_flags \
+ -h "$challenge_path" \
issue "$csrfile"
_ret=$?