mirror of
https://github.com/Nyr/openvpn-install.git
synced 2024-11-24 05:56:08 +03:00
add option to exit
This commit is contained in:
parent
33452242a1
commit
0f2c2ab54f
@ -75,7 +75,7 @@ if [[ -e /etc/openvpn/server.conf ]]; then
|
||||
echo ""
|
||||
echo "What do you want to do?"
|
||||
echo " 1) Add a new user"
|
||||
echo " 2) Revoke an existing user"
|
||||
echo " 2) Show and revoke existing users"
|
||||
echo " 3) Remove OpenVPN"
|
||||
echo " 4) Exit"
|
||||
read -p "Select an option [1-4]: " option
|
||||
@ -106,9 +106,12 @@ if [[ -e /etc/openvpn/server.conf ]]; then
|
||||
echo "Select the existing client certificate you want to revoke"
|
||||
tail -n +2 /etc/openvpn/easy-rsa/pki/index.txt | grep "^V" | cut -d '=' -f 2 | nl -s ') '
|
||||
if [[ "$NUMBEROFCLIENTS" = '1' ]]; then
|
||||
read -p "Select one client [1]: " CLIENTNUMBER
|
||||
read -p "Select one client [1] or 'x' to exit: " CLIENTNUMBER
|
||||
else
|
||||
read -p "Select one client [1-$NUMBEROFCLIENTS]: " CLIENTNUMBER
|
||||
read -p "Select one client [1-$NUMBEROFCLIENTS] or 'x' to exit: " CLIENTNUMBER
|
||||
fi
|
||||
if [[ "$CLIENTNUMBER" = 'x' ]]; then
|
||||
exit
|
||||
fi
|
||||
CLIENT=$(tail -n +2 /etc/openvpn/easy-rsa/pki/index.txt | grep "^V" | cut -d '=' -f 2 | sed -n "$CLIENTNUMBER"p)
|
||||
cd /etc/openvpn/easy-rsa/
|
||||
@ -422,4 +425,4 @@ verb 3" > /etc/openvpn/client-common.txt
|
||||
echo ""
|
||||
echo "Your client configuration is available at" ~/"$CLIENT.ovpn"
|
||||
echo "If you want to add more clients, you simply need to run this script again!"
|
||||
fi
|
||||
fi
|
||||
|
Loading…
Reference in New Issue
Block a user