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

Add support for 'ca' config file option #1742

Merged
merged 1 commit into from
Nov 14, 2016
Merged

Add support for 'ca' config file option #1742

merged 1 commit into from
Nov 14, 2016

Conversation

vvmnnnkv
Copy link
Contributor

@vvmnnnkv vvmnnnkv commented Nov 8, 2016

Summary
npm supports specifying CA contents directly in the .npmrc file, using ca option.
yarn does not currently support this, as mentioned in several comments, e.g.:

Test plan
Localhost is running Sinopia with cert signed by self-signed root CA.
Below is .npmrc file contents (root CA cert is removed for brevity):

registry=https://localhost:4873
ca[]="-----BEGIN CERTIFICATE----- ... -----END CERTIFICATE-----"

npm output:

$ npm install leftpad
leftpad@0.0.0 node_modules/leftpad

yarn output:

$ yarn add leftpad
yarn add v0.16.1
[1/4] Resolving packages...
error An unexpected error occured, please open a bug report with the information provided in "/home/yarn/bin/yarn-error.log".
info Visit https://yarnpkg.com/en/docs/cli/add for documentation about this command.

$ cat yarn-error.log 
...
  leftpad@^0.0.0:
    version "0.0.0"
    resolved "https://localhost:4873/leftpad/-/leftpad-0.0.0.tgz#020c9ad0787216ba0f30d79d479b4b355d7d39c3"

Trace: 
  Error: unable to verify the first certificate
  at Error (native)
  at TLSSocket.<anonymous> (_tls_wrap.js:1017:38)
  at emitNone (events.js:67:13)
  at TLSSocket.emit (events.js:166:7)
  at TLSSocket._init.ssl.onclienthello.ssl.oncertcb.TLSSocket._finishInit (_tls_wrap.js:582:8)
  at TLSWrap.ssl.onclienthello.ssl.oncertcb.ssl.onnewsession.ssl.onhandshakedone (_tls_wrap.js:424:38)

yarn output after the fix:

$ ./yarn add leftpad
yarn add v0.17.0-0
[1/4] Resolving packages...
[2/4] Fetching packages...
[3/4] Linking dependencies...
[4/4] Building fresh packages...
success Saved lockfile.
success Saved 1 new dependency.
└─ leftpad@0.0.0
Done in 0.77s.

@bestander bestander merged commit 5c84c65 into yarnpkg:master Nov 14, 2016
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

Successfully merging this pull request may close these issues.

2 participants