Skip to content
Hoody.com

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
# Add an ingress rule
hoody firewall ingress create -c $CONTAINER_ID --action allow --protocol tcp --description "Allow SSH from office" --destination-port 22 --source 203.0.113.50/32
Terminal window
# Add an egress rule
hoody firewall egress create -c $CONTAINER_ID --action drop --protocol tcp --description "Block all TCP egress" --destination 0.0.0.0/0 --destination-port 1-65535

Use case: Switch a container’s outbound traffic off entirely.

Allow only HTTPS to specific API:

Terminal window
# Add an egress rule
hoody firewall egress create -c $CONTAINER_ID --action allow --protocol tcp --description "Allow HTTPS to API" --destination-port 443 --destination 198.51.100.0/24

{"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
POST Block all ICMP egress
/api/v1/containers/{container_id}/firewall/egress
Click "Run" to execute the request

Rules match per protocol, so all three (tcp, udp, icmp4) are required — otherwise ICMP egress stays open under the default-allow policy.

Perfect for agent runs you want kept fully offline until you say otherwise.

Principle: Give your programs exactly the destinations they need — nothing else gets out.

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 — firewall rules are per-protocol, so a catch-all drop is needed for each of tcp, udp, and icmp4:

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

Traffic leaves only toward destinations you chose.


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.

Use both together for complete control.

See: Proxy Permissions →


Terminal window
# List all firewall rules for a container
hoody firewall list -c $CONTAINER_ID
Terminal window
# Toggle an ingress rule's state to disabled
hoody firewall ingress toggle -c $CONTAINER_ID --state disabled --description "Allow SSH from office"

Remove specific rule:

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

Reset completely (remove ALL rules):

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

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 blackholes all outbound TCP from the container — including calls to other containers’ service URLs. 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 /api/v1/containers/{id}/firewall/reset

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


Solutions:

  1. List rules: GET /api/v1/containers/{id}/firewall/rules
  2. Disable blocking rule: PATCH /api/v1/containers/{id}/firewall/ingress {"state": "disabled", "description": "..."}
  3. Add allow rule for your IP: POST /api/v1/containers/{id}/firewall/ingress {"action": "allow", "protocol": "tcp", "description": "Allow my IP", "source": "YOUR_IP/32", "destination_port": "1-65535"}
  4. Reset firewall: POST /api/v1/containers/{id}/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.