-
Notifications
You must be signed in to change notification settings - Fork 159
Extend ClientConfig to allow for setting key_log #308
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! I have some doc nits for consideration but the mechanics look good.
src/config.rs
Outdated
/// This sets `config.key_log` to a `KeyLogFile` which writes | ||
/// to the path in the `SSLKEYLOGFILE` env var (if set). If the variable is | ||
/// not set, it becomes a no-op. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is true for with_key_log_file()
, but not for with_key_log()
right? There's probably enough explanation on with_key_log_file()
to remove this bit to avoid confusion.
@@ -125,6 +126,37 @@ impl ConfigBuilderExt for ConfigBuilder<ClientConfig, WantsVerifier> { | |||
} | |||
} | |||
|
|||
/// Methods for enabling TLS key logging on a `ClientConfig`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd be tempted to put a warning after this headline similar to the one the Rusts docs have for KeyLog
to emphasize this should be used carefully:
Secrets passed over the interface are extremely sensitive and can break the security of past, present and future sessions.
fn with_key_log(self, key_log: Arc<dyn KeyLog>) -> Self; | ||
|
||
// Enable NSS-style key logging to the file named by `SSLKEYLOGFILE`. | ||
/// |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe worth using the word "replace" somewhere here similar to the other fn to emphasize if you call with_key_log(...)
and then with_key_log_file(...)
it isn't setting up both, it's stomping the first.
I'm not sure this is worth doing? It seems like this would be easy enough to do using existing API, and I'm not sure how easy we want to make this? |
I understand where you're coming from but I feel like people building products that use TLS should have ergonomic access to the available APIs that let them debug their programs. I saw in the issue thread that you'd accept a PR so I opened one. I can see myself using this as I continue to open PRs for |
Let's see what the other maintainers think... |
I feel like the the ergonomic builder-style API should be limited to things that we expect all users to make a decision on, and the less ergonomic and less discoverable setting-fields-on- In general I don't really want to put the keylog/SSLKEYLOGFILE stuff too far "forward" in the API. I've even been considering gating/defanging |
Yeah, my thinking has evolved since then. Sorry for turning down your PR! |
Hey, no problem, I'm here to make things better, not worse! Thanks for the review and information. |
This addresses #286
It extends
rustls::ClientConfig
with aClientConfigKeyLogExt
to allow settingkey_log
on theClientConfig
as part of the builder pattern.This seemed useful and looked like an easy addition so here it is. Writing a unit test seemed like more overhead than it was worth so I left it out but if you'd like a test just let me know.
Thanks!