GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Update SslHandler to set bio fd member to facilitate openssl tracing (Pixie integration) by ddelnano · Pull Request #12438 · netty/netty

Conversation

@ddelnano

@ddelnano ddelnano commented Jun 1, 2022 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

Motivation:

I've been working on extending the pixie platform to support out of the box instrumentation for twitter/finagle and eventually the netty project (pixie-io/pixie#407).

For those that aren't familiar, Pixie is an open source, Kubernetes Observability tool that provides auto instrumentation by leveraging eBPF. It has support for tracing network traffic for a variety of protocols (http/2, kafka, mysql, mux, etc) even if encrypted with openssl. Its openssl tracing support works by instrumenting the SSL_read and SSL_write functions through a uprobe. This uprobe captures the data just before encryption or just after decryption, in addition to navigating openssl's rbio struct to access the socket file descriptor (necessary for associating network traffic with a particular container).

Modification:

Due to how netty uses openssl today, the openssl SSL struct passed to SSL_read and SSL_write does not have the socket fd set. This is because netty's Java code handles the network transport and leverages openssl only for encryption and decryption. The functionality added in this PR allows netty to populate the SSL struct's rbio field with the socket file descriptor when a channel becomes active (first created). This change is dependent on the netty-tcnative changes made in netty/netty-tcnative#731

My understanding is that each netty channel will be given its own ssl engine, so setting this socket file descriptor on a per connection basis shouldn't be a problem. It's also worth mentioning that getting this to work with Pixie requires setting -Dio.netty.native.deleteLibAfterLoading=false. So while the goal is to instrument netty TLS connections with no configuration, that option would be necessary.

Result:

Fixes the majority of the remaining work in pixie-io/pixie#407. The remaining changes would be in the pixie project

  • Verified that pixie's netty TLS tracing works for a twitter/finagle service on Add thriftmux (finagle) openssl trace bpf test and get it passing by using a locally built netty and netty-tcnative pixie-io/pixie#446

I wanted to open up this PR to facilitate discussion on how to accomplish this integration between pixie and netty and look forward to your feedback :)

Todo

  • Deploy a Twitter production service with this change to stress test there aren't any regressions
  • Other items from code review

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@ddelnano ddelnano mentioned this pull request Jun 1, 2022
Add SSL.bioSetFd method to JNI code to support Pixie integration netty/netty-tcnative#731
Merged
2 of 3 tasks
@ddelnano ddelnano changed the title Update SslHandler to set bio fd member to facilitate openssl tracing Update SslHandler to set bio fd member to facilitate openssl tracing (Pixie integration) Jun 1, 2022
@ddelnano ddelnano mentioned this pull request Jun 1, 2022
Add thriftmux (finagle) openssl trace bpf test and get it passing by using a locally built netty and netty-tcnative pixie-io/pixie#446
Closed
1 of 3 tasks
normanmaurer
normanmaurer requested changes Jun 1, 2022
View reviewed changes
Comment thread handler/src/main/java/io/netty/handler/ssl/ReferenceCountedOpenSslEngine.java Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread handler/src/main/java/io/netty/handler/ssl/SslHandler.java Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread handler/src/main/java/io/netty/handler/ssl/SslHandler.java Resolved

Uh oh!

There was an error while loading. Please reload this page.

chrisvest
chrisvest reviewed Jun 1, 2022
View reviewed changes
Comment thread handler/pom.xml Resolved

Uh oh!

There was an error while loading. Please reload this page.

ddelnano
ddelnano commented Jun 2, 2022
View reviewed changes
Comment thread handler/src/main/java/io/netty/handler/ssl/SslHandler.java Resolved

Uh oh!

There was an error while loading. Please reload this page.

normanmaurer
normanmaurer approved these changes Jun 2, 2022
View reviewed changes
Kvicii
Kvicii approved these changes Jun 2, 2022
View reviewed changes
normanmaurer pushed a commit to netty/netty-tcnative that referenced this pull request Jun 3, 2022
@ddelnano
Add SSL.bioSetFd method to JNI code to support Pixie integration (#731)
4141ffe
Motivation:

I've been working on extending the pixie platform to support out of the box instrumentation for [twitter/finagle](https://github.com/twitter/finagle) and eventually the netty project (pixie-io/pixie#407).

For those that aren't familiar, [Pixie](https://github.com/pixie-io/pixie) is an open source, Kubernetes Observability tool that provides auto instrumentation by leveraging eBPF. It has support for tracing network traffic for a variety of protocols (http/2, kafka, mysql, mux, etc) even if encrypted with openssl. Its openssl tracing support works by instrumenting the `SSL_read` and `SSL_write` functions through a uprobe. This uprobe captures the data just before encryption or just after decryption, in addition to navigating [openssl's rbio struct](https://github.com/pixie-io/pixie/blob/294d3f36214dece583dd499ebd578cecb7cc7425/src/stirling/source_connectors/socket_tracer/bcc_bpf/openssl_trace.c#L59-L78) to access the socket file descriptor (necessary for associating network traffic with a particular container).

Due to how netty uses openssl today, the openssl SSL struct passed to `SSL_read` and `SSL_write` does not have the socket fd set. This is because netty's Java code handles the network transport and leverages openssl only for encryption and decryption. The functionality added in this PR will allow netty to populate the SSL struct's rbio field with the socket file descriptor when a channel becomes active (first created).

My understanding is that each netty channel will be given its own ssl engine (where I've updated in netty/netty#12438), so setting this socket file descriptor on a per connection basis shouldn't be a problem. It's also worth mentioning that getting this to work with Pixie requires setting `-Dio.netty.native.deleteLibAfterLoading=false`. So while the goal is to instrument netty TLS connections with minimal configuration, that option would be necessary.

Modifications:

Add method that allows to set the fd on the bio.

Result:

Be able to integrate with pixie later on.
@ddelnano ddelnano mentioned this pull request Jun 3, 2022
Upgrade scala and finagle dependencies to latest versions pixie-io/pixie#454
Closed
@ddelnano

ddelnano commented Jun 6, 2022 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor Author

@normanmaurer @chrisvest just wanted to check in on the next steps for this. Would we need to wait until netty-tcnative 2.0.53 is released before this could be merged (and update the dependencies appropriately)?

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@chrisvest

chrisvest commented Jun 6, 2022

Copy link
Copy Markdown
Member

@ddelnano I think so, yeah.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@normanmaurer

normanmaurer commented Jun 9, 2022

Copy link
Copy Markdown
Member

@ddelnano please rebase ...

ddelnano reacted with hooray emoji
All reactions
  • 🎉 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@normanmaurer

normanmaurer commented Jun 9, 2022

Copy link
Copy Markdown
Member

once rebased it should pick up the netty-tcnative release which has the required changes

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

Dom Del Nano and others added 3 commits June 9, 2022 09:59
Dom Del Nano
Update SslHandler to set bio fd member to facilitate openssl tracing
68926fb
@ddelnano @normanmaurer Dom Del Nano
Address code review feedback
a605edc
Co-authored-by: Norman Maurer <[email protected]>
Dom Del Nano
Refactor call to bioSetFd to method and ensure it's called on channel…
eabfdad
…Active and handlerAdded
@ddelnano
ddelnano force-pushed the ddelnano/ensure-openssl-bio-has-fd-set-on-channel-creation branch from c74d819 to eabfdad Compare June 9, 2022 17:00
@ddelnano

ddelnano commented Jun 9, 2022

Copy link
Copy Markdown
Contributor Author

@normanmaurer I've just rebased 👍

Is there anything that needs to be done to support netty 5? Is there a process for making sure changes are pulled 'upstream'?

Otherwise, let me know if there is anything left for me to do.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@ddelnano

ddelnano commented Jun 9, 2022 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor Author

@normanmaurer I think there might be an issue with the netty-tcnative 2.0.53 release (as mentioned in Discord).

Update: this was resolved and was a misunderstanding on my part that the final version would be suffixed with .Final!

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

normanmaurer
normanmaurer approved these changes Jun 10, 2022
View reviewed changes
@normanmaurer

normanmaurer commented Jun 10, 2022

Copy link
Copy Markdown
Member

@chrisvest if you are satisfied merge this one please .

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

chrisvest
chrisvest approved these changes Jun 10, 2022
View reviewed changes
@chrisvest
chrisvest merged commit bc085b0 into netty:4.1 Jun 10, 2022
@normanmaurer normanmaurer added this to the 4.1.78.Final milestone Jun 10, 2022
chrisvest pushed a commit that referenced this pull request Jun 10, 2022
@ddelnano @normanmaurer @chrisvest
Update SslHandler to set bio fd member to facilitate openssl tracing …
23e89e1
…(Pixie integration) (#12438)

Motivation:

I've been working on extending the pixie platform to support out of the box instrumentation for [twitter/finagle](https://github.com/twitter/finagle) and eventually the netty project (pixie-io/pixie#407).

For those that aren't familiar, [Pixie](https://github.com/pixie-io/pixie) is an open source, Kubernetes Observability tool that provides auto instrumentation by leveraging eBPF. It has support for tracing network traffic for a variety of protocols (http/2, kafka, mysql, mux, etc) even if encrypted with openssl. Its openssl tracing support works by instrumenting the `SSL_read` and `SSL_write` functions through a uprobe. This uprobe captures the data just before encryption or just after decryption, in addition to navigating [openssl's rbio struct](https://github.com/pixie-io/pixie/blob/294d3f36214dece583dd499ebd578cecb7cc7425/src/stirling/source_connectors/socket_tracer/bcc_bpf/openssl_trace.c#L59-L78) to access the socket file descriptor (necessary for associating network traffic with a particular container).

Modification:

Due to how netty uses openssl today, the openssl SSL struct passed to `SSL_read` and `SSL_write` does not have the socket fd set. This is because netty's Java code handles the network transport and leverages openssl only for encryption and decryption. The functionality added in this PR allows netty to populate the SSL struct's rbio field with the socket file descriptor when a channel becomes active (first created). This change is dependent on the netty-tcnative changes made in netty/netty-tcnative#731

My understanding is that each netty channel will be given its own ssl engine, so setting this socket file descriptor on a per connection basis shouldn't be a problem. It's also worth mentioning that getting this to work with Pixie requires setting `-Dio.netty.native.deleteLibAfterLoading=false`. So while the goal is to instrument netty TLS connections with no configuration, that option would be necessary.

Result:

Fixes the majority of the remaining work in pixie-io/pixie#407. The remaining changes would be in the pixie project
- [x] Verified that pixie's netty TLS tracing works for a twitter/finagle service on pixie-io/pixie#446

Co-authored-by: Norman Maurer <[email protected]>
@ddelnano ddelnano mentioned this pull request Jun 17, 2022
Add thriftmux (finagle) openssl trace bpf test and get it passing by using a locally built netty, netty-tcnative and finagle pixie-io/pixie#463
Closed
3 tasks
raidyue pushed a commit to raidyue/netty that referenced this pull request Jul 8, 2022
@ddelnano @normanmaurer 夏无影
Update SslHandler to set bio fd member to facilitate openssl tracing …
672547c
…(Pixie integration) (netty#12438)

Motivation:

I've been working on extending the pixie platform to support out of the box instrumentation for [twitter/finagle](https://github.com/twitter/finagle) and eventually the netty project (pixie-io/pixie#407).

For those that aren't familiar, [Pixie](https://github.com/pixie-io/pixie) is an open source, Kubernetes Observability tool that provides auto instrumentation by leveraging eBPF. It has support for tracing network traffic for a variety of protocols (http/2, kafka, mysql, mux, etc) even if encrypted with openssl. Its openssl tracing support works by instrumenting the `SSL_read` and `SSL_write` functions through a uprobe. This uprobe captures the data just before encryption or just after decryption, in addition to navigating [openssl's rbio struct](https://github.com/pixie-io/pixie/blob/294d3f36214dece583dd499ebd578cecb7cc7425/src/stirling/source_connectors/socket_tracer/bcc_bpf/openssl_trace.c#L59-L78) to access the socket file descriptor (necessary for associating network traffic with a particular container).

Modification:

Due to how netty uses openssl today, the openssl SSL struct passed to `SSL_read` and `SSL_write` does not have the socket fd set. This is because netty's Java code handles the network transport and leverages openssl only for encryption and decryption. The functionality added in this PR allows netty to populate the SSL struct's rbio field with the socket file descriptor when a channel becomes active (first created). This change is dependent on the netty-tcnative changes made in netty/netty-tcnative#731

My understanding is that each netty channel will be given its own ssl engine, so setting this socket file descriptor on a per connection basis shouldn't be a problem. It's also worth mentioning that getting this to work with Pixie requires setting `-Dio.netty.native.deleteLibAfterLoading=false`. So while the goal is to instrument netty TLS connections with no configuration, that option would be necessary.

Result:

Fixes the majority of the remaining work in pixie-io/pixie#407. The remaining changes would be in the pixie project
- [x] Verified that pixie's netty TLS tracing works for a twitter/finagle service on pixie-io/pixie#446

Co-authored-by: Norman Maurer <[email protected]>
@ddelnano ddelnano mentioned this pull request Aug 8, 2022
Upgrade finagle to version that includes tls tracing compatible netty-tcnative pixie-io/pixie#562
Closed
1 task done
franz1981 pushed a commit to franz1981/netty that referenced this pull request Aug 22, 2022
@ddelnano @normanmaurer @franz1981
Update SslHandler to set bio fd member to facilitate openssl tracing …
41db6e8
…(Pixie integration) (netty#12438)

Motivation:

I've been working on extending the pixie platform to support out of the box instrumentation for [twitter/finagle](https://github.com/twitter/finagle) and eventually the netty project (pixie-io/pixie#407).

For those that aren't familiar, [Pixie](https://github.com/pixie-io/pixie) is an open source, Kubernetes Observability tool that provides auto instrumentation by leveraging eBPF. It has support for tracing network traffic for a variety of protocols (http/2, kafka, mysql, mux, etc) even if encrypted with openssl. Its openssl tracing support works by instrumenting the `SSL_read` and `SSL_write` functions through a uprobe. This uprobe captures the data just before encryption or just after decryption, in addition to navigating [openssl's rbio struct](https://github.com/pixie-io/pixie/blob/294d3f36214dece583dd499ebd578cecb7cc7425/src/stirling/source_connectors/socket_tracer/bcc_bpf/openssl_trace.c#L59-L78) to access the socket file descriptor (necessary for associating network traffic with a particular container).

Modification:

Due to how netty uses openssl today, the openssl SSL struct passed to `SSL_read` and `SSL_write` does not have the socket fd set. This is because netty's Java code handles the network transport and leverages openssl only for encryption and decryption. The functionality added in this PR allows netty to populate the SSL struct's rbio field with the socket file descriptor when a channel becomes active (first created). This change is dependent on the netty-tcnative changes made in netty/netty-tcnative#731

My understanding is that each netty channel will be given its own ssl engine, so setting this socket file descriptor on a per connection basis shouldn't be a problem. It's also worth mentioning that getting this to work with Pixie requires setting `-Dio.netty.native.deleteLibAfterLoading=false`. So while the goal is to instrument netty TLS connections with no configuration, that option would be necessary.

Result:

Fixes the majority of the remaining work in pixie-io/pixie#407. The remaining changes would be in the pixie project
- [x] Verified that pixie's netty TLS tracing works for a twitter/finagle service on pixie-io/pixie#446

Co-authored-by: Norman Maurer <[email protected]>
copybaranaut pushed a commit to pixie-io/pixie that referenced this pull request Aug 24, 2022
Dom Del Nano @copybaranaut
Upgrade finagle to version that includes tls tracing compatible netty…
e577064
…-tcnative

Summary: This PR upgrades finagle to install a version that includes the netty changes I upstreamed (netty/netty#12438, netty/netty-tcnative#731) to support #407. Once this is upgraded, the next step is to refresh #463.

Test Plan: Ran the thriftmux container and verified that the logs of the client show that netty tcnative is used (improperly installed netty tcnative will silently succeed)

Reviewers: #stirling, jps

Reviewed By: #stirling, jps

Signed-off-by: Dom Del Nano <[email protected]>

Differential Revision: https://phab.corp.pixielabs.ai/D12111

GitOrigin-RevId: d3da5e233e5aa38b1b29865fd4cc8c58128966c2
@ddelnano ddelnano mentioned this pull request Oct 5, 2022
Add TLS tracing support to netty (portion of JVM based languages) pixie-io/pixie#407
Closed
@normanmaurer

normanmaurer commented Oct 11, 2022 via email

Copy link
Copy Markdown
Member
Yeah
…
Am 06.06.2022 um 02:43 schrieb Dom Del Nano ***@***.***>:  @normanmaurer @chrisvest just wanted to check in on this. Would we need to wait until netty-tcnative 2.0.53 is released before this could be merged (and update the dependencies appropriately)? — Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you were mentioned.
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@ddelnano

ddelnano commented Oct 11, 2022

Copy link
Copy Markdown
Contributor Author

@normanmaurer was your reply about my netty 5 question?

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@andsel andsel mentioned this pull request Jan 18, 2023
Update Netty to 4.1.87 logstash-plugins/logstash-input-tcp#209
Merged
3 tasks done
entlein pushed a commit to k8sstormcenter/pixie that referenced this pull request Jun 2, 2026
Dom Del Nano @copybaranaut
Upgrade finagle to version that includes tls tracing compatible netty…
b20c607
…-tcnative

Summary: This PR upgrades finagle to install a version that includes the netty changes I upstreamed (netty/netty#12438, netty/netty-tcnative#731) to support pixie-io#407. Once this is upgraded, the next step is to refresh pixie-io#463.

Test Plan: Ran the thriftmux container and verified that the logs of the client show that netty tcnative is used (improperly installed netty tcnative will silently succeed)

Reviewers: #stirling, jps

Reviewed By: #stirling, jps

Signed-off-by: Dom Del Nano <[email protected]>

Differential Revision: https://phab.corp.pixielabs.ai/D12111

GitOrigin-RevId: d3da5e233e5aa38b1b29865fd4cc8c58128966c2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@chrisvest chrisvest chrisvest approved these changes
@normanmaurer normanmaurer normanmaurer approved these changes
+1 more reviewer
@Kvicii Kvicii Kvicii approved these changes
Reviewers whose approvals may not affect merge requirements

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

4.1.78.Final

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

4 participants

@ddelnano @chrisvest @normanmaurer @Kvicii
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.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.