Overview
Pulling the network cable destroys the volatile evidence you need and takes the service down with it. What you usually want is narrower: stop it reaching anything new, keep watching it, and leave the machine running while you investigate.
Firewall rules match in both directions and run statelessly in the kernel at the TC hook, so nothing sits in the application's path and a compromised userspace process cannot bypass them.
When you see this
- A host beacons to a destination nobody recognises.
- An IDS alert and a model score agree that a host's traffic looks like command and control.
Steps
- 01
See what the host is talking to
Before you cut anything, record where the host is connecting. Look at it across every layer in the event log.
Everything involving the host jq -c 'select(.src_ip == "10.0.4.21")' /var/log/synapse/events.log - 02
Allow what the investigation needs
Your log collector and your management plane stay reachable. Give these rules a low order value so they are evaluated first.
- 03
Deny all other egress
Add a drop for egress with a higher order value than the exceptions. Evaluation stops at the first matching rule, lowest order first.
DecisionDid a connection you need get cut?Yes Its allow has a higher order than the deny. Give it a lower one.
No The containment shape is in place.
- 04
Block by name where a port is not enough
Firewall rules stop at the transport header: you can cut a destination and a port, not a TLS SNI. Amygdala evaluates the SNI on the host and installs the resulting block.
Smart firewall rule, action drop tls.sni == "cdn-update.example.net" - 05
Check what the kernel enforces
Only active rules are loaded, so a disabled rule is gone from the datapath rather than resident and inert.
Rules the kernel is enforcing sudo synapse --show-firewall-rules json
Common mistakes
- Placing the exceptions below the deny: they never run.
- Forgetting that rules are stateless: a reply needs a rule of its own.
- Treating containment as the fix. It buys time and limits blast radius; rebuild the host.
Escalate when
- The host held credentials or keys that other systems trust.
- The same destination appears from a second host.
Where this stops working
- A local-only compromise is untouched: egress rules do nothing about something that never leaves the box.
- Matching stops at the transport header; anything finer is Amygdala's job.