App security groups in Cloud Foundry
App Security Groups (ASGs) are a collection of egress rules that enable you to specify the protocols, ports, and IP address ranges where app or task instances send traffic.
ASGs define allow rules, and their order of evaluation is unimportant when multiple ASGs apply to the same space or deployment. The platform sets up rules to filter and log outbound network traffic from app and task instances. ASGs apply to both buildpack-based and Docker-based apps and tasks. Since capi-release v1.212.0, IPv6 is supported in ASGs.
Staging and running ASGs​
Admins can define a staging ASG for app and task staging, and a running ASG for app and task runtime.
When apps or tasks begin staging, they require traffic rules permissive enough to allow
them to pull resources from the network. A running app or task no longer needs to pull resources,
so traffic rules can be more restrictive and secure.
To distinguish between these two security requirements, you can define a staging ASG for app and task
staging with more permissive rules, and a running ASG for app and task runtime with less permissive rules.
Platform wide and space scoped ASGs​
To provide granular control when securing a deployment, you can assign platform-wide ASGs that apply to all app and task instances for the entire deployment, or space-scoped ASGs that apply only to apps and tasks in a particular space.
In environments with both platform-wide and space-specific ASGs, the ASGs for a particular space are combined with the platform ASGs to determine the effective rules for that space. Any of the permitted traffic in the set of applicable ASGs is then effectively permitted for that app.
Dynamic ASGs​
Dynamic ASGs allow ASGs to be applied to apps without the need for an application restart. Containers using the Silk CNI or NSX-T update their ASGs dynamically; Windows apps and apps using other CNIs do not support Dynamic ASGs at this time.
Dynamic ASGs are enabled with cf deployment v20.0.0 and higher through cf-networking-release 3.0.0. It is recommended to use Dynamic ASGs with capi-release v1.126.0 or later for improved performance on the /v3/security_groups APIs.
To deactivate Dynamic ASGs: use the ops file operations/disable-dynamic-asgs.yml from cf-deployment v20.0.0 or higher.