MCPcopy Create free account
hub / github.com/1Panel-dev/1Panel / lockDNSChallenge

Method lockDNSChallenge

agent/utils/ssl/client.go:226–257  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

224}
225
226func (c *AcmeClient) lockDNSChallenge() func() {
227 if c.dnsChallengeConfig == nil {
228 return func() {}
229 }
230
231 dnsChallengeMu.Lock()
232
233 oldCNAME, hadCNAME := os.LookupEnv("LEGO_DISABLE_CNAME_SUPPORT")
234 if c.dnsChallengeConfig.disableCNAME {
235 _ = os.Setenv("LEGO_DISABLE_CNAME_SUPPORT", "true")
236 } else {
237 _ = os.Setenv("LEGO_DISABLE_CNAME_SUPPORT", "false")
238 }
239
240 previousClient := dns01.DefaultClient()
241 // lego v5 removed dns01.AddRecursiveNameservers and dns01.AddDNSTimeout;
242 // configure them via dns01.NewClient(&dns01.Options{...}) + SetDefaultClient.
243 dns01.SetDefaultClient(dns01.NewClient(&dns01.Options{
244 RecursiveNameservers: c.dnsChallengeConfig.recursiveNameservers,
245 Timeout: c.dnsChallengeConfig.timeout,
246 }))
247
248 return func() {
249 dns01.SetDefaultClient(previousClient)
250 if hadCNAME {
251 _ = os.Setenv("LEGO_DISABLE_CNAME_SUPPORT", oldCNAME)
252 } else {
253 _ = os.Unsetenv("LEGO_DISABLE_CNAME_SUPPORT")
254 }
255 dnsChallengeMu.Unlock()
256 }
257}
258
259func waitForRetry(ctx context.Context, delay time.Duration) error {
260 timer := time.NewTimer(delay)

Callers 2

ObtainSSLMethod · 0.95
ObtainIPSSLMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected