Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use recursive query when checking for TXT records #224

Merged
merged 1 commit into from
Apr 10, 2023

Conversation

kizmc
Copy link
Contributor

@kizmc kizmc commented Apr 9, 2023

I am using the DNS challenge with the cloudflare plugin. It fails to get a certificate and results in a DNS propagation timeout error:

return fmt.Errorf("timed out waiting for record to fully propagate; verify DNS provider configuration is correct - last error: %v", err)

  1. The cloudflare plugin successfully adds the correct TXT DNS records.
  2. Running dig -t TXT _acme-challenge.sub.domain.com @1.1.1.1 on the caddy host machine correctly shows the TXT record very soon after the cloudflare dashboard shows the records. (So well before the default 2 minute propagation timeout)
  3. Running tcpdump port 53 and host 1.1.1.1 shows DNS queries happening every 2 seconds from caddy to 1.1.1.1. 1.1.1.1 correctly replies with the TXT records.
  4. caddy appears to completely ignore the provided TXT records and eventually times out.

After some testing using the code in dnsutil.go, changing the recursive flag from false to true seems to result in a dns.Msg which now correctly contains the TXT records.

@kizmc
Copy link
Contributor Author

kizmc commented Apr 9, 2023

Testing with:

FROM caddy:2.6.4-builder AS builder
RUN xcaddy build \
    --with github.com/caddy-dns/cloudflare \
    --with github.com/caddyserver/certmagic@master=github.com/kizmc/certmagic@dns-prop-issue

FROM caddy:2.6.4
COPY --from=builder /usr/bin/caddy /usr/bin/caddy

Seems to have finally resolved my issue.

@francislavoie
Copy link
Member

This makes sense to me. I looked through the commit history to see if there was a reason it was set to false, but I didn't see anything obvious. Seems like a simple improvement to me.

Copy link
Member

@mholt mholt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm trying to remember why I set it to false -- I swear there was some reason but maybe it was in Slack or something and it seemed obvious to me then in a discussion.

We can try this since, frankly, I can't explain it either -- and recursive makes more sense IMO, and it works for you. (Disclaimer: I'm not a DNS expert.)

Thanks!

@mholt mholt merged commit 462f5e2 into caddyserver:master Apr 10, 2023
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants