Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extra DNS name verification is made in verify-ca mode, making it effectively verify-full #1164

Open
rshura opened this issue Jul 12, 2024 · 1 comment

Comments

@rshura
Copy link

rshura commented Jul 12, 2024

Trying to connect to the db with verify-ca works if the address is IP, but fails if the address is a host name other than what's in the cacert.

It appears that this function is called in verify-ca scenario: https://github.com/lib/pq/blob/master/ssl.go#L185 and it explicitly checks the name. I don't think this is the desired behavior of verify-ca.

I'm also a little confused as to why any checks need to be made, since the TLS client handshake happens in the first line of the function. That handshake will or will not check the name, depending on InsecureSkipVerify value that is correctly set already.

Am I missing something obvious here? Thank you!

@evilensky
Copy link

Hi, I came here for an unrelated issue and found this, which I have also encountered. This is related but separate: even verify-full is implemented in a way that contradicts C libpq

In verify-full mode, the host name is matched against the certificate's Subject Alternative Name attribute(s) (SAN), or against the Common Name attribute if no SAN of type dNSName is present.

On go1.22 the current defaults reject the connection when "deprecated commonName attribute" is used in place of SAN.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants