Generate OpenSSL CRL file without a configuration file

Viewed 1251

I have a basic nginx home server setup which i use Client certificates to allow outside access. I have followed this guide to get everything setup which works as expected:

https://gist.github.com/rkaramandi/20a04a41536f3d7e6d2f26b0b9605ab6

in summary:

openssl genrsa -aes256 -out ca.privkey 4096
openssl req -new -x509 -days 365 -key ca.privkey -out ca.crt

openssl genrsa -aes256 -out bobs-ipad.privkey 4096
openssl req -new -out bobs-ipad.csr -key bobs-ipad.privkey 
openssl x509 -req -days 365 -in bobs-ipad.csr -CA ca.crt -CAkey ca.privkey -set_serial 100 -out bobs-ipad.crt
openssl pkcs12 -export -clcerts -in bobs-ipad.crt -inkey bobs-ipad.privkey -out bobs-ipad.p12

Also openssl pkcs12 -in bobs-ipad.p12 -out bobs-ipad.pem -nodes to generate a pem file as well.

And in nginx config:

    ssl_client_certificate <path>/ca.crt;
#    ssl_crl <path>/ca.crl;
    ssl_verify_client optional;

...
   location / {
        if ($ssl_client_verify != SUCCESS) {
            return 403;
        }


I am able to access the server from outside and only signed certificates on the client machine allow access.

However if one of the signed certificates were to be compromised i'd have to re-generate the CA and re-distribute the new signed client certificates. I understand that a CRL file can be used to revoke certificates using ssl_crl <path to crl>; in the nginx config but i am not sure to generate this using the guide i followed.

A command like this can be used openssl ca -gencrl -keyfile ca.privkey -cert ca.crt -out ca.crl

But this relies on a configuration file with an index of the certificates i believe?

Is there anyway of using a command like the above to input a (or list of) pem or p12 client certificate(s) -in bobs-ipad.pem that i want to revoke?

If not perhaps i need to start again and have a config with index file to then -revoke the certificates and re-generate the crl file.

Thanks in advance,

Richard

1 Answers
Related