From 6908b71140f8fc02b8c1e5b4bd0ec67535bd277e Mon Sep 17 00:00:00 2001 From: Keith Irwin Date: Sat, 10 Sep 2022 09:17:19 -0600 Subject: [PATCH] More debugging and logging --- back/lib/ns_update_add | 8 ++++++++ back/lib/wg_peer_add | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/back/lib/ns_update_add b/back/lib/ns_update_add index 0c856d7..8b2cd37 100755 --- a/back/lib/ns_update_add +++ b/back/lib/ns_update_add @@ -12,6 +12,14 @@ CONFIG_FILE='/etc/wgapi/config' [ -f "${CONFIG_FILE}" ] || exit 4 source "${CONFIG_FILE}" +printf "update add ${1}. ${DNS_TTL} A ${2} +update add ${1}. ${DNS_TTL} AAAA ${3} +update add *.${1}. ${DNS_TTL} CNAME ${1}. +send +update add $("${LIB_DIR}/ns_update_rev_ipv4" "${2}") ${DNS_TTL} PTR ${1}. +send +update add $("${LIB_DIR}/ns_update_rev_ipv6" "${3}") ${DNS_TTL} PTR ${1}." + "${LIB_DIR}/ns_update_send" "update add ${1}. ${DNS_TTL} A ${2} update add ${1}. ${DNS_TTL} AAAA ${3} update add *.${1}. ${DNS_TTL} CNAME ${1}. diff --git a/back/lib/wg_peer_add b/back/lib/wg_peer_add index f6cb636..f7e0c88 100755 --- a/back/lib/wg_peer_add +++ b/back/lib/wg_peer_add @@ -21,7 +21,7 @@ CONFIG_FILE='/etc/wgapi/config' source "${CONFIG_FILE}" set -x -res="$(sudo /usr/bin/wg set "${TLD}" peer "${1}" preshared-key <(printf '%s' "${2}") allowed-ips "${3}" 2>&1)" || ( +res="$(sudo /usr/bin/wg set "${TLD}" peer "${1}" preshared-key <(printf '%s\n' "${2}") allowed-ips "${3}" 2>&1)" || ( printf '%s %s\n' "${?}" "${res}" >>"${LOGFILE}" exit 6 )