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 ae73a87
Browse filesBrowse the repository at this point in the historyBrowse files
tui-firewall --check # read the firewall, print JSON, exit
224
224
tui-firewall --report # print what a bug report needs, exit
225
+
tui-firewall --open 19443/tcp,41641/udp --comment 'headscale control (tailnet)'
226
+
# open the add form prefilled, per port
225
227
tui-firewall --backend ufw # skip autodetection
226
228
tui-firewall --backend firewalld
227
229
tui-firewall --backend iptables
@@ -265,6 +267,52 @@ would run a binary nobody asked this tool to touch.
265
267
against real firewalls on Ubuntu, Fedora and Omarchy Server; the assertions live
266
268
in [`test/smoke.sh`](test/smoke.sh).
267
269
270
+
### `--open`, a prefilled add form for a hand-off
271
+
272
+
```sh
273
+
tui-firewall --open 19443/tcp,41641/udp --comment 'headscale control (tailnet)'
274
+
tui-firewall --open 19443/tcp --open 41641/udp # the same list, repeated
275
+
tui-firewall --demo --open 19443/tcp --comment test# try it on the demo
276
+
```
277
+
278
+
`--open` starts the UI straight in the add-rule form, filled in to allow the
279
+
first port: action ALLOW, the port, the protocol and the `--comment`. Enter
280
+
shows the preview and `y` applies it, exactly as a rule added by hand with `a`;
281
+
nothing is applied without that confirm. Then the form for the next port opens,
282
+
one form and one confirm per port, in the order given. `esc` skips a port and
283
+
`n` at the confirm declines it; either way the sequence moves on. Every other
284
+
field of the form is still there to change before Enter.
285
+
286
+
It is the entry point for another tool that has just found a port closed, such
287
+
as [tui-tailscale](https://github.com/tui-tools/tui-tailscale) handing over the
288
+
ports a self-hosted control plane needs, so the user does not have to retype
289
+
what that tool already knew.
290
+
291
+
Where the rule goes depends on the backend:
292
+
293
+
| Backend | Group the rule is added to |
294
+
|---|---|
295
+
| ufw | the rule list (`ufw allow 19443/tcp comment 'headscale control (tailnet)'`) |
296
+
| firewalld | the default zone (`--add-port=19443/tcp`); firewalld has no rule comments, so `--comment` is not used and the status line says so |
297
+
| nftables | the `input` chain of the `inet tui` table, or else the first chain hooked on input; on an empty ruleset the status line says so and the forms open once the chains are created with `x`|
298
+
| iptables | the filter `INPUT` chain of each family, so a port gets one form for `iptables` and one for `ip6tables`|
299
+
300
+
The value is checked before anything is read: each entry is a single port from
301
+
1 to 65535 and `tcp` or `udp`, a port may not be given twice, and the comment is
302
+
one line of at most 128 characters. A wrong value exits with the reason instead
303
+
of opening a half-filled form. `--comment` without `--open`, and `--open` with
304
+
`--check` or `--report`, are refused the same way. `--check` itself is
305
+
unchanged.
306
+
307
+
Every preview is shell-quoted, so a comment with a space or a parenthesis reads
308
+
as one argument, and the line pasted into a shell runs the same argv:
309
+
310
+
```console
311
+
$ /usr/bin/sudo -n ufw allow 19443/tcp comment 'headscale control (tailnet)'
0 commit comments