Please answer these questions before submitting your issue. Thanks!
What version of Go are you using (go version)? 1.9.2
Does this issue reproduce with the latest release? Yes
What operating system and processor architecture are you using (go env)?
GOHOSTARCH="amd64"
GOHOSTOS="linux"
What did you do?
If possible, provide a recipe for reproducing the error.
A complete runnable program is good.
A link on play.golang.org is best.
I'm using a program (NGINX Ingress Controller) that uses the VerifyHostname.
While this function is called, it returns me an error about Certificate not containing a valid CommonName (certificate is not valid for any names, but wanted to match server.domain.tld).
Looking to the Certificate, it does contain the name server.domain.tld as a CommonName.
While investigating, I've faced that it's entering the if here.
This function verifies if the Certificate has an extension (and it does, an email, but not a DNSName) and if this is the case, it tries to add the value to the rest of the 'valid' string.
As my certificate does contain an extension, but not a DNSName, shouldn't this function be something like if len(c.DNSNames) > 0 instead of c.hasSANExtension()?
If this is the case, I can open a PR to fix this :) Anyway I'm going to ask the re-creation of the Certificate with the right SAN.
Thanks!
Please answer these questions before submitting your issue. Thanks!
What version of Go are you using (
go version)? 1.9.2Does this issue reproduce with the latest release? Yes
What operating system and processor architecture are you using (
go env)?GOHOSTARCH="amd64"
GOHOSTOS="linux"
What did you do?
If possible, provide a recipe for reproducing the error.
A complete runnable program is good.
A link on play.golang.org is best.
I'm using a program (NGINX Ingress Controller) that uses the
VerifyHostname.While this function is called, it returns me an error about Certificate not containing a valid CommonName (
certificate is not valid for any names, but wanted to match server.domain.tld).Looking to the Certificate, it does contain the name server.domain.tld as a CommonName.
While investigating, I've faced that it's entering the if here.
This function verifies if the Certificate has an extension (and it does, an email, but not a DNSName) and if this is the case, it tries to add the value to the rest of the 'valid' string.
As my certificate does contain an extension, but not a DNSName, shouldn't this function be something like
if len(c.DNSNames) > 0instead ofc.hasSANExtension()?If this is the case, I can open a PR to fix this :) Anyway I'm going to ask the re-creation of the Certificate with the right SAN.
Thanks!