Skip to content

v3.25.0 truncates domain name leading to Exception with cloudflare #1157

@charleszlu

Description

@charleszlu

In v3.25.0. When using cloudflare as the provider it raises the following exception:

Executing auth hook for domain example.net, lineage example.net.
2024-01-26 08:48:32,230:WARNING:certbot.display.ops:Hook '--manual-auth-hook' for example.net ran with error output:
Error while executing the auth hook:
Traceback (most recent call last):
File "/usr/local/lib/python3.11/site-packages/dnsrobocert/core/hooks.py", line 40, in main
globals()[parsed_args.type](dnsrobocert_config, parsed_args.lineage)
File "/usr/local/lib/python3.11/site-packages/dnsrobocert/core/hooks.py", line 61, in auth
txt_challenge(certificate, profile, token, domain, action="create")
File "/usr/local/lib/python3.11/site-packages/dnsrobocert/core/challenge.py", line 52, in txt_challenge
with Client(ConfigResolver().with_dict(config_dict)) as operations:
File "/usr/local/lib/python3.11/site-packages/lexicon/client.py", line 168, in enter
raise e
File "/usr/local/lib/python3.11/site-packages/lexicon/client.py", line 161, in enter
provider.authenticate()
File "/usr/local/lib/python3.11/site-packages/lexicon/_private/providers/cloudflare.py", line 54, in authenticate
raise AuthenticationError("No domain found)
lexicon.exceptions.AuthenticationError: No domain found

This is due to resolve_zone_name is set to True in file challenge.py, which triggers lexicon's Client to call dns.resolver.zone_for_name(domain). This truncates the domain name from example.net to just net, leading to the exception above. If I manually set resolve_zone_name to False. Everything works the same as in v 3.24.x.

I have tested using:

  • Global API key with auth_username and auth_token
  • Unscoped API token with auth_token

Both methods give the above exception.

I am using the below config:

acme:
  staging: false
  certs_permissions:
    dirs_mode: 493
    files_mode: 420
  crontab_renew: 0 4 * * *
  email_account: mail@example.net

profiles:
- name: cloudflare
  provider: cloudflare
  provider_options:
    auth_token: <unscoped API token>
  sleep_time: 600

certificates:
- name: example.net
  domains:
  - example.net
  - '*.example.net'
  profile: cloudflare
  pfx:
    export: true
    passphrase: **********
  force_renew: false

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions