-
Notifications
You must be signed in to change notification settings - Fork 2.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
Self-signed TLS certificates don't work with rustls #5450
Comments
Note that you can create your own cert, and drop it into place (with the proper name) and I don't think it's an OpenSSL specific issue, as the certs work with all Go programs (which don't use openssl) and many other languages that may not be directly linking to openssl. |
We're writing an app that users will run with their own nodes, so we don't necessarily control the certificates that will be used, and assume that many node operators will have their own self-signed certificates.
Ah, gotcha. I just assumed that Go used openssl.
Thanks for the pointer! I think it might be the case that |
I would like to reiterate @casey here
Similar issue here mirleft/ocaml-tls#446, except with |
It sounds to me like the problem is that the cert has the CA cert=true flag? Could be that the way the cert is generated is non-standard. But it sounds like there is a workaround on the client side? That you just need to allow that CA cert=true flag? Changing the way the TLS cert works in lnd is probably not an easy thing. Dealing with the |
Sure, it's a workaround. I have to say I'm sad about this on, uhm, spiritual grounds? None of us here is using |
I haven't had time to look into this in more detail, it's been a while since I last did a TLS deep dive. |
TLS is kind of a black box to me as well so I can just say what I did to get it to work. The way I'm fixing this client side is to fork the I didn't open this issue though, and @casey may have different thoughts re: |
Hmm, it really just looks like we set a flag that could be set to false instead. Did a few quick tests and nothing seems to break with this patch (on top of current
@mbacarella and @casey, does this patch resolve your issues? |
I applied that patch on top of 0.14.1-beta and tried it out. My client now reports an "invalid certificate chain" error instead. lncli and openssl based clients continue to work. Not sure if the issue is another disagreement in protocol adherence or what. |
CHANGES: * Validation: allow self-signed server certificate with BasicConstraints CA=true (reported by @mbacarella in mirleft/ocaml-tls#446 (lightningnetwork/lnd#5450), fix mirleft/ocaml-x509#161 by @hannesm)
@mbacarella was this fixed with ocaml/opam-repository#23231? Can this issue be closed? |
Well, the problem is fixed in OCaml TLS, but this issue is about the Rust TLS library so I can't comment on whether it should be closed. :) |
Hi guys, Just wanted to add my 2 cents to this issue. It is true that the The error I see many people trying to integrate LND in rust using Quoting @guggero:
I actually recommend having a CA, TLS key and TLS cert. |
We're working on an
lnd
gRPC client in Rust, using rustls, andrustls
doesn't accept the self-signed certificates generated by LND 0.13.0-beta.The error reported by
rustls
,WebPKIError(CAUsedAsEndEntity)
, is caused bylnd
's certificate being a CA certificate, when servers should present end-entity certificates.These certificates work with OpenSSL (which we assume other client implementations are using), and we're trying to figure out the difference in behavior, cf. briansmith/webpki#114 (comment). We're not totally sure, but we think that OpenSSL just doesn't check that servers present end-entity certificates, when according to the spec it should.
We think the solution would be to make
lnd
generate both a CA cert (e.g.ca.cert
) and an end-entity cert (e.g.ee.cert
) signed by that CA. Clients would then addca.cert
as a trusted root certificate, and would then acceptee.cert
when presented bylnd
.The text was updated successfully, but these errors were encountered: