Repository navigation
Conversation
|
Hi @rdegnan, welcome and thank you for your contribution. We will try to review your Pull Request as quickly as possible. In the meantime, please take a look at the contribution guidelines if you have not done so already. |
Signed-off-by: Ryland Degnan <[email protected]>
There was a problem hiding this comment.
I think this PR would benefit from an explanation of what TLS client fingerprinting is. Presumably it's just a hash of some subset of fields in the TLS client hello. Which makes sense, I'm aware of some applications of this. I'd like to understand here the rationale behind choice of fields and what purpose this is intended to serve. This should be done in both the API and also more comments added across the code here.
/wait
There was a problem hiding this comment.
Thanks, I wasn't sure how much context this needed -- your description is accurate, as for the the rationale behind choice of fields and the choice of md5 as a hashing algorithm, this is specified by the JA3 standard, which allows the fingerprints to be shared/recorded in threat databases, etc.
There was a problem hiding this comment.
GREASE (Generate Random Extensions And Sustain Extensibility) is a mechanism Google uses to prevent extensibility failures in the TLS ecosystem. JA3 ignores these values completely to ensure that programs utilizing GREASE can still be identified with a single JA3 hash.
There was a problem hiding this comment.
No need to state a default for scalar types in proto3.
Is the reason to add an API field due to the CPU overhead of computing this if not needed?
Signed-off-by: Ryland Degnan <[email protected]>
ggreenway
left a comment
There was a problem hiding this comment.
This will need a lot more testing around all the length checks when you're parsing out fields of the client hello (CBS_*).
| ENVOY_LOG(trace, "tls:connectionFingerprint(), fingerprint: {}", fingerprint); | ||
|
|
||
| uint8_t buf[MD5_DIGEST_LENGTH]; | ||
| MD5(reinterpret_cast<const uint8_t*>(fingerprint.data()), fingerprint.size(), buf); |
There was a problem hiding this comment.
Why md5? As a cryptographic hash, it shouldn't really be used anymore; use sha256 instead. For a non-cryptographic hash, use something in source/common/common/hash.h that we already use.
There was a problem hiding this comment.
MD5 is specified by the JA3 standard, it's not cryptographic but the intent is to use a standard hashing algorithm so the fingerprint can be shared.
|
|
||
| std::ostringstream md5; | ||
| md5 << std::hex << std::uppercase << std::setfill('0'); | ||
| for (const auto &byte: buf) { |
There was a problem hiding this comment.
Replace with something out of source/common/common/hex.h for this.
| std::string upstream_transport_failure_reason_; | ||
| absl::optional<Upstream::ClusterInfoConstSharedPtr> upstream_cluster_info_; | ||
| absl::optional<uint64_t> connection_id_; | ||
| std::string connection_fingerprint_; |
There was a problem hiding this comment.
Should this use optional like the connection ID does, rather than returning an empty string if its's not set?
| [](const StreamInfo::StreamInfo& stream_info) { | ||
| return stream_info.connectionID().value_or(0); | ||
| }); | ||
| } else if (field_name == "CONNECTION_FINGERPRINT") { |
There was a problem hiding this comment.
Maybe the field name should be more specific (e.g. "JA3_TLS_FINGERPRINT") in case there's ever a different kind of fingerprinting added?
|
This pull request has been automatically marked as stale because it has not had activity in the last 30 days. It will be closed in 7 days if no further activity occurs. Please feel free to give a status update now, ping for review, or re-open when it's ready. Thank you for your contributions! |
|
This pull request has been automatically closed because it has not had activity in the last 37 days. Please feel free to give a status update now, ping for review, or re-open when it's ready. Thank you for your contributions! |
|
@rdegnan I see this PR was closed due to lack of activity. Would you be able to re-open it and get it going or if you don't mind, in a few weeks, I can probably spend sometime on this to get it going. |
Commit Message: Implement TLS client fingerprinting
Additional Description: See #16622
Risk Level: low
Testing: unit tests
Docs Changes: Documented in proto
Release Notes:
Platform Specific Features:
Fixes #16622