big svn cleanup
[anytun.git] / src / openvpn / easy-rsa / 2.0 / revoke-full
blobbf3e5fbf3c63186d25e8239730deee86059c1bcc
1 #!/bin/bash
3 # revoke a certificate, regenerate CRL,
4 # and verify revocation
6 CRL="crl.pem"
7 RT="revoke-test.pem"
9 if [ $# -ne 1 ]; then
10 echo "usage: revoke-full <common-name>";
11 exit 1
14 if [ "$KEY_DIR" ]; then
15 cd "$KEY_DIR"
16 rm -f "$RT"
18 # set defaults
19 export KEY_CN=""
20 export KEY_OU=""
22 # revoke key and generate a new CRL
23 $OPENSSL ca -revoke "$1.crt" -config "$KEY_CONFIG"
25 # generate a new CRL -- try to be compatible with
26 # intermediate PKIs
27 $OPENSSL ca -gencrl -out "$CRL" -config "$KEY_CONFIG"
28 if [ -e export-ca.crt ]; then
29 cat export-ca.crt "$CRL" >"$RT"
30 else
31 cat ca.crt "$CRL" >"$RT"
34 # verify the revocation
35 $OPENSSL verify -CAfile "$RT" -crl_check "$1.crt"
36 else
37 echo 'Please source the vars script first (i.e. "source ./vars")'
38 echo 'Make sure you have edited it to reflect your configuration.'