Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I verify client certificates against a CRL in Golang?

Tags:

ssl

go

tls1.2

I'm using the ClientCAs and ClientAuth options in tls.Config to do cert-based client authentication in my Go HTTP application. Is it possible to also verify the client certs against a provided CRL? I see in the x509 package there are some functions around CRLs, but I'm not sure how to configure the HTTP server to use them (ie. there doesn't seem to be any options in tls.Config that would cause a CRL to also be used).

like image 939
Bryan Avatar asked May 05 '16 19:05

Bryan


People also ask

Does Golang support OCSP and CRL?

Unfortunately, even though Golang has native support for TLS, it has extremely limited support for OCSP and CRL. OCSP and CRL provide a way to verify whether the TLS certificate was revoked by CA before the application establishes secure communication with a service that uses this certificate.

How to check if a certificate is a CRL?

Open a certificate you want to check against and go to the Details tab and scroll down to the CRL Distribution Points. Here you will see the URL of the web server hosting the CRL. You can copy out the full URL including the .crl file details. If you paste the URL into a broswer, this will download the CRL file.

How do I troubleshoot CRLs?

We have two whitepapers about CRL troubleshooting: Certutil.exe is the command-line tool to verify certificates and CRLs. To get reliable verification results, you must use certutil.exe because the Certificate MMC Snap-In does not verify the CRL of certificates.

What is a CCLR certificate?

CRL stands for Certificate Revocation List and is one way to validate a certificate status. It is an alternative to the OCSP, Online Certificate Status Protocol. You can read more about CRL's on Wikipedia. If you want to validate a certificate against an OCSP, see my article on that here.


1 Answers

Is it possible to also verify the client certs against a provided CRL?

Yes, it is possible, by means of the functionality provided in the crypto/x509 package (as you correctly stated in your question). However, higher-level interfaces such as crypto/tls.Config (consumed by net/http) do not offer that. A good chance to implement a check against a CRL probably is by inspecting net/http.Request.TLS.PeerCertificates.

A little bit of background: crypto/tls is maintained by security expert Adam Langley who has an opinion on revocation checking (original source is his blog). Though I have no evidence, one might assume that this was a deliberate design decision.

like image 71
Lorenz Leutgeb Avatar answered Sep 22 '22 06:09

Lorenz Leutgeb