caddy/caddytest/integration
Islam Elsayed 5ee9a2d424
Some checks are pending
Tests / test (./cmd/caddy/caddy, ~1.26.0, macos-14, 0, 1.26, mac) (push) Waiting to run
Tests / test (./cmd/caddy/caddy, ~1.26.0, ubuntu-latest, 0, 1.26, linux) (push) Waiting to run
Tests / test (./cmd/caddy/caddy.exe, ~1.26.0, windows-latest, True, 1.26, windows) (push) Waiting to run
Tests / test (s390x on IBM Z) (push) Waiting to run
Tests / goreleaser-check (push) Waiting to run
Cross-Build / build (~1.26.0, 1.26, aix) (push) Waiting to run
Cross-Build / build (~1.26.0, 1.26, darwin) (push) Waiting to run
Cross-Build / build (~1.26.0, 1.26, dragonfly) (push) Waiting to run
Cross-Build / build (~1.26.0, 1.26, freebsd) (push) Waiting to run
Cross-Build / build (~1.26.0, 1.26, illumos) (push) Waiting to run
Cross-Build / build (~1.26.0, 1.26, linux) (push) Waiting to run
Cross-Build / build (~1.26.0, 1.26, netbsd) (push) Waiting to run
Cross-Build / build (~1.26.0, 1.26, openbsd) (push) Waiting to run
Cross-Build / build (~1.26.0, 1.26, solaris) (push) Waiting to run
Cross-Build / build (~1.26.0, 1.26, windows) (push) Waiting to run
Lint / lint (push) Waiting to run
Lint / lint-1 (push) Waiting to run
Lint / lint-2 (push) Waiting to run
Lint / govulncheck (push) Waiting to run
Lint / dependency-review (push) Waiting to run
OpenSSF Scorecard supply-chain security / Scorecard analysis (push) Waiting to run
httpcaddyfile: new tls_automate_names global option (#8015)
* httpcaddyfile: new tls_automate_names global option

Provisioning a certificate for a name that is not served requires giving
it a site block of its own:

    *.example.com {
    }

    foo.example.com {
            respond "Real site"
    }

That asks the tls app for the wildcard, but it also adds a route to the
http app, so every name pointed at the server that has no site block of
its own -- bar.example.com here -- gets an empty but valid response
rather than no match at all. Wanting a certificate and wanting to serve
a name are separate things, and the Caddyfile had no way to say only the
first.

Name them in the new global option instead:

    {
            tls_automate_names *.example.com
    }

    foo.example.com {
            respond "Real site"
    }

The names are added to the automate certificate loader and to an
automation policy built from the global options, so a name listed here
is managed exactly as it would be from a site block, with the same
issuers; the only difference in the adapted config is that no route is
added for it. Repeating the option appends rather than replaces, so a
long list can be split over several lines.

Names that cannot get a public certificate are given the internal
issuer, the same treatment a site block gives them. Names that already
appear in the automate list are skipped, but a name that also has a site
block is left listed here as well: a site block for http:// only is not
managed by auto-HTTPS, so dropping the name because a block exists could
silently leave it without a certificate.

The option needs no http app at all, so a config consisting only of
global options now adapts to a tls app on its own -- enough to keep
certificates renewed for a mail or XMPP server, or for names served by a
layer 4 app.

Closes #7122

* httpcaddyfile: reuse an existing policy for an automated name

A name given to tls_automate_names may already have an automation policy
from its own site block. Adding a second policy for the same subject is
not just redundant: the adapter rejects overlapping subjects, so

    {
            email nobody@example.com
            tls_automate_names foo.example.com
    }

    foo.example.com {
            tls {
                    ca https://acme.example.test/directory
            }
    }

failed to adapt at all, with "hostname appears in more than one
automation policy, making certificate management ambiguous".

Keep such a name in the automate loader but leave its policy alone. The
site block's policy is the more specific of the two, and the loader entry
is still wanted, since a site block served only over HTTP is not managed
by auto-HTTPS.

* Pin that tls_automate_names overrides auto_https off

The names given to the option are managed whether or not auto-HTTPS is
disabled: unlike the hostless-key block above it, that code is not gated
on auto_https, because naming a subject explicitly is a stronger signal
than the general switch. Nothing enforced it, so add the adaptation
fixture @steadytao asked for.
2026-09-30 06:49:46 -04:00
..
caddyfile_adapt httpcaddyfile: new tls_automate_names global option (#8015) 2026-09-30 06:49:46 -04:00
testdata fix(caddyfile): {block} in snippet (#7558) 2026-04-15 02:58:53 -04:00
acme_test.go logging: Ensure slog error level logs don't print stack traces (#7512) 2026-03-03 14:44:42 -07:00
acmeserver_test.go chore: Add nolints to work around haywire linters (#7493) 2026-02-17 16:52:54 -07:00
autohttps_test.go caddyhttp: prefer port 443 in auto-HTTPS and add tests (#7666) 2026-04-23 17:29:03 +10:00
caddyfile_adapt_test.go httpcaddyfile: Validates TLS DNS challenge options (#7099) 2025-06-30 23:58:16 +00:00
caddyfile_test.go httpcaddyfile: Prevent error handler from overriding sub-handler matchers (#6999) 2025-06-06 11:46:39 -06:00
fastcgi_chunked_test.go fastcgi: explain the 411 a body without a length gets (#7956) 2026-09-23 09:31:54 -06:00
forwardauth_test.go Merge commit from fork 2026-08-11 08:00:15 -06:00
h2listener_test.go caddyhttp: wrap accepted connection to suppress tls.ConnectionState (#7247) 2025-10-16 03:13:40 +00:00
handler_test.go caddyhttp: surface 413 for oversized request body placeholders (#7969) 2026-09-25 22:27:19 +10:00
intercept_test.go intercept: fix replace_status being silently dropped (#7810) 2026-06-12 15:50:58 -06:00
leafcertloaders_test.go ci: fix the integration test TestLeafCertLoaders (#6149) 2024-03-06 02:09:13 +03:00
listener_test.go use math/rand/v2 instead of math/rand (#7413) 2026-02-11 09:15:51 -07:00
map_test.go map: reject malformed destination placeholders (#8074) 2026-09-28 22:19:51 +10:00
mockdns_test.go httpcaddyfile: Add missing DNS challenge check for acme_dns (#7270) 2025-10-03 14:05:46 -06:00
panic_test.go caddyhttp: log recovered handler panics at ERROR level (#7924) 2026-08-10 02:18:17 -04:00
pki_test.go admin: Fix tests locally, properly isolate storage (#7486) 2026-02-17 13:14:06 -07:00
proxyprotocol_test.go proxyproto: Generated test coverage (#7540) 2026-03-03 15:08:09 -07:00
reverseproxy_test.go reverseproxy: Fix partial response not flushed to clients (#7849) 2026-09-25 22:36:28 +10:00
rewrite_security_test.go Merge commit from fork 2026-09-14 12:50:44 -06:00
sni_test.go filesystem: Globally declared filesystems, fs directive (#5833) 2024-01-13 20:12:43 +00:00
stream_test.go chore: clean up wording and typo fixes (#7745) 2026-05-20 16:36:30 +10:00