-
Notifications
You must be signed in to change notification settings - Fork 217
Description
Proposed Change
As a developer,
I want this ability to capture tcpdumps or perform other privileged actions,
So that I can perform in-depth troubleshooting of my application.
The original request started with the ask to find a way to enable app developers to perform tcpdumps. This is a topic that has been going on in the background for quite some time but so far we never came to a solution for CF (for BOSH we have the introduced the bosh-pcap command).
When troubleshooting applications it is common to require elevated privileges, for example to dump the core on a process or start a packet capture on a network interface. Today there is no possibility for an app developer to perform such actions when they deploy their application via buildpacks.
If the operator allows docker apps to be pushed, the app owner can push such an app in a configuration that makes the executing user root and gain all the necessary privileges.
Option 1) sudo
(discarded)
sudo
The proposal is to add another switch (like the docker one) that allows operators to make the vcap user a sudoer. This has security implications but if docker apps are already allowed I don't see how this is any different than building the app locally and pushing as a docker image with the root user configured.
Option 2) setcap
on tcpdump
This would be a change in the stack to assign the tcpdump binary the necessary capabilities to perform packet captures (namely CAP_NET_RAW
and CAP_NET_ADMIN
). The scope here is much narrower as this only enables tcpdump but a change in the stack is hard to hide behind a feature flag and would probably be rolled out unconditionally to everyone. With the capabilities set on the tcpdump binary any regular user can use it and via that binary (and only that binary) gain the necessary capabilities to perform packet captures.
Option 2b) setcap
on custom packet capturing tool
A reduced tcpdump written in go. With gopacket it's trivial to start a capture and output the stream to stdout. We'd only support specifying an interface, filter and snaplen to reduce the attack surface - there even should be code in the archived pcap-release that pretty much does that. We can then setcap that binary to allow regular users to capture traffic. If the binary is injected via diego (say similar to diego-ssh) this can even become a per-app feature flag (although I'd prefer just making it a platform flag for simplicity).
Acceptance criteria
Application developers can perform tcpdumps in app containers.
Related links
Metadata
Metadata
Assignees
Labels
Type
Projects
Status