diff options
| author | Lexi Winter <ivy@FreeBSD.org> | 2025-06-04 10:42:19 +0100 |
|---|---|---|
| committer | Lexi Winter <ivy@FreeBSD.org> | 2025-06-04 10:56:04 +0100 |
| commit | 15010d062ae276a92065cd6ea7dc94b749e20756 (patch) | |
| tree | 8745f89f933826afbb329b4fc447186a1200610d /http.sh.in | |
| parent | 09aa3870070960d37d7bdbb724f4ac7b68395fdf (diff) | |
| download | lfacme-15010d062ae276a92065cd6ea7dc94b749e20756.tar.gz lfacme-15010d062ae276a92065cd6ea7dc94b749e20756.tar.bz2 | |
allow PREFIX to be customised
Diffstat (limited to 'http.sh.in')
| -rw-r--r-- | http.sh.in | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/http.sh.in b/http.sh.in new file mode 100644 index 0000000..048870e --- /dev/null +++ b/http.sh.in @@ -0,0 +1,51 @@ +#! /bin/sh +# This source code is released into the public domain. + +. __LIBDIR__/init.sh + +# begin, done or failed +ACTION=$1 +# ACME method, must be http-01. +METHOD=$2 +# The full domain name we're authorising. +DOMAIN=$3 +# Token name. +TOKEN=$4 +# The token value we need to create. +AUTH=$5 + +if [ "$#" -ne 5 ]; then + _fatal "missing arguments" +fi + +if [ "$METHOD" != "http-01" ]; then + exit 1 +fi + +if [ -z "$ACME_HTTP_CHALLENGE_DIR" ]; then + _fatal "must set ACME_HTTP_CHALLENGE_DIR" +fi + +if ! [ -d "$ACME_HTTP_CHALLENGE_DIR" ]; then + _fatal "missing $ACME_HTTP_CHALLENGE_DIR" +fi + +_file="${ACME_HTTP_CHALLENGE_DIR}/${TOKEN}" + +case "$ACTION" in + begin) + _verbose "creating validation token %s" "$_file" + echo "$AUTH" >"$_file" + exit $? + ;; + + done|failed) + _verbose "deleting validation token %s" "$_file" + rm -f "$_file" + exit $? + ;; + + *) + _fatal "unknown action: %s" "$ACTION" + ;; +esac |
