Skip to content
Hoody.com

This page covers packet-level control of container traffic: what can connect in (ingress) and what the container can reach out to (egress).


Complete endpoint documentation:


The firewall runs on your server’s host kernel, completely outside the containers.

What that means:

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

Two directions:

  • Ingress - traffic coming into the container (who can connect)
  • Egress - traffic going out from the container (what the 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: switching a container’s outbound traffic off entirely.

Allow only HTTPS to a 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 - a 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, so create specific rules before broad ones.

Correct order, 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 order, broad first: if you create the drop rule first, the allow rule is never 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.

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

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 then leaves only toward the destinations you chose.


The two are separate security layers:

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

The firewall controls network traffic; Proxy Permissions controls HTTP service access. Use both together to cover packets and HTTP requests.

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 a specific rule:

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

Reset completely, removing all rules:

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

Create the 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.com) 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.

How does block mode differ from egress rules?

Section titled “How does block mode differ from egress rules?”

Network Configuration block mode blackholes all outbound TCP from the container, including calls to other containers’ service URLs. Firewall egress rules are granular: allow some destinations, 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?”

Open the hoody-terminal URL, since HTTP through the Hoody Proxy bypasses the firewall. From there or from the API, add an allow rule or reset: POST /api/v1/containers/{id}/firewall/reset

No. The firewall operates at the IP layer, so use CIDR notation only.


Solutions:

  1. List the rules: GET /api/v1/containers/{id}/firewall/rules
  2. Disable the blocking rule: PATCH /api/v1/containers/{id}/firewall/ingress {"state": "disabled", "description": "..."}
  3. Add an 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 the firewall: POST /api/v1/containers/{id}/firewall/reset (removes all rules)

Check:

  • Rule state: must be "state": "enabled"
  • Rule order: specific before broad
  • Protocol: a TCP rule will not 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:

What this page covered:

  • The firewall is enforced at host level, and containers cannot bypass it
  • Ingress controls inbound traffic, egress controls outbound traffic
  • Rules are evaluated in order, and the first match wins
  • Three actions: allow, reject, drop
  • The firewall is independent from Hoody Proxy Permissions