Skip to content

Commit

Permalink
fix: Approve CLIENT_NAME without checking config file
Browse files Browse the repository at this point in the history
  • Loading branch information
lony committed Mar 16, 2024
1 parent a01b3cf commit f285af5
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion wireguard-install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down

0 comments on commit f285af5

Please sign in to comment.