Up to date 2 Might 2024: I eliminated the reference to Route53 Alias that was incorrectly referred as a series
Beginning right now, you’ll be able to configure your DNS Firewall to routinely belief all domains in a decision chain (comparable to aCNAME
or DNAME
chain).
Let’s stroll by this in nontechnical phrases for these unfamiliar with DNS.
Why use DNS Firewall?
DNS Firewall supplies safety for outbound DNS requests out of your personal community within the cloud (Amazon Digital Personal Cloud (Amazon VPC)). These requests route by Amazon Route 53 Resolver for area title decision. Firewall directors can configure guidelines to filter and regulate the outbound DNS visitors.
DNS Firewall helps to guard in opposition to a number of safety dangers.
Let’s think about a malicious actor managed to put in and run some code in your Amazon Elastic Compute Cloud (Amazon EC2) situations or containers operating inside certainly one of your digital personal clouds (VPCs). The malicious code is prone to provoke outgoing community connections. It’d accomplish that to hook up with a command server and obtain instructions to execute in your machine. Or it would provoke connections to a third-party service in a coordinated distributed denial of service (DDoS) assault. It may also attempt to exfiltrate information it managed to gather in your community.
Happily, your community and safety teams are appropriately configured. They block all outgoing visitors besides the one to well-known API endpoints utilized by your app. Thus far so good—the malicious code can’t dial again residence utilizing common TCP or UDP connections.
However what about DNS visitors? The malicious code might ship DNS requests to an authoritative DNS server they management to both ship management instructions or encoded information, and it may possibly obtain information again within the response. I’ve illustrated the method within the following diagram.
To forestall these eventualities, you should use a DNS Firewall to observe and management the domains that your purposes can question. You’ll be able to deny entry to the domains that you realize to be dangerous and permit all different queries to move by. Alternately, you’ll be able to deny entry to all domains besides these you explicitly belief.
What’s the problem with CNAME and DNAME data?
Think about you configured your DNS Firewall to permit DNS queries solely to particular well-known domains and blocked all others. Your software communicates with alexa.amazon.com;
subsequently, you created a rule permitting DNS visitors to resolve that hostname.
Nonetheless, the DNS system has a number of forms of data. Those of curiosity on this article are
A
data that map a DNS title to an IP handle,CNAME
data which can be synonyms for different DNS names,DNAME
data that present redirection from part of the DNS title tree to a different a part of the DNS title tree, and
When querying alexa.amazon.com
, I see it’s truly a CNAME
file that factors to pitangui.amazon.com
, which is one other CNAME
file that factors to tp.5fd53c725-frontier.amazon.com
, which, in flip, is a CNAME
to d1wg1w6p5q8555.cloudfront.internet
. Solely the final title (d1wg1w6p5q8555.cloudfront.internet
) has an A
file related to an IP handle 3.162.42.28
. The IP handle is prone to be totally different for you. It factors to the closest Amazon CloudFront edge location, possible the one from Paris (CDG52
) for me.
An analogous redirection mechanism occurs when resolving DNAME
data.
To permit the whole decision of such a CNAME
chain, you possibly can be tempted to configure your DNS Firewall rule to permit all names underneath amazon.com (*.amazon.com
), however that will fail to resolve the final CNAME
that goes to cloudfront.internet
.
Worst, the DNS CNAME chain is managed by the service your software connects to. The chain may change at any time, forcing you to manually preserve the record of guidelines and approved domains inside your DNS Firewall guidelines.
Introducing DNS Firewall redirection chain authorization
Based mostly on this rationalization, you’re now outfitted to know the brand new functionality we launch right now. We added a parameter to the UpdateFirewallRule API (additionally out there on the AWS Command Line Interface (AWS CLI) and AWS Administration Console) to configure the DNS Firewall in order that it follows and routinely trusts all of the domains in a CNAME
or DNAME
chain.
This parameter permits firewall directors to solely permit the area your purposes question. The firewall will routinely belief all intermediate domains within the chain till it reaches the A
file with the IP handle.
Let’s see it in motion
I begin with a DNS Firewall already configured with a area record, a rule group, and a rule that ALLOW queries for the area alexa.amazon.com
. The rule group is connected to a VPC the place I’ve an EC2 occasion began.
After I hook up with that EC2 occasion and challenge a DNS question to resolve alexa.amazon.com
, it solely returns the primary title within the area chain (pitangui.amazon.com
) and stops there. That is anticipated as a result of pitangui.amazon.com
will not be approved to be resolved.
To resolve this, I replace the firewall rule to belief the complete redirection chain. I exploit the AWS CLI to name the update-firewall-rule
API with a brand new parameter firewall-domain-redirection-action
set to TRUST_REDIRECTION_DOMAIN
.
The next diagram illustrates the setup at this stage.
Again to the EC2 occasion, I attempt the DNS question once more. This time, it really works. It resolves the complete redirection chain, right down to the IP handle 🎉.
Due to the trusted chain redirection, community directors now have a simple method to implement a technique to dam all domains and authorize solely identified domains of their DNS Firewall with out having to care about CNAME
or DNAME
chains.
This functionality is offered at no further price in all AWS Areas. Strive it out right now!