lego: EasyDNS dns provider doesn't properly handle domains with multi-part TLDs

Welcome

  • Yes, I’m using a binary release within 2 latest releases.
  • Yes, I’ve searched similar issues on GitHub and didn’t find any.
  • Yes, I’ve included all information below (version, config, etc).

What did you expect to see?

When attempting to obtain a cert for a domain with a ccTLD that is made up of two parts, e.g. example.co.uk, I expect lego to correctly submit the zone update to the EasyDNS REST API to complete the DNS challenge before generating certificates.

What did you see instead?

When attempting to obtain certificates for a domain in the form of example.co.uk using the DNS challenge provider for EasyDNS, I consistently get an error response:

Could not obtain certificates:
	error: one or more domains had a problem:
[www.example.co.uk] [www.example.co.uk] acme: error presenting token: easydns: error adding zone record: 403: request failed: {"error":{"code":403,"message":"Access to resource denied due to permissions"}}

When I tested the zone update against the REST API directly, using Postman and the same credentials, the request succeeded.

On inspection of the logging available through EasyDNS’s management portal I noticed that the domain was split such that the domain was co.uk and it treated example as part of the host name.

How do you use lego?

Docker image

Reproduction steps

Pre-requisite: A domain registered and managed with EasyDNS that has a multi-part TLD, such as .co.uk. It is also necessary to sign up explicitly for API access.

  1. Obtain the access token and API key for the EasyDNS API, making sure that you have the correct credentials for the endpoint you use for testing (sandbox or production). FWIW, the results are the same for both endpoints.
  2. Configure the env variables EASYDNS_TOKEN and EASYDNS_KEY, and optionally EASYDNS_ENDPOINT using the values obtained for the REST API.
  3. Run lego -a --dns easydns --domains example.co.uk --email confuzed@example.co.uk

In order to test this more easily I wrote a script which sets up the environment variables and executes lego via docker. I’ll share that here:

#!/bin/bash

set -e

# Replace with your full domain name
DOMAIN="www.example.co.uk"

# The email address to use in the request
EMAIL="someone@example.co.uk"

# LetsEncrypt staging server
CASERVER="https://acme-staging-v02.api.letsencrypt.org/directory"

# The EasyDNS endpoint to use, usually test with the sandbox endpoint
EASYDNS_ENDPOINT="https://sandbox.rest.easydns.net"

# easyDNS API creds
EASYDNS_TOKEN="Your Token Here"
EASYDNS_KEY="Your Key Here"

docker run \
  --rm \
  -v "$(pwd)/lego:/.lego" \
  -e EASYDNS_ENDPOINT=${EASYDNS_ENDPOINT} \
  -e EASYDNS_TOKEN=${EASYDNS_TOKEN} \
  -e EASYDNS_KEY=${EASYDNS_KEY} \
  goacme/lego \
  -a \
  --server "${CASERVER}" \
  --dns easydns \
  --dns.resolvers "dns1.easydns.com" \
  --domains "${DOMAIN}" \
  --email "${EMAIL}" \
  run 

Version of lego

lego version v4.4.0 linux/amd64

Logs

2021/08/17 16:59:59 [INFO] [www.example.co.uk] acme: Obtaining bundled SAN certificate
2021/08/17 17:00:00 [INFO] [www.example.co.uk] AuthURL: https://acme-staging-v02.api.letsencrypt.org/acme/authz-v3/292448088
2021/08/17 17:00:00 [INFO] [www.example.co.uk] acme: Could not find solver for: tls-alpn-01
2021/08/17 17:00:00 [INFO] [www.example.co.uk] acme: Could not find solver for: http-01
2021/08/17 17:00:00 [INFO] [www.example.co.uk] acme: use dns-01 solver
2021/08/17 17:00:00 [INFO] [www.example.co.uk] acme: Preparing to solve DNS-01
2021/08/17 17:00:00 [INFO] [www.example.co.uk] acme: Cleaning DNS-01 challenge
2021/08/17 17:00:01 [INFO] Deactivating auth: https://acme-staging-v02.api.letsencrypt.org/acme/authz-v3/292448088
2021/08/17 17:00:01 Could not obtain certificates:
	error: one or more domains had a problem:
[www.example.co.uk] [www.example.co.uk] acme: error presenting token: easydns: error adding zone record: 403: request failed: {"error":{"code":403,"message":"Access to resource denied due to permissions"}}

Go environment (if applicable)

The docker container

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Comments: 15 (6 by maintainers)

Most upvoted comments

Hello @Confuzed, if I create a PR are you able to test it?

Yes, be happy to 👍🏻