Free overview · hard · Lesson 4 of 8

NetworkPolicy in full

A default deny on ingress and egress in the shop's namespace: what breaks after it (DNS, the cluster API, traffic from outside) and how to allow exactly the paths you need.

The fourth lesson of the hardening track. The attacker in web already has no root and no useful permissions in the API, but the cluster network is still open: from web you can connect straight to the database and send data to any address on the internet. The lesson shows how to close a namespace with network policies without breaking what used to work.

Threat model

The attacker runs commands in the web Pod. They need the data, which lives in db, and a channel to carry it out.

Attack path

  1. A command through the vulnerable web endpoint.
  2. A direct TCP connection from web to the database on 5432, bypassing the api service.
  3. An HTTP request from web to the attacker's external server with the data in the body.

Checklist

Practice

A lab on the shared cluster of the track. The attack from web opens a connection to the database and sends data to the attacker's server. You write policies for shop that make both paths time out, while the shop still takes orders and the status page sees the Pods.

Done reading?

Mark the lesson as read to move your track progress forward.

Practice

Fix a local lab. The agent checks your work and gives hints if you get stuck.

Full access to all labs

$134 $67.00 for one year −50%

One payment, no auto-renewal · Terms

Buy for $67.00