Skip to content

fix(docs): trust Caddy root CA in quickstart prepare-ca-certs - #405

Open
jwsy wants to merge 1 commit into
opentdf:mainfrom
jwsy:fix/quickstart-trust-caddy-root
Open

jwsy wants to merge 1 commit into
opentdf:mainfrom
jwsy:fix/quickstart-trust-caddy-root

Conversation

@jwsy

@jwsy jwsy commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #404

Problem

The quickstart platform stops trusting Keycloak after Caddy renews its local intermediate CA (about 5–6 days after first start, then every few days). GetEntitlements and decrypt return HTTP 500 (failed to login to Keycloak … x509: certificate signed by unknown authority), and a restarted platform crash-loops on OIDC discovery. Full details and steps to reproduce are in #404.

Cause

prepare-ca-certs trusted keycloak.opentdf.local.crt, which holds the leaf plus Caddy's 7-day intermediate. Go treats that intermediate as a trust anchor, so trust breaks whenever Caddy renews it.

Change

prepare-ca-certs now trusts Caddy's local root CA (caddy/pki/authorities/local/root.crt, 10-year lifetime) instead:

  • This matches what static/quickstart/install.sh already trusts on the host, and Caddy's local HTTPS guidance (trust the root, let leaves and intermediates rotate).
  • It drops the no-op cp -r /etc/ssl/certs/* /etc/ssl/certs/. /etc/ssl/certs is already the shared platform_certs volume, so the line only copied the folder onto itself (and printed '…' and '…' are the same file warnings).

Scope is unchanged: the root lands only in the platform_certs volume, which only the platform container mounts. Nothing changes on the host. Within that container, the root (which has no name constraints) can vouch for any hostname Caddy signs. That's fine for a local quickstart, and the root key never leaves the caddy_data volume.

Testing

Tested on macOS (Apple Silicon, Rancher Desktop) with this exact file, plus a local override that only adds a corporate TLS-inspection CA for apk:

Scenario Before (main) After (this PR)
Fresh volumes, provision + 5 users × 4 TDFs encrypt/decrypt matrix ✅ ✅ 20/20
Leaf-only rotation ✅ ✅
Intermediate rotation, running platform ❌ HTTP 500 ✅ HTTP 200
Intermediate rotation, platform restarted ❌ crash-loop (OIDC discovery x509) ✅ HTTP 200
Second intermediate rotation, platform restarted n/a ✅ HTTP 200, 0 x509 errors

Rotation was forced by deleting /data/caddy/pki/authorities/local/intermediate.* and the Keycloak leaf in the caddy container, then restarting caddy (see #404).

Vale wasn't run: the change is YAML only, with no prose.

Follow-up (not in this PR)

The manual host-trust steps in docs/getting-started/index.mdx still trust the site certificates rather than root.crt, unlike install.sh. Happy to send a separate PR.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Documentation
    • The Docker Compose getting-started setup now installs Caddy’s local root certificate in the system trust store. Certificate trust is now based on the local certificate authority rather than a site-specific certificate, and the updated system certificate bundle is no longer copied into a shared volume. This affects certificate handling in the documented local setup.

prepare-ca-certs trusted keycloak.opentdf.local.crt, which holds the
leaf plus Caddy's 7-day intermediate. Once Caddy renews the
intermediate, the platform no longer trusts Keycloak: entity resolution
fails with x509 errors and a restarted platform crash-loops on OIDC
discovery.

Trust Caddy's local root CA (pki/authorities/local/root.crt) instead,
matching install.sh and Caddy's local HTTPS guidance. Also drop the
no-op `cp -r /etc/ssl/certs/* /etc/ssl/certs/`.

Fixes opentdf#404

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Jason Yee <jason.yee@virtru.com>
@jwsy
jwsy requested review from a team as code owners November 19, 2026 13:16
@coderabbitai

coderabbitai Bot commented Nov 19, 2026 •

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The quickstart’s prepare-ca-certs service now uses Caddy’s local root certificate to update the system CA bundle. It no longer copies the Keycloak leaf certificate or copies the updated bundle into the shared volume.

Changes: Quickstart CA trust

Layer / File(s) Summary
Prepare the root CA trust store
docs/getting-started/docker-compose.yaml
The service mounts Caddy’s local PKI directory and adds root.crt to the system CA certificate directory before updating the CA bundle. It removes the previous Keycloak leaf-certificate copy and shared-volume bundle copy.

Estimated code review effort: 2 (Simple) | ~8 minutes

Change: Bug fix · Severity of issue fixed: Medium

Suggested reviewers: b-long, jakedoublev, marythought

Merge Risk: Minimal · up to 4535b

The quickstart platform now trusts Caddy's root CA, so it keeps trusting Keycloak when Caddy rotates its intermediate certificate. No merge-blocking risk was found; the change is small and easy to revert.

Pre-merge checks: Passed 4

Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title "fix(docs): trust Caddy root CA in quickstart prepare-ca-certs" matches the main change. The docker-compose quickstart now mounts Caddy's local PKI authority directory and copies root.crt in…
Linked Issues check Passed Issue #404 requires the platform to keep trusting Keycloak across Caddy intermediate-CA renewals. The reviewed head of docs/getting-started/docker-compose.yaml shows the prepare-ca-certs service now…
Out of Scope Changes check Passed The change in docs/getting-started/docker-compose.yaml is limited to the prepare-ca-certs service. It switches the source from the Keycloak site-certificate directory to Caddy's local PKI root, and …
Full details: Title check

Explanation

The title "fix(docs): trust Caddy root CA in quickstart prepare-ca-certs" matches the main change. The docker-compose quickstart now mounts Caddy's local PKI authority directory and copies root.crt into the system CA store, instead of trusting the Keycloak site certificate. The title is specific, short, and states the primary change. The PR also removes a no-op copy, but that is a minor detail and does not need to appear in the title.

Full details: Linked Issues check

Explanation

Issue #404 requires the platform to keep trusting Keycloak across Caddy intermediate-CA renewals. The reviewed head of docs/getting-started/docker-compose.yaml shows the prepare-ca-certs service now mounts Caddy's local PKI directory (caddy_data subpath caddy/pki/authorities/local) at /caddy-pki, read-only. It copies /caddy-pki/root.crt into /usr/local/share/ca-certificates/ and runs update-ca-certificates. Alpine writes the result to /etc/ssl/certs, which is the platform_certs volume. The platform service mounts that volume at /etc/ssl/certs:ro, and it depends on prepare-ca-certs completing. This matches the issue's proposed fix: trust Caddy's root CA (caddy/pki/authorities/local/root.crt) and not the site certificate file that bundles the intermediate. The trust scope stays limited to the platform container. The PR description and summary report the test results. The issue's manual host-trust docs follow-up is not a coding requirement of this PR, and the PR states it is excluded. Limitation: the repository diff tool was unavailable, so the removed lines were checked against the PR description and summary, not a diff read. The reviewed head file content was read directly.

Full details: Out of Scope Changes check

Explanation

The change in docs/getting-started/docker-compose.yaml is limited to the prepare-ca-certs service. It switches the source from the Keycloak site-certificate directory to Caddy's local PKI root, and it removes the no-op self-copy of /etc/ssl/certs. It also removes the leaf-certificate copy and the copy of the bundle into the shared volume. The updated comments describe the same change. These edits support the issue #404 objective. No unrelated services or behavior were changed in the reviewed head file. The check-certs service still reads the Keycloak leaf file, but the PR does not change it, so it is not an out-of-scope change. The docs/getting-started/index.mdx follow-up is correctly excluded. Limitation: the diff tool was unavailable, so the removed hunks were confirmed from the PR description and summary.

Finishing Touches

Generate unit tests (beta)

  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

A rabbit hops by Caddy’s root,
And checks the trust store, nose to boot.
The root goes in; the bundle grows,
While leaf-certificate copying goes.
“Now roots are where the trust begins!”
The rabbit nibbles, grins, and spins.

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 735f212d-6ecd-40d9-9183-747fe3e061f3
Commits

Reviewing files that changed from the base of the PR and between 2b00228 and 4535b27.

Files selected for processing: 1

  • docs/getting-started/docker-compose.yaml

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.

@github-actions

Copy link
Copy Markdown
Contributor

📄 Preview deployed to https://opentdf-docs-pr-405.surge.sh

This branch has not been deployed

No deployments
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.

Quickstart: platform stops trusting Keycloak after Caddy renews its intermediate CA

2 participants