Node firewall

Protect the node itself: SSH allowlist, extra ports, ping, the agent port, and the automatic undo that keeps you from locking yourself out.

The node firewall filters traffic sent to the node itself: SSH, the agent's port, and anything else the node listens on. It does not touch the servers' traffic; each server has its own firewall (see Server firewall), and the node's network rules are on its Settings tab (see Node settings).

It is off by default on every node. While it is off, the node's Overview shows Recommended: turn the node firewall on. A node whose agent is too old for it shows Not available on this node: update the agent first (see Agent updates on a node).

What it allows#

When it is on, everything sent to the node is dropped except:

  • replies to the node's own connections, loopback, and the ICMP and ICMPv6 messages the network needs (including neighbour discovery and router advertisements);
  • the node's own DHCP and DHCPv6 client;
  • DHCP, DHCPv6 and DNS from the servers on the node, and ping from them (their gateway);
  • the agent port (8443): from anywhere by default, or only from the panel's addresses;
  • the migration port (8444) and the private networks port (UDP 51820) only from your other nodes;
  • SSH, from anywhere or from an allowlist;
  • the other ports you add;
  • ping from anywhere, rate-limited, when Answer ping from anywhere is on.

The rules live in their own nftables table, inet vmstack_node, on the input hook. A drop in any table is final, so ufw or firewalld rules on the node cannot reopen what this table drops.

Turn it on#

  1. On the node's Overview, in the Node firewall panel, click Set up the firewall… (later Edit firewall…).
  2. Fill in the form:
    • Firewall: tick Turn the node firewall on.
    • Agent port: From anywhere (recommended), or From the panel's addresses only. See The agent port.
    • SSH ports: the port sshd listens on, 22 by default; up to 4, separated by commas.
    • Allowed from: the addresses and networks that may use SSH (up to 64). Empty: from anywhere.
    • Other ports: services of the node itself that others must reach, such as a monitoring exporter. Each row has a Protocol (TCP or UDP), a Port or range, who it is allowed from, and a Note. Up to 32 rows. A row may not name the agent, migration or WireGuard port.
    • Ping: Answer ping from anywhere (on by default).
    • Always allowed lists, read-only, what the node needs whatever the form says.
  3. Click Apply on the node.

Keep or undo the change#

Every change that turns the firewall on or changes it is applied with an automatic undo. The panel shows The rules are in force on the node. with a countdown:

  1. Open a new SSH session to the node.
  2. If it works, click Keep these rules.
  3. If it does not, click Undo now, or do nothing: the node puts the previous rules back by itself when the countdown ends (5 minutes).

The undo runs from a systemd timer outside the agent, so it works even if the agent stops. A reboot before you keep the change loads the last kept rules. After an undo, the panel goes back to the last kept settings and shows the change that did not hold under Last undone change, with Try it again….

Turning the firewall off needs no confirmation and is applied at once: the table is removed.

The SSH guard#

If the SSH allowlist does not include the address your browser comes from, the form refuses the change unless you tick I reach SSH from another address in the list. It is a guard against the obvious mistake; the countdown and Keep these rules are the real check.

Warning: While SSH is open to the internet, the panel says SSH is open to the whole internet. Add the addresses you connect from. Opening SSH by default is what keeps turning the firewall on from ever locking you out; the allowlist is a step you take knowingly.

The agent port#

  • From anywhere (recommended): the agent answers only the panel's own certificate (mutual TLS), so this is safe, and a panel whose address changes never loses its nodes.
  • From the panel's addresses only: needs the panel's stable addresses in the panel's settings (This panel's public addresses). If the node does not hear from the panel for 10 minutes, it opens the port to all until the panel is back, so a changed address is never cut off for good. When you change the panel's addresses, every node in this mode is sent its firewall again.

If you lock yourself out of SSH#

The panel can still change the rules, because the agent port is always allowed. Edit the firewall in the panel and add your address. Without the panel, from the provider's console:

vmstack-agent node-firewall off

This removes the table and records the firewall as off. The node's page then says the firewall was turned off on the node, and the panel never turns it on again by itself: click Apply again when you want the panel's rules back.

Check the rules on the node#

The Node firewall panel lists the rules as a table, with Last changes from the audit log. On the node:

nft list table inet vmstack_node
journalctl -u vmstack-nodefw-rollback

With the firewall on, the security check no longer reports the node as having no firewall, and ports the node firewall drops are no longer reported as exposed. See Security advisories and checks.

Changes are audited as node.firewall_changed, node.firewall_confirmed, node.firewall_rolled_back and node.firewall_failed. The API has the same operations under /nodes/{id}/firewall (see the API reference).