kubeshark / tracer

The kernel tracer that attaches eBPF probes to containers for capturing TLS traffic
GNU General Public License v3.0
12 stars 6 forks source link

TLS payload goes into tls.pcap only appears after significant delay #22

Closed alongir closed 5 months ago

alongir commented 5 months ago

After running many tests, I come to the following conclusions:

  1. Tracer behavior isn't predictable
  2. It does show (sometimes) payload related to openSSL and crypto/tls.
  3. Often, payload appears in pcap.tls after a very long time.
  4. Often payload is completely ignored for a long time and then appears
  5. I can't be sure all traffic intercepted traffic appears there.

You can use this command for testing:

k apply -f https://raw.githubusercontent.com/kubeshark/sock-shop-demo/master/deploy/kubernetes/tls-demo.yaml

Hint: you can check the containers logs, to see the TLS payloads:

Image Image

iluxa commented 5 months ago

https://github.com/kubeshark/tracer/pull/24 can help for better debugging this issue.

Idea is to have circullar buffer tls_last.pcap pipe alongside with existing tls.pcap with different behaviour: once reading of this new pipe is requested, for example:

find /var/lib/kubelet/pods/ -iname "tls_last.pcap" -exec cat {} > /home/docker/tls_last.pcap \;

tracer dumps all packets from the circular buffer and closes the pipe.

Current existing issues in tracer related to tls.pcap:

I would propose some new packet interface between tracer and consumer, which can resolve above issues:

This can be, for example, unix socket with some simple protocol

alongir commented 5 months ago

https://github.com/kubeshark/tracer/pull/24 shows there's no issue with the tracer. It also provides confident int he tracer implementation. Hopefully https://github.com/kubeshark/tracer/pull/25 will fix this one as well.