Skip to content

Add TLS metadata to network connection data #3022

@smith-xyz

Description

@smith-xyz

In stackrox/stackrox#19001, I proposed adding TLS handshake metadata (version, cipher suite, key exchange algorithm, SNI) to network flows. After reviewing and understanding the Collector side more, this seems like it could be a significant addition. Today all eBPF collection goes through Falco's modern_bpf tracepoints, which operate at the syscall level. There's no packet-level inspection.

Capturing TLS metadata requires inspecting the ClientHello and ServerHello messages on the wire. This can be done without decrypting traffic since the handshake is plaintext up to the point where encryption begins.

A proposed approach:

Attach a BPF socket filter or TC classifier to network interfaces that:

  1. Identifies TCP segments containing TLS handshake records (content type 0x16)
  2. Parses ClientHello for SNI and supported key exchange groups
  3. Parses ServerHello for negotiated TLS version, cipher suite, and key exchange group
  4. Emits structured events (keyed by 5-tuple) to userspace via ring buffer

Userspace correlates these events with the existing ConnTracker 5-tuple state and populates the tls_info field on NetworkConnection in ConnToProto().

This would be a standalone BPF program loaded via libbpf, separate from the Falco probe. I noticed #1460 and #1461 discuss custom CO-RE BPF -- is that infrastructure something this should build on, or is this different enough to warrant its own loader?

For reference:

I have a working Rust/eBPF implementation that does this with TC classifiers: https://github.com/smith-xyz/tls-probe. The BPF side is portable -- the parsing logic for ClientHello/ServerHello is language-agnostic.

NetObserv's eBPF agent has an open PR for TLS version tracking (netobserv/netobserv-ebpf-agent#815) using a similar packet inspection approach.

Some open questions:

  • Is TC classifier vs socket filter preferred? TC gives ingress+egress visibility but requires interface attachment. Socket filter is simpler but may miss some traffic depending on attachment point.
  • Should this integrate with the custom CO-RE BPF work (Toggle for custom CO-RE BPF #1460/Compile-time switch for custom CO-RE BPF #1461) or be separate?
  • Any concerns about running a second BPF program alongside the Falco probe on production nodes?

Happy to contribute this. The stackrox/stackrox side (proto, Sensor/Central pipeline, DB migration) is straightforward plumbing -- the Collector BPF capture seems to be a larger shift into having custom BPF probes.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions