let the choice

because it's more clean

enhancement
This commit is contained in:
Super-Baleine 2016-07-12 00:00:50 +02:00
parent b28a29f8f6
commit 72ca23e880

View File

@ -68,7 +68,14 @@ newclient () {
# and to avoid getting an IPv6.
IP=$(ip addr | grep 'inet' | grep -v inet6 | grep -vE '127\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}' | grep -o -E '[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}' | head -1)
if [[ "$IP" = "" ]]; then
read -p "Can I search your ip on Internet ? (y|n) " search_ip
if [[ $search_ip = "y" ]]; then
IP=$(wget -qO- ipv4.icanhazip.com)
else
echo "So, I cannot continue without the server ip...
Exiting...";exit 0;
fi
unset search_ip
fi
@ -126,6 +133,7 @@ if [[ -e /etc/openvpn/server.conf ]]; then
cp /etc/openvpn/easy-rsa/pki/crl.pem /etc/openvpn/crl.pem
echo ""
echo "Certificate for client $CLIENT revoked"
echo "Exiting..."
exit
;;
3)
@ -220,8 +228,10 @@ else
done
echo ""
echo "Finally, tell me your name for the client cert"
while [[ $CLIENT = "" ]]; do
echo "Please, use one word only, no special characters"
read -p "Client name: " -e -i client CLIENT
done
echo ""
echo "Okay, that was all I needed. We are ready to setup your OpenVPN server now"
read -n1 -r -p "Press any key to continue..."
@ -489,3 +499,4 @@ tls-client" > /etc/openvpn/client-common.txt
echo "Your client config is available at ~/$CLIENT.ovpn"
echo "If you want to add more clients, you simply need to run this script another time!"
fi
exit 0;