Are there any known issues with CNAME flattening [aka ALIAS/ANAME] and HTTP-01 / TLS-ALPN-01?

I have a whitelabel cloud based product that customers CNAME a domain onto. Historically we have only had a reason to run this on subdomains, but a new featureset in development that now makes it attractive to run on the registered/apex domain.

I would prefer to not use A records for this and utilize CNAME/ALIAS/ANAME instead.

I searched the forum for these terms, and a few topics popped up - but the "flattening" seemed to be incidental and not the cause of the Subscriber's problems.

Does this sound correct? Does anyone know of issues I should be on the lookout for? If so, are they specific to any given provider or implementation?

Thank you all in advance.

5 Likes

Not sure if it's helpful, but:

4 Likes

Note that you cannot use TLS-ALPN-01 with a domain that is being proxied through Cloudflare.

ETA: It will work with DNS Only hostnames (in case the wasn't obvious).

5 Likes

Thanks! I am familiar with those Cloudflare docs. I've utilized CNAME flattening a bit in the past, but never layered with the HTTP-01 challenge. (e.g. grab cert via DNS-01 for static sites using Amazon S3 buckets).

Thanks! I totally forgot about that while writing the above, and well, wonderful! Our system does not currently support TLS-ALPN-01, and I don't want to waste resources on it. This gives me some ammo to decline requests!

5 Likes

The customer's DNS provider may have restrictions on CNAME flattening / ALIAS type features when directing to a different DNS provider.

2 Likes

CNAME Flattening and similarly named features from other providers are not visible to DNS clients. All that is usually returned are standard A or AAAA records. Keep in mind, this also means you retain control over the CAA records that would be queried from the apex unlike a CNAME which would delegate control over all record types.

It's basically cheating the limitation in the DNS specs on the DNS provider side. The provider does a direct lookup of the target FQDN (and presumably caches the result for the appropriate TTL) and responds authoritatively to the querying client with the A/AAAA records as necessary.

They're also useful outside of apex records when you want to, for example, delegate the A/AAAA responses, but keep local authority over other record types (TXT, MX, CAA, etc).

7 Likes

Thanks Ryan.

As there are no standards on this, and it is "cheating the limitation in the DNS specs on the DNS provider side" as you perfectly stated, I'm worried about how the implementation details of any one provider accomplishing this might cause issues.

This is also the sort of thing I was hoping to get more insight on. It is a much better description of this 2019 thread - CAA 403 issue, with multiple CNAME configuration - #3 by luuk .

We haven't hit this yet, but could. I'm going to need to define some polices for this.

2 Likes

In my experience so far, the implementation details vary mostly around failure cases such as how the DNS server responds when it can't get a valid response from the target FQDN and doesn't already have a previously cached value. It can range from NXDOMAIN, SERVFAIL, or empty NOERROR responses to even query timeouts. Even if it does have a previously cached value but the TTL has expired, I suspect there are differences around whether it will return the last known value or one of the error responses. But none of the providers I've seen have any sort of low level control over those choices.

4 Likes

That's great insight! Thanks. It reads like standard ephemeral failures.

We currently require clients to CNAME a DNS-01 record onto our acme-dns instance. I was debating dropping that requirement, but I'm inclined to keep it as a backup. We require this to "prime" our system before anything goes live; we obtain the certificate in advance of the client CNAME'ing a domain onto the Application Server and notify them when the platform is ready.

2 Likes

As example of my earlier comment ... Route53 only allows Alias to AWS services.

I vaguely recall restrictions with Cloudflare flattening beyond its borders as well but that may be only on free accounts. Not that sure of that.

As long as you don't mind people using A/AAAA records on their apex to you it won't matter. But, it sounded like you very much wanted to avoid that. At least, that's how I read your post.

2 Likes

They enabled Alias onto foreign DNS a while back, because the Cloudflare product was too much of an advantage.

Maybe this is for recursive CNAMEs when the targets are not within Cloudflare? Free accounts will definitely flatten an apex record that is pointed to external A record. I know that paid accounts are required to enable automatic flattening of all CNAMEs.

Route53 will also charge 1x-2x for alias expansion. You get a second charge if it requires a second DNS lookup on their system, but it's waived if it's going to certain Amazon resources.

4 Likes

The key limit on free accounts is that flattening is limited to the apex. More details on CNAME flattening can be found here:

5 Likes

Huh, I even checked the docs before posting and it didn't mention that. Or perhaps I mis-read. Anyway, good to know.

Edit: I also don't see an Alias option in my Route53 panel for foreign DNS. And, I can't make a CNAME for the apex. Oh well. Not something I need atm anyway :slight_smile:

2 Likes

Mis-read, or wrong docs?

Under "Comparison of alias and CNAME records", alias records can target Alias records or CNAMEs; the CNAMEs can be on external systems.

Then it goes into the pricing and describes the single vs double charge scenarios.

I have not personally done this. A few years ago I worked with a DevOps Engineer who routinely did this. I should probably set up a test.

4 Likes

Must be brain-cramping. I don't see the option for foreign CNAME in Alias record. And, I couldn't see how I could set it on the Route53 control panel either. You can do things in the same hosted zone.

Here's from the top section of that doc link you provided. I don't see a foreign CNAME as a valid target for Alias

Resources that you can redirect queries to

Alias records

An alias record can only redirect queries to selected AWS resources, including but not limited to the following:

  • Amazon S3 buckets
  • CloudFront distributions
  • Another record in the same Route 53 hosted zone

For example, you can create an alias record named acme.example.com that redirects queries to an Amazon S3 bucket that is also named acme.example.com. You can also create an acme.example.com alias record that redirects queries to a record named zenith.example.com in the example.com hosted zone.

2 Likes

I'll try to play with it this weekend, and reach out to my former colleague.

3 Likes

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