Fast and extensible multi-platform HTTP/1-2-3 web server with automatic HTTPS
Mirrored from https://github.com/Slazee/caddy.git
Synced Nov 11, 03:30 UTC
httpcaddyfile: keep a site block's TLS policy for ECH public names (#8156)
* httpcaddyfile: keep a site block's TLS policy for ECH public names The global ech option added its own automation policy for every public name, even when a site block already had a policy for that name. If the site block set its own TLS options, adapting failed with "hostname appears in more than one automation policy". If a hostless catch-all with the same settings was also present, the site's policy was merged away and the name got only the global settings. Skip public names that already have a policy, as tls_automate_names does, and only add the ECH policy when it still has subjects, since a policy without subjects acts as a catch-all. * httpcaddyfile: check ECH public names the way the TLS app matches them The check for an existing site policy only matched a subject spelled exactly like the ECH public name. A site policy for *.example.com, or for example.com when the public name is written Example.COM, already covers that name at runtime, but the global ECH policy was still added and sorted ahead of it, so the site's issuer settings were overridden. Lowercase and trim the public name as ECH provisioning does and compare it with certmagic.MatchWildcard, which is how the TLS app picks a policy for a name.