From 9af10ff24bed5579b36ced4462eabcf5397e5d9e Mon Sep 17 00:00:00 2001 From: Henry N Date: Sat, 4 Apr 2020 21:02:21 +0200 Subject: [PATCH] Exit, afer easyrsa errors If easyrsa returns an error on creation or revoke client cert, do not continue the rest of script, --- openvpn-install.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/openvpn-install.sh b/openvpn-install.sh index a9f1a03..9f166ea 100755 --- a/openvpn-install.sh +++ b/openvpn-install.sh @@ -1029,11 +1029,11 @@ function newClient () { cd /etc/openvpn/easy-rsa/ || return case $PASS in 1) - ./easyrsa build-client-full "$CLIENT" nopass + ./easyrsa build-client-full "$CLIENT" nopass || exit $? ;; 2) echo "⚠️ You will be asked for the client password below ⚠️" - ./easyrsa build-client-full "$CLIENT" + ./easyrsa build-client-full "$CLIENT" || exit $? ;; esac @@ -1109,7 +1109,7 @@ function revokeClient () { 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/ || return - ./easyrsa --batch revoke "$CLIENT" + ./easyrsa --batch revoke "$CLIENT" || exit $? EASYRSA_CRL_DAYS=3650 ./easyrsa gen-crl # Cleanup rm -f "pki/reqs/$CLIENT.req"