-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
Sending fatal alert BadCertificate: invalid certificate: UnknownIssuer #11482
Comments
You can enabled |
Thanks, here is the extra log info from adding that flag: DEBUG RS - deno_runtime::permissions:40 - ⚠️️ Granted net access to "foo.bar.com"
DEBUG RS - reqwest::connect:503 - starting new connection: https://foo.bar.com/
DEBUG RS - rustls::client::hs:89 - No cached session for DNSNameRef("foo.bar.com")
DEBUG RS - rustls::client::hs:211 - Not resuming any session
DEBUG RS - rustls::client::hs:430 - ALPN protocol is None
DEBUG RS - rustls::client::hs:598 - Using ciphersuite TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384
DEBUG RS - rustls::client::tls12:209 - ECDHE curve is ECParameters { curve_type: NamedCurve, named_group: secp256r1 }
DEBUG RS - rustls::client::tls12:508 - Server DNS name is DNSName("foo.bar.com")
Sending fatal alert BadCertificate |
I am able to reproduce it purely using the I've narrowed it down to this line:
|
@justinmchase Could you share the exact certificate that is causing issues with me so we can debug this? If you don't want to share it in public, feel free to email me at [email protected]. |
I think its becuase the server cert has a root ca of my company. I have the cert installed and trusted locally of course in order to access various internal services and Chrome and Curl both seem to respect it and thus accessing this particular server succeeds via chrome and curl. For the rustls client I see by default it just loads up some root certs from a crate full of trusted certs published by Mozilla. But if I add the flag
But still ends up having the same error later. Here is the exact line where it fails: And I think I found another clue the ca cert does not appear to be in I wonder if I can export that file as pem format if I'll be able to the pass the path directly to it. I'll have to try it tomorrow, I'll email you @lucacasonato if I hit a wall. I suspect that this library is supposed to use some kind of mac specific API to access the os system keychain but it isn't. Perhaps specifying the pem would work but my systems root pem is just full of generic public certificate authorities not my companies special cert. |
I found a link to this project from within the rustls project: I think this is basically what is needed to make it work. Without being an expert in this area it definitely seems like it should be using just the keystore of the OS by default. Those are the certs the user or the users network admin has deemed trustworthy, it seems like pulling in the mozilla certs is not the greatest way to handle the problem. |
@justinmchase We use the same approach as Firefox, which is to disregard the OS keystore because it might be very out of date (e.g. Windows XP not having ISRG Root X1). To add a cert to the root store that Deno uses you have to specify the certificate with the If this still results in verification errors there are two possible issues:
Does the file you are passing to |
The file I was passing to I was actually able to finally get it to work this morning with a few changes to Deno :) There isn't a bug per se but I had to add support for I think the real question is what is the right thing to do?
First off, this doesn't seem like a great strategy to me. Two main reasons: 1. It shouldn't be Denos responsibility to dictate certsUsing the systems certificate store would take the responsibility out of the hands of Deno and put it solely on the user. If the users certs in Windows XP don't work... well they need to get the right certs and install them. (Also, maybe Windows XP shouldn't be on the support matrix 😛 ) But conversely, what if a user wants to revoke a cert or only support a specific set of certs? There isn't a way to do that, Deno right now is loading the rustls mozilla certs then adding the one specified by 2. The certs are baked into Deno right nowAll of these builds of Deno appear to have the certs baked in. If one is updated or revoked for some reason, all of those older builds of Deno become broken I believe. By depending on the certificate store you decouple Deno from the certs and put the responsibility of managing which certs are valid onto the user. Now I get that in some cases that is annoying to users, users on old machines who don't care about certs who feel broken by default, that's not a great scenario. But on the other hand you have people with strict certs and working in corporate environments with internal certificate authorities and strict policy based management of certs, they're broken by default also. ConclusionI think Deno should get out of the business of providing certs and just use the systems store. Put the responsibility on the user to install and update valid certificates. I think Deno could provide documentation on how to update the latest set of mozilla certs and possibly an option and automatically install them for users during a Deno upgrade. Proposals
Other possibilities could include additional flags such as |
Reqwest with I would be open to having a I am not in favor of cc @bartlomieju @ry, opinions requested |
Ah, I already commented on the #11491, but I see Luca already said it here, that using As for |
Ok I'll remove How would you feel about adding both the webpki certs and the native certs by default? Will they stomp on each other, or is a valid cert a valid cert? So in that scenario we would have Deno do what its doing now plus we add all of the certs from the users native store. That way by default they get modern updated certs but also if you have some self signed or corporate CA installed by IT then you get that automatically too, then if one of your built-in mozilla certs expires or gets revoked for some reason then your path forward is to either update Deno or to get a new version of the mozilla certs and install them into your certificate store. The flags could control each step but they would both be enabled by default something like:
Then if you wanted to disable either one, or both you could use that variable to control it and then you'd have fine grained control with the |
The issuer is my company. I am behind a corporate firewall and so is the destination server. I have the same CA cert the server is using installed locally.
I am also on macOS Catalina 10.15.7
I'm using
fetch(url)
and its giving me this error:My code is basically:
Querying the same url using curl with the same cert from the terminal gives me a success result (domains and cert details altered):
May be related to #10312 (comment)
Is there a way for me to turn on deeper tracing to get a more detailed explanation of why its failing?
The text was updated successfully, but these errors were encountered: