Exit, afer easyrsa errors

If easyrsa returns an error on creation or revoke client cert, do not continue the rest of script,
This commit is contained in:
Henry N 2020-04-04 21:02:21 +02:00 committed by GitHub
parent 7e7a494f59
commit 9af10ff24b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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"