From e553b5e7bd27b7fc3b78a21769a7c150b07869a5 Mon Sep 17 00:00:00 2001 From: David Bailey Date: Sun, 16 Oct 2016 10:20:01 +0100 Subject: [PATCH] Check if client name is empty or contains spaces --- openvpn-install.sh | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/openvpn-install.sh b/openvpn-install.sh index 7ca4bf2..288bb6b 100644 --- a/openvpn-install.sh +++ b/openvpn-install.sh @@ -84,8 +84,10 @@ if [[ -e /etc/openvpn/server.conf ]]; then 1) echo "" echo "Tell me a name for the client cert" - echo "Please, use one word only, no special characters" - read -p "Client name: " -e -i client CLIENT + while [[ "$CLIENT" =~ ' ' || "$CLIENT" == '' ]]; do + echo "Please, use one word only, no special characters" + read -p "Client name: " -e -i client CLIENT + done cd /etc/openvpn/easy-rsa/ ./easyrsa build-client-full $CLIENT nopass # Generates the custom client.ovpn