Neeeeeed token

master
Keith Irwin 2022-09-15 21:35:56 -06:00
parent 408736b75b
commit e17047184c
Signed by: ki9
GPG Key ID: DF773B3F4A88DA86
1 changed files with 2 additions and 2 deletions

View File

@ -41,7 +41,7 @@ if [ "${token}" == "" ]; then
printf 'Creating token for %s...\n' "${ip}" >>"${LOGFILE}"
token="$(</dev/urandom tr -dc '[:alnum:]' | fold -w64 | head -n1)"
printf '%s\t%s\n' "${ip}" "${token}" >>"${TOKENS_FILE}"
fi &
fi
# Get peer IP list
if ! peers="$(sudo /usr/bin/wg show "${TLD}" allowed-ips)"; then
@ -62,7 +62,7 @@ fi
# Get domains for each peer
if peers="[$("${LIB_DIR}/ips_to_peers" json <<<"${peers}")]"; then
printf '{"token":"%s","peers":%s}' "${token}" "${peers}" | "${LIB_DIR}/http_res" 200 'application/json'
printf '{"token":"%s","peers":%s}' "${token!}" "${peers!}" | "${LIB_DIR}/http_res" 200 'application/json'
printf 'Sent peers to admin %s\n' "${ip}" >>"${LOGFILE}"
else
printf 'ERROR: Failed to lookup user: %s\n' "${ip}" >>"${LOGFILE}"