Topic 168 / Advanced
Network security and firewalls
Chapter 10.5 · Network and Architecture Security
What and why
Every control so far (→ 159–167) assumes a request has already reached the application; network security decides what reaches it at all. Segmenting a network into tiers, and allowing only the specific paths each tier actually needs, is defense in depth (→ 158) applied at the infrastructure layer: a compromise of one tier shouldn't hand an attacker a path to every other tier. Builds on: → 158 (defense in depth).
Diagram
| Layer | What it controls | Stops |
|---|---|---|
| Public / private subnets | Which resources are internet-reachable at all | Direct internet access to anything that doesn't need it |
| Security groups / firewalls | Allowed ports and sources between tiers (default-deny) | Lateral movement between tiers that have no legitimate reason to talk |
| WAF | HTTP-layer request patterns | Many OWASP-category attacks (→ 166) before they reach the application |
| Edge DDoS absorption (→ 89, 94) | Volumetric traffic, before it reaches origin | Origin servers being overwhelmed directly |
How it works
- Put only what must be internet-reachable in a public subnet (typically just a load balancer); everything else — application servers, databases — sits in private subnets.
- Write security group / firewall rules as default-deny: allow only the specific source, destination, and port each legitimate path needs, nothing broader.
- Place a WAF in front of application servers to filter HTTP-layer attack patterns before they reach application code.
- Absorb volumetric (DDoS) traffic at the edge (→ 89 CDN, → 94 Anycast) rather than at the origin, so an attack doesn't have to be handled by the servers actually running the application.
- Treat segmentation as blast-radius control, not a complete defense on its own — pair it with authenticating every request regardless of which network it arrived from (→ 169).
Practical example
(illustrative). A three-tier layout: a public subnet holding only the load balancer; a private subnet of application servers reachable only from the load balancer's security group; a private subnet holding the database, reachable only from the application servers' security group. Compromising the load balancer alone gives an attacker no direct path to the database — they would still have to compromise the application tier first, and each hop is a chance to detect them.
When to use it
- Use layered network controls for any system with internet-facing surface.
- Avoid relying on network segmentation as the only control — pair it with authenticating and authorizing every request regardless of its origin (→ 169), since perimeters do get breached.
- Failure scenarios: an overly broad security-group rule ("allow all from 0.0.0.0/0") left over from debugging and never removed; a flat network where any compromised host can reach every other host; a volumetric attack reaching origin because nothing absorbs it at the edge.
- Simpler alternative: for a small internal system with no internet exposure, a single private subnet with a default-deny firewall is enough — add the WAF and edge-DDoS layer only once there's real internet-facing surface to protect.
Practice
(Process kind — fill the template on a small real system; 20–30 min, no lab services). For Project 1 or Project 3, draw a three-tier segmentation diagram and write the firewall rule (source, destination, port) for every path the system actually needs. For any rule you can't justify by naming the specific traffic that needs it, remove it. Done when every remaining rule has a named, legitimate source and destination.
Key takeaway
Network segmentation limits how far a single compromise can spread; it's a blast-radius control, not a substitute for authenticating every request. Done when you can: draw a tiered network for a given system and justify every allowed path by name. Used next in → 169 (zero trust adds identity verification on top of this network layer).
References
None — this topic makes no external claims.
Source directory