DEV Community

Validating Client Certificate SANs in Go

Jeremy Mill on January 24, 2019

Go has one of the best TLS libraries available in any programming language, for it's my language of choice for doing networking tasks. So I was a b...
Collapse
 
living_syn profile image
Jeremy Mill

Note: Huge thanks to Filippo Valsorda (github.com/FiloSottile) for his help pointing me in the right direction on how to do this here

Collapse
 
marcmagnin profile image
Marc Magnin • Edited

I was wondering if we couldn't use tls.VerifyHostname for that check also: golang.org/src/crypto/tls/conn.go?...

Edit: By looking into go code it looks that tls.Verify is broader than tls.VerifyHostname (it actually can call VerifyHostname).
Thanks a lot for such great post!

Collapse
 
cueo profile image
Mohit Mayank

Would this work if the client is behind a NAT?

Collapse
 
living_syn profile image
Jeremy Mill

Sorry this reply is super late, but unless the public IP is what is on the cert, no, it won't.

Collapse
 
kaushaldokania profile image
Kaushal Dokania

Great article.