Skip to content

Trust Datadog CA certs in OS and all JDK truststores#174

Closed
AlexeyKuznetsov-DD wants to merge 1 commit into
masterfrom
alexeyk/datadog-ca-certs
Closed

Trust Datadog CA certs in OS and all JDK truststores#174
AlexeyKuznetsov-DD wants to merge 1 commit into
masterfrom
alexeyk/datadog-ca-certs

Conversation

@AlexeyKuznetsov-DD

@AlexeyKuznetsov-DD AlexeyKuznetsov-DD commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

What Does This Do

Adds the Datadog CA certificates to the build image so outbound TLS to Datadog-internal endpoints is trusted:

  • Pulls certs from registry.ddbuild.io/images/datadog-ca-certs:standard.
  • Trusts them at the OS level via update-ca-certificates.
  • Adds a new scripts/import-datadog-certs.sh that imports the certs into every JDK's own cacerts truststore (including the jre/lib/security/cacerts layout used by JDK 8 and the amd64-only ibm8 JDK).

Motivation

Instead of querying MASS like https://mass-read.us1.ddbuild.io(often failed with 503 error), use more reliable https://mass-read.rapid-dependency-management-mass.all-clusters.local-dc.fabric.dog:8443 (recommended by infra team).

JDKs ship their own cacerts and do not consult /etc/ssl/certs/java/cacerts, so trusting the certs at the OS level alone is not enough. Java processes running in the image need the Datadog CAs in each JDK truststore to establish TLS to Datadog-internal services.

Additional Notes

The import script runs as root via sudo because the JDKs are COPY'd from other stages and owned by root. Existing datadog-* aliases are deleted and re-imported to keep the operation idempotent.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: d8d22acd15

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread Dockerfile
EOT

# Stage the Datadog CA certs and import script, and trust the certs at the OS level.
COPY --from=datadog-ca-certs /certs/datadog /usr/local/share/ca-certificates/datadog

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Install OS certificates in the shipped stages

These certificates are added only in all-jdk-common, but the published base/variant/full images start again from a fresh ubuntu:24.04 stage and later copy only /usr/lib/jvm from default-jdk, so the updated /usr/local/share/ca-certificates and /etc/ssl/certs state is discarded. In those final images, non-Java tools such as curl, git, or datadog-ci still won't trust Datadog-internal TLS endpoints even though this change is intended to add OS-level trust.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch, but we need to support only Gradle (Java tool) so far.

Comment thread Dockerfile
COPY --from=ibm8-amd64 /opt/ibm/java /usr/lib/jvm/ibm8

# Import the Datadog CA certs into the amd64-only ibm8 truststore.
RUN sudo /usr/local/bin/import-datadog-certs.sh /usr/lib/jvm/ibm8

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Import Datadog certs into zulu7 as well

After all-jdk-common imports certificates, the amd64 stage copies in both the legacy zulu7 JDK and ibm8, but this new import only covers /usr/lib/jvm/ibm8. As a result, the 7/zulu7 image keeps the upstream zulu7 cacerts unchanged and Java 7 jobs still fail to trust Datadog-internal endpoints.

Useful? React with 👍 / 👎.

@datadog-datadog-us1-prod

Copy link
Copy Markdown

Tests

🔄 Datadog auto-retried 1 job - 0 passed on retry View in Datadog

This comment will be updated automatically if new data arrives.
🔗 Commit SHA: d8d22ac | Docs | Datadog PR Page | Give us feedback!

@AlexeyKuznetsov-DD

Copy link
Copy Markdown
Contributor Author

We can not use registry.ddbuild from GitHub :(, closing.

@AlexeyKuznetsov-DD AlexeyKuznetsov-DD deleted the alexeyk/datadog-ca-certs branch July 9, 2026 15:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant