Description
If a Linux workload does not need raw sockets, require NET_RAW or ALL in the legacy PSP’s requiredDropCapabilities.
Potential impact
A workload can open raw sockets if its runtime grants NET_RAW and the capability remains available.
Remediation
Check that workloads do not add back unnecessary capabilities. Kubernetes deprecated PSP in 1.21 and removed it in 1.25. On current clusters, set capabilities.drop: ["ALL"] on each container and enforce the Restricted Pod Security Standard or a policy using Gatekeeper or Kyverno.
Examples
The restricted2 policy drops only KILL. The restricted policy requires dropping ALL. Other required fields and use permissions are omitted. Because the names differ, verify that the new restriction applies to the intended workloads.
Before
apiVersion: policy/v1beta1
kind: PodSecurityPolicy
metadata:
name: restricted2
spec:
requiredDropCapabilities:
- KILL
After
apiVersion: policy/v1beta1
kind: PodSecurityPolicy
metadata:
name: restricted
spec:
requiredDropCapabilities:
- ALL