Skip to content

Desired rules

FireHawk works with a desired state: you edit the rules a host should have, and a deploy turns them into the exact commands for its backend. Nothing reaches the host until you deploy.

  • The Current tab of a host shows the live rules, read over SSH.
  • The Desired tab shows the rules FireHawk will deploy, the policies the host inherits and its NAT rules.

Desired tab of a full-mode iptables host: inherited policies, table tabs and the INPUT chain rules

Managed-chain mode Full mode
Backends all four iptables and nftables
What FireHawk owns its own chains or table; everything else on the host is left alone the whole ruleset, except chains and tables of other software
Rules go into iptables FIREHAWK (from INPUT), FIREHAWK_OUTPUT, FIREHAWK_FORWARD; nftables table inet firehawk; ufw user rules; firewalld default zone the real tables and chains
Editor one rule list for the base chains one tab per table, a section per chain

New iptables and nftables hosts start in full mode. Hosts added before full mode existed, and all ufw and firewalld hosts, use managed-chain mode. An iptables or nftables host in managed-chain mode shows a banner with Take over all rules to switch. This page describes managed-chain mode; see Full management mode for the other.

In managed-chain mode rules can only target the base chains:

Backend Chains
iptables INPUT, OUTPUT, FORWARD
nftables input, output, forward
ufw IN, OUT, ROUTED
firewalld IN (rich rules of the default zone)

On iptables each base chain jumps only to its own FireHawk chain, so an INPUT rule never matches outgoing or forwarded traffic.

  1. Open the host’s Desired tab and click + Add rule (or Edit on a rule).

  2. Fill in the form:

    Field Values
    Chain A base chain (see above).
    Action ACCEPT, DROP, REJECT, RETURN, LOG.
    Protocol tcp, udp or any.
    Comment Free text, shown in the rule tables.
    Source, Destination Empty (any), an IP address, a CIDR network, or an alias name. Alias names are suggested as you type.
    Source port, Destination port A port, a range such as 8000-8100, or a port alias. Needs protocol tcp or udp.
    In interface, Out interface For example eth0, or wg+ for every interface starting with wg.
    Connection state Toggles for new, established, related, invalid and untracked connections; none selected means any.
    Lifetime Permanent, or a temporary rule (1 hour to 1 week, or Until… a date).
  3. Click Add rule or Save rule.

In the rule table:

  • the On checkbox enables or disables a rule without deleting it (disabled rules are not deployed);
  • the arrows move a rule up or down, since order matters;
  • Edit and Del change or remove it;
  • aliases are shown as @name, empty match fields as any;
  • a temporary rule shows expires in ….

The form disables a field that cannot work on this backend or chain, and shows why when you hover it. The server refuses the same combinations.

Situation Disabled fields
Inbound chain (INPUT, input, IN) Out interface (inbound rules see incoming traffic only)
Outbound chain (OUTPUT, output, OUT) In interface
Protocol not tcp or udp Source port, Destination port
firewalld Destination, Source port, both interfaces (rules belong to the default zone)
ufw and firewalld Connection state (neither can match it)

ufw renders every other field: ufw allow in on eth0 …, ufw allow out …, ufw route allow …, with source and destination ports and port ranges written the way ufw expects.

The Chain policies bar sets the default action of each base chain (ACCEPT or DROP; ufw and firewalld also REJECT), or (unset) to leave it as it is. Click Save policies to store the change; it is deployed with the rules.

Whatever the backend, a deploy first makes sure the management SSH port stays reachable before anything can drop traffic:

  • iptables: an SSH guard rule at the top of the FIREHAWK (INPUT) chain;
  • nftables: a firehawk-ssh-guard rule first in input when its policy is drop; the drop policy is set last;
  • ufw: an allow for the SSH port;
  • firewalld: the SSH port added to the zone.

When you set INPUT to DROP, the Desired tab warns that everything not accepted by a rule is blocked and that FireHawk installs this guard.

Load from host replaces the desired rules with what is configured on the host right now. A dialog first reads the host and shows Changes to the desired rules (added, removed, modified, moved) and any rules that could not be imported; click Replace desired rules to accept. This is useful after manual changes that should stay, or to start from a host’s existing configuration. Nothing changes on the host.

Rules that came from policies (comment starting with policy:) are skipped, since policies are added at deploy time.

Editing desired rules needs the rules.edit permission on the host. The host then shows undeployed changes until its next deploy.