Skip to main content
Levelrail can manage allow and deny rules for the control plane host’s own ufw firewall (ufw is the firewall front end that ships with Ubuntu). You declare rules as records (a port, a protocol, an optional source, an action), and a reconciler changes ufw to match them. Edit the record and the host follows, like everything else on the platform. This is opt-in and narrow. If you never add a rule, nothing on the host changes.

What it does and does not touch

  • Only tagged rules: every rule the platform creates carries a ufw comment prefix derived from the brand short name (levelrail: by default, see White-labeling). Sync only adds and removes rules carrying that prefix. Rules you created yourself with ufw are never changed or deleted.
  • Enables the firewall only when you ask: nothing is switched on automatically. Use Settings, Firewall, Turn on firewall (or levelrail-cli firewall enable) and the platform allows SSH first, then the control plane ports and HTTP/3, and only then runs ufw --force enable. It never changes the default policy by itself, and if any allow step fails, the firewall stays off. If ufw is installed but inactive, rules are stored but not applied until you turn it on.
  • Only ufw, only the local host: if ufw is not installed (you use firewalld, nftables, iptables or a cloud security group), nothing is applied and the reconciler reports that as informational, not a failure. Rules are stored for the control plane host. Per-node rules for remote nodes are not supported yet, and a rule pinned to a remote node would be skipped and logged.
  • Not the installer’s firewall step: install.sh can allow SSH, 80 and 443 once with LEVELRAIL_CONFIGURE_UFW=1 (see Installing). That is a one-time script action. This page covers the ongoing, managed rules.

The lockout guard

Levelrail refuses a deny rule, or an allow rule restricted to a source CIDR, on a port the control plane itself needs. The protected ports are the ones this instance is actually configured to use:
  • the management API address (APP_HTTP_ADDR),
  • the agent gRPC address (APP_AGENT_ADDR),
  • the ingress HTTP address (APP_INGRESS_HTTP_ADDR),
  • the ingress HTTPS address (APP_INGRESS_HTTPS_ADDR).
With defaults these are 8080, 9443, 80 and 443. An unrestricted allow on a protected port is accepted. The check runs when you create the rule (the API returns a validation error) and again in the reconciler as a second line of defense. A control plane that has locked itself out cannot reopen itself, so this is always refused.

Turn the firewall on or off

The switch needs the root ability and is audit logged. Turning it on first shows the exact commands, then runs them in order: SSH, the management, agent and ingress ports, and 443/udp for HTTP/3, followed by ufw --force enable. The onboarding Server check offers the same button, so a new server never needs a command pasted into a terminal. SSH is assumed to be on port 22. If yours is not, set APP_FIREWALL_SSH_PORTS (comma separated) on the control plane before turning the firewall on.
The API is GET /api/v1/firewall/host, POST /api/v1/firewall/host/enable and POST /api/v1/firewall/host/disable, where both POSTs accept {"dry_run": true}.

Ports apps publish directly

GET /api/v1/firewall/host also returns published_ports: one row per host port an app binds directly, TCP or UDP, with port, protocol, app, service, bind_address and allowed. allowed is true when the host firewall lets that port and protocol in today (ufw absent, inactive, defaulting to allow, or with a matching allow rule). A cloud security group is not visible here, so check it separately for UDP ports such as 53 or 51820. Ports bound beyond loopback are added to the turn-on commands with their own protocol, so enabling the firewall never cuts off a running UDP service.

Add and remove rules

Open Settings, then Firewall. The page lists each rule with its action, port, protocol, source and label, and shows the host’s firewall preflight result from the system doctor. Use the add action to create a rule. Creating a deny rule, or an allow rule restricted to a source, shows a confirmation that explains it will close or narrow a port.
A source CIDR must parse as a valid CIDR. A source of 0.0.0.0/0 is treated the same as no source (any source).

How rules are applied

Creating or deleting a rule nudges the reconciler, which reads every stored rule, re-validates each against the protected ports, and syncs ufw: it adds tagged rules that are missing and removes tagged rules that no longer have a record. Each applied rule’s comment is the prefix plus rule:<id>, so you can match a ufw status line back to its record. The reconciler reports one of these outcomes as the firewall controller’s status:

Published container ports

To publish an app on a host port and open it here in one step, see App ports and exposure. ufw does not cover ports Docker publishes: they skip the INPUT chain. The Exposure audit lists which of your containers are reachable from outside and can restrict them with DOCKER-USER rules.

iptables-based hosts

Some images, including the Ubuntu images Oracle Cloud ships, use plain iptables with a saved ruleset instead of ufw. On those hosts the INPUT chain often ends in a catch-all REJECT. A rule added with iptables -A lands after that REJECT and is never reached, so the port stays closed. What Levelrail does here:
  • Reads only. levelrail-cli doctor reports the host_firewall_iptables check when iptables is the firewall in use, and says so when a REJECT or DROP sits before ACCEPT rules.
  • Prints the exact commands to open a port correctly (insert before the REJECT) and to persist it. Nothing is applied.
  • Lists your published ports and which layers they need opened (published_port_reachability). Ports bound only to loopback (127.0.0.1 or ::1) are listed as private and need no firewall change. It does not probe from outside, so it never claims a port is reachable.
  • Reuses one doctor result for APP_DASHBOARD_CACHE_TTL (default 5 seconds), so a check run right after you change a firewall rule can still show the old result. Wait that long and run levelrail-cli doctor again.
What Levelrail does not do:
  • It does not write, reorder or save iptables or nftables rules. The managed rules above are ufw only.
  • It cannot see or change the cloud provider’s own rules (a VCN security list, a network security group, a security group). Those are a separate layer, and a port needs both open.
To open a port by hand, insert before the REJECT (position 5 is an example, doctor prints yours) and save:
On a stock Oracle Ubuntu image this was checked: rule 5 was REJECT --reject-with icmp-host-prohibited, inserting at positions 5 and 6 worked, netfilter-persistent save wrote /etc/iptables/rules.v4, and the rules survived a reboot. See Install on Oracle Cloud Always Free. Without netfilter-persistent, use sudo sh -c 'iptables-save > /etc/iptables/rules.v4'. Docker-published ports are forwarded rather than passed through INPUT. On that image an nginx container published on TCP 25565 was reachable from outside with only the cloud rule, and the REJECT packet counter did not move. Services listening on the host itself (the dashboard, ingress on 80 and 443) need the INPUT accept. This was tested for TCP only, not UDP. Confirm on your own host with an outside connection test. To tell which layer blocks a port, look at how the connection fails. A timeout means the cloud firewall dropped it. “Connection refused” means the host answered, either because nothing listens or because the host REJECT rule did. Watch the counters with sudo iptables -L INPUT -v -n --line-numbers while you retry. If the REJECT count grows, the host firewall is the blocker. The host_firewall_iptables and other cloud checks are available from the release that includes them. A release published before them does not show them in levelrail-cli doctor. The cloud checks are optional. Set APP_DOCTOR_CLOUD_CHECKS=off to skip them, APP_DOCTOR_CLOUD_METADATA=on to allow one short link-local metadata call (timeout APP_DOCTOR_CLOUD_METADATA_TIMEOUT, default 300ms), and APP_DOCTOR_ORACLE_IDLE_PERCENT and APP_DOCTOR_ORACLE_IDLE_DAYS to change the figures quoted in the informational idle_reclaim_risk note (defaults 20 and 7). Oracle’s policy can change; read the current terms.

Troubleshooting

Ports 80 or 443 report as “blocked” in the preflight check

The installer could not reach the ports from outside the network during the preflight readiness check. Likely cause: the cloud provider’s firewall, the host firewall, or a NAT/hairpin configuration is blocking the ports. How to confirm: run levelrail-cli readiness [--domain <domain>] or check Settings > Updates > Server readiness in the dashboard to see which ports are unreachable. Also try curl -v http://localhost:80 and curl -v https://localhost:443 on the server itself to confirm the control plane is listening. Fix: open ports 80 and 443 (both TCP; 443 also UDP for HTTP/3) in your cloud provider’s firewall, and in the host firewall with sudo ufw allow 80,443/tcp or sudo ufw allow 443/udp. If the server is behind a NAT or hairpin NAT is not available, test from outside the network instead. Then re-run the readiness check.

A container port is not reachable from outside

A container published a port but external traffic cannot reach it. Likely cause: ufw is blocking the port (it does not affect Docker’s DOCKER-USER chain by default), or the container was not actually published. How to confirm: run docker ps and check if the container has a port mapping (e.g., 0.0.0.0:8000->8000/tcp). Also try connecting from the server itself (localhost) vs from outside to narrow down whether it is a local or network firewall issue. Fix: if ufw is blocking it, add the port with sudo ufw allow <port>/tcp (or udp). If Docker is not publishing the port, check the container’s run config or deployment spec. Verify with ss -tlnp | grep <port> to see what is listening and who owns it. Still stuck? Run levelrail-cli readiness and attach its output to an issue on GitHub.

Security overview

Fresh-box hardening checklist and the doctor’s firewall check.

Domains and ingress

Ports 80 and 443 for ingress and ACME.
Last modified on November 2, 2026