2022-05-24 14:47:14 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
#
|
|
|
|
# Revoke a client certificate
|
|
|
|
#
|
|
|
|
|
|
|
|
if [ "$DEBUG" == "1" ]; then
|
|
|
|
set -x
|
|
|
|
fi
|
|
|
|
|
|
|
|
set -e
|
|
|
|
|
|
|
|
if [ -z "$OPENVPN" ]; then
|
|
|
|
export OPENVPN="$PWD"
|
|
|
|
fi
|
|
|
|
if [ -z "$EASYRSA_PKI" ]; then
|
|
|
|
export EASYRSA_PKI="$OPENVPN/pki"
|
|
|
|
fi
|
|
|
|
|
|
|
|
cn="$1"
|
|
|
|
|
|
|
|
if [ ! -f "$EASYRSA_PKI/private/${cn}.key" ]; then
|
2022-07-07 12:44:39 +00:00
|
|
|
echo "Unable to find \"${cn}\"" >&2
|
2022-05-24 14:47:14 +00:00
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2022-07-07 12:44:39 +00:00
|
|
|
export EASYRSA_BATCH="True"
|
|
|
|
|
|
|
|
easyrsa revoke "$cn"
|
|
|
|
echo "Revoked $cn"
|
|
|
|
|
|
|
|
echo "Updating crl.pem"
|
|
|
|
easyrsa gen-crl
|
2022-05-24 14:47:14 +00:00
|
|
|
|
2022-07-07 12:44:39 +00:00
|
|
|
rm -f $OPENVPN/pki/issued/$cn.crt $OPENVPN/pki/private/$cn.key $OPENVPN/pki/reqs/$cn.req $OPENVPN/otp/$cn.google_authenticator
|