1
1
mirror of https://github.com/angristan/wireguard-install.git synced 2024-06-05 21:10:48 +00:00

Block subnet when asking client's internal IP

This commit is contained in:
randomshell 2020-07-02 23:04:21 +00:00
parent b5509d5192
commit 9cab30284e

View File

@ -35,7 +35,8 @@ function addClient() {
done
until [[ "$IPV4_EXISTS" == '0' ]]; do
read -rp "Client's WireGuard IPv4: " -e -i "${SERVER_WG_IPV4: : -1}${DOT_IP}" CLIENT_WG_IPV4
read -rp "Client's WireGuard IPv4: ${SERVER_WG_IPV4: : -1}" -e -i "${DOT_IP}" DOT_IP
CLIENT_WG_IPV4="${SERVER_WG_IPV4: : -1}${DOT_IP}"
IPV4_EXISTS=$(grep -c "$CLIENT_WG_IPV4" "/etc/wireguard/$SERVER_WG_NIC.conf")
if [[ $IPV4_EXISTS == '1' ]]; then
@ -46,7 +47,8 @@ function addClient() {
done
until [[ "$IPV6_EXISTS" == '0' ]]; do
read -rp "Client's WireGuard IPv6: " -e -i "${SERVER_WG_IPV6: : -1}${DOT_IP}" CLIENT_WG_IPV6
read -rp "Client's WireGuard IPv6: ${SERVER_WG_IPV6: : -1}" -e -i "${DOT_IP}" DOT_IP
CLIENT_WG_IPV6="${SERVER_WG_IPV6: : -1}${DOT_IP}"
IPV6_EXISTS=$(grep -c "$CLIENT_WG_IPV6" "/etc/wireguard/$SERVER_WG_NIC.conf")
if [[ $IPV6_EXISTS == '1' ]]; then