GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | ||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | ||||||||||||||
GeezerVison is showing github.com — Add SSL.bioSetFd method to JNI code to support Pixie integration by ddelnano · Pull Request #731 · netty/netty-tcnative Conversation
|
|
@ddelnano thanks a lot! |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
@normanmaurer really appreciate the prompt review! |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| case BIO_CTRL_FLUSH: | ||
| return 1; | ||
| case BIO_C_SET_FD: | ||
| #if defined(OPENSSL_IS_BORINGSSL) || defined(LIBRESSL_VERSION_NUMBER) |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
shouldn't this be like..
#if defined(OPENSSL_IS_BORINGSSL) || defined(LIBRESSL_VERSION_NUMBER) bio->num = *((int *)ptr); return 1; #endif return 0;
so we actually throw an exception on line 409 if it is not supported?
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
good catch! Let me fix it
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Well actually no ... I think we always want to return 1 to make it a NOOP on openssl
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Yes, exactly what @normanmaurer said. Otherwise this will cause openssl to throw an error. It's not a problem for this to silently succeed in openssl's case. I plan to follow up with the openssl project to see if we can get the bio_st struct in the openssl header files, in which case this compilation wouldn't need to be gated behind this #ifdef (see this comment for more background)
Sorry, something went wrong.
There was an error while loading. Please reload this page.
…(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]>
…(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]>
…(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]>
…(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]>
…-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
Summary: This PR will complete the initial support of #407 and is a refresh of an earlier proof of concept change (#463). The goal is to provide an extensible way for supporting other boringssl based tracing targets if the target binary supports the following: - Ability to determine the target binary's openssl version through the RawFptrManager or through dlsym The boringssl implementation populate's openssl's bio_st data structure with the fd of the socket file descriptor (like I did with netty - - Add SSL.bioSetFd method to JNI code to support Pixie integration netty/netty-tcnative#731). This won't work for envoy's case, but the hope is that this is more similar to Pixie's dynamic openssl tracing while envoy is more similar to nodejs (requiring additional application specific integration). Closes #569. Test Plan: New test verifies that TLS tracing is successful (output below) Verified the changes to socket_trace_connector allow `TraceMode::OnNewerKernel` to work Reviewers: #stirling, zasgar Reviewed By: zasgar Signed-off-by: Dom Del Nano <[email protected]> Differential Revision: https://phab.corp.pixielabs.ai/D12324 GitOrigin-RevId: 5ce5cd67c32ae9d6e4b11e04ab854d65371a3a16
…-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
Summary: This PR will complete the initial support of pixie-io#407 and is a refresh of an earlier proof of concept change (pixie-io#463). The goal is to provide an extensible way for supporting other boringssl based tracing targets if the target binary supports the following: - Ability to determine the target binary's openssl version through the RawFptrManager or through dlsym The boringssl implementation populate's openssl's bio_st data structure with the fd of the socket file descriptor (like I did with netty - - Add SSL.bioSetFd method to JNI code to support Pixie integration netty/netty-tcnative#731). This won't work for envoy's case, but the hope is that this is more similar to Pixie's dynamic openssl tracing while envoy is more similar to nodejs (requiring additional application specific integration). Closes pixie-io#569. Test Plan: New test verifies that TLS tracing is successful (output below) Verified the changes to socket_trace_connector allow `TraceMode::OnNewerKernel` to work Reviewers: #stirling, zasgar Reviewed By: zasgar Signed-off-by: Dom Del Nano <[email protected]> Differential Revision: https://phab.corp.pixielabs.ai/D12324 GitOrigin-RevId: 5ce5cd67c32ae9d6e4b11e04ab854d65371a3a16
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
There was an error while loading. Please reload this page.