3 ######## Public functions #####################
5 #Usage: dns_knot_add _acme-challenge.www.domain.com "XKrxpRBosdIKFzxW_CT3KLZNf6q0HG9i01zxXp5CPBs"
10 [ -n "${KNOT_SERVER}" ] || KNOT_SERVER
="localhost"
11 # save the dns server and key to the account.conf file.
12 _saveaccountconf KNOT_SERVER
"${KNOT_SERVER}"
13 _saveaccountconf KNOT_KEY
"${KNOT_KEY}"
15 if ! _get_root
"$fulldomain"; then
16 _err
"Domain does not exist."
20 _info
"Adding ${fulldomain}. 60 TXT \"${txtvalue}\""
22 knsupdate
-y "${KNOT_KEY}" <<EOF
25 update add ${fulldomain}. 60 TXT "${txtvalue}"
31 _err
"Error updating domain."
35 _info
"Domain TXT record successfully added."
39 #Usage: dns_knot_rm _acme-challenge.www.domain.com
43 [ -n "${KNOT_SERVER}" ] || KNOT_SERVER
="localhost"
45 if ! _get_root
"$fulldomain"; then
46 _err
"Domain does not exist."
50 _info
"Removing ${fulldomain}. TXT"
52 knsupdate
-y "${KNOT_KEY}" <<EOF
55 update del ${fulldomain}. TXT
61 _err
"error updating domain"
65 _info
"Domain TXT record successfully deleted."
69 #################### Private functions below ##################################
70 # _acme-challenge.www.domain.com
75 i
="$(echo "$fulldomain" | tr '.' ' ' | wc -w)"
79 h
=$
(printf "%s" "$domain" | cut
-d .
-f "$i"-100)
86 _debug
"$domain not found"
91 if [ -z "${KNOT_KEY}" ]; then
92 _err
"You must specify a TSIG key to authenticate the request."