Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I've run into a problem, that I removed certificate files from the server.

But client that has these files still can connect.

I've found out, that I should revoke the certificate and that this can be done by changing line with that certificate in

/etc/openvpn/easy-rsa/keys/index.txt

to have R, not V, as first character line.

But previously I've removed line for that certificate from the file, because attempt to generate that certificate again just gave an 0 byte size file.

As I've read, it shouldn't be able to connect after removing from index.txt, but it does connect.

What may cause the problem and how am I able to disallow that particular certificate to connect?

I want be able to create certificate with same name, CN, and other vars I set for each certificate, as the one being disallowed - newly created certificate should have the ability to connect.

EDIT:

Solution was undoing changes in index.txt (changing R back to V in cert I wished to revoke) and generating CRL in easy-rsa, which was missing.
The index.txt mustn't be manually changed in way I did it, because it was lacking revoke date and did not allow me to generate missing CRL. I found out, that revocation should be done by /etc/openvpn/easy-rsa/revoke-full <cert name>, with all vars as when cert was generated, in my case.

share|improve this question

1 Answer 1

up vote 2 down vote accepted

The plain answer is it does not work because you've got it all wrong.

Your basic misconception seems to lie in the idea that OpenVPN and the Certificate Authority do have a communication channel so OpenVPN would automagically know which certificates you want to allow. This is not the case. OpenVPN and the Certificate Authority are completely separate entities (even if they both reside on the same host) and do not have any communication whatsoever between each other.

The CA "signs" certification requests (basically public keys bundled with identification information like the host name) by encrypting a hash of the certification request with its own private key. What OpenVPN does is checking whether a) it can decrypt the hash using the public key of the CA (which it has, typically residing in a ca.crt file somewhere) and checking if the hash is correct for the given certificate. It does not require nor use any "live" connections to the CA for any of this.

You cannot revoke a certificate by deleting it from the CA's directory (note that if you have deleted the client certificate and it was your only copy, openssl ca would not allow you revoke it any more) or changing the index.txt (this file is just an indication for openssl ca about the state of the available certificates). What you need to do instead is

  1. run openssl ca -revoke <certificate file> to revoke the certificate in the internal OpenSSL CA database (basically adding the revocation information in the index.txt)
  2. create a certificate revocation list using openssl ca -gencrl -out ca.crl
  3. copy this revocation list to the OpenVPN revocation list file (see the crl-verify directive in the OpenVPN config file)
  4. see OpenVPN deny the connection on the next certificate check

If you are using the easy-rsa shell wrapper script set for OpenSSL CA, see the OpenVPN section on certificate revocation for a more detailed documentation on how to achieve the above using the easy-rsa scripts. The basic procedure is

# cd into the easy-rsa directory
cd <somewhere>/easy-rsa
# load your CA-related variables into the shell environment from the ./vars file
. ./vars
# run the revoke script for <clientcert.pem>
./revoke-full clientcert

you would find the crl.pem in the $KEY_DIR directory as defined in your ./vars file.

share|improve this answer
    
i think i've done something really wrong when i was setting up that server. when i'm trying to revoke cert, with any method, i get: unable to load CA private key and it doesn't seem to be easy to solve. i hadn't cakey.pem and created it, but it occurs for something more. –  tymik Jan 28 '13 at 11:14
    
@tymik you certainly would have had the CA key at the time you have got the certificates signed, I suspect it still is somewhere. Take a look at my answer's edit and see if the "easy-rsa way" works out in your config. If it doesn't, scrap your CA, re-issue new certificates (including the CA's) and make sure not to break it this time. This might mean some work depending on how many clients you would have to re-configure, but keeping an unmanageable CA would usually be the least favorable option. –  the-wabbit Jan 28 '13 at 16:30
    
i've had problems caused by partial hints i found earlier - as i followed them, i messed some things and it kept me failing with easy-rsa scripts and also with generating CRL. the R instead of V, as in question, was one of my problem - i changed it manually and then i had problem to generate CRL, because i "had invalid revoke date" in index.txt - i hadn't such date there at all, as didn't know about it. but i've managed to cleanup that whole mess and revoking works now. –  tymik Jan 28 '13 at 20:47

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.