From f285af5743bfe99c7a941cf5467c1db500c7f404 Mon Sep 17 00:00:00 2001 From: Goetz Epperlein Date: Sat, 16 Mar 2024 20:37:01 +0100 Subject: [PATCH] fix: Approve CLIENT_NAME without checking config file --- wireguard-install.sh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/wireguard-install.sh b/wireguard-install.sh index 5a852a1..f7b5ab0 100644 --- a/wireguard-install.sh +++ b/wireguard-install.sh @@ -331,7 +331,10 @@ function newClient() { echo "" echo "The client name must consist of alphanumeric character(s). It may also include underscores or dashes and can't exceed 15 chars." - CLIENT_EXISTS=$(grep -c -E "^### Client ${CLIENT_NAME}\$" "/etc/wireguard/${SERVER_WG_NIC}.conf") + if [[ ${APPROVE_INSTALL} == "y" ]]; then + CLIENT_EXISTS="0" + fi + until [[ ${CLIENT_NAME} =~ ^[a-zA-Z0-9_-]+$ && ${CLIENT_EXISTS} == '0' && ${#CLIENT_NAME} -lt 16 ]]; do read -rp "Client name: " -e CLIENT_NAME CLIENT_EXISTS=$(grep -c -E "^### Client ${CLIENT_NAME}\$" "/etc/wireguard/${SERVER_WG_NIC}.conf")