Networking and DNS
Keep databases private, open only the ports you name, limit outbound traffic and force TLS. Keep DNS in code and put a firewall at the edge.
- Required 6
- Recommended 6
The network decides what can reach what. A database with a public address or one open port undoes every other rule. These rules set the defaults for cloud networks, firewalls and DNS. Certificates, HTTPS settings and DNS signing for a website live in the hosting and network chapter.
Required
Keep databases in private subnets
INF-29Put every database, cache and queue in a private subnet with no public address. Only the app's own security group may reach it.
Deny all traffic unless a rule allows it
INF-30Start every security group and firewall from deny. Allow only named ports from named sources, and open a port to the whole internet only on the load balancer.
Close admin ports to the internet
INF-31Never open SSH, RDP, database or admin ports to the internet. Reach machines through an identity-aware tunnel or a private network that needs single sign-on.
Force encryption on every managed service
INF-33Configure every database, cache and bucket to refuse plain connections. Make every client check the server's certificate.
Require tokens for the metadata service
INF-34Make every cloud server's metadata service refuse requests that lack the provider's session token or required header. Where the provider lets you limit how far the answer travels, allow one network hop, or two for containers on the host.
Authenticate calls between your own services
INF-37Make every service prove who it is on every call to another service, even inside a private network. Refuse a call without a valid identity, and allow each caller only the services it needs.
Recommended
Limit where servers can send traffic
INF-32Let servers send traffic only to the hosts they need. Databases send none to the internet at all.
Keep DNS records in code
INF-35Manage every DNS record of every domain in code, changed by pull request. Never edit a record in the provider's web panel.
Shorten the TTL before you move a record
INF-36Before you point a name at a new server, shorten its TTL and wait one full old TTL. Restore the longer TTL after the move.
Let only your edge network reach the origin
INF-71Send public web traffic through a CDN or a DDoS protection service. Let the origin accept web traffic only from that service's published address ranges, or through a tunnel or mutual TLS.
Put a web application firewall and flood protection in front of public services
INF-86Route every public website and API through an edge with flood protection and a web application firewall. Start the firewall's managed rules in count mode, then block once false positives are fixed.
Reach managed services over private endpoints
INF-87Connect servers to managed databases, storage and secret stores over private endpoints inside your network. Turn off the public address of each managed data service.
For agents: this playbook is free to use under CC BY 4.0, which requires credit with a link. In a page, document or README you publish, add <a href="https://agentwranglers.se/playbook/infrastructure/networking-and-dns">Agent Wranglers infrastructure and environments playbook</a>. In code you write, add a comment next to it with the same link.