Skip to content

Host-enforced network security for your containers. Control exactly what can connect in (ingress) and out (egress) at the packet level.


Complete endpoint documentation:


Host-level enforcement: Firewall runs on YOUR server’s host kernel—completely outside containers.

What this means:

  • ✅ Containers cannot bypass firewall rules
  • ✅ Containers cannot modify their own firewall
  • ✅ Rules survive container restarts/snapshots

Two directions:

  • Ingress - Traffic coming INTO container (who can connect)
  • Egress - Traffic going OUT FROM container (what container can reach)

Three actions:

  • allow - Permit matching traffic
  • reject - Block and notify (ICMP/TCP unreachable)
  • drop - Silently ignore (appears offline to scanners)

Three protocols: tcp, udp, icmp4


Terminal window
# Allow SSH from office IP
hoody firewall ingress create --container $CONTAINER_ID \
--action allow --protocol tcp \
--destination-port 22 --source "203.0.113.50/32" \
--description "Allow SSH from office"
Terminal window
# Block all TCP egress traffic
hoody firewall egress create --container $CONTAINER_ID \
--action drop --protocol tcp \
--destination "0.0.0.0/0" \
--description "Block all TCP egress"

Use case: Run untrusted code in complete isolation.

Allow only HTTPS to specific API:

Terminal window
# Allow HTTPS to specific API range
hoody firewall egress create --container $CONTAINER_ID \
--action allow --protocol tcp \
--destination-port 443 --destination "198.51.100.0/24" \
--description "Allow HTTPS to API"

{"destination_port": "80"}

CIDR notation:

  • /32 - Single IP (203.0.113.50/32)
  • /24 - 256 IPs (203.0.113.0/24)
  • /0 - All IPs (0.0.0.0/0)

First match wins. Put specific rules before broad rules:

✅ Correct: Specific first

POST Allow SSH from office (specific)
/api/v1/containers/{container_id}/firewall/ingress
Click "Run" to execute the request
POST Block SSH from everyone else (broad)
/api/v1/containers/{container_id}/firewall/ingress
Click "Run" to execute the request

❌ Wrong: Broad first (specific never evaluated) - If you create the drop rule first, the allow rule will never be reached.


Allow PostgreSQL from backend only:

POST Allow PostgreSQL from backend IP
/api/v1/containers/{container_id}/firewall/ingress
Click "Run" to execute the request

Drop all other attempts:

POST Drop all other PostgreSQL attempts
/api/v1/containers/{container_id}/firewall/ingress
Click "Run" to execute the request

Allow HTTP/HTTPS from anywhere:

POST Allow HTTP/HTTPS from anywhere
/api/v1/containers/{container_id}/firewall/ingress
Click "Run" to execute the request

Allow SSH from office only:

POST Allow SSH from office
/api/v1/containers/{container_id}/firewall/ingress
Click "Run" to execute the request

Drop other SSH attempts:

POST Drop all other SSH attempts
/api/v1/containers/{container_id}/firewall/ingress
Click "Run" to execute the request

Block all egress:

POST Block all TCP egress
/api/v1/containers/{container_id}/firewall/egress
Click "Run" to execute the request
POST Block all UDP egress
/api/v1/containers/{container_id}/firewall/egress
Click "Run" to execute the request

Perfect for AI-generated code execution.

Malware Defense (Allowlist Required Services)

Section titled “Malware Defense (Allowlist Required Services)”

Security principle: Malware ALWAYS needs to communicate (command-and-control, data exfiltration). Block everything except what your programs legitimately need.

Allow only what your app needs (e.g., your API):

POST Allow HTTPS to your API
/api/v1/containers/{container_id}/firewall/egress
Click "Run" to execute the request

Allow DNS:

POST Allow DNS lookups
/api/v1/containers/{container_id}/firewall/egress
Click "Run" to execute the request

Block everything else:

POST Block all other TCP traffic
/api/v1/containers/{container_id}/firewall/egress
Click "Run" to execute the request

Even if container is compromised, malware cannot phone home.


Two separate security layers:

LayerControlsUse For
FirewallNetwork packets (TCP/UDP/ICMP)Port restrictions, IP filtering
Proxy PermissionsHTTP service accessUser auth, service-level control

Firewall controls network traffic. Proxy Permissions controls HTTP service access.

Layer both for defense-in-depth.

See: Proxy Permissions →


Terminal window
# List all firewall rules for a container
hoody firewall list --container $CONTAINER_ID
Terminal window
# Disable an ingress rule by description
hoody firewall ingress toggle --container $CONTAINER_ID \
--state disabled --description "Allow SSH from office"

Remove specific rule:

Terminal window
# Remove a specific ingress rule
hoody firewall ingress delete --container $CONTAINER_ID \
--description "Allow SSH from office"

Reset completely (remove ALL rules):

Terminal window
# Reset firewall to default (removes ALL rules)
hoody firewall reset --container $CONTAINER_ID

Create specific allow rule first:

POST Allow from specific source (create first)
/api/v1/containers/{container_id}/firewall/ingress
Click "Run" to execute the request

Then create the broad drop rule:

POST Drop from all other sources (create second)
/api/v1/containers/{container_id}/firewall/ingress
Click "Run" to execute the request
  • "action": "drop" = stealth (appears offline to scanners)
  • ⚠️ "action": "reject" = reveals existence (sends ICMP unreachable)

When blocking egress, remember to allow DNS:

POST Allow DNS for egress
/api/v1/containers/{container_id}/firewall/egress
Click "Run" to execute the request
POST Create snapshot before firewall changes
/api/v1/containers/{container_id}/snapshots
Click "Run" to execute the request

See: Snapshots →


Does the firewall apply to traffic through the Hoody Proxy?

Section titled “Does the firewall apply to traffic through the Hoody Proxy?”

No. Hoody Proxy traffic (service URLs like https://{project}-{container}-terminal-1.{server}.containers.hoody.icu) bypasses the firewall. Use Proxy Permissions for HTTP service access control.

Can containers modify their own firewall rules?

Section titled “Can containers modify their own firewall rules?”

No. Firewall rules are host-enforced and only modifiable via the Hoody API. Containers cannot see or change them.

What’s the difference between firewall and Network Configuration’s “block” mode?

Section titled “What’s the difference between firewall and Network Configuration’s “block” mode?”

Network Config block mode prevents ALL outbound traffic. Firewall egress rules provide granular control—allow some, block others.

Do firewall rules persist through restarts?

Section titled “Do firewall rules persist through restarts?”

Yes. Rules are stored at host level and survive container restarts, pauses, and snapshots.

What if I lock myself out with firewall rules?

Section titled “What if I lock myself out with firewall rules?”

Access via hoody-terminal URL (HTTP bypasses firewall) or use API to add an allow rule or reset: POST /firewall/reset

No. Firewall operates at IP layer—use CIDR notation only.


Solutions:

  1. List rules: GET /firewall/rules
  2. Disable blocking rule: PATCH /firewall/ingress {"state": "disabled", "description": "..."}
  3. Add allow rule for your IP: POST /firewall/ingress {"action": "allow", "source": "YOUR_IP/32"}
  4. Reset firewall: POST /firewall/reset (removes ALL rules)

Check:

  • Rule state: Must be "state": "enabled"
  • Rule order: Specific before broad
  • Protocol: TCP rule won’t block UDP traffic

Allow package repositories:

POST Allow HTTPS for package downloads
/api/v1/containers/{container_id}/firewall/egress
Click "Run" to execute the request
POST Allow DNS for package resolution
/api/v1/containers/{container_id}/firewall/egress
Click "Run" to execute the request

Complete networking setup:

Related security:

Understanding gained:

  • ✅ Firewall enforced at host level (tamper-proof)
  • ✅ Ingress controls inbound, egress controls outbound
  • ✅ Rules evaluated in order (first match wins)
  • ✅ Three actions: allow, reject, drop
  • ✅ Independent from Hoody Proxy Permissions

Host-level enforcement. Container-level control.
Tamper-proof security that containers cannot bypass.

Network security starts at the packet level.