Skip to content

Conversation

maxmoehl
Copy link
Member

@maxmoehl maxmoehl commented Sep 10, 2025

Copy link
Contributor

@peanball peanball left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A few comments and points of discussion.

General:

  • I'm missing the "opt-in" nature and control of the feature and discussion of possible security risks when this feature is enabled overall. The "attacker" in this case is a rouge operator and that might be more of an organizational problem. But the app's operator shouldn't be able to override an org policy, etc.
  • Because this is an analog to bosh pcap, maybe we can explain the functionality and one of its main benefits (multiplexing of traffic captured across multiple instances) a bit earlier? Right now it's in the very last sentence of the very last section (before the references). If it's important it should be repeated.

Comment on lines +42 to +44
The challenge is providing this functionality while maintaining the security
model of Cloud Foundry, where applications run in isolated, unprivileged
containers.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we highlight here that this could be achieved by not generally elevating privileges but elevating privileges for clearly defined, narrow use cases?

Or rather: "Elevated privileges can easily be misused and it is paramount (or some less fancy word) that the security model of CF remains intact, while giving app developers and operators the choice and tools to be able to asses network traffic."

This also alludes to this feature being opt-in. You might not want to enable it permanently, and you may not want to enable it for some specific apps at all.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe something like this?

Suggested change
The challenge is providing this functionality while maintaining the security
model of Cloud Foundry, where applications run in isolated, unprivileged
containers.
While platform traffic can be secured from eavesdropping, e.g. via mTLS, access to
the network traffic in a container will contain sensitive and possibly private
information.
Elevated privileges of any kind can easily be misused and it is paramount that the
security model of Cloud Foundry remains intact, where applications usually run in
isolated, unprivileged containers.
Any solution must consider that network capture is a privilege that has to be
enabled explicitly, not given by default and can be forbidden altogether.

@maxmoehl
Copy link
Member Author

Maybe a general note on the opt-in: there were no extensive discussions on what that "opt-in" would look like. In my opinion it should just be the existing SSH access and not a dedicated flag. Mainly because having SSH access already puts you in a position of being able to do a lot and we have this setup as a feature flag on the different levels of CF.

the various lifecycle archives that are added to the final app container and
the necessary capabilities (`CAP_NET_RAW` and `CAP_NET_ADMIN`) will be assigned
to the executable via file capabilities. This allows regular users to gain those
capabilities when executing the binary.
Copy link
Contributor

@peanball peanball Sep 10, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
capabilities when executing the binary.
capabilities when executing the binary.
The functionality is limited to network capturing with the aforementioned scope
of selected network interface, filtering expression in pcap-filter format and
length of captured packets (snaplen). This reduces the attack surface, compared
to invoking a full `tcpdump`.

(if it's important, repeat it ;-) )

Comment on lines +102 to +106
Similar to the `bosh pcap` command a `cf pcap` command will be added. Like its
predecessor it will connect to the desired instances via SSH and execute the new
packet capturing tool and stream back the captured packets via stdout. If there
are multiple streams, the CLI will merge them and write them out to a single
file in the pcap format.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Similar to the `bosh pcap` command a `cf pcap` command will be added. Like its
predecessor it will connect to the desired instances via SSH and execute the new
packet capturing tool and stream back the captured packets via stdout. If there
are multiple streams, the CLI will merge them and write them out to a single
file in the pcap format.
Similar to the `bosh pcap` command, a `cf pcap` command will be added. Like its
counterpart, it will connect to the desired instances via SSH, execute the new
packet capturing tool and stream back the captured packets via stdout and thus via SSH.
If there are multiple streams, the CLI will merge them and write them out to a single
file in the pcap format.

"predecessor" makes it look like bosh pcap might be going away.

@peanball
Copy link
Contributor

peanball commented Sep 10, 2025

Maybe a general note on the opt-in: there were no extensive discussions on what that "opt-in" would look like. In my opinion it should just be the existing SSH access and not a dedicated flag. Mainly because having SSH access already puts you in a position of being able to do a lot and we have this setup as a feature flag on the different levels of CF.

I see your point. That said, capturing network traffic might show data that is not even stored plain-text in a database that you could gain access to via SSH. So maybe something worth discussing more extensively.

For future discussions and votes: My opinion is that network capture is a privilege beyond SSH.

Copy link
Member

@ameowlia ameowlia left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. Would a user be able to see unencrypted traffic contents?

  2. What roles would be able to use this comment for a given app?

  3. Would this feature always be on, or would there be a foundation wide flag?

  4. Could there be a cf event to log when this action is taken?

Comment on lines 110 to 117
```bash
# Capture HTTP traffic for myapp
cf pcap myapp --interface eth0 --filter "tcp port 80" --snaplen 1500

# Capture specific instance with custom filter
cf pcap myapp --instance 1 --filter "host database.example.com"
```

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you give some examples of what the output would look like?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done, please check again.

@peanball
Copy link
Contributor

Some replies to Amelia's questions. @maxmoehl, please correct me if I'm wrong.

  • Would a user be able to see unencrypted traffic contents?

If they capture on the interface lo, they would.

  • What roles would be able to use this comment for a given app?

This needs to be fleshed out in the RFC a bit. I think it depends on the scenario. In a test org or space a group of developers may want to capture stuff, in a production org maybe only select people after prior approval.

  • Would this feature always be on, or would there be a foundation wide flag?

Foundation wide general flag, and ideally additional per org/space/app(?) flag.

  • Could there be a cf event to log when this action is taken?

That is a good idea, for traceability purposes.

@beyhan beyhan added toc rfc CFF community RFC labels Sep 12, 2025
@maxmoehl
Copy link
Member Author

maxmoehl commented Sep 16, 2025

  • What roles would be able to use this comment for a given app?

This needs to be fleshed out in the RFC a bit. I think it depends on the scenario. In a test org or space a group of developers may want to capture stuff, in a production org maybe only select people after prior approval.

My current proposal (though I should maybe clarify this a bit more) does not introduce any additional permissions. As long as a user can SSH into the app they will be able to initiate a capture. That includes capturing plain-text traffic.

  • Would this feature always be on, or would there be a foundation wide flag?

Foundation wide general flag, and ideally additional per org/space/app(?) flag.

This is where it gets tricky. Foundational flag we can somehow make work via diego-release, it would need to control whether the binary is injected or not which makes this complicated as the injected binaries right now come via a BOSH package which is not configurable in any way. I would prefer not to add org/space/app flags beyond the SSH one1.

  • Could there be a cf event to log when this action is taken?

That is a good idea, for traceability purposes.

This comes down to the feature just being SSH with a special binary. There won't be any interaction with the CF API beyond SSH, so no special audit log will be written.

I will also spend some time today addressing the remaining comments.

Footnotes

  1. This also comes down to capacity. If we require a feature flag equivalent to the SSH one on every level I would need someone to help me make this work as it is quite a lot more work.

@maxmoehl maxmoehl marked this pull request as ready for review September 25, 2025 05:51
@beyhan beyhan requested review from a team, rkoster, beyhan, Gerg, stephanme and cweibel and removed request for a team September 29, 2025 06:49
@beyhan beyhan moved this from Inbox to In Progress in CF Community Sep 30, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
rfc CFF community RFC toc
Projects
Status: In Progress
Development

Successfully merging this pull request may close these issues.

4 participants