SSL for two A records with different hosts?

My domain is: direbox.net, shop.direbox.net

I ran this command: sudo certbot renew --dry-run

It produced this output:

Certbot failed to authenticate some domains (authenticator: nginx). The Certificate Authority reported these problems:
  Domain: direbox.net
  Type:   unauthorized
  Detail: 23.227.38.65: Invalid response from http://direbox.net/.well-known/acme-challenge/ecT0PrzanUcimuPGwsRgumXBnsqvmD_SdBlUUqhnkGY: 404

Hint: The Certificate Authority failed to verify the temporary nginx configuration changes made by Certbot. Ensure the listed domains point to this nginx server and that it is accessible from the internet.

Failed to renew certificate direbox.net with error: Some challenges have failed.


- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
All simulated renewals failed. The following certificates could not be renewed:
  /etc/letsencrypt/live/direbox.net/fullchain.pem (failure)
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
1 renew failure(s), 0 parse failure(s)
Ask for help or search for solutions at https://community.letsencrypt.org. See the logfile /var/log/letsencrypt/letsencrypt.log or re-run Certbot with -v for more details.

My web server is (include version): nginx/1.18.0

The operating system my web server runs on is (include version): Ubuntu 20.04

My hosting provider, if applicable, is: FranTech

I can login to a root shell on my machine (yes or no, or I don't know): yes

I'm using a control panel to manage my site (no, or provide the name and version of the control panel): no

The version of my client is (e.g. output of certbot --version or certbot-auto --version if you're using Certbot): certbot 3.1.0

Problem Description

Heya Certbot community! I'm stumped and truly need your help. I've used Certbot successfully for years but this situation has put me in a pickle.

The subdomain shop.direbox.net is managed by Shopify, who automatically created an A record and a CNAME record for the subdomain. That domain works just fine.

My main website, direbox.net, is hosted separately on a VPS, so I created a second A record pointing to the VPS IP and configured NGINX as usual for port 80 traffic only to the root domain. Everything worked fine until I ran Certbot.

The first few times I ran Certbot, it failed with a 404 and NGINX produced a 403 Cloudflare error in the browser. Then for some reason it worked and I had SSL for a few hours. Then it stopped working and the --dry-run command started failing as well.

Poking around the LetsEncrypt logs, I noticed this:

{
  "identifier": {
    "type": "dns",
    "value": "direbox.net"
  },
  "status": "invalid",
  "expires": "2025-02-16T23:43:58Z",
  "challenges": [
    {
      "type": "http-01",
      "url": "https://acme-staging-v02.api.letsencrypt.org/acme/chall/184031914/16008052234/cqet2w",
      "status": "invalid",
      "validated": "2025-02-09T23:43:59Z",
      "error": {
        "type": "urn:ietf:params:acme:error:unauthorized",
        "detail": "23.227.38.65: Invalid response from http://direbox.net/.well-known/acme-challenge/ecT0PrzanUcimuPGwsRgumXBnsqvmD_SdBlUUqhnkGY: 404",
        "status": 403
      },
      "token": "ecT0PrzanUcimuPGwsRgumXBnsqvmD_SdBlUUqhnkGY",
      "validationRecord": [
        {
          "url": "http://direbox.net/.well-known/acme-challenge/ecT0PrzanUcimuPGwsRgumXBnsqvmD_SdBlUUqhnkGY",
          "hostname": "direbox.net",
          "port": "80",
          "addressesResolved": [
            "23.227.38.65",
            "205.185.122.219"
          ],
          "addressUsed": "23.227.38.65"
        }
      ]
    }
  ]
}

The addressUsed field is Shopify's IP address, though in addressesResolved it does list my VPS IP second. So I know this has something to do with a conflict between the SSL/TLS cert issued directly by Shopify and the one I'm trying to issue separately for the root domain.

But I have no idea where to go from here! Any help would be greatly appreciated.

Hello @federalfarmer, welcome to the Let's Encrypt community. :slightly_smiling_face:

Using the online tool Let's Debug I see the 2 different domain names behave somewhat different from each other.
https://letsdebug.net/shop.direbox.net/2360575
https://letsdebug.net/direbox.net/2360576

CloudflareCDN
Warning
The domain shop.direbox.net is being served through Cloudflare CDN. Any Let's Encrypt certificate installed on the origin server will only encrypt traffic between the server and Cloudflare. It is strongly recommended that the SSL option 'Full SSL (strict)' be enabled.
https://support.cloudflare.com/hc/en-us/articles/200170416-What-do-the-SSL-options-mean-

And this seem the be the present DNS

Also SSL Server Test: direbox.net (Powered by Qualys SSL Labs) shows " Warning: Inconsistent server configuration" as well as IPv4 Address 23.227.38.65 gets "Certificate not valid for domain name"

And here is an interesting one @federalfarmer demonstrating inconstant results even from the same IP Address, from different locations around the world.

One problem is that direbox.net has two IP addresses set in DNS for the same A record, and one looks similar to the shopify one. Is there a need for the 23.227.38.65 one?

dig direbox.net

; <<>> DiG 9.18.30-0ubuntu0.24.04.2-Ubuntu <<>> direbox.net
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 6601
;; flags: qr rd ra; QUERY: 1, ANSWER: 2, AUTHORITY: 0, ADDITIONAL: 1

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 512
;; QUESTION SECTION:
;direbox.net.                   IN      A

;; ANSWER SECTION:
direbox.net.            1799    IN      A       23.227.38.65
direbox.net.            1799    IN      A       205.185.122.219
2 Likes

If both addresses respond the same there shouldn’t be a problem, but they are not responding the same.

1 Like

Thank you @webprofusion and @Bruce5051 for your replies!

Could having two A records that both use the @ alias be the problem here? Shopify configured the first A record at 23.227.38.65 automatically. Presumably they also pulled the SSL/TLS because HTTPS on the subdomain works just fine.

Forgive me, I've only ever managed domains with a single A record and no third-party services like Shopify so my lack of understanding of DNS is really showing itself.

2 Likes

I didn't remember until tonight that @ is an alias for the root domain. :person_facepalming: So the issue was with my DNS configuration. I changed Shopify's A record from the root domain to the subdomain and everything seems to be working now.

That's what I get for blindly following automated configuration! Many thanks for all your leg-work on this.

3 Likes

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.