Fix admin deleting peer
parent
8acfdc3a52
commit
46886b7d85
|
@ -53,7 +53,7 @@ if ! wg_output="$(sudo /usr/bin/wg show "${TLD}" allowed-ips)"; then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Filter out this user's
|
# Filter out this user's
|
||||||
user_peers="$(grep "${ip%[.:]*}" <<<"${wg_output}" 2>/dev/null)"
|
user_peers="$(grep "${pubkey}" <<<"${wg_output}" 2>/dev/null)"
|
||||||
if [ "${user_peers}" == "" ]; then
|
if [ "${user_peers}" == "" ]; then
|
||||||
printf "ERROR! %s accessed the dashboard but isn't on the network!\n" "${ip}" >>"${LOGFILE}"
|
printf "ERROR! %s accessed the dashboard but isn't on the network!\n" "${ip}" >>"${LOGFILE}"
|
||||||
exit 8
|
exit 8
|
||||||
|
@ -61,7 +61,7 @@ fi
|
||||||
|
|
||||||
# Get peer domains
|
# Get peer domains
|
||||||
if ! peer="$("${LIB_DIR}/ips_to_peers" tsv <<<"${user_peers}" | grep "${pubkey}")"; then
|
if ! peer="$("${LIB_DIR}/ips_to_peers" tsv <<<"${user_peers}" | grep "${pubkey}")"; then
|
||||||
printf 'ERROR! Peer %s not found for user %s!\n' "${pubkey}" "${ip}" >>"${LOGFILE}" &
|
printf 'ERROR! Peer %s not found!\n' "${pubkey}" >>"${LOGFILE}" &
|
||||||
printf 'Peer not found\n' | "${LIB_DIR}/http_res" 404
|
printf 'Peer not found\n' | "${LIB_DIR}/http_res" 404
|
||||||
exit 6
|
exit 6
|
||||||
fi
|
fi
|
||||||
|
|
Loading…
Reference in New Issue