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}\""
26 update add ${fulldomain}. 60 TXT "${txtvalue}"
32 _err
"Error updating domain."
36 _info
"Domain TXT record successfully added."
40 #Usage: dns_knot_rm _acme-challenge.www.domain.com
44 [ -n "${KNOT_SERVER}" ] || KNOT_SERVER
="localhost"
46 if ! _get_root
"$fulldomain"; then
47 _err
"Domain does not exist."
51 _info
"Removing ${fulldomain}. TXT"
57 update del ${fulldomain}. TXT
63 _err
"error updating domain"
67 _info
"Domain TXT record successfully deleted."
71 #################### Private functions below ##################################
72 # _acme-challenge.www.domain.com
77 i
="$(echo "$fulldomain" | tr '.' ' ' | wc -w)"
81 h
=$
(printf "%s" "$domain" | cut
-d .
-f "$i"-100)
88 _debug
"$domain not found"
93 if [ -z "${KNOT_KEY}" ]; then
94 _err
"You must specify a TSIG key to authenticate the request."