Skip to content

httpcaddyfile: Inherit global ACME issuer settings in tls shortcuts - #7617

Merged
steadytao merged 1 commit into
caddyserver:masterfrom
steadytao:fix/global-cert-issuer-acme-shortcuts
Apr 26, 2026
Merged

steadytao merged 1 commit into
caddyserver:masterfrom
steadytao:fix/global-cert-issuer-acme-shortcuts

Conversation

@steadytao

Copy link
Copy Markdown
Member

Fixes implicit ACME issuer construction for tls shortcut directives such as ca, ca_root, and dns when a global cert_issuer acme { ... } is also configured.

Before this change, the tls shortcuts built a fresh site-local ACME issuer and replaced the base/global issuers for that automation policy. That meant ACME-specific settings configured globally through cert_issuer acme such as disable_tlsalpn_challenge were not carried over to the subject-specific issuer actually used for issuance or renewal.

This change makes implicit ACME issuers inherit from any globally-configured ACME issuer templates then applies the local shortcut settings as overrides. This preserves global ACME issuer behavior while still allowing per-site shortcut customization such as overriding the CA directory or trusted roots.

Notably, this fixes the #7612 case where:

  • a global cert_issuer acme { disable_tlsalpn_challenge } was configured
  • the site used tls { ca ... ca_root ... }
  • the adapted config ended up with a subject-specific ACME issuer that no longer had TLS-ALPN disabled

This fix is not specific to TLS-ALPN. It preserves nested ACME challenge settings generically for implicit issuer construction.

Tests added:

  • regression coverage for the exact global cert_issuer + local ca/ca_root composition shape from #7612
  • direct merge coverage to ensure nested ACME challenge settings are preserved rather than overwritten shallowly

Fixes #7612.

Assistance Disclosure

No AI was used.

@francislavoie

Copy link
Copy Markdown
Member

Hmmm. I think this does make sense, but I worry that some users may be relying on this behaviour so it could be a breaking change. Also because we design config as one-way like disable_*, there's no enable_* to re-override it, so keeping certain settings like that sticky through a merge can be hard to manage. It means having to throw away the global if there's a single case where that option is undesirable for it to be applied everywhere. I'm not sure we want to add the enable_* counterparts, I don't think I want to encourage flip-floppy config like that and people setting stuff as enabled when the default is already enabled and so on.

@steadytao

Copy link
Copy Markdown
Member Author

This helped me think about the broader posture here and I think you’re right to be cautious.

I was originally looking at it mainly from the reporter’s expectation that global cert_issuer acme settings would carry into the implicit ACME issuer created by tls { ca ... ca_root ... } but the “sticky disable” problem makes that a much less obvious rule to bake in. Since disable_* options are one-way and there’s no clean per-site way to undo them, inheriting them implicitly could easily turn into a surprising config-wide behavior change.

That also lines up with the reporter’s follow-up concern, even if the PR made the original Caddyfile path behave the way they expected it would not affect already-adapted JSON/autosave so it doesn’t really settle the broader composition semantics.

At this point I’m leaning away from the current broad merge approach. The safer direction is probably to avoid implicitly propagating module-specific disable_* ACME settings through tls shortcut issuers and instead either document that boundary more clearly or warn when users combine global cert_issuer acme with site-local ACME shortcuts in a way that looks like it should compose but currently doesn’t.

@steadytao
steadytao marked this pull request as draft April 2, 2026 11:48
@francislavoie

Copy link
Copy Markdown
Member

even if the PR made the original Caddyfile path behave the way they expected it would not affect already-adapted JSON/autosave so it doesn’t really settle the broader composition semantics.

That's not a valid concern, no users adapt to JSON then upgrade Caddy then load JSON config. Users use caddy run -c Caddyfile which adapts their Caddyfile using the current version. It's out of scope to consider old JSON configs adapted from Caddyfile, it's safe to assume users will adapt with the newest version.

@steadytao

Copy link
Copy Markdown
Member Author

That’s a fair point and I think I framed that part too loosely.

I don’t think the already-adapted JSON/autosave angle is really the right compatibility concern here. The more relevant concern is that users running a Caddyfile will have it adapted by the new version so this would silently change the meaning of existing configs that combine global cert_issuer acme with site-local tls shortcuts. Since the settings in question are one-way disable_* flags there also isn’t a clean local way to undo that inheritance if it ends up being undesirable.

Does that sound like the right way to think about the compatibility risk here? If so, I’m wondering whether the better direction is to keep the current semantics and instead either document the boundary more clearly or warn on that combination rather than trying to make the adapter implicitly compose them?

@mholt

mholt commented Apr 2, 2026

Copy link
Copy Markdown
Member

@francislavoie Tbh I do feel like I would expect this to disable the challenge for ALL sites. Usually if it's disabled, it's because there's not a route for TLS to get from the "outside" to the current process or machine. I don't know if I ever see it disabled on a per-site basis.

@steadytao

Copy link
Copy Markdown
Member Author

Was looking through issues and noticed this one has been sitting stale for a small while. Just nudging this in your direction @francislavoie

@francislavoie francislavoie added the bug 🐞 Something isn't working label Apr 25, 2026
@francislavoie francislavoie added this to the v2.11.3 milestone Apr 25, 2026

@francislavoie francislavoie left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think I'm good with this. Does deserve a noted shout in the release notes that the semantics change a bit for existing configs, but it's better in the long run.

@steadytao
steadytao marked this pull request as ready for review April 25, 2026 14:54
@steadytao

Copy link
Copy Markdown
Member Author

Does deserve a noted shout in the release notes that the semantics change a bit for existing configs.

Most definitely agree.

@steadytao

Copy link
Copy Markdown
Member Author

Release note. I have it noted to include in Behaviour changes to call out for 2.11.3

  • Caddyfile tls ACME shortcut issuers now inherit global cert_issuer acme settings before applying local shortcut overrides. This fixes configs that expected global ACME settings such as disable_tlsalpn_challenge to apply to shortcut-created issuers but may change behaviour for existing configs that combine global cert_issuer acme with per-site tls shortcuts.

    If this inheritance is not desired for a site, avoid using the tls ACME shortcut directives for that site and configure the site’s issuer explicitly instead or move the differing ACME settings out of the global issuer and into only the sites that should receive them.

@steadytao
steadytao merged commit c1918ff into caddyserver:master Apr 26, 2026
26 checks passed
@steadytao
steadytao deleted the fix/global-cert-issuer-acme-shortcuts branch April 26, 2026 13:40
social4hyq pushed a commit to social4hyq/homebrew-core that referenced this pull request Sep 20, 2026
caddy 2.11.3

Created-by: HarmonybrewBot
Commit-by: HarmonybrewBot
Merged-by: HarmonybrewBot
Description: Created by `brew bump`

---

Created with `brew bump-formula-pr`.

- [ ] `resource` blocks have been checked for updates.
<details>
  <summary>release notes</summary>
  <pre>This release improves several aspects of Caddy with minor features, bug fixes, and security patches. Thank you to everyone and their bots who contributed to help make this release the best one yet!

**Security patches:**

- fastcgi: Carrying over a patch from FrankenPHP for a bug that could allow non-PHP files to be executed; collaborated on by @dunglas, @KC1zs4, and @chenjj.
- vars: A more thorough fix for GHSA-m2w3-8f23-hxxf, collaborated by @everping and @vnxme.
- admin: Array index normalization to prevent remote admin socket auth bypass, by @Amemoyoi and bot.
- admin: More rigorous path prefix matching to prevent remote admin socket auth bypass, by @Amemoyoi and bot.

We've also merged a couple PRs that fix upstream security bugs in other projects like quic-go and CertMagic. Thank you to @marten-seemann for maintaining quic-go so diligently!

## What's Changed
* caddyhttp: Sync placeholder expansion in `vars` and `vars_regexp` by @vnxme in caddyserver/caddy#7573
* caddytls: Avoid ACME fallback for implicit Tailscale *.ts.net policies by @steadytao in caddyserver/caddy#7577
* chore: Resolve recent CI failures by @mholt in caddyserver/caddy#7593
* caddytls: Consolidate empty APs more smartly by @mholt in caddyserver/caddy#7567
* rewrite: skip query rename when source key is absent by @steadytao in caddyserver/caddy#7599
* root: introduce down-propagating Helper.BlockState for other directives/plugins to use by @henderkes in caddyserver/caddy#7594
* http: make zstd checksum configurable by @ottenhoff in caddyserver/caddy#7586
* notify: Always send "READY=1" even after an error by @francislavoie in caddyserver/caddy#7597
* reverseproxy: Fix check for `header_up Host {upstream_hostport}` redundancy by @yubiuser in caddyserver/caddy#7564
* caddytls: Expand placeholders in dns_challenge override_domain tls parameter by @pberkel in caddyserver/caddy#7609
* tls: add system and combined CA pool modules by @HarshPatel5940 in caddyserver/caddy#7406
* vars: Don't expand placeholders in values by @vnxme in caddyserver/caddy#7629
* build(deps): bump go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp from 1.42.0 to 1.43.0 by @dependabot[bot] in caddyserver/caddy#7637
* build(deps): bump the all-updates group across 1 directory with 11 updates by @dependabot[bot] in caddyserver/caddy#7641
* reverseproxy: make stream copy buffer size configurable by @steadytao in caddyserver/caddy#7627
* vars: Add matcher placeholder handling tests by @steadytao in caddyserver/caddy#7640
* build(deps): bump github.com/go-jose/go-jose/v4 from 4.1.3 to 4.1.4 by @dependabot[bot] in caddyserver/caddy#7621
* logging: Add journald encoder wrapper by @steadytao in caddyserver/caddy#7623
* caddyfile: Improve import/global options UX for imports before global options by @steadytao in caddyserver/caddy#7642
* chore: replace `interface{}` with `any` for modernization by @tsinglua in caddyserver/caddy#7571
* chore: bump timberjack to v1.4.1 by @DeRuina in caddyserver/caddy#7618
* logging: Preserve ts for journald-wrapped JSON logs by @steadytao in caddyserver/caddy#7644
* fileserver: show symlink targets verbatim (#7476) by @maxtruxa in caddyserver/caddy#7579
* fix(caddyfile): {block} in snippet by @prettysunflower in caddyserver/caddy#7558
* caddyhttp: Document missing placeholders for escaped URI and prefixed query by @steffenbusch in caddyserver/caddy#7659
* chore: add `AGENTS.md` by @mohammed90 in caddyserver/caddy#7652
* build(deps): bump github.com/jackc/pgx/v5 from 5.8.0 to 5.9.0 by @dependabot[bot] in caddyserver/caddy#7655
* admin: Redact sensitive request headers in API logs by @steadytao in caddyserver/caddy#7578
* reverseproxy: add `lb_retry_match` condition on response status by @seroperson in caddyserver/caddy#7569
* caddyhttp: prefer port 443 in auto-HTTPS and add tests by @mholt in caddyserver/caddy#7666
* fix: Propagate ECH keys to the QUIC listener by @steadytao in caddyserver/caddy#7670
* chore: Use atomics where appropriate by @francislavoie in caddyserver/caddy#7648
* metrics: Implement pushing via OLTP by @dunglas in caddyserver/caddy#7664
* logging: Add regression coverage for rotated file mode by @steadytao in caddyserver/caddy#7620
* httpcaddyfile: Inherit global ACME issuer settings in tls shortcuts by @steadytao in caddyserver/caddy#7617
* build(deps): bump github.com/jackc/pgx/v5 from 5.9.0 to 5.9.2 by @dependabot[bot] in caddyserver/caddy#7668
* admin: require path segment boundary in remote access control by @Amemoyoi in caddyserver/caddy#7673
* reverseproxy: Add ability to clear dynamic upstreams cache during retries by @mholt in caddyserver/caddy#7662
* listeners: clean up stale Unix socket files on Windows by @mfrischknecht in caddyserver/caddy#7676
* admin: reject non-canonical config array indices by @Amemoyoi in caddyserver/caddy#7592
* caddytls: Expand ACME credentials by @tribut in caddyserver/caddy#7554
* caddyauth: set user placeholders before auth rejection by @cyphercodes in caddyserver/caddy#7685
* caddyauth: revert user placeholders on auth rejection by @steadytao in caddyserver/caddy#7688
* chore: Fix golangci-lint 2.12.1 findings by @steadytao in caddyserver/caddy#7690
* httpcaddyfile: accept duration strings for log sampling interval by @tomholford in caddyserver/caddy#7694
* tls: Add alpn to managed HTTPS records by @steadytao in caddyserver/caddy#7653
* caddytls: avoid duplicate automation for wildcard-covered hosts by @Rijul-A in caddyserver/caddy#7697
* docs: add documentation for fileExists and fileStat template functions by @steffenbusch in caddyserver/caddy#7700
* rewrite: escape file matcher paths before rewriting by @cyphercodes in caddyserver/caddy#7683
* metrics: Add nil check for metricsHandler in AdminMetrics.serveHTTP by @Br1an67 in caddyserver/caddy#7553

## New Contributors
* @steadytao made their first contribution in caddyserver/caddy#7577
* @henderkes made their first contribution in caddyserver/caddy#7594
* @yubiuser made their first contribution in caddyserver/caddy#7564
* @pberkel made their first contribution in caddyserver/caddy#7609
* @HarshPatel5940 made their first contribution in caddyserver/caddy#7406
* @tsinglua made their first contribution in caddyserver/caddy#7571
* @maxtruxa made their first contribution in caddyserver/caddy#7579
* @seroperson made their first contribution in caddyserver/caddy#7569
* @Amemoyoi made their first contribution in caddyserver/caddy#7673
* @mfrischknecht made their first contribution in caddyserver/caddy#7676
* @tribut made their first contribution in caddyserver/caddy#7554
* @cyphercodes made their first contribution in caddyserver/caddy#7685
* @tomholford made their first contribution in caddyserver/caddy#7694
* @Rijul-A made their first contribution in caddyserver/caddy#7697
* @Br1an67 made their first contribution in caddyserver/caddy#7553

**Full Changelog**: https://github.com/caddyserver/caddy/compare/v2.11.2...v2.11.3</pre>
  <p>View the full release notes at <a href="https://github.com/caddyserver/caddy/releases/tag/v2.11.3">https://github.com/caddyserver/caddy/releases/tag/v2.11.3</a>.</p>
</details>
<hr>



See merge request: Harmonybrew/homebrew-core!842
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug 🐞 Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

TLS_ALPN challenge doesn't get disabled by Caddyfile directive

3 participants