github.com/philhug/dnscontrol@v0.2.4-0.20180625181521-921fa9849001/pkg/acme/checkDns.go (about) 1 package acme 2 3 import ( 4 "log" 5 "time" 6 7 "github.com/xenolf/lego/acmev2" 8 ) 9 10 func init() { 11 // default record verification in the client library makes sure the authoritative nameservers 12 // have the expected records. 13 // Sometimes the Let's Encrypt verification fails anyway because records have not propagated the provider's network fully. 14 // So we add an additional 20 second sleep just for safety. 15 origCheck := acme.PreCheckDNS 16 acme.PreCheckDNS = func(fqdn, value string) (bool, error) { 17 start := time.Now() 18 v, err := origCheck(fqdn, value) 19 if err != nil { 20 return v, err 21 } 22 log.Printf("DNS ok after %s. Waiting again for propagation", time.Now().Sub(start)) 23 time.Sleep(20 * time.Second) 24 return v, err 25 } 26 } 27 28 // Timeout increases the client-side polling check time to five minutes with one second waits in-between. 29 func (c *certManager) Timeout() (timeout, interval time.Duration) { 30 return 5 * time.Minute, time.Second 31 }