-
Notifications
You must be signed in to change notification settings - Fork 488
Add support for TLS protocol tracing #2096
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
Merged
ddelnano
merged 7 commits into
pixie-io:main
from
ddelnano:ddelnano/wire-up-tls-protocol-parser-to-stirling
Feb 18, 2025
Merged
Changes from 5 commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
8ff4143
Add support for TLS protocol tracing
ddelnano 888c8a1
Fix gcc compilation issue
ddelnano 298824c
Use TLS specific extension bytes limit
ddelnano 37bcf97
Update comment to reflect current test
ddelnano 3f80935
Rename tls_events fields for future compatibility with non handshake …
ddelnano 256b76e
Rename content_type column to req_type for tls_events. Remove version…
ddelnano 13295f4
Fix field renaming missed in tls parse test
ddelnano File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -39,6 +39,7 @@ enum class Protocol { | |
| kKafka = 10, | ||
| kMux = 11, | ||
| kAMQP = 12, | ||
| kTLS = 13, | ||
| }; | ||
|
|
||
| } // namespace protocols | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -43,8 +43,6 @@ namespace stirling { | |
| namespace protocols { | ||
| namespace tls { | ||
|
|
||
| using ::px::utils::ToJSONString; | ||
|
|
||
| enum class ContentType : uint8_t { | ||
| kChangeCipherSpec = 0x14, | ||
| kAlert = 0x15, | ||
|
|
@@ -186,6 +184,25 @@ enum class ExtensionType : uint16_t { | |
| kRenegotiationInfo = 65281, | ||
| }; | ||
|
|
||
| // Extensions that are common to both the client and server side | ||
| // of a TLS handshake | ||
| struct SharedExtensions { | ||
| void ToJSON(::px::utils::JSONObjectBuilder* /*builder*/) const {} | ||
| }; | ||
|
|
||
| struct ReqExtensions : public SharedExtensions { | ||
| std::vector<std::string> server_names; | ||
|
|
||
| void ToJSON(::px::utils::JSONObjectBuilder* builder) const { | ||
| SharedExtensions::ToJSON(builder); | ||
| builder->WriteKV("server_name", server_names); | ||
| } | ||
| }; | ||
|
|
||
| struct RespExtensions : public SharedExtensions { | ||
| void ToJSON(::px::utils::JSONObjectBuilder* builder) const { SharedExtensions::ToJSON(builder); } | ||
| }; | ||
|
|
||
| struct Frame : public FrameBase { | ||
| ContentType content_type; | ||
|
|
||
|
|
@@ -195,12 +212,13 @@ struct Frame : public FrameBase { | |
|
|
||
| HandshakeType handshake_type; | ||
|
|
||
| uint24_t handshake_length; | ||
| uint24_t handshake_length = uint24_t(0); | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. GCC fails if this isn't initialized (buildbuddy failure) |
||
|
|
||
| LegacyVersion handshake_version; | ||
|
|
||
| std::string session_id; | ||
| std::map<std::string, std::string> extensions; | ||
| std::string req_body; | ||
| std::string resp_body; | ||
|
|
||
| bool consumed = false; | ||
|
|
||
|
|
@@ -209,9 +227,9 @@ struct Frame : public FrameBase { | |
| std::string ToString() const override { | ||
| return absl::Substitute( | ||
| "TLS Frame [len=$0 content_type=$1 legacy_version=$2 handshake_version=$3 " | ||
| "handshake_type=$4 extensions=$5]", | ||
| length, content_type, legacy_version, handshake_version, handshake_type, | ||
| ToJSONString(extensions)); | ||
| "handshake_type=$4 req_body=$5 resp_body=$6]", | ||
| length, content_type, legacy_version, handshake_version, handshake_type, req_body, | ||
| resp_body); | ||
| } | ||
| }; | ||
|
|
||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.