mirror of
https://github.com/caddyserver/caddy.git
synced 2025-02-24 16:59:00 +01:00
caddytls: Add propagation_delay
, support propagation_timeout -1
(#4723)
This commit is contained in:
parent
db62942d63
commit
77a77c0219
5 changed files with 60 additions and 11 deletions
|
@ -3,7 +3,12 @@ localhost
|
||||||
respond "hello from localhost"
|
respond "hello from localhost"
|
||||||
tls {
|
tls {
|
||||||
issuer acme {
|
issuer acme {
|
||||||
propagation_timeout "10m0s"
|
propagation_delay 5m10s
|
||||||
|
propagation_timeout 10m20s
|
||||||
|
}
|
||||||
|
issuer zerossl {
|
||||||
|
propagation_delay 5m30s
|
||||||
|
propagation_timeout -1
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
----------
|
----------
|
||||||
|
@ -56,10 +61,20 @@ tls {
|
||||||
{
|
{
|
||||||
"challenges": {
|
"challenges": {
|
||||||
"dns": {
|
"dns": {
|
||||||
"propagation_timeout": 600000000000
|
"propagation_delay": 310000000000,
|
||||||
|
"propagation_timeout": 620000000000
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"module": "acme"
|
"module": "acme"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"challenges": {
|
||||||
|
"dns": {
|
||||||
|
"propagation_delay": 330000000000,
|
||||||
|
"propagation_timeout": -1
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"module": "zerossl"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
2
go.mod
2
go.mod
|
@ -7,7 +7,7 @@ require (
|
||||||
github.com/Masterminds/sprig/v3 v3.2.2
|
github.com/Masterminds/sprig/v3 v3.2.2
|
||||||
github.com/alecthomas/chroma v0.10.0
|
github.com/alecthomas/chroma v0.10.0
|
||||||
github.com/aryann/difflib v0.0.0-20210328193216-ff5ff6dc229b
|
github.com/aryann/difflib v0.0.0-20210328193216-ff5ff6dc229b
|
||||||
github.com/caddyserver/certmagic v0.16.0
|
github.com/caddyserver/certmagic v0.16.1
|
||||||
github.com/dustin/go-humanize v1.0.1-0.20200219035652-afde56e7acac
|
github.com/dustin/go-humanize v1.0.1-0.20200219035652-afde56e7acac
|
||||||
github.com/go-chi/chi v4.1.2+incompatible
|
github.com/go-chi/chi v4.1.2+incompatible
|
||||||
github.com/google/cel-go v0.7.3
|
github.com/google/cel-go v0.7.3
|
||||||
|
|
4
go.sum
4
go.sum
|
@ -199,8 +199,8 @@ github.com/boombuler/barcode v1.0.1/go.mod h1:paBWMcWSl3LHKBqUq+rly7CNSldXjb2rDl
|
||||||
github.com/bradfitz/go-smtpd v0.0.0-20170404230938-deb6d6237625/go.mod h1:HYsPBTaaSFSlLx/70C2HPIMNZpVV8+vt/A+FMnYP11g=
|
github.com/bradfitz/go-smtpd v0.0.0-20170404230938-deb6d6237625/go.mod h1:HYsPBTaaSFSlLx/70C2HPIMNZpVV8+vt/A+FMnYP11g=
|
||||||
github.com/buger/jsonparser v0.0.0-20181115193947-bf1c66bbce23/go.mod h1:bbYlZJ7hK1yFx9hf58LP0zeX7UjIGs20ufpu3evjr+s=
|
github.com/buger/jsonparser v0.0.0-20181115193947-bf1c66bbce23/go.mod h1:bbYlZJ7hK1yFx9hf58LP0zeX7UjIGs20ufpu3evjr+s=
|
||||||
github.com/caarlos0/ctrlc v1.0.0/go.mod h1:CdXpj4rmq0q/1Eb44M9zi2nKB0QraNKuRGYGrrHhcQw=
|
github.com/caarlos0/ctrlc v1.0.0/go.mod h1:CdXpj4rmq0q/1Eb44M9zi2nKB0QraNKuRGYGrrHhcQw=
|
||||||
github.com/caddyserver/certmagic v0.16.0 h1:nM6Fm+OSnTpx/uRWmN++I2fYq006uhi6m6m3rD1Jjtg=
|
github.com/caddyserver/certmagic v0.16.1 h1:rdSnjcUVJojmL4M0efJ+yHXErrrijS4YYg3FuwRdJkI=
|
||||||
github.com/caddyserver/certmagic v0.16.0/go.mod h1:jKQ5n+ViHAr6DbPwEGLTSM2vDwTO6EvCKBblBRUvvuQ=
|
github.com/caddyserver/certmagic v0.16.1/go.mod h1:jKQ5n+ViHAr6DbPwEGLTSM2vDwTO6EvCKBblBRUvvuQ=
|
||||||
github.com/campoy/unique v0.0.0-20180121183637-88950e537e7e/go.mod h1:9IOqJGCPMSc6E5ydlp5NIonxObaeu/Iub/X03EKPVYo=
|
github.com/campoy/unique v0.0.0-20180121183637-88950e537e7e/go.mod h1:9IOqJGCPMSc6E5ydlp5NIonxObaeu/Iub/X03EKPVYo=
|
||||||
github.com/casbin/casbin/v2 v2.1.2/go.mod h1:YcPU1XXisHhLzuxH9coDNf2FbKpjGlbCg3n9yuLkIJQ=
|
github.com/casbin/casbin/v2 v2.1.2/go.mod h1:YcPU1XXisHhLzuxH9coDNf2FbKpjGlbCg3n9yuLkIJQ=
|
||||||
github.com/cavaliercoder/go-cpio v0.0.0-20180626203310-925f9528c45e/go.mod h1:oDpT4efm8tSYHXV5tHSdRvBet/b/QzxZ+XyyPehvm3A=
|
github.com/cavaliercoder/go-cpio v0.0.0-20180626203310-925f9528c45e/go.mod h1:oDpT4efm8tSYHXV5tHSdRvBet/b/QzxZ+XyyPehvm3A=
|
||||||
|
|
|
@ -142,6 +142,7 @@ func (iss *ACMEIssuer) Provision(ctx caddy.Context) error {
|
||||||
iss.Challenges.DNS.solver = &certmagic.DNS01Solver{
|
iss.Challenges.DNS.solver = &certmagic.DNS01Solver{
|
||||||
DNSProvider: val.(certmagic.ACMEDNSProvider),
|
DNSProvider: val.(certmagic.ACMEDNSProvider),
|
||||||
TTL: time.Duration(iss.Challenges.DNS.TTL),
|
TTL: time.Duration(iss.Challenges.DNS.TTL),
|
||||||
|
PropagationDelay: time.Duration(iss.Challenges.DNS.PropagationDelay),
|
||||||
PropagationTimeout: time.Duration(iss.Challenges.DNS.PropagationTimeout),
|
PropagationTimeout: time.Duration(iss.Challenges.DNS.PropagationTimeout),
|
||||||
Resolvers: iss.Challenges.DNS.Resolvers,
|
Resolvers: iss.Challenges.DNS.Resolvers,
|
||||||
OverrideDomain: iss.Challenges.DNS.OverrideDomain,
|
OverrideDomain: iss.Challenges.DNS.OverrideDomain,
|
||||||
|
@ -262,7 +263,10 @@ func (iss *ACMEIssuer) GetACMEIssuer() *ACMEIssuer { return iss }
|
||||||
// eab <key_id> <mac_key>
|
// eab <key_id> <mac_key>
|
||||||
// trusted_roots <pem_files...>
|
// trusted_roots <pem_files...>
|
||||||
// dns <provider_name> [<options>]
|
// dns <provider_name> [<options>]
|
||||||
|
// propagation_delay <duration>
|
||||||
|
// propagation_timeout <duration>
|
||||||
// resolvers <dns_servers...>
|
// resolvers <dns_servers...>
|
||||||
|
// dns_challenge_override_domain <domain>
|
||||||
// preferred_chains [smallest] {
|
// preferred_chains [smallest] {
|
||||||
// root_common_name <common_names...>
|
// root_common_name <common_names...>
|
||||||
// any_common_name <common_names...>
|
// any_common_name <common_names...>
|
||||||
|
@ -389,15 +393,39 @@ func (iss *ACMEIssuer) UnmarshalCaddyfile(d *caddyfile.Dispenser) error {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
iss.Challenges.DNS.ProviderRaw = caddyconfig.JSONModuleObject(unm, "name", provName, nil)
|
iss.Challenges.DNS.ProviderRaw = caddyconfig.JSONModuleObject(unm, "name", provName, nil)
|
||||||
|
|
||||||
|
case "propagation_delay":
|
||||||
|
if !d.NextArg() {
|
||||||
|
return d.ArgErr()
|
||||||
|
}
|
||||||
|
delayStr := d.Val()
|
||||||
|
delay, err := caddy.ParseDuration(delayStr)
|
||||||
|
if err != nil {
|
||||||
|
return d.Errf("invalid propagation_delay duration %s: %v", delayStr, err)
|
||||||
|
}
|
||||||
|
if iss.Challenges == nil {
|
||||||
|
iss.Challenges = new(ChallengesConfig)
|
||||||
|
}
|
||||||
|
if iss.Challenges.DNS == nil {
|
||||||
|
iss.Challenges.DNS = new(DNSChallengeConfig)
|
||||||
|
}
|
||||||
|
iss.Challenges.DNS.PropagationDelay = caddy.Duration(delay)
|
||||||
|
|
||||||
case "propagation_timeout":
|
case "propagation_timeout":
|
||||||
if !d.NextArg() {
|
if !d.NextArg() {
|
||||||
return d.ArgErr()
|
return d.ArgErr()
|
||||||
}
|
}
|
||||||
timeoutStr := d.Val()
|
timeoutStr := d.Val()
|
||||||
timeout, err := caddy.ParseDuration(timeoutStr)
|
var timeout time.Duration
|
||||||
|
if timeoutStr == "-1" {
|
||||||
|
timeout = time.Duration(-1)
|
||||||
|
} else {
|
||||||
|
var err error
|
||||||
|
timeout, err = caddy.ParseDuration(timeoutStr)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return d.Errf("invalid propagation_timeout duration %s: %v", timeoutStr, err)
|
return d.Errf("invalid propagation_timeout duration %s: %v", timeoutStr, err)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if iss.Challenges == nil {
|
if iss.Challenges == nil {
|
||||||
iss.Challenges = new(ChallengesConfig)
|
iss.Challenges = new(ChallengesConfig)
|
||||||
}
|
}
|
||||||
|
|
|
@ -363,7 +363,13 @@ type DNSChallengeConfig struct {
|
||||||
// The TTL of the TXT record used for the DNS challenge.
|
// The TTL of the TXT record used for the DNS challenge.
|
||||||
TTL caddy.Duration `json:"ttl,omitempty"`
|
TTL caddy.Duration `json:"ttl,omitempty"`
|
||||||
|
|
||||||
// How long to wait for DNS record to propagate.
|
// How long to wait before starting propagation checks.
|
||||||
|
// Default: 0 (no wait).
|
||||||
|
PropagationDelay caddy.Duration `json:"propagation_delay,omitempty"`
|
||||||
|
|
||||||
|
// Maximum time to wait for temporary DNS record to appear.
|
||||||
|
// Set to -1 to disable propagation checks.
|
||||||
|
// Default: 2 minutes.
|
||||||
PropagationTimeout caddy.Duration `json:"propagation_timeout,omitempty"`
|
PropagationTimeout caddy.Duration `json:"propagation_timeout,omitempty"`
|
||||||
|
|
||||||
// Custom DNS resolvers to prefer over system/built-in defaults.
|
// Custom DNS resolvers to prefer over system/built-in defaults.
|
||||||
|
|
Loading…
Reference in a new issue