Pass host to tls.connect for certificate validation - #2273
Conversation
|
Someone’ll need to write a test for this. I wonder what it does when |
e426771 to
839b6b4
Compare
I think from the links I put in #2263 it's clear that host is only used for checking the server identity, and that for non-IP addresses this is currently set by servername. So nothing has changed for unix domain sockets in that regard. |
839b6b4 to
03c4ea5
Compare
|
What can I do to get this merged? |
|
When indeed? :) I got another issue open about the same, it seems. |
Yeah, sorry, I didn't look up close. But what's valid there is something else in the configuration here, since |
|
@vitaly-t It looks like pg sets |
|
@charmander #1890 was merged without a test despite the consequences for IP addresses so I get the impression the test setup wouldn't easily support such a test. The existing tests all pass for this PR too. I think it should be clear from the description in the issue what is wrong. It's quite frustrating because it's fairly easy to see why IP addresses don't work and how pg got like this:
|
|
Of course it’s clear what’s wrong. That doesn’t mean it doesn’t need a test. It was able to break in the first place because there was no test. I can write the test, but it’ll be a while. |
|
Hey all, any updates on this? |
|
Just stumbled upon this issue. I can confirm that this PR would fix the problem. Node's docs are quite clear in that regard that " @charmander Would you still merge it if it had tests? |
|
@jhnns Yep! |
…P address tls.connect verifies the server identity against `servername`, falling back to `host` and then to 'localhost'. Since `servername` must not be set to an IP address (RFC 6066 section 3), certificates were validated against 'localhost' whenever the connection host was an IP address. Passing `host` to tls.connect fixes this. Continues brianc#2273 (originally by Frazer McLean) with tests. Fixes brianc#2263 Co-authored-by: Frazer McLean <frazer@frazermclean.co.uk>
|
@charmander I created a PR with the implementation and the tests: #3756 |
Fixes #2263