Skip to content

[Proposal] Let TShark Do All the Dirty Work #432

Closed
@blaisewang

Description

@blaisewang

I'm proposing several enhancements to improve the usability of eCapture and I welcome discussions and suggestions from all contributors.

1. Utilize TShark Protocol Parsing Capabilities

Currently, eCapture relies on http.ReadRequest and http.ReadResponse in Golang for assembling http.Request and http.Response, which limits support to HTTP/1.1 and older protocols. By leveraging the advanced protocol parsing capabilities of TShark, eCapture can extend its protocol support to nearly match that of Wireshark, starting from the TCP/UDP layer.

2. Reduce the burden on ecapture

With the reduced need for data transfer between user land and kernel land, eCapture can evolve into a more efficient TLS Key Log recording tool. This optimization would allow eCapture to function as a lightweight TLS key log collection agent, potentially operable as a DaemonSet privileged container for monitoring encrypted traffic across an entire Kubernetes cluster.

3. Agent-Server Architecture

In agent mode, eCapture offers flexibility, allowing users to choose between mirroring network packets with the TLS Key Log or capturing only the TLS Key Log, based on the startup command.

In server mode, acting essentially as a TShark Wrapper, eCapture can listen on a specified address to receive network packets and TLS Key logs from the agent for analysis. This server mode opens up limitless possibilities for data analysis.

With this design, ecapture becomes more flexible and practical from an architectural perspective. Certainly, ecapture is also capable of recording TLS Key logs concurrently with the streaming decryption process.

4. ecapctl (Optional)

Similar to Docker/Containerd, the ecapctl command-line tool could be introduced to control eCapture, enabling modifications to its behavior dynamically, without the need to stop the process.

POC

Demonstrating TShark's capability to stream and decrypt TLS traffic is straightforward. The following commands can be executed in two separate terminals:

tshark -o tls.keylog_file:key.log -Y http -T fields -e http.file_data -f "port 32888" -i <interface>
SSLKEYLOGFILE=key.log curl --local-port 32888 --http1.1 --tlsv1.3 https://www.google.com

Under this setup, TShark monitors the tls.keylog_file for changes, temporarily storing network packets in the /tmp/ directory, showcasing its efficient packet handling and decryption capabilities.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions