diff options
author | Julian Gaal <22290570+juliangaal@users.noreply.github.com> | 2020-11-24 15:33:39 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-11-24 15:33:39 +0100 |
commit | af935850cd233843c910cb1877294c4ac6115b9c (patch) | |
tree | c1a10dca58ca32e434083fbd16c51a1432d2172a /wireguard-install.sh | |
parent | a1b1ac2ececa50d35a6ddd078a86dd6f28003fb3 (diff) |
Forbid interface names exceeding 15 chars in length (#157)
Diffstat (limited to 'wireguard-install.sh')
-rw-r--r-- | wireguard-install.sh | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/wireguard-install.sh b/wireguard-install.sh index 9e09caa..cd0b5e0 100644 --- a/wireguard-install.sh +++ b/wireguard-install.sh @@ -79,7 +79,7 @@ function installQuestions() { read -rp "Public interface: " -e -i "${SERVER_NIC}" SERVER_PUB_NIC done - until [[ ${SERVER_WG_NIC} =~ ^[a-zA-Z0-9_]+$ ]]; do + until [[ ${SERVER_WG_NIC} =~ ^[a-zA-Z0-9_]+$ && ${#SERVER_WG_NIC} -lt 16 ]]; do read -rp "WireGuard interface name: " -e -i wg0 SERVER_WG_NIC done @@ -219,9 +219,9 @@ function newClient() { echo "" echo "Tell me a name for the client." - echo "The name must consist of alphanumeric character. It may also include an underscore or a dash." + echo "The name must consist of alphanumeric character. It may also include an underscore or a dash and can't exceed 15 chars." - until [[ ${CLIENT_NAME} =~ ^[a-zA-Z0-9_-]+$ && ${CLIENT_EXISTS} == '0' ]]; do + 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") |