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 — Add thriftmux (finagle) openssl trace bpf test and get it passing by using a locally built netty and netty-tcnative by ddelnano · Pull Request #446 · pixie-io/pixie

Conversation

@ddelnano

@ddelnano ddelnano commented May 31, 2022 •
edited
Loading

Uh oh!

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

Copy link
Copy Markdown
Member

This PR is a proof of concept for the remaining functionality needed to support netty TLS tracing (#407). This PR uses netty and netty-tcnative jars built from the following branches (netty/netty-tcnative#731 and netty/netty#12438) and demonstrates that Pixie is able to intercept the request and response data despite using mtls finagle services.

Testing

  • New test verifies that netty TLS tracing is successful (output below)
vagrant@vagrant:/vagrant$ ./scripts/sudo_bazel_run.sh -c dbg src/stirling/source_connectors/socket_tracer:thriftmux_openssl_trace_bpf_test

[ ... ]

I20220531 20:40:57.226110 633419 conn_tracker.cc:110] conn_id=[upid=633230:43862295 fd=114 gen=438642685040706] state=kCollecting remote_addr=127.0.0.1:48678 role=kRoleServer protocol=kProtocolUnknown conn_open: [type=kConnOpen ts=438642685041322 conn_id=[upid=633230:43862295 fd=114 gen=438642685040706] source_fn=kSyscallAccept [addr=[family=2 addr=127.0.0.1 port=9918]]]
I20220531 20:40:57.444905 633419 conn_tracker.cc:524] conn_id=[upid=633230:43862295 fd=114 gen=438642685040706] state=kCollecting remote_addr=127.0.0.1:48678 role=kRoleServer protocol=kProtocolMux Protocol changed: kProtocolUnknown->kProtocolMux, reason=[inferred from data_event]
I20220531 20:40:57.446892 633419 conn_tracker.cc:548] conn_id=[upid=633230:43862295 fd=114 gen=438642685040706] state=kCollecting remote_addr=127.0.0.1:48678 role=kRoleServer protocol=kProtocolMux SSL state changed: false->true, reason=[inferred from data_event]
I20220531 20:40:57.447631 633419 conn_tracker.cc:153] conn_id=[upid=633230:43862295 fd=114 gen=438642685040706] state=kCollecting remote_addr=127.0.0.1:48678 role=kRoleServer protocol=kProtocolMux Data event: attr:[[ts=438642949314509 conn_id=[upid=633230:43862295 fd=114 gen=438642685040706] protocol=kProtocolMux role=kRoleServer dir=kIngress ssl=true source_fn=kSSLRead pos=218 size=19 buf_size=19]] msg_size:19 msg:[\x00\x00\x00\x0F\x7F\x00\x00\x01tinit check]
I20220531 20:40:57.447942 633419 conn_tracker.cc:153] conn_id=[upid=633230:43862295 fd=114 gen=438642685040706] state=kCollecting remote_addr=127.0.0.1:48678 role=kRoleServer protocol=kProtocolMux Data event: attr:[[ts=438642949683822 conn_id=[upid=633230:43862295 fd=114 gen=438642685040706] protocol=kProtocolMux role=kRoleServer dir=kEgress ssl=true source_fn=kSSLWrite pos=0 size=19 buf_size=19]] msg_size:19 msg:[\x00\x00\x00\x0F\x7F\x00\x00\x01tinit check]
I20220531 20:40:57.448066 633419 conn_tracker.cc:153] conn_id=[upid=633230:43862295 fd=114 gen=438642685040706] state=kCollecting remote_addr=127.0.0.1:48678 role=kRoleServer protocol=kProtocolMux Data event: attr:[[ts=438642952816339 conn_id=[upid=633230:43862295 fd=114 gen=438642685040706] protocol=kProtocolMux role=kRoleServer dir=kIngress ssl=true source_fn=kSSLRead pos=237 size=46 buf_size=46]] msg_size:46 msg:[\x00\x00\x00*D\x00\x00\x01\x00\x01\x00\x00\x00\x0Amux-framer\x00\x00\x00\x04\x7F\xFF\xFF\xFF\x00\x00\x00\x03tls\x00\x00\x00\x03off]
I20220531 20:40:57.448184 633419 conn_tracker.cc:153] conn_id=[upid=633230:43862295 fd=114 gen=438642685040706] state=kCollecting remote_addr=127.0.0.1:48678 role=kRoleServer protocol=kProtocolMux Data event: attr:[[ts=438642953113601 conn_id=[upid=633230:43862295 fd=114 gen=438642685040706] protocol=kProtocolMux role=kRoleServer dir=kEgress ssl=true source_fn=kSSLWrite pos=19 size=46 buf_size=46]] msg_size:46 msg:[\x00\x00\x00*\xBC\x00\x00\x01\x00\x01\x00\x00\x00\x0Amux-framer\x00\x00\x00\x04\x7F\xFF\xFF\xFF\x00\x00\x00\x03tls\x00\x00\x00\x03off]
I20220531 20:40:57.448617 633419 conn_tracker.h:270] conn_id=[upid=633230:43862295 fd=114 gen=438642685040706] state=kTransferring remote_addr=127.0.0.1:48678 role=kRoleServer protocol=kProtocolMux req_frames=2 resp_frames=2
I20220531 20:40:57.448765 633419 conn_tracker.h:277] conn_id=[upid=633230:43862295 fd=114 gen=438642685040706] state=kTransferring remote_addr=127.0.0.1:48678 role=kRoleServer protocol=kProtocolMux records=2
I20220531 20:40:57.558565 633419 conn_tracker.cc:153] conn_id=[upid=633230:43862295 fd=114 gen=438642685040706] state=kTransferring remote_addr=127.0.0.1:48678 role=kRoleServer protocol=kProtocolMux Data event: attr:[[ts=438643029393686 conn_id=[upid=633230:43862295 fd=114 gen=438642685040706] protocol=kProtocolMux role=kRoleServer dir=kIngress ssl=true source_fn=kSSLRead pos=283 size=8 buf_size=8]] msg_size:8 msg:[\x00\x00\x00\x04A\x00\x00\x01]
I20220531 20:40:57.558804 633419 conn_tracker.cc:153] conn_id=[upid=633230:43862295 fd=114 gen=438642685040706] state=kTransferring remote_addr=127.0.0.1:48678 role=kRoleServer protocol=kProtocolMux Data event: attr:[[ts=438643029653924 conn_id=[upid=633230:43862295 fd=114 gen=438642685040706] protocol=kProtocolMux role=kRoleServer dir=kEgress ssl=true source_fn=kSSLWrite pos=65 size=8 buf_size=8]] msg_size:8 msg:[\x00\x00\x00\x04\xBF\x00\x00\x01]
I20220531 20:40:57.558976 633419 conn_tracker.cc:153] conn_id=[upid=633230:43862295 fd=114 gen=438642685040706] state=kTransferring remote_addr=127.0.0.1:48678 role=kRoleServer protocol=kProtocolMux Data event: attr:[[ts=438643042717271 conn_id=[upid=633230:43862295 fd=114 gen=438642685040706] protocol=kProtocolMux role=kRoleServer dir=kIngress ssl=true source_fn=kSSLRead pos=291 size=204 buf_size=204]] msg_size:204 msg:[\x00\x00\x00\xC8\x02\x00\x00\x02\x00\x03\x00(com.twitter.finagle.tracing.TraceContext\x00 \x9F\x18\x9A\x7FGF)\xBB\x9F\x18\x9A\x7FGF)\xBB\x9F\x18\x9A\x7FGF)\xBB\x00\x00\x00\x00\x00\x00\x00\x00\x00\x1Bcom.twitter.finagle.Retries\x00\x04\x00\x00\x00\x00\x00\x1Ccom.twitter.finagle.Deadline\x00\x10\x16\xF4K5\xC6\xB6J\xC0\x7F\xFF\xFF\xFF\xFF\xFF\xFF\xFF\x00\x00\x00\x00\x80\x01\x00\x01\x00\x00\x00\x05query\x00\x00\x00\x00\x0B\x00\x01\x00\x00\x00\x06String\x00]
I20220531 20:40:57.559165 633419 conn_tracker.cc:153] conn_id=[upid=633230:43862295 fd=114 gen=438642685040706] state=kTransferring remote_addr=127.0.0.1:48678 role=kRoleServer protocol=kProtocolMux Data event: attr:[[ts=438643043946400 conn_id=[upid=633230:43862295 fd=114 gen=438642685040706] protocol=kProtocolMux role=kRoleServer dir=kEgress ssl=true source_fn=kSSLWrite pos=73 size=48 buf_size=48]] msg_size:48 msg:[\x00\x00\x00,\xFE\x00\x00\x02\x00\x00\x00\x80\x01\x00\x02\x00\x00\x00\x05query\x00\x00\x00\x00\x0B\x00\x00\x00\x00\x00\x0CStringString\x00]
I20220531 20:40:57.559701 633419 conn_tracker.h:270] conn_id=[upid=633230:43862295 fd=114 gen=438642685040706] state=kTransferring remote_addr=127.0.0.1:48678 role=kRoleServer protocol=kProtocolMux req_frames=2 resp_frames=2
I20220531 20:40:57.559826 633419 conn_tracker.h:277] conn_id=[upid=633230:43862295 fd=114 gen=438642685040706] state=kTransferring remote_addr=127.0.0.1:48678 role=kRoleServer protocol=kProtocolMux records=2
I20220531 20:40:57.669531 633419 conn_tracker.h:270] conn_id=[upid=633230:43862295 fd=114 gen=438642685040706] state=kTransferring remote_addr=127.0.0.1:48678 role=kRoleServer protocol=kProtocolMux req_frames=0 resp_frames=0
I20220531 20:40:57.669718 633419 conn_tracker.h:277] conn_id=[upid=633230:43862295 fd=114 gen=438642685040706] state=kTransferring remote_addr=127.0.0.1:48678 role=kRoleServer protocol=kProtocolMux records=0
I20220531 20:40:57.779081 633419 conn_tracker.h:270] conn_id=[upid=633230:43862295 fd=114 gen=438642685040706] state=kTransferring remote_addr=127.0.0.1:48678 role=kRoleServer protocol=kProtocolMux req_frames=0 resp_frames=0
I20220531 20:40:57.779264 633419 conn_tracker.h:277] conn_id=[upid=633230:43862295 fd=114 gen=438642685040706] state=kTransferring remote_addr=127.0.0.1:48678 role=kRoleServer protocol=kProtocolMux records=0
I20220531 20:40:57.887400 633147 thriftmux_openssl_trace_bpf_test.cc:112] thriftmux client command output: '633467
20:40:56.112 [main] DEBUG io.netty.util.internal.logging.InternalLoggerFactory - Using SLF4J as the default logging framework
20:40:56.116 [main] DEBUG io.netty.util.ResourceLeakDetector - -Dio.netty.leakDetection.level: simple
20:40:56.116 [main] DEBUG io.netty.util.ResourceLeakDetector - -Dio.netty.leakDetection.targetRecords: 4
20:40:56.135 [main] DEBUG io.netty.util.internal.PlatformDependent0 - -Dio.netty.noUnsafe: false
20:40:56.136 [main] DEBUG io.netty.util.internal.PlatformDependent0 - Java version: 11
20:40:56.136 [main] DEBUG io.netty.util.internal.PlatformDependent0 - sun.misc.Unsafe.theUnsafe: available
20:40:56.137 [main] DEBUG io.netty.util.internal.PlatformDependent0 - sun.misc.Unsafe.copyMemory: available
20:40:56.137 [main] DEBUG io.netty.util.internal.PlatformDependent0 - java.nio.Buffer.address: available
20:40:56.138 [main] DEBUG io.netty.util.internal.PlatformDependent0 - direct buffer constructor: unavailable
java.lang.UnsupportedOperationException: Reflective setAccessible(true) disabled
        at io.netty.util.internal.ReflectionUtil.trySetAccessible(ReflectionUtil.java:31)
        at io.netty.util.internal.PlatformDependent0$4.run(PlatformDependent0.java:238)
        at java.base/java.security.AccessController.doPrivileged(Native Method)
        at io.netty.util.internal.PlatformDependent0.<clinit>(PlatformDependent0.java:232)
        at io.netty.util.internal.PlatformDependent.isAndroid(PlatformDependent.java:294)
        at io.netty.util.internal.PlatformDependent.<clinit>(PlatformDependent.java:93)
        at io.netty.buffer.PooledByteBufAllocator.<clinit>(PooledByteBufAllocator.java:110)
        at com.twitter.finagle.netty4.exportNetty4MetricsAndRegistryEntries$.$anonfun$exportMetrics$1(exportNetty4MetricsAndRegistryEntries.scala:45)
        at com.twitter.concurrent.Once$$anon$1.apply$mcV$sp(Once.scala:23)
        at com.twitter.finagle.netty4.exportNetty4MetricsAndRegistryEntries$.apply(exportNetty4MetricsAndRegistryEntries.scala:144)
        at com.twitter.finagle.netty4.Netty4Init.apply$mcV$sp(Netty4Init.scala:73)
        at com.twitter.finagle.Init$.$anonfun$once$2(Init.scala:98)
        at com.twitter.finagle.Init$.$anonfun$once$2$adapted(Init.scala:96)
        at scala.collection.immutable.Vector.foreach(Vector.scala:1856)
        at com.twitter.finagle.Init$.$anonfun$once$1(Init.scala:96)
        at com.twitter.concurrent.Once$$anon$1.apply$mcV$sp(Once.scala:23)
        at com.twitter.finagle.Init$.apply(Init.scala:131)
        at com.twitter.finagle.client.StackClient$.endpointStack(StackClient.scala:101)
        at com.twitter.finagle.client.StackClient$.newStack(StackClient.scala:286)
        at com.twitter.finagle.Mux$Client$.<clinit>(Mux.scala:158)
        at com.twitter.finagle.Mux$.client(Mux.scala:309)
        at com.twitter.finagle.ThriftMux$.<clinit>(ThriftMux.scala:136)
        at Client$.main(Client.scala:24)
        at Client.main(Client.scala)
20:40:56.139 [main] DEBUG io.netty.util.internal.PlatformDependent0 - java.nio.Bits.unaligned: available, true
20:40:56.140 [main] DEBUG io.netty.util.internal.PlatformDependent0 - jdk.internal.misc.Unsafe.allocateUninitializedArray(int): unavailable
java.lang.IllegalAccessException: class io.netty.util.internal.PlatformDependent0$6 cannot access class jdk.internal.misc.Unsafe (in module java.base) because module java.base does not export jdk.internal.misc to unnamed module @3591009c
        at java.base/jdk.internal.reflect.Reflection.newIllegalAccessException(Reflection.java:361)
        at java.base/java.lang.reflect.AccessibleObject.checkAccess(AccessibleObject.java:591)
        at java.base/java.lang.reflect.Method.invoke(Method.java:558)
        at io.netty.util.internal.PlatformDependent0$6.run(PlatformDependent0.java:352)
        at java.base/java.security.AccessController.doPrivileged(Native Method)
        at io.netty.util.internal.PlatformDependent0.<clinit>(PlatformDependent0.java:343)
        at io.netty.util.internal.PlatformDependent.isAndroid(PlatformDependent.java:294)
        at io.netty.util.internal.PlatformDependent.<clinit>(PlatformDependent.java:93)
        at io.netty.buffer.PooledByteBufAllocator.<clinit>(PooledByteBufAllocator.java:110)
        at com.twitter.finagle.netty4.exportNetty4MetricsAndRegistryEntries$.$anonfun$exportMetrics$1(exportNetty4MetricsAndRegistryEntries.scala:45)
        at com.twitter.concurrent.Once$$anon$1.apply$mcV$sp(Once.scala:23)
        at com.twitter.finagle.netty4.exportNetty4MetricsAndRegistryEntries$.apply(exportNetty4MetricsAndRegistryEntries.scala:144)
        at com.twitter.finagle.netty4.Netty4Init.apply$mcV$sp(Netty4Init.scala:73)
        at com.twitter.finagle.Init$.$anonfun$once$2(Init.scala:98)
        at com.twitter.finagle.Init$.$anonfun$once$2$adapted(Init.scala:96)
        at scala.collection.immutable.Vector.foreach(Vector.scala:1856)
        at com.twitter.finagle.Init$.$anonfun$once$1(Init.scala:96)
        at com.twitter.concurrent.Once$$anon$1.apply$mcV$sp(Once.scala:23)
        at com.twitter.finagle.Init$.apply(Init.scala:131)
        at com.twitter.finagle.client.StackClient$.endpointStack(StackClient.scala:101)
        at com.twitter.finagle.client.StackClient$.newStack(StackClient.scala:286)
        at com.twitter.finagle.Mux$Client$.<clinit>(Mux.scala:158)
        at com.twitter.finagle.Mux$.client(Mux.scala:309)
        at com.twitter.finagle.ThriftMux$.<clinit>(ThriftMux.scala:136)
        at Client$.main(Client.scala:24)
        at Client.main(Client.scala)
20:40:56.140 [main] DEBUG io.netty.util.internal.PlatformDependent0 - java.nio.DirectByteBuffer.<init>(long, int): unavailable
20:40:56.140 [main] DEBUG io.netty.util.internal.PlatformDependent - sun.misc.Unsafe: available
20:40:56.140 [main] DEBUG io.netty.util.internal.PlatformDependent - maxDirectMemory: 2088763392 bytes (maybe)
20:40:56.140 [main] DEBUG io.netty.util.internal.PlatformDependent - -Dio.netty.tmpdir: /tmp (java.io.tmpdir)
20:40:56.141 [main] DEBUG io.netty.util.internal.PlatformDependent - -Dio.netty.bitMode: 64 (sun.arch.data.model)
20:40:56.142 [main] DEBUG io.netty.util.internal.PlatformDependent - -Dio.netty.maxDirectMemory: -1 bytes
20:40:56.142 [main] DEBUG io.netty.util.internal.PlatformDependent - -Dio.netty.uninitializedArrayAllocationThreshold: -1
20:40:56.142 [main] DEBUG io.netty.util.internal.CleanerJava9 - java.nio.ByteBuffer.cleaner(): available
20:40:56.142 [main] DEBUG io.netty.util.internal.PlatformDependent - -Dio.netty.noPreferDirect: false
20:40:56.144 [main] DEBUG io.netty.buffer.PooledByteBufAllocator - -Dio.netty.allocator.numHeapArenas: 8
20:40:56.144 [main] DEBUG io.netty.buffer.PooledByteBufAllocator - -Dio.netty.allocator.numDirectArenas: 8
20:40:56.144 [main] DEBUG io.netty.buffer.PooledByteBufAllocator - -Dio.netty.allocator.pageSize: 8192
20:40:56.144 [main] DEBUG io.netty.buffer.PooledByteBufAllocator - -Dio.netty.allocator.maxOrder: 7
20:40:56.144 [main] DEBUG io.netty.buffer.PooledByteBufAllocator - -Dio.netty.allocator.chunkSize: 1048576
20:40:56.144 [main] DEBUG io.netty.buffer.PooledByteBufAllocator - -Dio.netty.allocator.smallCacheSize: 256
20:40:56.144 [main] DEBUG io.netty.buffer.PooledByteBufAllocator - -Dio.netty.allocator.normalCacheSize: 64
20:40:56.144 [main] DEBUG io.netty.buffer.PooledByteBufAllocator - -Dio.netty.allocator.maxCachedBufferCapacity: 32768
20:40:56.144 [main] DEBUG io.netty.buffer.PooledByteBufAllocator - -Dio.netty.allocator.cacheTrimInterval: 8192
20:40:56.144 [main] DEBUG io.netty.buffer.PooledByteBufAllocator - -Dio.netty.allocator.cacheTrimIntervalMillis: 0
20:40:56.144 [main] DEBUG io.netty.buffer.PooledByteBufAllocator - -Dio.netty.allocator.useCacheForAllThreads: true
20:40:56.145 [main] DEBUG io.netty.buffer.PooledByteBufAllocator - -Dio.netty.allocator.maxCachedByteBuffersPerChunk: 1023
20:40:56.148 [main] DEBUG io.netty.util.internal.InternalThreadLocalMap - -Dio.netty.threadLocalMap.stringBuilder.initialSize: 1024
20:40:56.149 [main] DEBUG io.netty.util.internal.InternalThreadLocalMap - -Dio.netty.threadLocalMap.stringBuilder.maxSize: 4096
20:40:56.160 [main] DEBUG io.netty.util.internal.NativeLibraryLoader - -Dio.netty.native.workdir: /tmp (io.netty.tmpdir)
20:40:56.160 [main] DEBUG io.netty.util.internal.NativeLibraryLoader - -Dio.netty.native.deleteLibAfterLoading: true
20:40:56.160 [main] DEBUG io.netty.util.internal.NativeLibraryLoader - -Dio.netty.native.tryPatchShadedId: true
20:40:56.175 [main] DEBUG io.netty.util.internal.NativeLibraryLoader - Successfully loaded the library /tmp/libnetty_transport_native_epoll_x86_648742828098284244458.so
20:40:56.176 [main] DEBUG io.netty.util.NetUtil - -Djava.net.preferIPv4Stack: false
20:40:56.177 [main] DEBUG io.netty.util.NetUtil - -Djava.net.preferIPv6Addresses: false
20:40:56.178 [main] DEBUG io.netty.util.NetUtilInitializations - Loopback interface: lo (lo, 127.0.0.1)
20:40:56.179 [main] DEBUG io.netty.util.NetUtil - /proc/sys/net/core/somaxconn: 4096
20:40:56.374 [main] DEBUG io.netty.util.ResourceLeakDetectorFactory - Loaded default ResourceLeakDetector: io.netty.util.ResourceLeakDetector@2ca5f1ed
20:40:56.381 [main] DEBUG io.netty.util.internal.PlatformDependent - org.jctools-core.MpscChunkedArrayQueue: available
20:40:56.704 [main] DEBUG io.netty.channel.MultithreadEventLoopGroup - -Dio.netty.eventLoopThreads: 4
20:40:56.736 [main] DEBUG io.netty.channel.DefaultChannelId - -Dio.netty.processId: 633484 (auto-detected)
20:40:56.738 [main] DEBUG io.netty.channel.DefaultChannelId - -Dio.netty.machineId: 02:42:ac:ff:fe:11:00:02 (auto-detected)
20:40:56.750 [main] DEBUG io.netty.buffer.ByteBufUtil - -Dio.netty.allocator.type: pooled
20:40:56.750 [main] DEBUG io.netty.buffer.ByteBufUtil - -Dio.netty.threadLocalDirectBufferSize: 0
20:40:56.750 [main] DEBUG io.netty.buffer.ByteBufUtil - -Dio.netty.maxThreadLocalCharBufferSize: 16384
20:40:56.903 [finagle/netty4-1-1] DEBUG io.netty.util.internal.NativeLibraryLoader - Successfully loaded the library /tmp/libnetty_tcnative_linux_x86_644745938825833084343.so
20:40:56.904 [finagle/netty4-1-1] DEBUG io.netty.handler.ssl.OpenSsl - Initialize netty-tcnative using engine: 'default'
20:40:56.904 [finagle/netty4-1-1] DEBUG io.netty.handler.ssl.OpenSsl - netty-tcnative using native library: BoringSSL
20:40:56.966 [finagle/netty4-1-1] DEBUG io.netty.buffer.AbstractByteBuf - -Dio.netty.buffer.checkAccessible: true
20:40:56.966 [finagle/netty4-1-1] DEBUG io.netty.buffer.AbstractByteBuf - -Dio.netty.buffer.checkBounds: true
20:40:56.966 [finagle/netty4-1-1] DEBUG io.netty.util.ResourceLeakDetectorFactory - Loaded default ResourceLeakDetector: io.netty.util.ResourceLeakDetector@2d133f82
20:40:56.981 [finagle/netty4-1-1] DEBUG io.netty.util.ResourceLeakDetectorFactory - Loaded default ResourceLeakDetector: io.netty.util.ResourceLeakDetector@2b5ba5c6
20:40:56.985 [finagle/netty4-1-1] DEBUG io.netty.util.Recycler - -Dio.netty.recycler.maxCapacityPerThread: disabled
20:40:56.985 [finagle/netty4-1-1] DEBUG io.netty.util.Recycler - -Dio.netty.recycler.maxSharedCapacityFactor: disabled
20:40:56.985 [finagle/netty4-1-1] DEBUG io.netty.util.Recycler - -Dio.netty.recycler.linkCapacity: disabled
20:40:56.985 [finagle/netty4-1-1] DEBUG io.netty.util.Recycler - -Dio.netty.recycler.ratio: disabled
20:40:56.985 [finagle/netty4-1-1] DEBUG io.netty.util.Recycler - -Dio.netty.recycler.delayedQueue.ratio: disabled
20:40:56.993 [finagle/netty4-1-1] DEBUG io.netty.handler.ssl.CipherSuiteConverter - Cipher suite mapping: TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256 => ECDHE-ECDSA-AES128-GCM-SHA256
20:40:56.993 [finagle/netty4-1-1] DEBUG io.netty.handler.ssl.CipherSuiteConverter - Cipher suite mapping: SSL_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256 => ECDHE-ECDSA-AES128-GCM-SHA256
20:40:56.993 [finagle/netty4-1-1] DEBUG io.netty.handler.ssl.CipherSuiteConverter - Cipher suite mapping: TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 => ECDHE-RSA-AES128-GCM-SHA256
20:40:56.993 [finagle/netty4-1-1] DEBUG io.netty.handler.ssl.CipherSuiteConverter - Cipher suite mapping: SSL_ECDHE_RSA_WITH_AES_128_GCM_SHA256 => ECDHE-RSA-AES128-GCM-SHA256
20:40:56.994 [finagle/netty4-1-1] DEBUG io.netty.handler.ssl.CipherSuiteConverter - Cipher suite mapping: TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384 => ECDHE-ECDSA-AES256-GCM-SHA384
20:40:56.994 [finagle/netty4-1-1] DEBUG io.netty.handler.ssl.CipherSuiteConverter - Cipher suite mapping: SSL_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384 => ECDHE-ECDSA-AES256-GCM-SHA384
20:40:56.994 [finagle/netty4-1-1] DEBUG io.netty.handler.ssl.CipherSuiteConverter - Cipher suite mapping: TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 => ECDHE-RSA-AES256-GCM-SHA384
20:40:56.994 [finagle/netty4-1-1] DEBUG io.netty.handler.ssl.CipherSuiteConverter - Cipher suite mapping: SSL_ECDHE_RSA_WITH_AES_256_GCM_SHA384 => ECDHE-RSA-AES256-GCM-SHA384
20:40:56.994 [finagle/netty4-1-1] DEBUG io.netty.handler.ssl.CipherSuiteConverter - Cipher suite mapping: TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305_SHA256 => ECDHE-ECDSA-CHACHA20-POLY1305
20:40:56.994 [finagle/netty4-1-1] DEBUG io.netty.handler.ssl.CipherSuiteConverter - Cipher suite mapping: SSL_ECDHE_ECDSA_WITH_CHACHA20_POLY1305_SHA256 => ECDHE-ECDSA-CHACHA20-POLY1305
20:40:56.994 [finagle/netty4-1-1] DEBUG io.netty.handler.ssl.CipherSuiteConverter - Cipher suite mapping: TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256 => ECDHE-RSA-CHACHA20-POLY1305
20:40:56.994 [finagle/netty4-1-1] DEBUG io.netty.handler.ssl.CipherSuiteConverter - Cipher suite mapping: SSL_ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256 => ECDHE-RSA-CHACHA20-POLY1305
20:40:56.995 [finagle/netty4-1-1] DEBUG io.netty.handler.ssl.CipherSuiteConverter - Cipher suite mapping: TLS_ECDHE_PSK_WITH_CHACHA20_POLY1305_SHA256 => ECDHE-PSK-CHACHA20-POLY1305
20:40:56.995 [finagle/netty4-1-1] DEBUG io.netty.handler.ssl.CipherSuiteConverter - Cipher suite mapping: SSL_ECDHE_PSK_WITH_CHACHA20_POLY1305_SHA256 => ECDHE-PSK-CHACHA20-POLY1305
20:40:56.995 [finagle/netty4-1-1] DEBUG io.netty.handler.ssl.CipherSuiteConverter - Cipher suite mapping: TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA => ECDHE-ECDSA-AES128-SHA
20:40:56.995 [finagle/netty4-1-1] DEBUG io.netty.handler.ssl.CipherSuiteConverter - Cipher suite mapping: SSL_ECDHE_ECDSA_WITH_AES_128_CBC_SHA => ECDHE-ECDSA-AES128-SHA
20:40:56.995 [finagle/netty4-1-1] DEBUG io.netty.handler.ssl.CipherSuiteConverter - Cipher suite mapping: TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA => ECDHE-RSA-AES128-SHA
20:40:56.995 [finagle/netty4-1-1] DEBUG io.netty.handler.ssl.CipherSuiteConverter - Cipher suite mapping: SSL_ECDHE_RSA_WITH_AES_128_CBC_SHA => ECDHE-RSA-AES128-SHA
20:40:56.995 [finagle/netty4-1-1] DEBUG io.netty.handler.ssl.CipherSuiteConverter - Cipher suite mapping: TLS_ECDHE_PSK_WITH_AES_128_CBC_SHA => ECDHE-PSK-AES128-CBC-SHA
20:40:56.995 [finagle/netty4-1-1] DEBUG io.netty.handler.ssl.CipherSuiteConverter - Cipher suite mapping: SSL_ECDHE_PSK_WITH_AES_128_CBC_SHA => ECDHE-PSK-AES128-CBC-SHA
20:40:56.996 [finagle/netty4-1-1] DEBUG io.netty.handler.ssl.CipherSuiteConverter - Cipher suite mapping: TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA => ECDHE-ECDSA-AES256-SHA
20:40:56.996 [finagle/netty4-1-1] DEBUG io.netty.handler.ssl.CipherSuiteConverter - Cipher suite mapping: SSL_ECDHE_ECDSA_WITH_AES_256_CBC_SHA => ECDHE-ECDSA-AES256-SHA
20:40:56.996 [finagle/netty4-1-1] DEBUG io.netty.handler.ssl.CipherSuiteConverter - Cipher suite mapping: TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA => ECDHE-RSA-AES256-SHA
20:40:56.996 [finagle/netty4-1-1] DEBUG io.netty.handler.ssl.CipherSuiteConverter - Cipher suite mapping: SSL_ECDHE_RSA_WITH_AES_256_CBC_SHA => ECDHE-RSA-AES256-SHA
20:40:56.996 [finagle/netty4-1-1] DEBUG io.netty.handler.ssl.CipherSuiteConverter - Cipher suite mapping: TLS_ECDHE_PSK_WITH_AES_256_CBC_SHA => ECDHE-PSK-AES256-CBC-SHA
20:40:56.996 [finagle/netty4-1-1] DEBUG io.netty.handler.ssl.CipherSuiteConverter - Cipher suite mapping: SSL_ECDHE_PSK_WITH_AES_256_CBC_SHA => ECDHE-PSK-AES256-CBC-SHA
20:40:56.997 [finagle/netty4-1-1] DEBUG io.netty.handler.ssl.CipherSuiteConverter - Cipher suite mapping: TLS_RSA_WITH_AES_128_GCM_SHA256 => AES128-GCM-SHA256
20:40:56.997 [finagle/netty4-1-1] DEBUG io.netty.handler.ssl.CipherSuiteConverter - Cipher suite mapping: SSL_RSA_WITH_AES_128_GCM_SHA256 => AES128-GCM-SHA256
20:40:56.997 [finagle/netty4-1-1] DEBUG io.netty.handler.ssl.CipherSuiteConverter - Cipher suite mapping: TLS_RSA_WITH_AES_256_GCM_SHA384 => AES256-GCM-SHA384
20:40:56.997 [finagle/netty4-1-1] DEBUG io.netty.handler.ssl.CipherSuiteConverter - Cipher suite mapping: SSL_RSA_WITH_AES_256_GCM_SHA384 => AES256-GCM-SHA384
20:40:56.997 [finagle/netty4-1-1] DEBUG io.netty.handler.ssl.CipherSuiteConverter - Cipher suite mapping: TLS_RSA_WITH_AES_128_CBC_SHA => AES128-SHA
20:40:56.997 [finagle/netty4-1-1] DEBUG io.netty.handler.ssl.CipherSuiteConverter - Cipher suite mapping: SSL_RSA_WITH_AES_128_CBC_SHA => AES128-SHA
20:40:56.997 [finagle/netty4-1-1] DEBUG io.netty.handler.ssl.CipherSuiteConverter - Cipher suite mapping: TLS_PSK_WITH_AES_128_CBC_SHA => PSK-AES128-CBC-SHA
20:40:56.998 [finagle/netty4-1-1] DEBUG io.netty.handler.ssl.CipherSuiteConverter - Cipher suite mapping: SSL_PSK_WITH_AES_128_CBC_SHA => PSK-AES128-CBC-SHA
20:40:56.998 [finagle/netty4-1-1] DEBUG io.netty.handler.ssl.CipherSuiteConverter - Cipher suite mapping: TLS_RSA_WITH_AES_256_CBC_SHA => AES256-SHA
20:40:56.998 [finagle/netty4-1-1] DEBUG io.netty.handler.ssl.CipherSuiteConverter - Cipher suite mapping: SSL_RSA_WITH_AES_256_CBC_SHA => AES256-SHA
20:40:57.000 [finagle/netty4-1-1] DEBUG io.netty.handler.ssl.CipherSuiteConverter - Cipher suite mapping: TLS_PSK_WITH_AES_256_CBC_SHA => PSK-AES256-CBC-SHA
20:40:57.000 [finagle/netty4-1-1] DEBUG io.netty.handler.ssl.CipherSuiteConverter - Cipher suite mapping: SSL_PSK_WITH_AES_256_CBC_SHA => PSK-AES256-CBC-SHA
20:40:57.000 [finagle/netty4-1-1] DEBUG io.netty.handler.ssl.CipherSuiteConverter - Cipher suite mapping: TLS_RSA_WITH_3DES_EDE_CBC_SHA => DES-CBC3-SHA
20:40:57.000 [finagle/netty4-1-1] DEBUG io.netty.handler.ssl.CipherSuiteConverter - Cipher suite mapping: SSL_RSA_WITH_3DES_EDE_CBC_SHA => DES-CBC3-SHA
20:40:57.000 [finagle/netty4-1-1] DEBUG io.netty.handler.ssl.OpenSsl - Supported protocols (OpenSSL): [SSLv2Hello, TLSv1, TLSv1.1, TLSv1.2, TLSv1.3]
20:40:57.000 [finagle/netty4-1-1] DEBUG io.netty.handler.ssl.OpenSsl - Default cipher suites (OpenSSL): [TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384, TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256, TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256, TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384, TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA, TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA, TLS_RSA_WITH_AES_128_GCM_SHA256, TLS_RSA_WITH_AES_128_CBC_SHA, TLS_RSA_WITH_AES_256_CBC_SHA, TLS_AES_128_GCM_SHA256, TLS_AES_256_GCM_SHA384, TLS_AES_128_GCM_SHA256, TLS_AES_256_GCM_SHA384]
20:40:57.096 [finagle/netty4-1-1] DEBUG io.netty.util.ResourceLeakDetectorFactory - Loaded default ResourceLeakDetector: io.netty.util.ResourceLeakDetector@746c5926
20:40:57.139 [finagle/netty4-1-1] DEBUG io.netty.util.ResourceLeakDetectorFactory - Loaded default ResourceLeakDetector: io.netty.util.ResourceLeakDetector@46cd7121
20:40:57.406 [finagle/netty4-1-1] DEBUG io.netty.handler.ssl.SslHandler - [id: 0xa9c555e7, L:/127.0.0.1:48678 - R:localhost/127.0.0.1:8080] HANDSHAKEN: protocol:TLSv1.3 cipher suite:TLS_AES_128_GCM_SHA256
StringString
'
I20220531 20:40:57.888101 633147 thriftmux_openssl_trace_bpf_test.cc:121] Client PID: 633467
I20220531 20:40:57.891284 633419 conn_tracker.cc:139] conn_id=[upid=633230:43862295 fd=114 gen=438642685040706] state=kTransferring remote_addr=127.0.0.1:48678 role=kRoleServer protocol=kProtocolMux conn_close: [type=kConnClose ts=438643409005540 conn_id=[upid=633230:43862295 fd=114 gen=438642685040706] source_fn=kSyscallClose [wr_bytes=121 rd_bytes=495]]
I20220531 20:40:57.891332 633419 conn_tracker.cc:598] conn_id=[upid=633230:43862295 fd=114 gen=438642685040706] state=kTransferring remote_addr=127.0.0.1:48678 role=kRoleServer protocol=kProtocolMux Marked for death, countdown=3
I20220531 20:40:57.891355 633419 conn_tracker.cc:198] conn_id=[upid=633230:43862295 fd=114 gen=438642685040706] state=kTransferring remote_addr=127.0.0.1:48678 role=kRoleServer protocol=kProtocolMux ConnStats timestamp=438643409012518 wr=121 rd=495 close=2
I20220531 20:40:57.891691 633419 conn_tracker.h:270] conn_id=[upid=633230:43862295 fd=114 gen=438642685040706] state=kTransferring remote_addr=127.0.0.1:48678 role=kRoleServer protocol=kProtocolMux req_frames=0 resp_frames=0
I20220531 20:40:57.891824 633419 conn_tracker.h:277] conn_id=[upid=633230:43862295 fd=114 gen=438642685040706] state=kTransferring remote_addr=127.0.0.1:48678 role=kRoleServer protocol=kProtocolMux records=0
I20220531 20:40:57.891937 633419 conn_tracker.cc:796] conn_id=[upid=633230:43862295 fd=114 gen=438642685040706] state=kTransferring remote_addr=127.0.0.1:48678 role=kRoleServer protocol=kProtocolMux Death countdown=2
I20220531 20:40:58.003444 633419 conn_tracker.h:270] conn_id=[upid=633230:43862295 fd=114 gen=438642685040706] state=kTransferring remote_addr=127.0.0.1:48678 role=kRoleServer protocol=kProtocolMux req_frames=0 resp_frames=0
I20220531 20:40:58.003654 633419 conn_tracker.h:277] conn_id=[upid=633230:43862295 fd=114 gen=438642685040706] state=kTransferring remote_addr=127.0.0.1:48678 role=kRoleServer protocol=kProtocolMux records=0
I20220531 20:40:58.003779 633419 conn_tracker.cc:796] conn_id=[upid=633230:43862295 fd=114 gen=438642685040706] state=kTransferring remote_addr=127.0.0.1:48678 role=kRoleServer protocol=kProtocolMux Death countdown=1
I20220531 20:40:59.704216 633147 container_runner.cc:59] docker rm -f thriftmux_server_438622741729428
I20220531 20:40:59.906308 633147 conn_tracker.cc:78] conn_id=[upid=633230:43862295 fd=114 gen=438642685040706] state=kTransferring remote_addr=127.0.0.1:48678 role=kRoleServer protocol=kProtocolMux Being destroyed
[       OK ] OpenSSLTraceRawFptrsTest/0.mtls_thriftmux_client (23809 ms)
[----------] 1 test from OpenSSLTraceRawFptrsTest/0 (23809 ms total)

[----------] Global test environment tear-down
[==========] 1 test from 1 test suite ran. (23811 ms total)
[  PASSED  ] 1 test.
I20220531 20:40:59.939134 633147 env.cc:51] Shutting down

Future work

  • Follow up with netty team about upstreaming the netty and netty-tcnative changes
  • Address TODO comments in

Sorry, something went wrong.

Uh oh!

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

All reactions
Dom Del Nano
Add thriftmux openssl trace bpf test and get it passing by using a lo…
a3fbdeb
…cally built netty and netty-tcnative
@pixie-io-buildbot

pixie-io-buildbot commented May 31, 2022

Copy link
Copy Markdown
Member

Can one of the admins verify this patch?

All reactions

Sorry, something went wrong.

Uh oh!

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

ddelnano
ddelnano commented May 31, 2022
View reviewed changes
Comment thread bazel/thrift.bzl
"io.netty:netty-handler",
"io.netty:netty-common",
"io.netty:netty-tcnative-boringssl-static",
# "io.netty:netty-tcnative-classes",

@ddelnano ddelnano May 31, 2022

Copy link
Copy Markdown
Member Author

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.

This excludes maven from installing them so we can supply our locally built versions.

Sorry, something went wrong.

Uh oh!

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

All reactions
@ddelnano ddelnano changed the title Add thriftmux openssl trace bpf test and get it passing by using a locally built netty and netty-tcnative Add thriftmux (finagle) openssl trace bpf test and get it passing by using a locally built netty and netty-tcnative Jun 1, 2022
This was referenced Jun 1, 2022
Add SSL.bioSetFd method to JNI code to support Pixie integration netty/netty-tcnative#731
Merged
Update SslHandler to set bio fd member to facilitate openssl tracing (Pixie integration) netty/netty#12438
Merged
@oazizi000 oazizi000 mentioned this pull request Jun 8, 2022
Upgrade scala and finagle dependencies to latest versions #454
Closed
chrisvest pushed a commit to netty/netty that referenced this pull request Jun 10, 2022
@ddelnano @normanmaurer
Update SslHandler to set bio fd member to facilitate openssl tracing …
bc085b0
…(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]>
chrisvest pushed a commit to netty/netty 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 #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]>
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]>
@ddelnano ddelnano closed this Aug 29, 2022
@ddelnano

ddelnano commented Aug 29, 2022

Copy link
Copy Markdown
Member Author

This was a proof of concept in order to test my proposed upstream changes.

All reactions

Sorry, something went wrong.

Uh oh!

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

No reviews

Uh oh!

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

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

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

2 participants

@ddelnano @pixie-io-buildbot
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.