luci-app-fwlive: add firewall live view - #8992
lucas-albers-lz4 wants to merge 1 commit into
Conversation
openwrt-ai
left a comment
There was a problem hiding this comment.
Reviewed 1 new commit (91b4629). The commit message matches the diff; no commit-level issues.
Two of the inline findings look like they break advertised features on a stock image rather than being polish: the rules map is assembled inside pipeline subshells so the nft/iptables log-prefix labels never reach the client (the __rulesmap_iptables selftest uses a redirect and so passes), and resolve calls getent, which is not present anywhere in OpenWrt. Worth confirming both against a real device before merge, since the current code fails silently in each case.
Generated by Claude Code
Replace getent with nslookup, move json_escape into logging.sh, declare jsonfilter, skip whitespace-split UCI names, and rewrite the classifier to one awk pass so a 2000-line poll stays inside budget. Closes #218, Closes #219, Closes #220, Closes #222, Closes #224, Closes #225, Closes #226 Refs #216
Replace getent with nslookup, move json_escape into logging.sh, declare jsonfilter, skip whitespace-split UCI names, and rewrite the classifier to one awk pass so a 2000-line poll stays inside budget. Closes #218, Closes #219, Closes #220, Closes #222, Closes #224, Closes #225, Closes #226 Refs #216
Replace getent with nslookup, move json_escape into logging.sh, declare jsonfilter, skip whitespace-split UCI names, and rewrite the classifier to one awk pass so a 2000-line poll stays inside budget. Closes #218, Closes #219, Closes #220, Closes #222, Closes #224, Closes #225, Closes #226 Refs #216
Re-cut from lucas-albers-lz4/fwlive after merging the openwrt#227/openwrt#228 review wave: rules map delivery, poll clamp, nslookup resolver, jsonfilter declare, classifier codegen, json_escape in logging.sh, and related host-test fixes. Refresh the .pot via i18n-scan.pl. Signed-off-by: Lucas Albers <lucas.b.albers@gmail.com>
Fold the openwrt/luci#8992 review wave (#227/#228): rules map delivery, poll clamp, nslookup resolver, jsonfilter declare, classifier codegen, and related security fixes. Refresh the .pot after the upstream cut.
|
Re-cut from fwlive with the post-review follow-ups (BusyBox-safe WAN lock dir check, jsonfilter stdin for large rings, poll Fork tip: |
openwrt-ai
left a comment
There was a problem hiding this comment.
Reviewed 3 new commits since 91b4629.
The previous round's two functional findings are genuinely fixed: the rules map is now assembled in the current shell via <"$_rules_dump" redirects (and __rulesmap_iptables exercises the same two-pass path), and resolve uses BusyBox nslookup. poll_clamp_lines and the single-awk classifier both check out — I ran dash root/usr/libexec/rpcd/fwlive __selftest and _fwlive_filter_json_entries against a sample batch locally and they behave as documented. The stat -c → test -O + find -perm swap in #232 is correct for stock OpenWrt: BUSYBOX_DEFAULT_FEATURE_STAT_FORMAT is n while FEATURE_FIND_PERM, FEATURE_FIND_PAREN and FEATURE_FIND_PRUNE are all y in package/utils/busybox/Config-defaults.in.
One of the inline findings is a hard blocker for a feature the PR advertises: the nslookup resolver now works, but the client double-unwraps the reply (expect: { names: {} } and res.names), so hostnames are still never displayed. Worth confirming on a device before merge.
Commit checks
05a223d2"luci-app-fwlive: sync #8992 with fwlive master" — the message does not match the diff. It claims "Refresh the .pot viai18n-scan.pl", but the commit touches nopo/file (onlyfwlive-is-firewall-event.sh,fwlive-logging.sh,rpcd/fwlive). It also credits itself with "rules map delivery, poll clamp, nslookup resolver, jsonfilter declare, classifier codegen, json_escape in logging.sh" — all of which landed in the preceding commit79019f0;jsonfilter declareis aMakefilechange this commit does not contain. What it actually does is add the_fwlive_tmp_dir_oksticky-bit gate on/tmp, strip the trailing dot in theAddress N:branch ofparse_nslookup_name, add the__tmp_dir_okCLI hook, and reorder the selftest sorun_logging_selftestruns before the jshn-gated early return. Please rewrite the body to describe that.
Generated by Claude Code
| async loadRulesMap() { | ||
| try { | ||
| const res = await callFwliveRules(); | ||
| this.rulesMap = (res && res.rules) || {}; |
There was a problem hiding this comment.
nit: build_rules_map now emits an error field (mktemp_failed from _fwlive_mktemp, or rules_truncated once RULES_MAP_MAX_KEYS/RULES_MAP_MAX_BYTES trip — see rpcd/fwlive:324-330), but nothing here reads it: a truncated or empty map renders identically to a router with no labelled rules.
That is the inverse of what this same commit did for poll, where expect was dropped specifically so reply.error could reach the banner (#233). Truncation is reachable in practice — map_uci_rule_names adds up to two keys per UCI rule before any nft prefix is seen, so ~256 firewall rules exhaust the 512-key budget and every nft log prefix label is dropped silently. Worth surfacing the same way the poll error is, or at least logging it to the console.
Generated by Claude Code
There was a problem hiding this comment.
fixed, thanks — solved by surfacing lastRulesError in the #fwlive-backend span (plus a console.warn) rather than in the poll banner.
Generated by Claude Code
|
Round-5 follow-up is in snapshot commit d7d4586. classList.toggle: dropped the inaccurate 21.02-era compatibility notes. Development home: lucas-albers-lz4/fwlive PR #258. |
openwrt-ai round-6 nit on openwrt/luci#8992: updateMessageLayoutUi computed `this.messageLayout === 'oneline'` twice under two names (onelineLayout inside the scroll block, oneline four lines below). Hoist one const above the `if (scroll)` block and use it in both places. Refs openwrt/luci#8992
…end span (luci #8992 round 5) Refs openwrt/luci#8992, #216
Bugbot on #262: step order pushed luci before verifying openwrt/luci#8992 still open; audit regex missed github.com .../pull/N closing forms.
Bugbot on #262: step order pushed luci before verifying openwrt/luci#8992 still open; audit regex missed github.com .../pull/N closing forms.
|
Could you please add a few screenshots so we can see what it looks like? |
|
Screenshots as part of the documentation : |
|
Why in this PR there is 10 commits? Can you squash them, please? |
97fae44 to
5e811b4
Compare
|
Squashed to a single commit |
5e811b4 to
5dce0f6
Compare
Comment #N auto-links to the luci tracker. Keep ids in tests, CHANGELOG, and commit messages. The cut also strips leftover ids from generated classifier headers. Refs openwrt/luci#8992
* fix: luci-cut README and drop #43 from shipped comments LuCI review asked not to name an out-of-tree winner in the in-tree README, and comment #43 auto-links to the wrong tracker. Keep tracker ids in tests and CHANGELOG. Refs openwrt/luci#8992 * docs: record wave 6 as fwlive#337 * fix: strip tracker ids from shipped luci comments Comment #N auto-links to the luci tracker. Keep ids in tests, CHANGELOG, and commit messages. The cut also strips leftover ids from generated classifier headers. Refs openwrt/luci#8992 * test: scan // comments in upstream-cut tracker gate Align the cut comment gate with upstream-cut.sh, which already sanitizes JavaScript // lines for leftover tracker ids.
openwrt-ai
left a comment
There was a problem hiding this comment.
Commit checks
5dce0f66"luci-app-fwlive: add firewall live view" — "First commit ships po/templates only" is left over from the pre-squash series; there is only one commit now. Reword to "This commit shipspo/templatesonly".
Generated by Claude Code
Add a Status menu view that polls firewall-only log lines via a dedicated rpcd plugin (rules, poll, resolve, logging_status, enable/disable WAN logging). Sessions never receive ubus log.read; the plugin filters as root under a narrow ACL. WAN zone log=1 is opt-in from the UI and restored on package removal (prerm). This commit ships po/templates only; Weblate can add locales after merge. License: Apache-2.0 (PKG_LICENSE). This tree is a snapshot for the luci feed. Signed-off-by: Lucas Albers <lucas.b.albers@gmail.com>
5dce0f6 to
b69e117
Compare
|
Snapshot head is now b69e117 (still one FormalityCheck commit). Generated headers are labels only (no out-of-tree repo, no do-not-edit). Sticky-dir lock comment rewrapped. Commit and Design notes say this commit ships po/templates only. |
| # Wall-clock budget clock starts at the TRUE function entry: the | ||
| # budget must bound the whole call — including | ||
| # read_rpc_input (stalled stdin must not escape the budget) and json | ||
| # parsing. `date +%s` can jump under NTP sync — accepted (worst case | ||
| # the budget over- or under-runs by the jump; worker starvation is | ||
| # still prevented). |
There was a problem hiding this comment.
nit: dropping the parenthetical left the block unwrapped, so it now has short ragged lines instead of the ~75-column fill the rest of the file uses. Same leftovers at lines 485, 672 and 700 in this file and at fwlive-logging.sh lines 122 and 593.
| # Wall-clock budget clock starts at the TRUE function entry: the | |
| # budget must bound the whole call — including | |
| # read_rpc_input (stalled stdin must not escape the budget) and json | |
| # parsing. `date +%s` can jump under NTP sync — accepted (worst case | |
| # the budget over- or under-runs by the jump; worker starvation is | |
| # still prevented). | |
| # Wall-clock budget clock starts at the TRUE function entry: the budget | |
| # must bound the whole call — including read_rpc_input (stalled stdin | |
| # must not escape the budget) and json parsing. `date +%s` can jump | |
| # under NTP sync — accepted (worst case the budget over- or under-runs | |
| # by the jump; worker starvation is still prevented). |
Generated by Claude Code
Summary
Add luci-app-fwlive (Firewall Live View): a Status menu view that polls
firewall-only log lines via a dedicated rpcd plugin (
rules,poll,resolve,logging_status,enable_wan_logging,disable_wan_logging).License: Apache-2.0 (
PKG_LICENSE). This PR is a snapshot ofhttps://github.com/lucas-albers-lz4/fwlive (signed binary feed remains for
non-snapshot users), not a move.
Maintenance
fwlive stays the development home. This tree is a snapshot. On conflict, the
next snapshot from that repository replaces this copy — land fixes there
first. A
PKG_SOURCEtarball was considered and declined: LuCI applicationsare in-tree under
applications/, and Weblate ownspo/<lang>/after merge.Design notes
ubus log.read. The plugin filters logs as rootunder a narrow ACL (read/write scopes kept separate).
log=1is opt-in from the UI;prermrestores the saved baseline(fail-open).
po/templatesonly. Locales can come from Weblateafter merge. Please do not hand-add
.pofiles in follow-ups that wouldclobber Weblate.
PKG_VERSION/PKG_RELEASEkept in lockstep with the out-of-tree app.Node/
core/are not vendored here.luci-base,logd,jsonfilter. Optional hostnames useBusyBox
nslookup(stock image).Review follow-up (second commit)
Addresses the first-round findings: rules map assembled in the current shell
(nft/iptables labels reach the client); reverse DNS via
nslookup;jsonfilterdeclared and no longer a silent empty table; poll classifier isone awk pass;
json_escapeis self-contained forprerm; UCI names withwhitespace are not word-split.
Test plan
luci-app-fwliveagainst a current OpenWrt SDK / image builderlog prefix/!fw4:comments show labelslog.readdirectly