Skip to content

Debian's default firewall is nftables, and the catalogue has no nftables vocabulary #239

Description

@vladimirrott

Cross-references corrected 2026-09-14 at 61b3a878. Three issues this body
pointed at have since closed (#234, #237, #238), and one of them changed the
premise rather than the detail: Debian is eligible now, so the first paragraph
below was written in the conditional and should not have stayed there. The
defect itself is unchanged and still reproduces:

$ git rev-parse --short=8 HEAD
61b3a878
$ grep -c Ufw crates/sysknife-types/src/lib.rs
8
$ grep -ci nft crates/sysknife-types/src/lib.rs
0

Scope 1 is taken. PR #413 by @QinXi-ai is open against the read-only half
(GetNftablesRuleset and a backend reporter). Scope 2 is untouched.

The catalogue has eight ufw actions and no nftables ones. On Ubuntu that is the right call, because ufw is the family's canonical frontend. On Debian it is not: Debian's own handbook names nftables as "the default firewall framework in Debian Buster and later", and stock Debian installs no ufw.

Debian eligibility landed on 10 September. #238 is closed and is_supported now accepts Debian 12 and later, so SysKnife already runs on hosts where its only firewall vocabulary is absent.

The two failure shapes

ufw absent. UfwStatus and the seven mutating ufw actions fail at exec with a command-not-found, which surfaces as execution_failure with no explanation of why.

ufw installed but idle. Worse, and this repo has already been burned by this exact shape. The NON_CANONICAL_ON_DEBIAN doc comment (crates/sysknife-core/src/action_family.rs:98) records it:

an Ubuntu host running firewalld lost firewall management entirely, and UfwStatus answered Status: inactive — a confident wrong answer instead of a refusal.

Substitute nftables for firewalld and Debian for Ubuntu and it is the same bug. An operator asking "is the firewall on" gets "inactive" from ufw while nftables is filtering traffic.

Scope

Two independent pieces; either is a reasonable PR.

1. Read-only truth first. A GetNftablesRuleset action over sudo nft list ruleset, and a state read that reports which backend is in force rather than which frontend was queried. This is the piece that stops the confident wrong answer, and it is Low risk with no approval receipt, so it is the smaller start.

2. Mutating parity, if wanted. nftables equivalents of allow, deny, limit and delete. This is a design question rather than a transcription: ufw's rule model is a thin abstraction and nft's is tables, chains and handles, so UfwDeleteRule's index has no direct analogue. Worth discussing here before code. #234 closed on 10 September and query_ufw_rules now produces the number UfwDeleteRule needs, so the missing-index problem is a ufw one no longer; nft handles are a separate design question.

Either piece needs its packaging/sysknife-sudoers grant, and nft argv is token-matched there like every other tool.

Tests first

Assert the argv, then assert the backend-detection logic against fixtures for three states: nftables active with rules, ufw active, and neither. The third case is the one that must not answer confidently.

Worth deciding alongside

If a host runs nftables, should the ufw actions be refused there rather than offered? That is the NON_CANONICAL_ON_DEBIAN question again, one layer down. #237 closed on 9 September and the family fence now means what it says, so this is a fresh decision rather than part of that surgery.

Difficulty

medium for the read-only action and backend detection. hard for mutating parity, because the rule model differs rather than the syntax.

Getting started

CONTRIBUTING.md has the build and test commands. No CLA and no copyright waiver. The project is MIT.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

claimedSomeone has said in the thread that they are working on thisenhancementNew feature or requesthelp wantedExtra attention is neededmediumDifficulty: needs familiarity with one subsystemtwir-listedListed in a This Week in Rust CfP. Do not offer to anyone until that issue publishes.

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions