mirror of
https://github.com/angristan/openvpn-install.git
synced 2024-12-04 14:35:31 +01:00
Update regex check for existing clients and make it idempotent again
See https://github.com/angristan/openvpn-install/issues/652#issuecomment-650372450
This commit is contained in:
parent
b2888fa514
commit
106a2ce3c9
@ -1068,11 +1068,10 @@ function newClient() {
|
|||||||
read -rp "Select an option [1-2]: " -e -i 1 PASS
|
read -rp "Select an option [1-2]: " -e -i 1 PASS
|
||||||
done
|
done
|
||||||
|
|
||||||
CLIENTEXISTS=$(tail -n +2 /etc/openvpn/easy-rsa/pki/index.txt | grep -c -E "/CN=$CLIENT\$")
|
CLIENTEXISTS=$(tail -n +2 /etc/openvpn/easy-rsa/pki/index.txt | grep -c -E "^V.*/CN=$CLIENT\$")
|
||||||
if [[ $CLIENTEXISTS == '1' ]]; then
|
if [[ $CLIENTEXISTS == '1' ]]; then
|
||||||
echo ""
|
echo ""
|
||||||
echo "The specified client CN was already found in easy-rsa, please choose another name."
|
echo "The specified client CN was already found in easy-rsa."
|
||||||
exit
|
|
||||||
else
|
else
|
||||||
cd /etc/openvpn/easy-rsa/ || return
|
cd /etc/openvpn/easy-rsa/ || return
|
||||||
case $PASS in
|
case $PASS in
|
||||||
|
Loading…
Reference in New Issue
Block a user