mirror of
https://github.com/caddyserver/caddy.git
synced 2025-05-24 02:02:26 -04:00
caddyhttp: Use internal issuer for IPs when no APs configured
Some checks failed
Tests / test (./cmd/caddy/caddy, ~1.22.3, ubuntu-latest, 0, 1.22, linux) (push) Failing after 1m33s
Tests / test (./cmd/caddy/caddy, ~1.23.0, ubuntu-latest, 0, 1.23, linux) (push) Failing after 1m22s
Tests / test (s390x on IBM Z) (push) Has been skipped
Tests / goreleaser-check (push) Successful in 2m51s
Cross-Build / build (~1.22.3, 1.22, aix) (push) Successful in 1m34s
Cross-Build / build (~1.22.3, 1.22, darwin) (push) Successful in 1m34s
Cross-Build / build (~1.22.3, 1.22, dragonfly) (push) Successful in 1m33s
Cross-Build / build (~1.22.3, 1.22, freebsd) (push) Successful in 1m35s
Cross-Build / build (~1.22.3, 1.22, illumos) (push) Successful in 1m33s
Cross-Build / build (~1.22.3, 1.22, linux) (push) Successful in 1m32s
Cross-Build / build (~1.22.3, 1.22, netbsd) (push) Successful in 1m31s
Cross-Build / build (~1.22.3, 1.22, openbsd) (push) Successful in 1m32s
Cross-Build / build (~1.22.3, 1.22, solaris) (push) Successful in 1m30s
Cross-Build / build (~1.22.3, 1.22, windows) (push) Successful in 1m31s
Cross-Build / build (~1.23.0, 1.23, aix) (push) Successful in 1m26s
Cross-Build / build (~1.23.0, 1.23, darwin) (push) Successful in 1m24s
Cross-Build / build (~1.23.0, 1.23, dragonfly) (push) Successful in 1m22s
Cross-Build / build (~1.23.0, 1.23, freebsd) (push) Successful in 1m21s
Cross-Build / build (~1.23.0, 1.23, illumos) (push) Successful in 1m21s
Cross-Build / build (~1.23.0, 1.23, linux) (push) Successful in 1m22s
Cross-Build / build (~1.23.0, 1.23, netbsd) (push) Successful in 1m21s
Cross-Build / build (~1.23.0, 1.23, openbsd) (push) Successful in 1m25s
Cross-Build / build (~1.23.0, 1.23, solaris) (push) Successful in 1m23s
Cross-Build / build (~1.23.0, 1.23, windows) (push) Successful in 1m22s
Lint / lint (ubuntu-latest, linux) (push) Successful in 2m3s
Lint / govulncheck (push) Successful in 1m14s
Tests / test (./cmd/caddy/caddy, ~1.22.3, macos-14, 0, 1.22, mac) (push) Has been cancelled
Tests / test (./cmd/caddy/caddy, ~1.23.0, macos-14, 0, 1.23, mac) (push) Has been cancelled
Tests / test (./cmd/caddy/caddy.exe, ~1.22.3, windows-latest, True, 1.22, windows) (push) Has been cancelled
Tests / test (./cmd/caddy/caddy.exe, ~1.23.0, windows-latest, True, 1.23, windows) (push) Has been cancelled
Lint / lint (macos-14, mac) (push) Has been cancelled
Lint / lint (windows-latest, windows) (push) Has been cancelled
Some checks failed
Tests / test (./cmd/caddy/caddy, ~1.22.3, ubuntu-latest, 0, 1.22, linux) (push) Failing after 1m33s
Tests / test (./cmd/caddy/caddy, ~1.23.0, ubuntu-latest, 0, 1.23, linux) (push) Failing after 1m22s
Tests / test (s390x on IBM Z) (push) Has been skipped
Tests / goreleaser-check (push) Successful in 2m51s
Cross-Build / build (~1.22.3, 1.22, aix) (push) Successful in 1m34s
Cross-Build / build (~1.22.3, 1.22, darwin) (push) Successful in 1m34s
Cross-Build / build (~1.22.3, 1.22, dragonfly) (push) Successful in 1m33s
Cross-Build / build (~1.22.3, 1.22, freebsd) (push) Successful in 1m35s
Cross-Build / build (~1.22.3, 1.22, illumos) (push) Successful in 1m33s
Cross-Build / build (~1.22.3, 1.22, linux) (push) Successful in 1m32s
Cross-Build / build (~1.22.3, 1.22, netbsd) (push) Successful in 1m31s
Cross-Build / build (~1.22.3, 1.22, openbsd) (push) Successful in 1m32s
Cross-Build / build (~1.22.3, 1.22, solaris) (push) Successful in 1m30s
Cross-Build / build (~1.22.3, 1.22, windows) (push) Successful in 1m31s
Cross-Build / build (~1.23.0, 1.23, aix) (push) Successful in 1m26s
Cross-Build / build (~1.23.0, 1.23, darwin) (push) Successful in 1m24s
Cross-Build / build (~1.23.0, 1.23, dragonfly) (push) Successful in 1m22s
Cross-Build / build (~1.23.0, 1.23, freebsd) (push) Successful in 1m21s
Cross-Build / build (~1.23.0, 1.23, illumos) (push) Successful in 1m21s
Cross-Build / build (~1.23.0, 1.23, linux) (push) Successful in 1m22s
Cross-Build / build (~1.23.0, 1.23, netbsd) (push) Successful in 1m21s
Cross-Build / build (~1.23.0, 1.23, openbsd) (push) Successful in 1m25s
Cross-Build / build (~1.23.0, 1.23, solaris) (push) Successful in 1m23s
Cross-Build / build (~1.23.0, 1.23, windows) (push) Successful in 1m22s
Lint / lint (ubuntu-latest, linux) (push) Successful in 2m3s
Lint / govulncheck (push) Successful in 1m14s
Tests / test (./cmd/caddy/caddy, ~1.22.3, macos-14, 0, 1.22, mac) (push) Has been cancelled
Tests / test (./cmd/caddy/caddy, ~1.23.0, macos-14, 0, 1.23, mac) (push) Has been cancelled
Tests / test (./cmd/caddy/caddy.exe, ~1.22.3, windows-latest, True, 1.22, windows) (push) Has been cancelled
Tests / test (./cmd/caddy/caddy.exe, ~1.23.0, windows-latest, True, 1.23, windows) (push) Has been cancelled
Lint / lint (macos-14, mac) (push) Has been cancelled
Lint / lint (windows-latest, windows) (push) Has been cancelled
This fixes a regression in 2.8 where IP addresses would be considered qualifying for public certs by auto-HTTPS. The default issuers do not issue IP certs at this time, so if no APs are explicitly configured, we assign them to the internal issuer. We have to add a couple lines of code because CertMagic can no longer consider IPs as not qualifying for public certs, since there are public CAs that issue IP certs. This edge case is specific to Caddy's auto-HTTPS. Without this patch, Caddy will try using Let's Encrypt or ZeroSSL's ACME endpoint to get IP certs, neither of which support that.
This commit is contained in:
parent
2ae58ac13e
commit
88fd5f3491
@ -320,11 +320,21 @@ uniqueDomainsLoop:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// if no automation policy exists for the name yet, we
|
// if no automation policy exists for the name yet, we will associate it with an implicit one;
|
||||||
// will associate it with an implicit one
|
// we handle tailscale domains specially, and we also separate out identifiers that need the
|
||||||
|
// internal issuer (self-signed certs); certmagic does not consider public IP addresses to be
|
||||||
|
// disqualified for public certs, because there are public CAs that will issue certs for IPs.
|
||||||
|
// However, with auto-HTTPS, many times there is no issuer explicitly defined, and the default
|
||||||
|
// issuers do not (currently, as of 2024) issue IP certificates; so assign all IP subjects to
|
||||||
|
// the internal issuer when there are no explicit automation policies
|
||||||
|
shouldUseInternal := func(ident string) bool {
|
||||||
|
usingDefaultIssuersAndIsIP := certmagic.SubjectIsIP(ident) &&
|
||||||
|
(app.tlsApp == nil || app.tlsApp.Automation == nil || len(app.tlsApp.Automation.Policies) == 0)
|
||||||
|
return !certmagic.SubjectQualifiesForPublicCert(d) || usingDefaultIssuersAndIsIP
|
||||||
|
}
|
||||||
if isTailscaleDomain(d) {
|
if isTailscaleDomain(d) {
|
||||||
tailscale = append(tailscale, d)
|
tailscale = append(tailscale, d)
|
||||||
} else if !certmagic.SubjectQualifiesForPublicCert(d) {
|
} else if shouldUseInternal(d) {
|
||||||
internal = append(internal, d)
|
internal = append(internal, d)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user