ameshkov/legoagh

failed to find zone co.uk

romprod opened this issue · 1 comments

I'm trying to generate a certificate for a .co.uk domain and in this example 123.co.uk

It appears that the script is missing the 123 part of the domain and is looking for the .co.uk zone instead of the 123.co.uk zone in CloudFlare

If I swap it out for .com it appears to correctly look for 123.com (but I don't own the .com version of the domain so correctly it fails that test)

DOMAIN_NAME="123.co.uk" \
    EMAIL="email@email.com" \
    DNS_PROVIDER="cloudflare" \
    CLOUDFLARE_DNS_API_TOKEN="1234567890abcedfgh" \
    ./lego.sh

Error output =

root@adguard:~# DOMAIN_NAME=123.co.uk EMAIL=email@email.com DNS_PROVIDER=cloudflare CLOUDFLARE_DNS_API_TOKEN=1234567890abcedfgh ./lego.sh
operating system: linux
cpu type: amd64
Downloading the latest lego release from https://github.com/go-acme/lego/releases/download/v4.14.0/lego_v4.14.0_linux_amd64.tar.gz
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
2023/09/14 06:43:40 [INFO] [*.123.co.uk, 123.co.uk] acme: Obtaining bundled SAN certificate
2023/09/14 06:43:41 [INFO] [*.123.co.uk] AuthURL: https://acme-v02.api.letsencrypt.org/acme/authz-v3/264278992996
2023/09/14 06:43:41 [INFO] [123.co.uk] AuthURL: https://acme-v02.api.letsencrypt.org/acme/authz-v3/264278993006
2023/09/14 06:43:41 [INFO] [*.123.co.uk] acme: use dns-01 solver
2023/09/14 06:43:41 [INFO] [123.co.uk] acme: Could not find solver for: tls-alpn-01
2023/09/14 06:43:41 [INFO] [123.co.uk] acme: Could not find solver for: http-01
2023/09/14 06:43:41 [INFO] [123.co.uk] acme: use dns-01 solver
2023/09/14 06:43:41 [INFO] [*.123.co.uk] acme: Preparing to solve DNS-01
2023/09/14 06:43:42 [INFO] [123.co.uk] acme: Preparing to solve DNS-01
2023/09/14 06:43:43 [INFO] [*.123.co.uk] acme: Cleaning DNS-01 challenge
2023/09/14 06:43:44 [WARN] [*.123.co.uk] acme: cleaning up failed: cloudflare: failed to find zone co.uk.: zone could not be found 
2023/09/14 06:43:44 [INFO] [123.co.uk] acme: Cleaning DNS-01 challenge
2023/09/14 06:43:45 [WARN] [123.co.uk] acme: cleaning up failed: cloudflare: failed to find zone co.uk.: zone could not be found 
2023/09/14 06:43:45 [INFO] Deactivating auth: https://acme-v02.api.letsencrypt.org/acme/authz-v3/264278992996
2023/09/14 06:43:45 [INFO] Deactivating auth: https://acme-v02.api.letsencrypt.org/acme/authz-v3/264278993006
2023/09/14 06:43:45 Could not obtain certificates:
        error: one or more domains had a problem:
[*.123.co.uk] [*.123.co.uk] acme: error presenting token: cloudflare: failed to find zone co.uk.: zone could not be found
[123.co.uk] [123.co.uk] acme: error presenting token: cloudflare: failed to find zone co.uk.: zone could not be found

Where as the following seems to pickup the domain name

root@adguard:~# DOMAIN_NAME=123.com EMAIL=email@email.com DNS_PROVIDER=cloudflare CLOUDFLARE_DNS_API_TOKEN=1234567890abcedfgh ./lego.sh
operating system: linux
cpu type: amd64
Downloading the latest lego release from https://github.com/go-acme/lego/releases/download/v4.14.0/lego_v4.14.0_linux_amd64.tar.gz
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
2023/09/14 06:43:22 [INFO] [*.123.com, 123.com] acme: Obtaining bundled SAN certificate
2023/09/14 06:43:23 [INFO] [*.123.com] AuthURL: https://acme-v02.api.letsencrypt.org/acme/authz-v3/264278931346
2023/09/14 06:43:23 [INFO] [123.com] AuthURL: https://acme-v02.api.letsencrypt.org/acme/authz-v3/264278931356
2023/09/14 06:43:23 [INFO] [*.123.com] acme: use dns-01 solver
2023/09/14 06:43:23 [INFO] [123.com] acme: Could not find solver for: tls-alpn-01
2023/09/14 06:43:23 [INFO] [123.com] acme: Could not find solver for: http-01
2023/09/14 06:43:23 [INFO] [123.com] acme: use dns-01 solver
2023/09/14 06:43:23 [INFO] [*.123.com] acme: Preparing to solve DNS-01
2023/09/14 06:43:24 [INFO] [123.com] acme: Preparing to solve DNS-01
2023/09/14 06:43:24 [INFO] [*.123.com] acme: Cleaning DNS-01 challenge
2023/09/14 06:43:24 [WARN] [*.123.com] acme: cleaning up failed: cloudflare: failed to find zone 123.com.: zone could not be found 
2023/09/14 06:43:24 [INFO] [123.com] acme: Cleaning DNS-01 challenge
2023/09/14 06:43:24 [WARN] [123.com] acme: cleaning up failed: cloudflare: failed to find zone 123.com.: zone could not be found 
2023/09/14 06:43:24 [INFO] Deactivating auth: https://acme-v02.api.letsencrypt.org/acme/authz-v3/264278931346
2023/09/14 06:43:25 [INFO] Deactivating auth: https://acme-v02.api.letsencrypt.org/acme/authz-v3/264278931356
2023/09/14 06:43:25 Could not obtain certificates:
        error: one or more domains had a problem:
[*.123.com] [*.123.com] acme: error presenting token: cloudflare: failed to find zone 123.com.: zone could not be found
[123.com] [123.com] acme: error presenting token: cloudflare: failed to find zone 123.com.: zone could not be found

Tbh it seems that the bug is in lego itself, not in the script.