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

Fails with TLS and certificates containing IPv6 addresses #52

Closed
mattiash opened this issue Sep 29, 2017 · 1 comment
Closed

Fails with TLS and certificates containing IPv6 addresses #52

mattiash opened this issue Sep 29, 2017 · 1 comment

Comments

@mattiash
Copy link
Contributor

I setup https-servers that have TLS certificates that include the ipv6-address of the server. This does currently not work with the https-implementation in node. I have filed an issue with the node project about this (nodejs/node#14736) and I have also submitted a PR for fixing this in node that will hopefully be accepted soon.

I have now found the same bug in the agentkeepalive library. The code contains the following lines:

    const hostHeader = req.getHeader('host');
    if (hostHeader) {
      options.servername = hostHeader.replace(/:.*$/, '');
    }

This does not work when the host-header has the value [::1]:3000

I have written a test-case for this at https://github.com/mattiash/test-checkServerIdentity With the latest node (without my patch) the test-case fails for both plain node and agentkeepalive

Test 1 failed: Shall connect to ::1. Error:  Host: [. is not in the cert's altnames: IP Address:127.0.0.1, IP Address:0:0:0:0:0:0:0:1
Test 3 failed: Shall connect to ::1 with keepaliveagent. Error:  IP: ::1 is not in the cert's list: 127.0.0.1, 0:0:0:0:0:0:0:1
Test 4 ok: Shall connect to 127.0.0.1 with keepaliveagent
Test 2 ok: Shall connect to 127.0.0.1

With a patched node, it only fails with agentkeepalive:

Test 3 failed: Shall connect to ::1 with keepaliveagent. Error:  Host: [. is not in the cert's altnames: IP Address:127.0.0.1, IP Address:0:0:0:0:0:0:0:1
Test 1 ok: Shall connect to ::1
Test 4 ok: Shall connect to 127.0.0.1 with keepaliveagent
Test 2 ok: Shall connect to 127.0.0.1

I will post a PR soon that resolves the problem in agentkeepalive as well.

@mattiash
Copy link
Contributor Author

mattiash commented Mar 9, 2018

PR #53 has been merged, so this issue is resolved.

@mattiash mattiash closed this as completed Mar 9, 2018
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

1 participant