-
Notifications
You must be signed in to change notification settings - Fork 252
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
rumqttd: adding optional native-tls support. #258
Conversation
e0187a4
to
0d994fe
Compare
@tekjar looks like CI needs openssl or a way to build it. |
0d994fe
to
2cbee48
Compare
Thanks @jaredwolff . I'll try to find some time. I'm a bit occupied with other work for the whole month |
@tekjar no worries. I'm kicking the tires here to make sure it's working ok. |
56d5930
to
7dd2f24
Compare
Looks like this is running |
8361306
to
f3c8924
Compare
This is a very useful addition. Thanks @jaredwolff Cargo features are only additive. In this case, I think we are trying to create mutually exclusive features. This is a problem. If this library is included in the dependency tree multiple times, using What we need is a single feature flag |
Is this really the case? I thought if
It seems like a runtime option could increase the amount of unused cruft that you need to compile when building the |
I'll check reqwest in depth tomorrow but reqwest features are still additive
builds and works fine
Yeah. This is a well know problem. Here is a good explanation. In short, multiple dependencies using rumqtt library and enabling different features shouldn't cause compilation errors or silently switch tls implementation underneath |
Hmm ok! I'll look into more how he did it as well so I can modify the PR as necessary.
Agh! Ok now I get it. It doesn't necessarily matter about other deps using a |
By using the `use-native-tls` feature, this crate can now use tokio-native-tls vs tokio-rustls. Changed: * Made certain rustls includes to be conditional in rumqttd * How errors are handled in main loop. Otherwise process loop exits silently. * Configuration .conf files to account for cert usage * Support for all 3 cases, Rustls, Native-TLS or none! * Changed CI to support different use cases of this library. Added: * Notes to Readme about adding native-tls * Added separate tls() function in rumqttd for native-tls * Added use of tokio-native-tls
a9329a2
to
47af57d
Compare
@tekjar updated the code so it works in all 4 cases:
I'm going to kick the tires a bit and will push any other changes I find to make this work. |
@jaredwolff This is nice. Do you think we'll need both the feature flags? I think it's fine to leave rustls as is and have just one feature flag to enable native-tls. What you've done makes sense when you want disable rustls and enable native-tls. In our usecase, we usually want a rustls server on a port always but also run native-tls on a different port for microcontrollers that can't work with rustls |
In my use case it's handy. I don't use Rustls anywhere else since I use a separate ACME reverse proxy for web stuff. |
Cool. We'll merge as is then. This work is very useful for us as well. Thanks for your contribution |
Awesome @tekjar! I have to make some small tweaks but those will come in another PR. 😎 |
By using the `use-native-tls` feature, this crate can now use tokio-native-tls vs tokio-rustls. Changed: * Made certain rustls includes to be conditional in rumqttd * How errors are handled in main loop. Otherwise process loop exits silently. * Configuration .conf files to account for cert usage * Support for all 3 cases, Rustls, Native-TLS or none! * Changed CI to support different use cases of this library. Added: * Notes to Readme about adding native-tls * Added separate tls() function in rumqttd for native-tls * Added use of tokio-native-tls
By using the
use-native-tls
feature, this crate can now use tokio-native-tls vs tokio-rustls. Discussed this in #257. Turns out it was trivial to add sincetokio
uses the same API for both packages. The only thing that seems like a bummer right now is that it requires use of apkcs12
cert rather than 3 separate ones.