You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 1afcf1e
Browse filesBrowse the repository at this point in the historyBrowse files
Manage, not view: persistence (Save), rule edit and move (#16)
* Manage, not view: persistence (Save), rule edit and move
The nftables backend could create rules, NAT and aliases but everything it
did was runtime-only and immutable: a reboot reverted the ruleset, and the
only way to change a rule was delete-and-re-add. This closes those gaps.
Save (W): the tool's own table is captured with `nft list table inet tui`
and installed with `install -m 644 /dev/stdin <path>` — the listing rides
on stdin, never on a command line. The path is
/etc/omarchy/router/tui-firewall.nft on an Omarchy router (the profile
includes it on boot), /etc/nftables.d/tui-firewall.nft elsewhere, and
TUI_FIREWALL_SAVE_PATH overrides it for tests. The confirm dialog shows a
unified diff against the file as it stands. install(1) gets a runner of
its own inside the backend, so the exec boundary stays where it was.
Edit (E): the add-rule form opens pre-filled from the rule's modelled
match and submits as `nft replace rule … handle H`, the same
replace-by-handle rebuild the log toggle uses, with the same refusals — a
rule shown only as text, a NAT rule, a source-port match or a log level
the form cannot round-trip is refused before the form opens.
Move (K/J): a copy written at the new position plus a delete of the old
handle, always one `nft -f` transaction — staged into the atomic batch
when staging is on, wrapped by the new staging.AtomicCommand when it is
off — so the rule is never duplicated or missing in between.
Per-rule enable/disable is deliberately left out; DESIGN.md records the
persisted-spec format it waits for. The demo applies every new command
in memory, so --demo behaves exactly like the real backend, and the new
builders carry injection-guard and refusal tests.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MCypLQF5AD8JD831Ea9S9q
* gosec: 0600 test fixture, annotated preview read of the vetted save path
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MCypLQF5AD8JD831Ea9S9q
---------
Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
0 commit comments