Skip to content

test/document TLS authentication, then add support for TRUSTED CERTIFICATE pem headers - #24733

Closed
sam-github wants to merge 2 commits into
nodejs:masterfrom
sam-github:test-client-auth
Closed

test/document TLS authentication, then add support for TRUSTED CERTIFICATE pem headers#24733
sam-github wants to merge 2 commits into
nodejs:masterfrom
sam-github:test-client-auth

Conversation

@sam-github

@sam-githubsam-github commented Nov 29, 2018

Copy link
Copy Markdown
Contributor

TLS client authentication should be tested, including failure scenarios.

There were tests for a couple success scenarios as side-effects of testing other things, but little coverage for the various ways intermediate and root CAs can be configured.

Support the same PEM certificate formats for the ca: option to
tls.createSecureContext() that are supported by openssl when loading a
CAfile.

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • tests and/or benchmarks are included
  • documentation is changed or added
  • commit message follows commit guidelines

@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

@nodejs-github-botnodejs-github-bot added the test Issues and PRs related to the tests. label Nov 29, 2018
@Trott

Copy link
Copy Markdown
Member

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this module maybe rather be in test/common/?

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know. It predates test/common, AFAICT, but perhaps it should have been moved there when test/common was created? Moving it would be a good code-n-learn activity.

@addaleaxaddaleax added the tls Issues and PRs related to the tls subsystem. label Nov 30, 2018
@sam-githubsam-github added the semver-minor PRs that contain new features and should be released in the next minor version. label Nov 30, 2018
@sam-githubsam-github changed the title test: test TLS client authenticationtest/document TLS authentication, then add support for TRUSTED CERTIFICATE pem headersNov 30, 2018
@sam-github
sam-githubforce-pushed the test-client-auth branch 2 times, most recently from 3674751 to 61380b3CompareNovember 30, 2018 19:48
@sam-github

Copy link
Copy Markdown
ContributorAuthor

While I was doing some support yesterday for people banging their head against node's tls, I found that node wasn't working with "TRUSTED CERATIFICATE", and @bnoordhuis pointed me towards the root cause.

I pushed the fix onto this PR so I can use the tests to prove it did not used to work, and now it does.

x=PEM_read_bio_X509_AUX(in, NULL, NULL, "");
is what openssl's -CAfile option eventually leads to, so I believe calling PEM_read_bio_X509_AUX() is the right thing for Node.js to do as well.

@addaleax@bnoordhuis PTAL

@sam-github

Copy link
Copy Markdown
ContributorAuthor

Travis failed to find the first commit, as it often does.

ci: https://ci.nodejs.org/job/node-test-pull-request/19097/

@Trott

Trott commented Dec 2, 2018

Copy link
Copy Markdown
Member

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wrap in common.mustCall(...) here and below?

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The common connect() function does that already.

@bnoordhuis

Copy link
Copy Markdown
Member

The linux failures look unrelated but the windows failures do. As to why the connection is being established when it shouldn't, I have no idea.

@sam-github

Copy link
Copy Markdown
ContributorAuthor

@sam-github

Copy link
Copy Markdown
ContributorAuthor

@addaleax

Copy link
Copy Markdown
Member

@Trott

Trott commented Dec 4, 2018

Copy link
Copy Markdown
Member

Windows failures on CI are relevant:

https://ci.nodejs.org/job/node-test-binary-windows/22179/COMPILED_BY=vs2017,RUNNER=win10,RUN_SUBSET=3/console

03:11:38 not ok 456 parallel/test-tls-client-auth03:11:38 ---03:11:38 duration_ms: 0.23903:11:38 severity: fail03:11:38 exitcode: 103:11:38 stack: |-03:11:38 c:\workspace\node-test-binary-windows\test\parallel\test-tls-client-auth.js:15203:11:38 assert.strictEqual(err.code, 'UNABLE_TO_VERIFY_LEAF_SIGNATURE');03:11:38 ^03:11:38 03:11:38 TypeError: Cannot read property 'code' of undefined03:11:38 at c:\workspace\node-test-binary-windows\test\parallel\test-tls-client-auth.js:152:2603:11:38 at c:\workspace\node-test-binary-windows\test\common\index.js:346:1503:11:38 at maybeCallback (c:\workspace\node-test-binary-windows\test\fixtures\tls-connect.js:97:7)03:11:38 at TLSSocket.<anonymous> (c:\workspace\node-test-binary-windows\test\fixtures\tls-connect.js:68:13)03:11:38 at TLSSocket.emit (events.js:189:13)03:11:38 at TLSSocket.onConnectSecure (_tls_wrap.js:1168:10)03:11:38 at TLSSocket.emit (events.js:189:13)03:11:38 at TLSSocket._finishInit (_tls_wrap.js:629:8)03:11:38 ...

@sam-github

Copy link
Copy Markdown
ContributorAuthor

Ah, Windows CRLF... I do not love thee.

ci: https://ci.nodejs.org/job/node-test-pull-request/19314/

@sam-github

Copy link
Copy Markdown
ContributorAuthor

linux failures: https://ci.nodejs.org/job/node-test-commit-linux/23842/

Look like exit code test failures, not related to TLS.

re-ci: https://ci.nodejs.org/job/node-test-commit-linux/23845/

@sam-github

Copy link
Copy Markdown
ContributorAuthor

more aix & linux exit code and CLI syntax failures, retry: https://ci.nodejs.org/job/node-test-commit/24172/

@sam-github

Copy link
Copy Markdown
ContributorAuthor

The only failures were test-cli-syntax.js, which is flaky. I'm re-running ci, but I think this is landable.

re-ci: https://ci.nodejs.org/job/node-test-commit/24210/

@sam-github

Copy link
Copy Markdown
ContributorAuthor

Landed in 83ec33b...2e4a163

@sam-github
sam-github deleted the test-client-auth branch December 11, 2018 23:29
sam-github added a commit that referenced this pull request Dec 11, 2018
TLS client authentication should be tested, including failure scenarios.
PR-URL: #24733
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
sam-github added a commit that referenced this pull request Dec 11, 2018
Support the same PEM certificate formats for the ca: option to
tls.createSecureContext() that are supported by openssl when loading a
CAfile.
Fixes: #24761
PR-URL: #24733
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
BethGriggs pushed a commit that referenced this pull request Dec 17, 2018
TLS client authentication should be tested, including failure scenarios.
PR-URL: #24733
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
BethGriggs pushed a commit that referenced this pull request Dec 17, 2018
Support the same PEM certificate formats for the ca: option to
tls.createSecureContext() that are supported by openssl when loading a
CAfile.
Fixes: #24761
PR-URL: #24733
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
@BethGriggsBethGriggs mentioned this pull request Dec 18, 2018
BethGriggs added a commit that referenced this pull request Dec 18, 2018
Notable changes:
* **test**:
* test TLS client authentication (Sam Roberts)
[#24733](#24733)
* **tls**:
* support "BEGIN TRUSTED CERTIFICATE" for ca: (Sam Roberts)
[#24733](#24733)
* **tools**:
* update ESLint to 5.10.0 (cjihrig)
[#24903](#24903)
* **util**:
* add inspection getter option (Ruben Bridgewater)
[#24852](#24852)
PR-URL: #25102
MylesBorins pushed a commit that referenced this pull request Dec 18, 2018
Notable changes:
* **test**:
* test TLS client authentication (Sam Roberts)
[#24733](#24733)
* **tls**:
* support "BEGIN TRUSTED CERTIFICATE" for ca: (Sam Roberts)
[#24733](#24733)
* **tools**:
* update ESLint to 5.10.0 (cjihrig)
[#24903](#24903)
* **util**:
* add inspection getter option (Ruben Bridgewater)
[#24852](#24852)
PR-URL: #25102
BethGriggs added a commit that referenced this pull request Dec 18, 2018
Notable changes:
* **tls**:
* support "BEGIN TRUSTED CERTIFICATE" for ca: (Sam Roberts)
[#24733](#24733)
* **util**:
* add inspection getter option (Ruben Bridgewater)
[#24852](#24852)
PR-URL: #25102
BethGriggs added a commit that referenced this pull request Dec 18, 2018
Notable changes:
* **tls**:
* support "BEGIN TRUSTED CERTIFICATE" for ca: (Sam Roberts)
[#24733](#24733)
* **util**:
* add inspection getter option (Ruben Bridgewater)
[#24852](#24852)
PR-URL: #25102
refack pushed a commit to refack/node that referenced this pull request Jan 14, 2019
TLS client authentication should be tested, including failure scenarios.
PR-URL: nodejs#24733
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
refack pushed a commit to refack/node that referenced this pull request Jan 14, 2019
Support the same PEM certificate formats for the ca: option to
tls.createSecureContext() that are supported by openssl when loading a
CAfile.
Fixes: nodejs#24761
PR-URL: nodejs#24733
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
refack pushed a commit to refack/node that referenced this pull request Jan 14, 2019
Notable changes:
* **tls**:
* support "BEGIN TRUSTED CERTIFICATE" for ca: (Sam Roberts)
[nodejs#24733](nodejs#24733)
* **util**:
* add inspection getter option (Ruben Bridgewater)
[nodejs#24852](nodejs#24852)
PR-URL: nodejs#25102
BethGriggs pushed a commit that referenced this pull request Apr 17, 2019
TLS client authentication should be tested, including failure scenarios.
PR-URL: #24733
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
BethGriggs pushed a commit that referenced this pull request Apr 28, 2019
TLS client authentication should be tested, including failure scenarios.
PR-URL: #24733
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
sam-github added a commit to sam-github/node that referenced this pull request Apr 29, 2019
Support the same PEM certificate formats for the ca: option to
tls.createSecureContext() that are supported by openssl when loading a
CAfile.
Fixes: nodejs#24761
PR-URL: nodejs#24733
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
@BethGriggsBethGriggs mentioned this pull request May 1, 2019
MylesBorins pushed a commit that referenced this pull request May 16, 2019
TLS client authentication should be tested, including failure scenarios.
PR-URL: #24733
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

semver-minorPRs that contain new features and should be released in the next minor version.testIssues and PRs related to the tests.tlsIssues and PRs related to the tls subsystem.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants

@sam-github@nodejs-github-bot@Trott@bnoordhuis@addaleax@BethGriggs