diff options
| author | Lexi Winter <lexi@le-fay.org> | 2025-06-04 12:46:22 +0100 |
|---|---|---|
| committer | Lexi Winter <lexi@le-fay.org> | 2025-06-04 12:46:22 +0100 |
| commit | a08a66d7ee07a2fc27cbe17c85e78c7e34076131 (patch) | |
| tree | 48b2b06b51556f6f6ec755bd17759b364aa2d74d /ualpn.sh.in | |
| parent | 927f3abdc469775f666e5778edfa9693663b4871 (diff) | |
| download | lfacme-a08a66d7ee07a2fc27cbe17c85e78c7e34076131.tar.gz lfacme-a08a66d7ee07a2fc27cbe17c85e78c7e34076131.tar.bz2 | |
add a challenge handler for ualpn(1)
Diffstat (limited to 'ualpn.sh.in')
| -rw-r--r-- | ualpn.sh.in | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/ualpn.sh.in b/ualpn.sh.in new file mode 100644 index 0000000..372ed27 --- /dev/null +++ b/ualpn.sh.in @@ -0,0 +1,55 @@ +#! /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" != "tls-alpn-01" ]; then + exit 1 +fi + +case "$ACTION" in + begin) + _verbose "creating validation token %s" "$_file" + status="$(ualpn <<EOF +auth ${DOMAIN} ${AUTH} +EOF +)" + if [ "$status" = "OK" ]; then + exit 0 + else + exit 1 + fi + ;; + + done|failed) + _verbose "deleting validation token %s" "$_file" + status="$(ualpn <<EOF +unauth ${DOMAIN} +EOF +)" + if [ "$status" = "OK" ]; then + exit 0 + else + exit 1 + fi + ;; + + *) + _fatal "unknown action: %s" "$ACTION" + ;; +esac |
