Skip to content

Conversation

@ldez
Copy link
Member

@ldez ldez commented Oct 9, 2025

Closes #2662

How to test this PR?

  1. You need Go
  2. Check out the PR:
    git clone https://github.com/ldez/lego.git
    cd lego
    git checkout feat/dns/hetzner-v1
  3. Compile lego:
    • if you have make: make build
    • if you don't have make: go build -o dist/lego ./cmd/lego
  4. Run the following command with your information (email, domain, credentials):
    HETZNER_API_TOKEN="xxx" \
    ./dist/lego --email [email protected] --dns hetzner -d '*.example.com' -d example.com  -s https://acme-staging-v02.api.letsencrypt.org/directory run
    The wildcard domain is important
  5. Before each run of the command, you should clean your local environment:
    rm -rf .lego
  6. Put the output of this command in a comment

@ldez ldez mentioned this pull request Oct 9, 2025
5 tasks
@ldez ldez changed the title Add DNS provider for Hetzner v1 hetzner: update to new API Oct 9, 2025
@ldez ldez force-pushed the feat/dns/hetzner-v1 branch 2 times, most recently from c829878 to c0bee9b Compare October 9, 2025 20:46
@ldez ldez force-pushed the feat/dns/hetzner-v1 branch 2 times, most recently from ebc14e4 to bf46bbb Compare October 10, 2025 11:01
@jschneider

This comment was marked as outdated.

@ldez

This comment was marked as outdated.

@jschneider

This comment was marked as outdated.

@jschneider

This comment was marked as outdated.

@jschneider

This comment was marked as outdated.

@ldez

This comment was marked as outdated.

@jschneider

This comment was marked as outdated.

@jschneider

This comment was marked as outdated.

@ldez

This comment was marked as outdated.

@ldez

This comment was marked as outdated.

@jschneider
Copy link

Oh no! I had a typo! Sorry :-(

@jschneider

This comment was marked as outdated.

@jschneider

This comment was marked as outdated.

@ldez

This comment was marked as outdated.

@jschneider

This comment was marked as outdated.

@ldez

This comment was marked as outdated.

@jschneider

This comment was marked as outdated.

@ldez

This comment was marked as outdated.

@ldez

This comment was marked as outdated.

@jschneider

This comment was marked as outdated.

@jschneider

This comment was marked as off-topic.

@jschneider
Copy link

Verdict: From my point of view it seems to work.
The remaining issues seem to be timing / DNS update related.

@ldez
Copy link
Member Author

ldez commented Oct 12, 2025

I might run into the timeout?

No, if there is a timeout, an error message about that appears.

Got cleanup timeout messages, too (Wait for remove RRSet records [timeout: 1m0s, interval: 2s])

This message is not an error.
This always appears: this is the beginning of the wait for the removal of the TXT record.


1.1.1.1 is an example; my sentence was:

you can improve stability by adding extra resolvers (ex: --dns.resolvers 1.1.1.1).


Is 1.1.1.1 also used when checking for the removals?

You are mixing several things:

  • the propagation check
  • add/remove TXT record with the Hetzner API

Lego checks TXT record propagation after creating the TXT records and before attempting to call Let's Encrypt.

The errors DNS problem: NXDOMAIN looking up TXT for and DNS problem: server failure at resolver looking up CAA for originate from Let's Encrypt.
This happens after the propagation check by lego.

@jschneider
Copy link

Well, I don't know anything about the internals of lego ;-). Therefore, I leave it in your hands.
If I can help with further testing, give me a hint!
Until then: Thanks for your work - greatly appreciated.

@ldez ldez added this to the unreleased milestone Oct 13, 2025
@ldez ldez requested a review from dmke October 13, 2025 15:26
config.APIKey = values[EnvAPIKey]
switch {
case foundAPIToken && foundAPIKey:
return nil, fmt.Errorf("hetzner: credentials are provided by both %s and %s", EnvAPIToken, EnvAPIKey)
Copy link
Member

Choose a reason for hiding this comment

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

Would it not be better to just use the API key here (and maybe log a strongly worded warning about the API token)?

I could imagine a scenario where one would rollout both the API token and API key, and then gradually upgrade the lego binaries (or more likely their traefik instances).

Copy link
Member

Choose a reason for hiding this comment

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

(Otherwise: LGTM)

Copy link
Member Author

@ldez ldez Oct 13, 2025

Choose a reason for hiding this comment

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

I think about when I added the message.

For me, APIToken should "override" APIKey.

NewDNSProvider() and NewDNSProviderConfig(*Config) should have the same behavior.

NewDNSProviderConfig() when there is no env var should report the same error as hetznerv1, I should duplicate the code, and I was not happy with that.

But duplication, in this context, is not important.

Copy link
Member Author

Choose a reason for hiding this comment

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

🤔 You are thinking the opposite of me:

  • you: APIKey > APIToken
  • me: APIToken > APIKey

If you are using a previous version of lego, you can set APIKey and APIToken without any problem because only APIKey will be handled.

APIToken is related to v1, and APIKey is related to legacy.

For me, it's better to use APIToken even if APIKey is defined.

@ldez ldez marked this pull request as ready for review October 13, 2025 15:36
@ldez ldez force-pushed the feat/dns/hetzner-v1 branch from 50164d6 to 6b7e7c8 Compare October 13, 2025 15:43
@ldez ldez requested a review from dmke October 13, 2025 15:46
@ldez ldez force-pushed the feat/dns/hetzner-v1 branch from 6b7e7c8 to 693e7a6 Compare October 13, 2025 15:52
@ldez ldez merged commit f0c314c into go-acme:master Oct 14, 2025
7 checks passed
@ldez ldez deleted the feat/dns/hetzner-v1 branch October 14, 2025 19:56
@ldez ldez modified the milestones: unreleased, v4.27 Oct 17, 2025
@ldez ldez mentioned this pull request Oct 23, 2025
Closed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Development

Successfully merging this pull request may close these issues.

hetzner: new API (Hetzner Cloud DNS)

5 participants