Lesson 2 of 4 VPC Network Security

Inspecting and Filtering Traffic with AWS Network Firewall

This lesson explains how AWS Network Firewall inspects and filters traffic by domain name, protocol behaviour or intrusion prevention signature, which security groups and NACLs cannot do, as the managed answer for egress filtering and intrusion prevention in VPCs.

Learning outcomes

After completing this lesson, you will be able to:

  • Describe how firewall endpoints are deployed and traffic is routed through them.
  • Distinguish stateless rules, stateful domain lists and Suricata-compatible rules.
  • Describe centralised inspection with a transit gateway and appliance mode.
  • Explain how Network Firewall and DNS Firewall complement each other.

Deployment

Firewall endpoints sit in dedicated firewall subnets, one per AZ. Route tables are changed so that traffic between subnets, to the internet gateway or to a transit gateway passes through them. The firewall scales automatically and is highly available.

True or false

Deploying Network Firewall

Exam skills 3.3.1 · 3.3.4

Check how Network Firewall is deployed and centralised.

Log in to try this activity Interactive activities are free with an account.

Rule types

AWS Network Firewall inspects traffic with four kinds of rule. Stateless rules look at each packet's five-tuple (source and destination addresses and ports, and protocol) and decide quickly, without tracking connections. Stateful rules, written in the Suricata-compatible format, track connections and inspect protocol behaviour, acting as an intrusion prevention system (IPS) with signatures.

Domain list rules filter by the domain name in the TLS Server Name Indication (SNI) or the HTTP Host header. This is the usual way to restrict outbound traffic to approved destinations, for example only .amazonaws.com and approved SaaS providers, which blocks malware from reaching its command servers. AWS managed threat signatures add rule groups for known threats that AWS keeps up to date. The following table summarises the rule types.

Rule typeFilters on
StatelessThe five-tuple, quickly
Stateful (Suricata-compatible)IPS signatures and protocol behaviour
Domain listsTLS SNI or HTTP Host, for example allowing egress only to .amazonaws.com and approved SaaS
AWS managed threat signaturesKnown threats

TLS inspection decrypts and re-encrypts traffic using ACM certificates. Alert, flow and TLS logs go to S3, CloudWatch Logs or Firehose.

Match the pairs

Network Firewall rule types

Exam skills 3.3.1

Match each Network Firewall rule type with what it filters on.

Log in to try this activity Interactive activities are free with an account.

Centralised inspection

An inspection VPC attached to a transit gateway inspects east-west and north-south traffic for many VPCs, with appliance mode on the attachment for symmetric routing. Firewall policies are shared with AWS RAM, and Firewall Manager deploys firewalls and policies across the organisation.

The following diagram summarises, in order, the rules of an egress allow list in AWS Network Firewall and its default action.

An egress allow list in AWS Network Firewall with strict rule order. TLS to AWS API names and the package mirror passes; the TCP handshake passes so the firewall can read the ClientHello's SNI; other TLS and plain HTTP are dropped, and a default drop catches the rest. SNI is client-chosen, so high assurance adds TLS inspection or DNS Firewall.
The scenario is illustrative.
Scenario questions

Centralising inspection

Exam skills 3.3.4 · 6.2.3

Choose how to inspect and govern traffic for many VPCs.

Log in to try this activity Interactive activities are free with an account.

Complementary controls

Network Firewall blocks connections, including those made directly to IP addresses; Route 53 Resolver DNS Firewall, covered with DNS logging, blocks the lookups of unwanted domains. Using both gives defence in depth for egress control.

Worked example

An egress allow list with Suricata rules

Workloads may reach only AWS APIs and the company's package mirror; everything else outbound must be dropped and logged. A stateful rule group in strict order allows the approved TLS server names and drops the rest:

pass tls $HOME_NET any -> $EXTERNAL_NET 443 (tls.sni; dotprefix; content:".amazonaws.com"; endswith; msg:"AWS APIs"; sid:100001; rev:1;)
pass tls $HOME_NET any -> $EXTERNAL_NET 443 (tls.sni; content:"mirror.example.com"; startswith; endswith; msg:"Package mirror"; sid:100002; rev:1;)
pass tcp $HOME_NET any -> $EXTERNAL_NET 443 (flow:not_established; sid:100003; rev:1;)
drop tls $HOME_NET any -> $EXTERNAL_NET any (msg:"Unapproved TLS destination"; sid:100010; rev:1;)
drop http $HOME_NET any -> $EXTERNAL_NET any (msg:"Plain HTTP egress"; sid:100011; rev:1;)

The third rule lets the TCP handshake complete so the firewall can see the TLS ClientHello and its SNI. With strict rule ordering and a default drop for established traffic, anything not explicitly passed is blocked. Domain names in SNI are chosen by the client, so for high assurance this is combined with TLS inspection or DNS Firewall.

Check yourself

How can Network Firewall inspect encrypted traffic?

Show answer

With TLS inspection.

Exam Tips

Remember for the exam

  • To allow outbound traffic only to approved domains, use a Network Firewall domain allow list.
  • For IPS signatures on VPC traffic, use Network Firewall stateful rules or managed threat signatures.
  • To inspect encrypted traffic, use Network Firewall TLS inspection.
  • For central inspection of many VPCs, use an inspection VPC behind a transit gateway with appliance mode.
  • Combine Network Firewall with DNS Firewall for egress control.