mirror of
https://github.com/Nyr/openvpn-install.git
synced 2024-11-24 05:56:08 +03:00
check if selected client to revoke does exist
This commit is contained in:
parent
33452242a1
commit
f778282002
@ -110,6 +110,18 @@ if [[ -e /etc/openvpn/server.conf ]]; then
|
|||||||
else
|
else
|
||||||
read -p "Select one client [1-$NUMBEROFCLIENTS]: " CLIENTNUMBER
|
read -p "Select one client [1-$NUMBEROFCLIENTS]: " CLIENTNUMBER
|
||||||
fi
|
fi
|
||||||
|
#check if selected client does exist
|
||||||
|
if [[ !("$CLIENTNUMBER" =~ ^[0-9]+$) ]]; then
|
||||||
|
echo ""
|
||||||
|
echo "error: please enter a valid number!"
|
||||||
|
exit
|
||||||
|
fi
|
||||||
|
if [[ "$CLIENTNUMBER" < "1" || "$CLIENTNUMBER" > "$NUMBEROFCLIENTS" || ${#CLIENTNUMBER} != ${#NUMBEROFCLIENTS} ]]; then
|
||||||
|
echo ""
|
||||||
|
echo "error: could not find client number $CLIENTNUMBER."
|
||||||
|
exit
|
||||||
|
fi
|
||||||
|
echo "INPUT: $CLIENTNUMBER"
|
||||||
CLIENT=$(tail -n +2 /etc/openvpn/easy-rsa/pki/index.txt | grep "^V" | cut -d '=' -f 2 | sed -n "$CLIENTNUMBER"p)
|
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/
|
cd /etc/openvpn/easy-rsa/
|
||||||
./easyrsa --batch revoke $CLIENT
|
./easyrsa --batch revoke $CLIENT
|
||||||
|
Loading…
Reference in New Issue
Block a user