From 63f6a3181fea59360b2bfe430f5c798f88b22527 Mon Sep 17 00:00:00 2001 From: Lexi Winter Date: Wed, 4 Jun 2025 08:51:26 +0100 Subject: add a TSIG-based dns validation handler while here, reorganise and improve documentation a bit. --- dns.sh | 78 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 78 insertions(+) create mode 100644 dns.sh (limited to 'dns.sh') diff --git a/dns.sh b/dns.sh new file mode 100644 index 0000000..9b26bd3 --- /dev/null +++ b/dns.sh @@ -0,0 +1,78 @@ +#! /bin/sh +# This source code is released into the public domain. + +. /usr/local/share/lfacme/init.sh +. /usr/local/share/lfacme/dnsutils.sh + +# begin, done or failed +ACTION=$1 +# ACME method, must be dns-01. +METHOD=$2 +# This is the full domain name we're authorising. +DOMAIN=$3 +# Token name, not used for dns-01. +TOKEN=$4 +# The token value we need to create. +AUTH=$5 + +if [ "$#" -ne 5 ]; then + _fatal "missing arguments" +fi + +if [ "$METHOD" != "dns-01" ]; then + exit 1 +fi + +if [ -z "$ACME_DNS_KEYFILE" ]; then + _fatal "ACME_DNS_KEYFILE not configured" +fi + +# Add a new record using nsupdate. +_add_record() { + local domain="$1" + local auth="$2" + + nsupdate -k "$ACME_DNS_KEYFILE" <