Egress Filtering & Outbound Control Policy Prompt
Design a default-deny egress policy that controls outbound traffic from servers and clusters — allowlisting required destinations, proxying egress, and detecting exfiltration and C2 beaconing.
- Target user
- Security/platform engineers limiting outbound network access
- Difficulty
- Advanced
- Tools
- Claude, ChatGPT
The prompt
You are a network security engineer who locks down outbound traffic. Most environments obsess over inbound and leave egress wide open — which is exactly how data exfiltration and command-and-control beaconing succeed. You design a default-deny egress posture that still lets legitimate dependencies work. I will provide: - The environment (cloud VPC, Kubernetes, on-prem) and current egress controls (usually "allow all") - What each workload legitimately needs to reach (package mirrors, APIs, telemetry, update servers) - Available enforcement (NAT gateway, egress proxy, cloud security groups/firewall, k8s NetworkPolicy/Cilium, DNS firewall) - Constraints (CI that pulls from many registries, SaaS dependencies) - Drivers (compliance, a suspected exfil incident, audit finding) Your job: 1. **Discover real egress** — before denying anything, map actual outbound flows (flow logs, proxy logs, NetworkPolicy audit mode). You cannot allowlist what you have not measured; surprise dependencies cause the outages that get egress controls rolled back. 2. **Allowlist model** — design default-deny egress with explicit allows by destination. Prefer FQDN/domain allowlists (via an egress proxy or DNS firewall) over brittle IP lists for SaaS/CDN endpoints, and pin internal traffic by CIDR. 3. **Enforcement mapping** — match controls to layers: NetworkPolicy/Cilium FQDN policies for pods, an explicit egress proxy (Squid/Envoy) for HTTP(S) with TLS SNI/domain filtering, cloud firewall rules for VM tiers, and a DNS firewall/RPZ to block resolution of unapproved domains. 4. **Exfiltration & C2 detection** — flag the channels attackers abuse when ports are blocked: DNS tunneling, traffic to newly-registered or rare domains, large sustained uploads, and regular low-volume beaconing. Recommend logging allowed/denied egress to your SIEM with alerting. 5. **Phased rollout** — log-only first, build the allowlist from observed flows, then enforce deny per segment (start with the most sensitive/data-bearing tier). Define exit criteria and a break-glass path. 6. **Maintenance** — how new dependencies get added (a reviewed change, not an ad-hoc `allow all`) and how stale allows are pruned. Output as: (a) a discovered-flows summary, (b) an egress allowlist matrix (source, destination/FQDN, port, justification), (c) the enforcement design per layer, (d) a phased rollout plan with detection + break-glass. Anti-patterns to flag: allow-all egress, IP allowlists for CDN-backed SaaS, no DNS-layer control (leaving tunneling open), no logging of denied egress, and an exception process that quietly becomes "just allow everything".
Run this prompt with AI
Test it, get an AI-improved version, or compare models — live in the Prompt Workspace. No copy-paste.
Related prompts
-
Cilium FQDN Egress Allowlist and Hubble Observability Prompt
Design Cilium DNS/FQDN-based egress allowlist policies validated against real Hubble flow data to lock down outbound traffic
-
Data Exfiltration & DLP Controls Design Prompt
Design layered controls that detect and prevent sensitive-data exfiltration — DLP policies, egress monitoring, and access guardrails — without crippling legitimate workflows.
-
DNS Security & Resolver Hardening Review Prompt
Review DNS posture for DNSSEC validation gaps, open/recursive resolver exposure, and missing encrypted transport, then harden resolvers and zones against spoofing and exfiltration.
-
WireGuard VPN Hardening Review Prompt
Review a WireGuard (or legacy VPN) configuration for weak peer scoping, over-broad AllowedIPs, missing key rotation, and routing leaks, then harden it to least-privilege access.
More DevOps Security & Hardening prompts & error guides
Browse every DevOps Security & Hardening prompt and troubleshooting guide in one place.
Reading prompts? Get all 500 in one free PDF
500 battle-tested, copy-paste AI prompts engineered by a senior systems engineer — every one with fill-in placeholders and safety/back-out notes. Drop your email and it's yours.
- 500 prompts: Linux · Kubernetes · Terraform · OpenStack · GitLab · Docker · Monitoring · Incident Response
- Instant PDF download — yours free, forever
- Plus one practical AI-workflow email a week (no spam)
Single opt-in · unsubscribe anytime · no spam.