Fixed wrong var used
parent
e6c6e73538
commit
bc82390803
|
@ -61,8 +61,8 @@ saved_token="$(grep "${ip}" "${TOKENS_FILE}" | cut -f2)"
|
|||
printf '%s token was valid\n' "${ip}" >>"${LOGFILE}"
|
||||
|
||||
# Check user
|
||||
username="$("${LIB_DIR}/ns_lookup_rdns" "${REMOTE_ADDR}" | cut -d'.' -f2)" || (
|
||||
printf 'User not found for %s\n' "${REMOTE_ADDR}" >>"${LOGFILE}"
|
||||
username="$("${LIB_DIR}/ns_lookup_rdns" "${ip}" | cut -d'.' -f2)" || (
|
||||
printf 'User not found for %s\n' "${ip}" >>"${LOGFILE}"
|
||||
printf 'User not found' | "${LIB_DIR}/http_res" 403
|
||||
exit 17
|
||||
)
|
||||
|
@ -85,7 +85,7 @@ peers="$("${LIB_DIR}/wg_peer_list" "${1}" tsv)" || exit 10
|
|||
hostnames="$(<<<"${peers}" awk '{print $1}' | cut -d'.' -f1)"
|
||||
ipv4s="$(<<<"${peers}" awk '{print $2}')"
|
||||
ipv6s="$(<<<"${peers}" awk '{print $3}')"
|
||||
usernumber="$(<<<"${ipv4s}" head -n1 | cut -d'.' -f3)"
|
||||
u="$(<<<"${ipv4s}" head -n1 | cut -d'.' -f3)"
|
||||
# Increment hostnumber from 1 until an unused one is found
|
||||
used_hostnumbers="$(<<<"${ipv4s}" cut -d'.' -f4 | sort | uniq)"
|
||||
hostnumber=1; while <<<"${used_hostnumbers}" grep -q "${hostnumber}"
|
||||
|
@ -104,7 +104,6 @@ privkey="$(/usr/bin/wg genkey)"
|
|||
pubkey="$(echo "${privkey}" | /usr/bin/wg pubkey)"
|
||||
address="${ipv4}/${IPV4_NET##*/},${ipv6}/${IPV6_NET##*/}"
|
||||
|
||||
|
||||
# Update nameserver
|
||||
if "${LIB_DIR}/ns_update_add" "${domain:?}" "${ipv4:?}" "${ipv6:?}"
|
||||
then printf 'Successfully added %s to DNS server.\n' "${domain}" >>"${LOGFILE}"
|
||||
|
|
Loading…
Reference in New Issue