Skip to content

Commit d706c69

Browse files
committed
firewall: allow dev server ports on localhost
Add ranges for local dev servers the agent needs when running/testing: - 3000-3999: Next.js (dashboard, website) - 5173: Vite - 6006: Storybook - 8787-8800: Wrangler (Cloudflare Workers) - 9229-9260: Node/Wrangler inspector ports Still blocked: CUPS (631), Tailscale admin, Steam, and any other localhost services the agent has no business talking to.
1 parent 518a0d0 commit d706c69

1 file changed

Lines changed: 21 additions & 7 deletions

File tree

bin/setup-firewall.sh

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@
77
# Blocks: everything else (reverse shells, raw sockets, non-standard ports)
88
#
99
# LOCALHOST:
10-
# Allows: Slack bridge (7890), Ollama (11434), PostgreSQL (54322), DNS (53)
10+
# Allows: Dev servers (3000-3999, 5173, 6006, 8787-8800, 9229-9260),
11+
# Slack bridge (7890), Ollama (11434), PostgreSQL (54322), DNS (53)
1112
# Blocks: everything else (Steam, CUPS, Tailscale admin, unknown services)
1213
#
1314
# The agent cannot:
@@ -43,15 +44,26 @@ iptables -w -N "$CHAIN"
4344

4445
# ── Localhost: allow only specific services ──────────────────────────────────
4546

46-
# Allow Slack bridge (outbound API)
47+
# ── Infrastructure ────────────────────────────────────────────────────────
48+
# Slack bridge (outbound API)
4749
iptables -w -A "$CHAIN" -o lo -p tcp --dport 7890 -j ACCEPT
48-
49-
# Allow Ollama (local LLM inference)
50+
# Ollama (local LLM inference)
5051
iptables -w -A "$CHAIN" -o lo -p tcp --dport 11434 -j ACCEPT
51-
52-
# Allow PostgreSQL in Docker (modem app dev/test)
52+
# PostgreSQL in Docker (modem app)
5353
iptables -w -A "$CHAIN" -o lo -p tcp --dport 54322 -j ACCEPT
5454

55+
# ── Dev servers (for running/testing modem app locally) ──────────────────
56+
# Next.js (dashboard, website)
57+
iptables -w -A "$CHAIN" -o lo -p tcp --dport 3000:3999 -j ACCEPT
58+
# Vite
59+
iptables -w -A "$CHAIN" -o lo -p tcp --dport 5173 -j ACCEPT
60+
# Storybook
61+
iptables -w -A "$CHAIN" -o lo -p tcp --dport 6006 -j ACCEPT
62+
# Wrangler dev servers (Cloudflare Workers)
63+
iptables -w -A "$CHAIN" -o lo -p tcp --dport 8787:8800 -j ACCEPT
64+
# Node/Wrangler inspector (debugging)
65+
iptables -w -A "$CHAIN" -o lo -p tcp --dport 9229:9260 -j ACCEPT
66+
5567
# Allow DNS on localhost
5668
iptables -w -A "$CHAIN" -o lo -p udp --dport 53 -j ACCEPT
5769
iptables -w -A "$CHAIN" -o lo -p tcp --dport 53 -j ACCEPT
@@ -90,7 +102,9 @@ echo "✅ Firewall active. Rules:"
90102
echo ""
91103
iptables -w -L "$CHAIN" -n -v --line-numbers
92104
echo ""
93-
echo "Localhost allowed: 7890 (bridge), 11434 (ollama), 54322 (postgres), 53 (dns)"
105+
echo "Localhost allowed: 3000-3999 (next), 5173 (vite), 6006 (storybook),"
106+
echo " 7890 (bridge), 8787-8800 (wrangler), 9229-9260 (inspector),"
107+
echo " 11434 (ollama), 54322 (postgres), 53 (dns)"
94108
echo "Internet allowed: 80, 443, 22, 53"
95109
echo "Everything else: BLOCKED + LOGGED"
96110
echo ""

0 commit comments

Comments
 (0)