mirror of
https://github.com/caddyserver/caddy.git
synced 2025-08-30 23:02:33 -04:00
httpcaddyfile: Fix acme_dns
regression (#7199)
This commit is contained in:
parent
16fe83c7af
commit
4564261d83
@ -564,21 +564,22 @@ func fillInGlobalACMEDefaults(issuer certmagic.Issuer, options map[string]any) e
|
|||||||
if globalACMECARoot != nil && !slices.Contains(acmeIssuer.TrustedRootsPEMFiles, globalACMECARoot.(string)) {
|
if globalACMECARoot != nil && !slices.Contains(acmeIssuer.TrustedRootsPEMFiles, globalACMECARoot.(string)) {
|
||||||
acmeIssuer.TrustedRootsPEMFiles = append(acmeIssuer.TrustedRootsPEMFiles, globalACMECARoot.(string))
|
acmeIssuer.TrustedRootsPEMFiles = append(acmeIssuer.TrustedRootsPEMFiles, globalACMECARoot.(string))
|
||||||
}
|
}
|
||||||
if globalACMEDNSok && (acmeIssuer.Challenges == nil || acmeIssuer.Challenges.DNS == nil) {
|
if globalACMEDNSok {
|
||||||
if globalACMEDNS == nil {
|
globalDNS := options["dns"]
|
||||||
globalACMEDNS = options["dns"]
|
if globalDNS != nil {
|
||||||
if globalACMEDNS == nil {
|
// If global `dns` is set, do NOT set provider in issuer, just set empty dns config
|
||||||
return fmt.Errorf("acme_dns specified without DNS provider config, but no provider specified with 'dns' global option")
|
acmeIssuer.Challenges = &caddytls.ChallengesConfig{
|
||||||
|
DNS: &caddytls.DNSChallengeConfig{},
|
||||||
}
|
}
|
||||||
}
|
} else if globalACMEDNS != nil {
|
||||||
acmeIssuer.Challenges = &caddytls.ChallengesConfig{
|
// Set a global DNS provider if `acme_dns` is set and `dns` is NOT set
|
||||||
DNS: new(caddytls.DNSChallengeConfig),
|
acmeIssuer.Challenges = &caddytls.ChallengesConfig{
|
||||||
}
|
DNS: &caddytls.DNSChallengeConfig{
|
||||||
} else if globalACMEDNS != nil {
|
ProviderRaw: caddyconfig.JSONModuleObject(globalACMEDNS, "name", globalACMEDNS.(caddy.Module).CaddyModule().ID.Name(), nil),
|
||||||
acmeIssuer.Challenges = &caddytls.ChallengesConfig{
|
},
|
||||||
DNS: &caddytls.DNSChallengeConfig{
|
}
|
||||||
ProviderRaw: caddyconfig.JSONModuleObject(globalACMEDNS, "name", globalACMEDNS.(caddy.Module).CaddyModule().ID.Name(), nil),
|
} else {
|
||||||
},
|
return fmt.Errorf("acme_dns specified without DNS provider config, but no provider specified with 'dns' global option")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if globalACMEEAB != nil && acmeIssuer.ExternalAccount == nil {
|
if globalACMEEAB != nil && acmeIssuer.ExternalAccount == nil {
|
||||||
|
@ -0,0 +1,68 @@
|
|||||||
|
{
|
||||||
|
acme_dns mock foo
|
||||||
|
}
|
||||||
|
|
||||||
|
example.com {
|
||||||
|
respond "Hello World"
|
||||||
|
}
|
||||||
|
----------
|
||||||
|
{
|
||||||
|
"apps": {
|
||||||
|
"http": {
|
||||||
|
"servers": {
|
||||||
|
"srv0": {
|
||||||
|
"listen": [
|
||||||
|
":443"
|
||||||
|
],
|
||||||
|
"routes": [
|
||||||
|
{
|
||||||
|
"match": [
|
||||||
|
{
|
||||||
|
"host": [
|
||||||
|
"example.com"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"handle": [
|
||||||
|
{
|
||||||
|
"handler": "subroute",
|
||||||
|
"routes": [
|
||||||
|
{
|
||||||
|
"handle": [
|
||||||
|
{
|
||||||
|
"body": "Hello World",
|
||||||
|
"handler": "static_response"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"terminal": true
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"tls": {
|
||||||
|
"automation": {
|
||||||
|
"policies": [
|
||||||
|
{
|
||||||
|
"issuers": [
|
||||||
|
{
|
||||||
|
"challenges": {
|
||||||
|
"dns": {
|
||||||
|
"provider": {
|
||||||
|
"name": "mock"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"module": "acme"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,9 @@
|
|||||||
|
{
|
||||||
|
acme_dns
|
||||||
|
}
|
||||||
|
|
||||||
|
example.com {
|
||||||
|
respond "Hello World"
|
||||||
|
}
|
||||||
|
----------
|
||||||
|
acme_dns specified without DNS provider config, but no provider specified with 'dns' global option
|
Loading…
x
Reference in New Issue
Block a user