Skip to content

Bypass Lexicon subdomain resolution in Lexicon-based DNS plugins#9821

Merged
bmw merged 1 commit intocertbot:masterfrom
adferrand:bypass-lexicon-subdomain-resolution
Oct 27, 2023
Merged

Bypass Lexicon subdomain resolution in Lexicon-based DNS plugins#9821
bmw merged 1 commit intocertbot:masterfrom
adferrand:bypass-lexicon-subdomain-resolution

Conversation

@adferrand
Copy link
Copy Markdown
Collaborator

@adferrand adferrand commented Oct 27, 2023

As always, brittle code breaks first.

The Lexicon-based DNS plugins use a mechanism to determine which actual segment of the input domain is actually the DNS zone in which the DNS-01 challenge has to be initiated (eg. subdomain.domain.com or domain.com for input subdomain.domain.com): they tries recursively to configure Lexicon and initiate authentication from the most specific to most generic domain segment, and select the first segment where Lexicon stop erroring out.

This mechanism broke with #9746 because now the plugins call Lexicon client instead of the underlying providers, and the client makes guess on the actual domain requested. Typically for subdomain.domain.com it will actually try to authenticate against domain.com, and so the mechanism above does not work anymore.

This PR fixes the issue by using the delegated field in Lexicon config each time the plugin needs it. This field is designed for this kind of purpose: it will instruct Lexicon what is the actual DNS zone domain instead of guessing it.

I tested the change with one of my OVH account. The expected behavior is re-established and the plugin is able to test subdomain.domain.com then domain.com as before.

Fixes #9791
Fixes #9818

Copy link
Copy Markdown
Member

@bmw bmw left a comment

Choose a reason for hiding this comment

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

Thanks so much Adrien.

@bmw bmw merged commit cf4f07d into certbot:master Oct 27, 2023
bmw pushed a commit that referenced this pull request Oct 27, 2023
…ion (#9821)

The Lexicon-based DNS plugins use a mechanism to determine which actual segment of the input domain is actually the DNS zone in which the DNS-01 challenge has to be initiated (eg. `subdomain.domain.com` or `domain.com` for input `subdomain.domain.com`): they tries recursively to configure Lexicon and initiate authentication from the most specific to most generic domain segment, and select the first segment where Lexicon stop erroring out.

This mechanism broke with #9746 because now the plugins call Lexicon client instead of the underlying providers, and the client makes guess on the actual domain requested. Typically for `subdomain.domain.com` it will actually try to authenticate against `domain.com`, and so the mechanism above does not work anymore.

This PR fixes the issue by using the `delegated` field in Lexicon config each time the plugin needs it. This field is designed for this kind of purpose: it will instruct Lexicon what is the actual DNS zone domain instead of guessing it.

I tested the change with one of my OVH account. The expected behavior is re-established and the plugin is able to test `subdomain.domain.com` then `domain.com` as before.

Fixes #9791
Fixes #9818

(cherry picked from commit cf4f07d)
bmw added a commit that referenced this pull request Oct 30, 2023
* Set the delegated field in Lexicon config to bypass subdomain resolution (#9821)

The Lexicon-based DNS plugins use a mechanism to determine which actual segment of the input domain is actually the DNS zone in which the DNS-01 challenge has to be initiated (eg. `subdomain.domain.com` or `domain.com` for input `subdomain.domain.com`): they tries recursively to configure Lexicon and initiate authentication from the most specific to most generic domain segment, and select the first segment where Lexicon stop erroring out.

This mechanism broke with #9746 because now the plugins call Lexicon client instead of the underlying providers, and the client makes guess on the actual domain requested. Typically for `subdomain.domain.com` it will actually try to authenticate against `domain.com`, and so the mechanism above does not work anymore.

This PR fixes the issue by using the `delegated` field in Lexicon config each time the plugin needs it. This field is designed for this kind of purpose: it will instruct Lexicon what is the actual DNS zone domain instead of guessing it.

I tested the change with one of my OVH account. The expected behavior is re-established and the plugin is able to test `subdomain.domain.com` then `domain.com` as before.

Fixes #9791
Fixes #9818

(cherry picked from commit cf4f07d)

* add changelog entry for 9821 (#9822)

(cherry picked from commit 7bb85f8)

---------

Co-authored-by: Adrien Ferrand <adferrand@users.noreply.github.com>
@Marvo2011
Copy link
Copy Markdown

I think we need a better way, some users need to bypass the delegated override.
See miigotu/certbot-dns-godaddy#76 or kaechele/certbot-dns-pdns#60

I also run into this problem, only thing that works is to comment out line 'delegated': domain, in certbot/certbot/plugins/dns_common_lexicon.py.

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.

Issue renewing subdomains on certbot+certbot-dns-dnsmadeeasy v2.7.0+ Certbot with certbot-dns-ovh fails to identify subdomain zone

3 participants