Network Security Fundamentals

Network security is the discipline of protecting data in transit and controlling access between systems. The traditional perimeter model (firewall around the trusted inside) has been giving way to zero-trust (don't trust anything; verify everything). Modern networks combine both.

This page covers the fundamentals.

Perimeter security (the old model)

The traditional model:

Pros: simple; cheap to operate. Cons: attacker who gets inside has free rein; doesn't fit cloud or mobile.

For most modern environments, perimeter alone is insufficient.

Zero-trust (the modern model)

Don't trust anything based on network location. Authenticate and authorize every request, including internal ones.

Principles:

Implementation:

This is significant work but reduces lateral movement risk after compromise.

Segmentation

Divide the network into segments. Limit lateral movement.

VPCs / VLANs

Logical network boundaries. Different VPCs don't see each other unless explicitly peered.

Security groups (cloud)

Instance-level firewall rules. "Only the load balancer can talk to the application instances on port 8080."

Service mesh

mTLS + identity-based authorization between services. See ServiceMeshArchitecture.

Database segmentation

Database servers in private subnet. Only application servers can connect. No direct internet access.

Encryption in transit

All traffic should be TLS-encrypted, even internal.

TLS basics

For modern apps, TLS 1.2 minimum; 1.3 preferred. Older versions (SSL, TLS 1.0/1.1) are deprecated and have known vulnerabilities.

Certificate management

Let's Encrypt for public certs (free, automated). AWS Certificate Manager / GCP Certificate Manager for managed renewal.

For internal services: private CA with automated rotation. Cert lifecycle is operational work; automate it.

mTLS

Mutual TLS: both sides authenticate. The server presents a cert; the client also presents a cert. Both verify.

For service-to-service auth, mTLS is more secure than API keys. Service meshes provide it transparently.

Common attacks and defenses

DDoS

Distributed denial of service: many sources flooding your service.

Defenses:

Man-in-the-middle

Attacker intercepts traffic between client and server.

Defenses:

Network reconnaissance

Attacker scans your network for vulnerabilities.

Defenses:

Phishing-derived access

Attacker phishes a user; uses their credentials to access internal network.

Defenses:

Patterns

Defense in depth

Multiple layers of security. Perimeter firewall + segmentation + mTLS + authorization. Compromise of one layer doesn't grant full access.

Principle of least privilege

Each component has the minimum permissions needed. Don't grant broad access "in case it's needed later."

Public/private subnets

Public subnets: load balancers, bastion hosts. Private subnets: application servers, databases.

Internet traffic enters public; internal traffic stays in private.

Bastion hosts vs. SSM Session Manager

Old: bastion host (jump server) for SSH access. Modern: AWS SSM Session Manager — no SSH; session through AWS APIs. More auditable; no port 22 exposed.

VPN vs. zero-trust networking

Old: VPN to access internal services. Modern: zero-trust apps (each user authenticates per app); no flat internal network.

Cloud-specific patterns

Security groups (AWS)

Instance-level firewall. Stateful. Reference other security groups: "the database SG allows the application SG."

NACLs (AWS)

Subnet-level. Stateless. Used for broad rules (block specific IP ranges).

VPC endpoints

Access AWS services without going through internet. Reduces exposure.

Expose specific services to specific accounts without internet routing.

WAF

Web Application Firewall at the edge. See WebApplicationFirewalls.

Common failure patterns

A reasonable baseline

For a typical web app:

  1. Public subnet for load balancers; private for everything else
  2. Security groups: deny by default; allow specific
  3. TLS 1.2+ for all external traffic; mTLS or TLS for internal
  4. MFA for all human access
  5. Cloud-managed DDoS protection
  6. WAF for HTTP-facing services
  7. Monitoring + alerting

Further Reading