Skip to content

Commit 74d7160

Browse files
committed
firewall: allow cloud database + OTLP ports outbound
Add external ports for cloud databases and observability: 3306 MySQL / PlanetScale 5432-5433 PostgreSQL / Neon 6543 Supabase pooler (PgBouncer) 6379 Redis Cloud / Upstash 27017 MongoDB Atlas 4317-4318 OpenTelemetry OTLP (gRPC + HTTP) Still blocked externally: SMTP (25/465/587), reverse shell ports, non-standard ports. HTTPS exfil is already possible so these database ports add no meaningful attack surface.
1 parent 8344389 commit 74d7160

1 file changed

Lines changed: 19 additions & 7 deletions

File tree

bin/setup-firewall.sh

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
# Run as root: sudo ~/hornet/bin/setup-firewall.sh
44
#
55
# OUTBOUND (internet):
6-
# Allows: HTTP (80), HTTPS (443), SSH (22), DNS (53)
7-
# Blocks: everything else (reverse shells, raw sockets, non-standard ports)
6+
# Allows: HTTP/S, SSH, DNS, cloud databases (pg, mysql, redis, mongo), OTLP
7+
# Blocks: reverse shells, raw sockets, SMTP, non-standard ports
88
#
99
# LOCALHOST:
1010
# Allows: Dev servers & databases on common ports (see rules below)
@@ -82,19 +82,29 @@ iptables -w -A "$CHAIN" -o lo -m state --state ESTABLISHED,RELATED -j ACCEPT
8282
iptables -w -A "$CHAIN" -o lo -j LOG --log-prefix "HORNET_LOCAL_BLOCKED: " --log-level 4
8383
iptables -w -A "$CHAIN" -o lo -j DROP
8484

85-
# ── Internet: allow only standard ports ─────────────────────────────────────
85+
# ── Internet: allow standard + dev ports ─────────────────────────────────────
8686

87-
# Allow DNS (UDP + TCP)
87+
# DNS (UDP + TCP)
8888
iptables -w -A "$CHAIN" -p udp --dport 53 -j ACCEPT
8989
iptables -w -A "$CHAIN" -p tcp --dport 53 -j ACCEPT
9090

91-
# Allow HTTP/HTTPS (web browsing, all APIs)
91+
# HTTP/HTTPS (web, APIs, cloud services)
9292
iptables -w -A "$CHAIN" -p tcp --dport 80 -j ACCEPT
9393
iptables -w -A "$CHAIN" -p tcp --dport 443 -j ACCEPT
9494

95-
# Allow SSH (git push/pull)
95+
# SSH (git push/pull)
9696
iptables -w -A "$CHAIN" -p tcp --dport 22 -j ACCEPT
9797

98+
# Cloud databases (Neon, Supabase, RDS, PlanetScale, Atlas, Upstash, etc.)
99+
iptables -w -A "$CHAIN" -p tcp --dport 3306 -j ACCEPT # MySQL / PlanetScale
100+
iptables -w -A "$CHAIN" -p tcp --dport 5432:5433 -j ACCEPT # PostgreSQL / Neon
101+
iptables -w -A "$CHAIN" -p tcp --dport 6543 -j ACCEPT # Supabase pooler
102+
iptables -w -A "$CHAIN" -p tcp --dport 6379 -j ACCEPT # Redis Cloud / Upstash
103+
iptables -w -A "$CHAIN" -p tcp --dport 27017 -j ACCEPT # MongoDB Atlas
104+
105+
# Observability (OpenTelemetry OTLP)
106+
iptables -w -A "$CHAIN" -p tcp --dport 4317:4318 -j ACCEPT
107+
98108
# Allow established/related (responses to allowed outbound)
99109
iptables -w -A "$CHAIN" -m state --state ESTABLISHED,RELATED -j ACCEPT
100110

@@ -113,7 +123,9 @@ echo "Localhost allowed: 3000-5999 (dev servers), 5432 (pg), 6006 (storybook),"
113123
echo " 6379 (redis), 7890 (bridge), 8000-9999 (wrangler/inspector),"
114124
echo " 11434 (ollama), 24678 (vite hmr), 27017 (mongo),"
115125
echo " 54322 (pg docker), 53 (dns)"
116-
echo "Internet allowed: 80, 443, 22, 53"
126+
echo "Internet allowed: 22 (ssh), 53 (dns), 80/443 (http/s),"
127+
echo " 3306 (mysql), 4317-4318 (otlp), 5432-5433 (pg),"
128+
echo " 6379 (redis), 6543 (supabase), 27017 (mongo)"
117129
echo "Everything else: BLOCKED + LOGGED"
118130
echo ""
119131
echo "To remove: sudo iptables -w -D OUTPUT -m owner --uid-owner $UID_HORNET -j $CHAIN && sudo iptables -w -F $CHAIN && sudo iptables -w -X $CHAIN"

0 commit comments

Comments
 (0)