-
Notifications
You must be signed in to change notification settings - Fork 7
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
TLS client verification support? #27
Comments
Hey! The other crate supports it simply for the reason that the TLS implementation is based on OpenSSL and it is kinda broken, especially if your local libssl is old (crypto/tls/ssl is hard so I can't blame Frank). From what I can see you're trying to connect through SSLv2 which is a widely deprecated and unsupported protocol. (Even OpenSSL dropped support for it) As such, So, it's not really nitox-related, you should just upgrade your security protocols :) |
Also, quick note but when acting as a client, you don't need to provide a root cert, only the host name is needed. The current code works fine in production for months for us, given that your certificates business is setup correctly as well. For reference, client-side implementation of native-tls is the first example: https://github.com/sfackler/rust-native-tls#usage |
NATS enforces TLS v1.2, so if I had an outdated protocol, NATS would've rejected the connection.
I was talking about mutual authentication (i.e., server-side verification of certs presented by the clients before accepting a connection). Since we're using NATS internally, we're using self-signed certs for both server and the clients (that's why we needed support for adding root CA certs). I agree that the other crate isn't good (especially because it's sync) but it actually works. And, we're trying to move to nitox, but we're getting blocked by TLS support. |
It turned out that this has got to do with NATS protocol itself and how nitox currently deals with TLS. When I tried debugging this with
So, NATS actually sends server So, I guess the current implementation doesn't actually work? Because, you're upgrading to TLS immediately following the TCP connection, rather than after parsing |
Oh, and one minor thing that struck me - Nitox is parsing the URL to get the host name when TLS is enabled. But, the previous step tries to parse the URL as Both the steps are mutually exclusive. You can't parse / resolve an address with protocol, and you can't parse the address as |
Wow indeed, just looked at the mechanism that Alright, let's just consider then that NATS TLS is just unsupported for I can't determine the effort needed (besides what you already did about TLS configuration) to implement it, since And indeed we upgrade the TCP to TLS immediately even before trying to talk to the server. I have an idea to make it work quickly (thanks to the work done on the verbose mode Ack mechanism) but I'm really not sure. About the |
Hi, just to clarify that currently only the initial INFO message is plain text, once the connection has been upgraded to TLS the following INFO messages use the TLS transport. |
@wallyqs Alright, thanks for the clarification, duly noted! |
yes that wouldn't happen, only when |
It's not weird, but it doesn't work in the current setup. All I'm saying is that it needs to be improved as part of the TLS suppport, because currently it fails if we enable TLS and pass a cluster address like |
I agree that how it works currently is definitely not foolproof and relies on the user giving proper params for each tls/tcp mode. tls = url form / tcp = url/ip form That will change in the PR draft I created :) |
I have opened a PR for this! |
It looks like Nitox doesn't support client verification as of now. I made some quick changes to pass TLS config to the
native-tls
connector. When I tested this, I'm getting:Apparently, the certificate is verified, but the connection is being cut off. I'm guessing I'm missing something in the NATS protocol? Either that, or something's wrong with how nitox does TLS. The other nats crate however supports this feature.
The text was updated successfully, but these errors were encountered: