Containers with added capabilities This product is not supported for your selected
Datadog site . (
).
Id: kubernetes-containers-with-added-capabilities
Platform: Kubernetes
Severity: Medium
Category: Insecure Configurations
Learn More Description Containers and initContainers should not include added capabilities other than NET_BIND_SERVICE. The rule checks container.securityContext.capabilities.add and reports an IncorrectValue when any capability other than NET_BIND_SERVICE is present. It applies to both containers and initContainers found in the pod spec.
Compliant Code Examples apiVersion : v1
kind : Pod
metadata :
name : pod1
spec :
containers :
- name : app
image : images.my-company.example/app:v4
securityContext :
allowPrivilegeEscalation : false
resources :
requests :
memory : "64Mi"
cpu : "250m"
limits :
memory : "128Mi"
cpu : "500m"
- name : log-aggregator
image : images.my-company.example/log-aggregator:v6
securityContext :
allowPrivilegeEscalation : false
resources :
requests :
memory : "64Mi"
cpu : "250m"
limits :
memory : "128Mi"
cpu : "500m"
apiVersion : v1
kind : Pod
metadata :
name : pod4
spec :
containers :
- name : app
image : images.my-company.example/app:v4
securityContext :
allowPrivilegeEscalation : false
capabilities :
drop :
- ALL
add :
- NET_BIND_SERVICE
resources :
requests :
memory : "64Mi"
cpu : "250m"
limits :
memory : "128Mi"
cpu : "500m"
- name : log-aggregator
image : images.my-company.example/log-aggregator:v6
securityContext :
allowPrivilegeEscalation : false
resources :
requests :
memory : "64Mi"
cpu : "250m"
limits :
memory : "128Mi"
cpu : "500m"
Non-Compliant Code Examples apiVersion : v1
kind : Pod
metadata :
name : pod2
spec :
containers :
- name : app
image : images.my-company.example/app:v4
securityContext :
allowPrivilegeEscalation : false
capabilities :
add : [ "NET_ADMIN" , "SYS_TIME" ]
resources :
requests :
memory : "64Mi"
cpu : "250m"
limits :
memory : "128Mi"
cpu : "500m"
- name : log-aggregator
image : images.my-company.example/log-aggregator:v6
securityContext :
allowPrivilegeEscalation : false
resources :
requests :
memory : "64Mi"
cpu : "250m"
limits :
memory : "128Mi"
cpu : "500m"
---
apiVersion : v1
kind : Pod
metadata :
name : pod3
spec :
initContainers :
- name : app
image : images.my-company.example/app:v4
securityContext :
allowPrivilegeEscalation : false
capabilities :
add : [ "NET_ADMIN" , "SYS_TIME" ]
resources :
requests :
memory : "64Mi"
cpu : "250m"
limits :
memory : "128Mi"
cpu : "500m"
- name : log-aggregator
image : images.my-company.example/log-aggregator:v6
securityContext :
allowPrivilegeEscalation : false
resources :
requests :
memory : "64Mi"
cpu : "250m"
limits :
memory : "128Mi"
cpu : "500m"
containers :
- name : app
image : images.my-company.example/app:v4