tui-tools

tui-firewall

ufw, firewalld, iptables and nftables, every change previewed before it runs

A terminal UI (TUI) for ufw, firewall-cmd, iptables and nft on Linux: the Linux firewall, driving ufw, firewalld, iptables and nftables directly.

v1.1.0Stable since 1.0.0firewallMIT
The rules table, with status, default policies and logging in the header
The rules table, with status, default policies and logging in the header

A terminal UI for the Linux firewall, driving ufw, firewalld, iptables and nftables directly. It shows the rules you actually have — action, ports, source, destination, services, rich rules, IPv6 and forwarding included — alongside the default policies or chain policies and the logging level.

The UI never builds a command line: the confirm dialog shows the backend's command values and hands the same ones to the runner, so what you read is what executes.

On a machine nothing else manages it drives nft itself: filter chains by hook, a NAT view, and named sets as aliases. It writes only where it safely can, and says why when it will not.

On a cloud image whose iptables rules are restored at boot by iptables-persistent or iptables-services, a new rule lands in front of the catch-all REJECT, and persisting is its own previewed step.

Run tui-firewall --demo for an in-memory ufw, --demo=firewalld for firewalld, --demo=iptables for a cloud-image iptables, or --demo=nftables for a sample router ruleset: every command is built and previewed for real, and nothing touches your system.

Keys

KeyAction
aAdd a rule
EEdit the selected rule in place, keeping its handle and position (nftables)
K / JMove the selected rule up / down, as one atomic transaction (nftables)
DDisable or enable the selected rule, keeping its spec and position (nftables)
dDelete the selected rule
eEnable or disable the firewall (ufw)
rReload the firewall
pChange a default policy, a firewalld zone target or a chain policy
LChange the logging level, or the firewalld log-denied value
lToggle logging on the selected rule (nftables)
wWatch the live firewall log of the logged rules (nftables)
sToggle staging: collect changes instead of applying them (nftables, iptables)
SReview and apply the staged changes as one atomic transaction
kKeep an applied batch before its rollback timer fires
WPersist the running rules with a diff preview (iptables); save the tool's table (nftables)
xActions this backend offers beyond these keys
/Filter rules across every column
vPick a group: a firewalld zone, an nftables or iptables chain, NAT, aliases
[ / ]Previous / next group: firewalld zones, nftables chains
RRe-read the firewall
?Help
qQuit

Press ? inside the tool for the full help screen, which is generated from the same action table as the key map.

Compatibility

This tool is a face on the program below, so its version matters. Tested is not a claim: a version lands there only after the tool's own suite passed against it on a real machine in the lab, and the run is kept as evidence in the repository. At startup the tool probes the backend once and says what it found in its header — a version nobody has run against is shown as (untested) in the warning colour, one older than the minimum as (below minimum) in the error colour. Neither stops it: the backend still refuses what it cannot do, in its own words.

ufw

ufw ≥ 0.36
Binary
ufw
Minimum
0.36
Probed with
ufw --version
Tested
0.36.2

Needs a version this new

  • rule-commentssince 0.35

What changes on older versions

  • ufw <0.36

    ufw status numbered has no app profile column, so a rule added from a profile is shown by its ports and cannot be edited as a profile

  • ufw 0.36.x

    status numbered indexes IPv4 and IPv6 halves of one rule separately, so deleting by number renumbers the rest and the list is re-read after every delete

firewalld

firewall-cmd ≥ 0.9
Binary
firewall-cmd
Minimum
0.9
Probed with
firewall-cmd --version
Tested
2.4.4

What changes on older versions

  • firewalld ==2.0.0

    --permanent --list-all-zones prints the same settings for every zone on this release (firewalld#1152), so the permanent half of the runtime/permanent comparison is not trustworthy; 2.0.1 fixed it

  • firewalld >=2.2

    firewalld removed the lockdown feature, so no lockdown state is shown

iptables

iptables ≥ 1.6
Binary
iptables
Minimum
1.6
Probed with
iptables --version
Tested
1.8.101.8.11

What changes on older versions

  • iptables <1.8

    only the legacy xtables interface exists, so the rules live outside nf_tables and the nft ruleset cannot show them; the backend reads them through iptables-save and the selector asks the legacy tables directly

  • iptables >=1.8

    iptables-nft writes table ip filter and ip6 filter in nf_tables, and iptables --version says which variant is installed; the nftables backend treats those tables as read-only and points here

nftables

nft ≥ 0.9
Binary
nft
Minimum
0.9
Probed with
nft --version
Tested
No recorded run yet. The tool still runs and reports the version it found as untested.

What changes on older versions

  • nftables <0.9

    nft -j does not exist yet, so there is no ruleset to read in any form this tool will parse. 0.9.0 is where nft grew JSON output and stamped it json_schema_version 1, the schema this backend reads, and that is the whole reason the minimum is 0.9

  • nftables >=0.9

    nft -j list ruleset carries rule handles whether or not -a is given, unlike the human output. A handle is how a rule is deleted, because positions shift the moment anything is inserted above them

Maintain ufw, firewalld, iptables or nftables? You are welcome to help shape this tool. About → maintainers

Guides

Written after the work, from a machine the commands were actually run on. Every guide that mentions tui-firewall is listed here.

  • Managing a server's ufw firewall over SSH with tui-firewall

    Turning on a firewall over the SSH session it is about to filter is how people lock themselves out of a server. One walk through tui-firewall on Ubuntu's ufw, from a second machine, with SSH allowed first, web ports opened, a port kept to one network, a rule deleted, and every result checked from outside.

  • A company tailnet with Keycloak single sign-on

    A local CA from tui-cert, Keycloak served over https with a certificate from it, and a Headscale control plane set up with tui-tailscale that admits only the members of one Keycloak group. Run end to end in the family lab and told through the screens it produced, including the login that was refused.

  • A private tailnet with your own CA

    A Headscale control plane with no public DNS name and no Let's Encrypt. tui-cert runs a local certificate authority, tui-tailscale serves its certificate and trusts it on each client, and machines join with pre-auth keys.

  • Opening ports on a cloud image's iptables firewall

    Many cloud images ship no ufw and no firewalld, just an iptables ruleset whose INPUT chain ends in a REJECT. A rule appended after it never matches. tui-firewall inserts in front of it, persists with a diff, and says when the running rules and the saved ones disagree.

  • Self-hosted Tailscale with Headscale and Google login

    One public host runs the Headscale control plane with a Let's Encrypt certificate, people log in with their Google account, and the same host serves its private network to every client. Every step is one key in tui-tailscale, previewed before it runs.

  • Verify a release before you run it

    Three checks, with the real commands and the real output, that answer who built a tui-tools binary before you give it your root password.

Install

Once per machine, then every tool in the family is one pacman away.

Add the repository
$ curl -fsSL https://pkgs.tui.tools/install.sh | sh
Or run the same thing yourself, one command at a time

A family whose whole promise is preview before you run is not going to insist you pipe a script into a shell. These are the commands that script runs.

The one-time setup, by hand
$ k="$(mktemp -d)/tui-tools.asc"
  curl -fsSL --proto =https --tlsv1.2 -o "$k" https://pkgs.tui.tools/pubkey.asc
  [ "$(gpg --show-keys --with-colons "$k" | awk -F: '$1 == "pub" { p = 1; next } p && $1 == "fpr" { print $10; p = 0 }')" = 767CFB337B01F32FFC073F3F389120B277E4FB44 ] && echo "key OK" || { echo "WRONG KEY: stop here"; rm -f "$k"; }
  sudo pacman-key --add "$k"
  sudo pacman-key --lsign-key 767CFB337B01F32FFC073F3F389120B277E4FB44
  printf '[tui-tools]\nServer = https://pkgs.tui.tools/arch/$arch\n' | sudo tee -a /etc/pacman.conf
  sudo pacman -Sy

The first lines check the signing key: go on only if they print key OK.

Arch Linux · tui-firewall
$ sudo pacman -S tui-firewall

Upgrades then arrive with the rest of your system updates.

What it can do to your machine

  • Preview, then confirm

    Every change is shown as an exact command line and confirmed before it runs. The dialog and the runner receive the same value, so the preview cannot drift from what executes.

  • Escalates for actions

    Reading the firewall and every change need root: ufw, firewall-cmd, nft, iptables and their -save/-restore tools, and netfilter-persistent. Escalation goes through sudo -n, which never prompts; --sudo "" runs the command directly when you are already root.

  • No daemon, no state of its own

    Nothing keeps running after you quit, and nothing is installed to run later. The system is the source of truth; the tool re-reads it after every change.

  • No network access

    The tool opens no network connection of its own. No telemetry, no update check, no phone home.

  • Static binary

    Released statically linked, with no runtime dependencies to install.

  • Signed release, with provenance

    checksums.txt carries a keyless cosign signature from this repository's release workflow, every archive has a CycloneDX SBOM, and every archive, package and the checksum file carry SLSA build provenance. The security page shows the three commands that check it.

Reporting

Report a security issue privately, through GitHub's private vulnerability reporting on the repository's Security tab. The family-wide policy, and what counts as in scope, is on the security page.

Downloads

v1.1.0 · 2026-11-20
FileSizeSHA-256
checksums.txt1 KB—
checksums.txt.sigstore.json10 KB—
provenance.intoto.jsonl12 KB—
tui-firewall-1.1.0-1-aarch64.pkg.tar.zst2.1 MBebb1a2ef0a304b885ccc79ba7a30cca2d0959d5039abac38857a37f527b5d88f
tui-firewall-1.1.0-1-x86_64.pkg.tar.zst2.3 MB212efbf5b702046b6d51ed0e21140debfe80df858e02b59c07945fd7116fead8
tui-firewall-1.1.0-1.aarch64.rpm2.1 MB68dae2c8a96bf2a3d70e6461d504078c1f4a687b6a6c14af65d859ddf8da3e5c
tui-firewall-1.1.0-1.x86_64.rpm2.4 MB3424843a76561523fa8ce479907c3383ac5afb48be21a12f32c0e5648d4bdd57
tui-firewall_1.1.0_amd64.deb2.3 MB79f83ba80ff371ea25ae5c336eac6558f0cbb2e968148d55455de6eac3c22ccc
tui-firewall_1.1.0_arm64.deb2.1 MBd93b01978017cf61424c505092261ef699a5f7e15be121ec98d8265e2eb96042
tui-firewall_1.1.0_linux_amd64.tar.gz2.3 MBe87f113b2b8c35cab857177cd1c22318db6da03f18fdad80799affd6f86fe017
tui-firewall_1.1.0_linux_amd64.tar.gz.cyclonedx.json24 KB41c09ae463dd667f138bcdfd6a20db3bc6a7a20554ef09fbac95959ba7a4b44d
tui-firewall_1.1.0_linux_arm64.tar.gz2.1 MBdb6c5b6cdf4c95f2b84457cda10a94c8999dfab36405b6321622cac174087b11
tui-firewall_1.1.0_linux_arm64.tar.gz.cyclonedx.json24 KBa6ded3dc601c0210dfc94d1ce17a08a47b54fbb6fa1d28c3f6be90a19299c19e

Every release ships a checksums.txt. Download it next to the archive and run sha256sum -c checksums.txt --ignore-missing. See verifying a download.

Releases

v1.1.0

2026-11-20
## tui-firewall v1.1.0

tui-firewall 1.1.0

- ufw: an inactive firewall shows the rules it has saved (#39). They come from `ufw show added`, and the default policies and logging level from /etc/default/ufw and /etc/ufw/ufw.conf. Each saved rule is marked inactive, the status reads "disabled, rules apply once enabled", and a delete removes the rule by its text, both address families together. The `--check` counts follow the model; no key, flag or field is removed or renamed.
- ufw: deleting one half of a rule that covers IPv4 and IPv6 names the half, for example "Delete rule 4 (IPv4 half)", and says the other half stays (#40). The command run is unchanged.
- Built with tui-kit v0.5.0, the kit's security release, and Go 1.27.4, which fixes GO-2026-6859 in the standard library. As root, the repository key is accepted only when it is the pinned key alone; privileged commands are resolved only from trusted root-owned system paths and start from a minimal environment; config files must be owned and writable by root alone, and TUI_FIREWALL_* variables carried over from sudo, doas, pkexec or su are refused (the error points at /etc/tui-firewall/config.toml). Running without root is unchanged.
- The manual apt, dnf and pacman setup in the README checks the downloaded key against the pinned fingerprint before any step trusts it.
- CI actions on their latest versions. Nothing else changes.

Built by this repository's CI on the tag itself. Each archive ships a
CycloneDX SBOM, `checksums.txt` carries a keyless cosign signature, and
every file has SLSA build provenance — see the README's "Verify a
download" for the two commands that check them.

The commits in this release:

## Changelog
* 5fde1752eb8a1aa40c020e8adf5353af35b374e9 1.1.0: tui-kit v0.5.0 (security release) (#46)
* bc5e19b8f5ce5af1912f7e6014a90e98bda7a2fa Bump github.com/tui-tools/tui-kit (#43)
* c0a33c4d15eeca188ec01af44abd2838c41be2ca Bump the github-actions group across 1 directory with 5 updates (#44)
* 17119898bb7d566053cfe9f3073784689ffb5168 Take tui-kit v0.5.0 and Go 1.27.4 (#45)
* f52d05a21e3708b853d90ac2312cce4853e2de6f ufw: show the saved rules of an inactive firewall; name the half a delete removes (#41)

v1.0.1

2026-10-22
## tui-firewall v1.0.1

tui-firewall 1.0.1

- Built with Go 1.27.3, which fixes CVE-2026-111943 in the standard library (crypto/x509), and tui-kit v0.4.5; dependencies on their latest versions. No change in behavior.

Built by this repository's CI on the tag itself. Each archive ships a
CycloneDX SBOM, `checksums.txt` carries a keyless cosign signature, and
every file has SLSA build provenance — see the README's "Verify a
download" for the two commands that check them.

The commits in this release:

## Changelog
* 560ce34a17fecc4ffe49a3b3ecf2f06bd0a81bc5 1.0.1: Go 1.27.3 (stdlib security fixes) (#38)

v1.0.0

2026-10-22
## tui-firewall v1.0.0

tui-firewall 1.0.0: stable

tui-firewall 1.0.0 is stable. Stable means a frozen contract under semver: the keys, the flags and the `--check` JSON only grow in minor releases, and anything removed or changed waits for a major release announced one minor ahead. It drives ufw, firewalld, iptables and nftables, previews every change as the exact command line, and has driven a real cloud host whose iptables INPUT chain ends in a REJECT; installs from apt, dnf, pacman and a static binary; and ships signed checksums, SBOMs and build provenance. Since 0.6.3 the help screen, the README and tool.json list the same keys (#33). Built with Go 1.27.2 and tui-kit v0.4.4.

Built by this repository's CI on the tag itself. Each archive ships a
CycloneDX SBOM, `checksums.txt` carries a keyless cosign signature, and
every file has SLSA build provenance — see the README's "Verify a
download" for the two commands that check them.

The commits in this release:

## Changelog
* b3a2515053c0fd67dfda1719d1b56ab823488766 Bump the github-actions group across 1 directory with 9 updates (#35)
* f93894802bef6fed75c31873df0a539d2b1c5ef1 Keys: one list in the help screen, the README and tool.json (#33)
* 58e2ec95bfc24f4139736e153fced88ad4d0070f Promote tui-firewall to stable: 1.0.0 (#37)

v0.6.3

2026-10-20
## tui-firewall v0.6.3

tui-firewall 0.6.3

- Built with Go 1.27.2, which fixes CVE-2026-78667, CVE-2026-78669 and CVE-2026-97031 in the standard library (net/http, crypto/tls). No change in behavior.

Built by this repository's CI on the tag itself. Each archive ships a
CycloneDX SBOM, `checksums.txt` carries a keyless cosign signature, and
every file has SLSA build provenance — see the README's "Verify a
download" for the two commands that check them.

The commits in this release:

## Changelog
* c553bc58d5b123ec309c47aae463c72a7076f5b1 0.6.3: Go 1.27.2 (stdlib security fixes) (#36)

v0.6.2

2026-09-26
## tui-firewall v0.6.2

tui-firewall 0.6.2

- firewalld: `--check` and the reload in the UI read the firewall in under 2 s instead of about 8 s. The tool now asks firewalld for whole zone and policy listings and runs those reads in parallel. The output is unchanged.
- README: the `--check` section says what `--check` costs on each backend, and that callers can keep its answer for a few seconds.
Version 0.6.2.

Built by this repository's CI on the tag itself. Each archive ships a
CycloneDX SBOM, `checksums.txt` carries a keyless cosign signature, and
every file has SLSA build provenance — see the README's "Verify a
download" for the two commands that check them.

The commits in this release:

## Changelog
* 53f2c9ea82ea6375a2ad17ea0f9e68fff081fb12 0.6.2: firewalld --check in one parallel wave of whole listings (#29) (#30)

v0.6.1

2026-09-25
## tui-firewall v0.6.1

tui-firewall 0.6.1: tui-kit v0.4.4

tui-firewall 0.6.1 moves to tui-kit v0.4.4: every ufw, firewalld, iptables and nft command now runs in its own session without a controlling terminal, so a step that would prompt fails at once instead of hanging behind the UI, and a failed step reports its meaningful line, cleaned of escape codes. The two screenshots that changed under the new renderer are re-rendered and the install snippet points at this release.

Built by this repository's CI on the tag itself. Each archive ships a
CycloneDX SBOM, `checksums.txt` carries a keyless cosign signature, and
every file has SLSA build provenance — see the README's "Verify a
download" for the two commands that check them.

The commits in this release:

## Changelog
* 520745207888b5ba589419691cc195503b66a4b9 0.6.1: tui-kit v0.4.4 (#28)

v0.6.0

2026-09-25
## tui-firewall v0.6.0

tui-firewall 0.6.0

Every command preview is now shell-quoted (tui-kit v0.4.3): a rule whose comment carries a space or a parenthesis previews as `ufw allow 19443/tcp comment 'headscale control (tailnet)'`, and the line pasted into a shell runs the same argv. On iptables a comment is no longer limited to one word. A new `--open <port>/<proto>[,<port>/<proto>...]` flag, with an optional `--comment <text>`, starts the UI in the add-rule form prefilled to allow each port in turn, one form and one confirm per port, still previewed; it is the hand-off target for another tool that has just found a port closed. Every screenshot is re-rendered with the kit's fixed box borders.

Built by this repository's CI on the tag itself. Each archive ships a
CycloneDX SBOM, `checksums.txt` carries a keyless cosign signature, and
every file has SLSA build provenance — see the README's "Verify a
download" for the two commands that check them.

The commits in this release:

## Changelog
* ae73a87eef6be8474cf0ade81c013e9f4cdc7594 0.6.0: quoted previews; --open prefilled add form (#26) (#27)

v0.5.0

2026-09-25
## tui-firewall v0.5.0

tui-firewall 0.5.0: plain iptables

tui-firewall now drives plain iptables, the firewall of cloud images whose rules are restored at boot by iptables-persistent (Debian, Ubuntu) or iptables-services (Fedora, RHEL). It is picked automatically when that loader is enabled, and the selection reason says so. A new rule is inserted right before the chain's catch-all REJECT or DROP, with the position and the reason in the preview; rules are deleted by specification, not by number. Changes apply to the running kernel, and `W` persists them with the layer's own save (`netfilter-persistent save`, or iptables-services' `iptables.init save` and `ip6tables.init save`), previewed with a diff against the saved files. The header, the status line and `--check` report runtime-vs-saved drift, ignoring the chains docker and tailscaled rebuild. Staging works here too, through `iptables-restore --noflush` with an automatic rollback. Also: tui-kit v0.4.0.

Built by this repository's CI on the tag itself. Each archive ships a
CycloneDX SBOM, `checksums.txt` carries a keyless cosign signature, and
every file has SLSA build provenance — see the README's "Verify a
download" for the two commands that check them.

The commits in this release:

## Changelog
* cf8a7c2a3fb7552def245b51bee6c2c039f99b3d Bump anchore/sbom-action/download-syft in the github-actions group (#21)
* 5ee7cd68539d7cd9b6ce38a89faf09f6c639d9f8 Bump the github-actions group with 4 updates (#22)
* 00b452af619a977f1256d9bffb8fed1f9df19c75 README: link the tool's page on tui.tools (#20)
* 73fda3e67bd4d0b5fe93b06fc4654f669f41ecfe README: point the install snippet at the current release (#19)
* ee682ff208be4e6b9b43be015834f386d3b8fa63 Release 0.5.0: iptables backend; tui-kit v0.4.0 (#25)
* 00e649ca1e533480ff3f13c3ff97b8e56c7b12f5 iptables backend (#23) (#24)

v0.4.1

2026-09-02
## tui-firewall v0.4.1

tui-kit v0.3.0: the dialogs wrap and scroll instead of clipping the
command preview, and the picker filters as you type.

Built by this repository's CI on the tag itself. Each archive ships a
CycloneDX SBOM, `checksums.txt` carries a keyless cosign signature, and
every file has SLSA build provenance — see the README's "Verify a
download" for the two commands that check them.

The commits in this release:

## Changelog
* 21bcef401a84bcdb426ab13761f0cfaf75b2d395 Bump tui-kit to v0.3.0 (#18)

v0.4.0

2026-09-01
## tui-firewall v0.4.0

Manage, not view (wave 2): apply what it diagnoses, author what it manages; lab-validated.

Built by this repository's CI on the tag itself. Each archive ships a
CycloneDX SBOM, `checksums.txt` carries a keyless cosign signature, and
every file has SLSA build provenance — see the README's "Verify a
download" for the two commands that check them.

The commits in this release:

## Changelog
* 8ebbc93c5eab918b523bb9a5d55af9a28c80e599 Per-rule disable/enable with a persisted spec (#17)