radix-platform icon indicating copy to clipboard operation
radix-platform copied to clipboard

Add exception: Least privileged Linux capabilities should be enforced for containers [Medium]

Open emirgens opened this issue 2 years ago • 1 comments

To reduce attack surface of your container, restrict Linux capabilities and grant specific privileges to containers without granting all the privileges of the root user. We recommend dropping all capabilities, then adding those that are required.

  • [ ] Add exception for nginx

Sample from list: ingress-nginx/ingress-nginx-controller-597555d48f-qsjmf

Others needs to be remediated

Manual remediation:

  1. Make sure lists of dropped capabilities and allowed capabilities are configured, via the security policy parameters. Recommend to set parameter 'Required drop capabilities' as ["ALL"] to enforce to drop all capabilities. The recommendation by default will only block to add capacities.
  2. From the Unhealthy resources tab, select the cluster. Defender for Cloud lists the running containers with capabilities outside the configured list.
  3. Limit the containers' Linux capabilities. To add or remove Linux capabilities for a container, include a capabilities section in the securityContext section of the container manifest with the relevant capabilities set e.g. Drop: ALL ; add: ["NET_ADMIN", "SYS_TIME"]. Read more 1, 2
  4. After making your changes, redeploy the pod with the updated capabilities.

emirgens avatar Jun 08 '23 13:06 emirgens

We should keep chroot enabled on ingress-nginx:

https://kubernetes.io/blog/2022/04/28/ingress-nginx-1-2-0/

Richard87 avatar Jan 24 '24 12:01 Richard87