-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
[Bug] 'unable to get local issuer certificate' - Config options for 'strict-ssl' and 'cafile' missing from Berry? #798
Comments
So the main issue with that is the testing infrastructure. At the moment our mock server doesn't support certificates, so implementing that wouldn't be covered by tests and I'd very much want to avoid that as it seems the kind of thing very likely to regress given enough time. If someone can spend some time to make the mock server understand https (I admit I'm not well enough versed in it to do it myself in a timely manner) and the resolver send them it would be helpful. |
@jamador-usgs in general you could use |
@eliasku Thanks for the hint! |
This comment has been minimized.
This comment has been minimized.
@ZickZakk seeting NODE_TLS_REJECT_UNAUTHORIZED with value 0 In my windows, It doesn't work. Are you sure you can? |
Also hitting this issue trying to migrate our department projects to Yarn2. The workaround using NODE_TLS_REJECT_UNAUTHORIZED hasn't worked for us either. |
@arcanis I am presently trying to introduce yarn 2 based monorepo in my workplace which is a banking company with security requirements. Non availability of cafile configuration in .yarnrc.yml will be the blocking factor for adoption. |
@arcanis I am ready to spend time to try and get the mock server understand https. I went through the Contributor Guidelines but unable to find relevant instructions for this kind of work. Please let me know how I can help. |
Hey @netizen, that would be really nice of you! Here are some pointers:
Feel free to pop on our Discord if you have other questions, we'll be happy to answer (I'm myself AFK today, but other maintainers might be around). |
I can vouch that having this feature would also be critical for us as well, due to internal certificates. And in fact I just tried setting |
Unfortunately it's still the same problem: I don't have any setup with internal certificates, and as far as I know none of the other contributors do, so any change we make would be completely untested. I'd really like to put this behind us, but it's exactly the kind of change that needs to be supported by someone experiencing the issue firsthand 😕 (That, or you can suggest a step-by-step very simple way to test, like perhaps a proxy tool or something - I can't fiddle with with my computers' global configuration for this) |
I just opened a PR at #1934 which should address this. You can test it before it gets merged with Add to
|
@netizen or @markerikson are you able to test the above? Sounds like they need people who had the issue to confirm it's fixed |
I'd love to, but the corporate machine I'm on atm is unfortunately rather locked down. When I tried Can someone try generating a build that has both #1934 and #1920 in here? Those were the two issues I ran into the other day. Alternately, I see that the PR checks for #1934 supposedly generated a build and "uploaded" it somewhere. Is that build accessible for download? edit Okay, I see that artifact is in fact attached to the job run. Lemme give that a shot. |
Good news! I pulled down the built artifact from #1934 , unzipped it, and replaced the I then set Yarn was successfully able to go pull all packages from our internal NexusRepository server - no SSL errors! So, I'm going to say this is correctly working as intended. The bad news, on my end at least, is that something about the way Yarn v2 is trying to spawn post-install build scripts in the user temp folder is triggering the corporate process monitoring allowlist tool, which is blocking those processes from executing at all. So, no post-install scripts can build anything, which means there's a good chance I won't actually be able to use this on a corporate machine :( (side question: it looks like Yarn is maybe trying to copy Node itself to a temp folder and run it? Any pointers to how that behavior works and where it's implemented?) |
Note that it should be Also, you should use just one of the options. If you disable strict ssl, that takes precedence and the CA file doesn't really do anything. The flag will disable certificate validation. |
To give a bit of context:
|
@arcanis : yeah. Don't want to hijack the SSL thread for that discussion, but it would be really nice to have an alternate way to handle this. Our company has some process-monitoring software installed, and while it's not 100% all-encompassing, it frequently blocks "unknown" executables from executing at all. In this case, the .exe files in the temp folder are all getting killed before they can start, so the post-install steps all fail. (Which is a real shame, because it looks like the rest of the package installation process actually worked fine with the SSL changes, and I would really like to see what actual package dep issues exist after installing via v2.) Hmm. does v2 have an |
Do you know what exactly causes it to block a file? Does it have to be signed?
It's a configuration https://yarnpkg.com/configuration/yarnrc#enableScripts yarn config set enableScripts false |
Let's discuss about binjumper in #1938 👍 Thanks @andreialecu for implementing this much requested feature! 🎉 |
@andreialecu how will people in future know this? Is it added to documentation somewhere? |
The documentation will be updated before the next release. If anyone finds this via Google, instructions can be found here: #798 (comment) 🙂 |
Thanks for this! I followed the steps in the comment above and was able to run I'm now trying to get my project to build and I may have discovered an issue related to this feature. I'm investigating typescript issues and I tried running: yarn plugin import typescript
➤ YN0001: RequestError: unable to get local issuer certificate If I remove the new |
Is the CA cert only used for access to specific repositories, instead of the entire internet? |
Yes, the CA is for accessing our internal registry (an artifactory instance). I dunno if yarn should fetch plugins via the registry (which is a proxy as well as a private registry) or if it should have a way to use different CAs for difference hosts. |
In our case, the NexusRepository instance is a proxy for all queries to the public NPM registry. The intent is that the package manager is never going out to the public internet itself. |
This is interesting. I believe in The difference with Perhaps a way to scope the
What approach would be best here for your use cases? |
I opened #1946 which you can install via: It adds the ability to override the networkSettings:
"github.com":
caFilePath: <path> # root caFilePath setting still works:
caFilePath: <path> |
The above steps worked for me. I do wonder if npm/yarnv1 added the CA to the build-in CAs akin to However, I'm totally fine with this approach. Would it be possible to inline the certs in the yaml? The old npm behavior supported this format:
|
Based on this issue: yarnpkg/yarn#6578 it doesn't seem like v1 added the certs. It's actually hard to add certs to the existing trust list, and much easier to replace it entirely. See https://stackoverflow.com/a/39972054/114732 Regarding inlining the certs, I guess if @arcanis thinks that's a good idea, it would be easy enough to add. |
Fair enough! If you decide not to support inlining, can you expand the path when it includes |
We already support environment variables in the Yarnrc, so you should be able to just use |
tried install berry 3 last night on 1 unsecured machine and 1 secured machine. Worked fine on unsecured machine. Couldn't find certificates on the secure machine. This was my yarnrc.yml: httpProxy: "http://127.0.0.1:9000" (or zsbundle.pem, neither one worked) these are same settings I used with 1.22.11, which worked fine on the secure machine. Any suggestions would be appreciated. Does 2.x have the same problem? |
Similar problem (new key |
Describe the bug
Previously, there was an option to force SSL and set a CA file. Looking at the config options for Berry, this is no longer the case. We don't use a proxy to access the internet, but rather a signed certificate that acts as a MiTM for our traffic. I'm getting my team to just start to work with Yarn and I'd like us to migrate to the latest version. However, without the ability to set these options like with npm and yarn v1, i get the 'unable to get local issuer certificate' error and so I've been forced to uninstall Berry and go back to Yarn v1.21.1.
To Reproduce
Not sure how to reproduce this outside of our internal network. These options are just missing from Berry.
Screenshots
Running the
npx @yarnpkg/doctor
command from the migration guide gives me this:Environment if relevant (please complete the following information):
The text was updated successfully, but these errors were encountered: