Skip to content

Commit

Permalink
Add support for overlayfs direct scan for SBOMs (#1540)
Browse files Browse the repository at this point in the history
* Use uncompressedlayerssupport only if containerImage is enabled

* Add support for overlayfs direct scan for SBOMs

* Mount docker directory to access container image mounts

---------

Co-authored-by: Timothée Bavelier <timothee.bavelier@datadoghq.com>
  • Loading branch information
lebauce and tbavelier authored Oct 29, 2024
1 parent e8333d5 commit 6b2cbbc
Show file tree
Hide file tree
Showing 7 changed files with 27 additions and 7 deletions.
4 changes: 4 additions & 0 deletions charts/datadog/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Datadog changelog

## 3.77.0

* Add experimental support for overlayfs direct scan for SBOMs

## 3.76.3

* Add `podisruptionbudgets` RBAC to the Cluster Agent.
Expand Down
2 changes: 1 addition & 1 deletion charts/datadog/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
apiVersion: v1
name: datadog
version: 3.76.3
version: 3.77.0
appVersion: "7"
description: Datadog Agent
keywords:
Expand Down
3 changes: 2 additions & 1 deletion charts/datadog/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Datadog

![Version: 3.76.3](https://img.shields.io/badge/Version-3.76.3-informational?style=flat-square) ![AppVersion: 7](https://img.shields.io/badge/AppVersion-7-informational?style=flat-square)
![Version: 3.77.0](https://img.shields.io/badge/Version-3.77.0-informational?style=flat-square) ![AppVersion: 7](https://img.shields.io/badge/AppVersion-7-informational?style=flat-square)

[Datadog](https://www.datadoghq.com/) is a hosted infrastructure monitoring platform. This chart adds the Datadog Agent to all nodes in your cluster via a DaemonSet. It also optionally depends on the [kube-state-metrics chart](https://github.com/prometheus-community/helm-charts/tree/main/charts/kube-state-metrics). For more information about monitoring Kubernetes with Datadog, please refer to the [Datadog documentation website](https://docs.datadoghq.com/agent/basic_agent_usage/kubernetes/).

Expand Down Expand Up @@ -799,6 +799,7 @@ helm install <RELEASE_NAME> \
| datadog.prometheusScrape.version | int | `2` | Version of the openmetrics check to schedule by default. |
| datadog.remoteConfiguration.enabled | bool | `true` | Set to true to enable remote configuration. DEPRECATED: Consider using remoteConfiguration.enabled instead |
| datadog.sbom.containerImage.enabled | bool | `false` | Enable SBOM collection for container images |
| datadog.sbom.containerImage.overlayFSDirectScan | bool | `false` | Use experimental overlayFS direct scan |
| datadog.sbom.containerImage.uncompressedLayersSupport | bool | `true` | Use container runtime snapshotter This should be set to true when using EKS, GKE or if containerd is configured to discard uncompressed layers. This feature will cause the SYS_ADMIN capability to be added to the Agent container. Setting this to false could cause a high error rate when generating SBOMs due to missing uncompressed layer. See https://docs.datadoghq.com/security/cloud_security_management/troubleshooting/vulnerabilities/#uncompressed-container-image-layers |
| datadog.sbom.host.enabled | bool | `false` | Enable SBOM collection for host filesystems |
| datadog.secretAnnotations | object | `{}` | |
Expand Down
17 changes: 13 additions & 4 deletions charts/datadog/templates/_container-agent.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
image: "{{ include "image-path" (dict "root" .Values "image" .Values.agents.image) }}"
imagePullPolicy: {{ .Values.agents.image.pullPolicy }}
command: ["agent", "run"]
{{ include "generate-security-context" (dict "securityContext" .Values.agents.containers.agent.securityContext "targetSystem" .Values.targetSystem "seccomp" "" "kubeversion" .Capabilities.KubeVersion.Version "sysAdmin" (and (eq (include "should-enable-sbom-container-image-collection" .) "true") .Values.datadog.sbom.containerImage.uncompressedLayersSupport)) | indent 2 }}
{{ include "generate-security-context" (dict "securityContext" .Values.agents.containers.agent.securityContext "targetSystem" .Values.targetSystem "seccomp" "" "kubeversion" .Capabilities.KubeVersion.Version "sysAdmin" (and (eq (include "should-enable-sbom-container-image-collection" .) "true") (and .Values.datadog.sbom.containerImage.uncompressedLayersSupport (not .Values.datadog.sbom.containerImage.overlayFSDirectScan)))) | indent 2 }}
resources:
{{ toYaml .Values.agents.containers.agent.resources | indent 4 }}
ports:
Expand Down Expand Up @@ -177,11 +177,17 @@
- name: DD_SBOM_CONTAINER_IMAGE_ENABLED
value: "true"
{{- end }}
{{- if and (eq (include "should-enable-sbom-container-image-collection" .) "true") .Values.datadog.sbom.containerImage.uncompressedLayersSupport }}
{{- if (eq (include "should-enable-sbom-container-image-collection" .) "true") }}
{{- if .Values.datadog.sbom.containerImage.uncompressedLayersSupport }}
{{- if .Values.datadog.sbom.containerImage.overlayFSDirectScan }}
- name: DD_SBOM_CONTAINER_IMAGE_OVERLAYFS_DIRECT_SCAN
value: "true"
{{- else }}
- name: DD_SBOM_CONTAINER_IMAGE_USE_MOUNT
value: "true"
{{- end }}

{{- end }}
{{- end }}
{{- if .Values.datadog.sbom.host.enabled }}
- name: DD_SBOM_HOST_ENABLED
value: "true"
Expand Down Expand Up @@ -276,10 +282,13 @@
readOnly: true
{{- end }}
{{- end }}
{{- if and (eq (include "should-enable-sbom-container-image-collection" .) "true") .Values.datadog.sbom.containerImage.uncompressedLayersSupport }}
{{- if and (eq (include "should-enable-sbom-container-image-collection" .) "true") (or .Values.datadog.sbom.containerImage.uncompressedLayersSupport .Values.datadog.sbom.containerImage.overlayFSDirectScan)}}
- name: host-containerd-dir
mountPath: /host/var/lib/containerd
readOnly: true
- name: host-docker-dir
mountPath: /host/var/lib/docker
readOnly: true
{{- end }}
{{- if .Values.datadog.sbom.host.enabled }}
- name: host-apk-dir
Expand Down
3 changes: 3 additions & 0 deletions charts/datadog/templates/_daemonset-volumes-linux.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,9 @@
- hostPath:
path: /var/lib/containerd
name: host-containerd-dir
- hostPath:
path: /var/lib/docker
name: host-docker-dir
{{- end }}
{{- if .Values.datadog.sbom.host.enabled }}
- hostPath:
Expand Down
2 changes: 1 addition & 1 deletion charts/datadog/templates/daemonset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ spec:
shareProcessNamespace: {{ .Values.agents.shareProcessNamespace }}
{{- end }}
{{- if .Values.datadog.securityContext -}}
{{ include "generate-security-context" (dict "securityContext" .Values.datadog.securityContext "targetSystem" .Values.targetSystem "seccomp" "" "kubeversion" .Capabilities.KubeVersion.Version ) | nindent 6 }}
{{ include "generate-security-context" (dict "securityContext" .Values.datadog.securityContext "targetSystem" .Values.targetSystem "seccomp" "" "kubeversion" .Capabilities.KubeVersion.Version) | nindent 6 }}
{{- else if or .Values.agents.podSecurity.podSecurityPolicy.create .Values.agents.podSecurity.securityContextConstraints.create -}}
{{- if .Values.agents.podSecurity.securityContext }}
{{- if .Values.agents.podSecurity.securityContext.seLinuxOptions }}
Expand Down
3 changes: 3 additions & 0 deletions charts/datadog/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -826,6 +826,9 @@ datadog:
# See https://docs.datadoghq.com/security/cloud_security_management/troubleshooting/vulnerabilities/#uncompressed-container-image-layers
uncompressedLayersSupport: true

# datadog.sbom.containerImage.overlayFSDirectScan -- Use experimental overlayFS direct scan
overlayFSDirectScan: false

host:
# datadog.sbom.host.enabled -- Enable SBOM collection for host filesystems
enabled: false
Expand Down

0 comments on commit 6b2cbbc

Please sign in to comment.