1
1
mirror of https://github.com/namibia/openvpn-install.git synced 2024-12-23 07:18:54 +00:00

Update check on the client's name input

This commit is contained in:
Angristan 2018-08-18 19:55:36 +02:00
parent 9ef0bbc47d
commit 47c86874dc

View File

@ -122,9 +122,11 @@ if [[ -e /etc/openvpn/server.conf ]]; then
done
echo ""
echo "Tell me a name for the client cert"
echo "Please, use one word only, no special characters"
echo "Use one word only, no special characters"
until [[ "$CLIENT" =~ ^[a-zA-Z0-9_]+$ ]]; do
read -rp "Client name: " -e CLIENT
done
read -rp "Client name: " -e -i newclient CLIENT
cd /etc/openvpn/easy-rsa/ || return
case $pass in
1)
@ -390,11 +392,9 @@ else
done
echo ""
echo "Finally, tell me a name for the client certificate and configuration"
while [[ $CLIENT = "" ]]; do
echo "Please, use one word only, no special characters"
read -rp "Client name: " -e -i client CLIENT
# Remove special characters
CLIENT=$(echo $CLIENT | tr -dc '[:alnum:]\n\r')
echo "Use one word only, no special characters"
until [[ "$CLIENT" =~ ^[a-zA-Z0-9_]+$ ]]; do
read -rp "Client name: " -e CLIENT
done
echo ""
echo "Okay, that was all I needed. We are ready to setup your OpenVPN server now"