github.com/teknogeek/dnscontrol/v2@v2.10.1-0.20200227202244-ae299b55ba42/pkg/acme/checkDns.go (about)

     1  package acme
     2  
     3  import (
     4  	"log"
     5  	"time"
     6  
     7  	"github.com/go-acme/lego/challenge/dns01"
     8  )
     9  
    10  func (c *certManager) preCheckDNS(domain, fqdn, value string, native dns01.PreCheckFunc) (bool, error) {
    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 60 second sleep just for safety.
    15  	v, err := native(fqdn, value)
    16  	if err != nil {
    17  		return v, err
    18  	}
    19  	if !c.waitedOnce {
    20  		log.Printf("DNS ok. Waiting another 60s to ensure stability.")
    21  		time.Sleep(60 * time.Second)
    22  		c.waitedOnce = true
    23  	}
    24  	log.Printf("DNS records seem to exist. Proceeding to request validation")
    25  	return v, err
    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  }