Report a ruleset that nft did not print as unknown #71

Merged
kevinheyer merged 1 commit from firewall-unreadable-unknown into main 2026-11-25 10:29:24 +01:00
Member

Refs #46

d4e9083 meldet eine fehlgeschlagene jq-Auswertung als "unbekannt". Offen blieb der Fall, dass nft -j list ruleset selbst nichts ausgibt: die Auswertung lief auf einem leeren Regelsatz und meldete iac_loaded: false und den Zustand none für jeden Port, also "not loaded" in NetBox und rot in iac-compliance.

Kein gelesener Regelsatz gibt jetzt iac_loaded: null und unknown je Port. Ein lesbarer Regelsatz ohne die Tabelle von iac bleibt none. iac-provisioner (unreadable) und iac-compliance (firewall.unreadable) lesen null schon.

Geprüft: tests/host.sh prüft beide Fälle und schlägt mit dem alten Code an; im Dev-Container mit einem nft, das mit 1 endet, ist der Bericht vollständig und zeigt "unknown (not readable)", security.json hat iac_loaded: null und unknown; check-modules.sh security-report und lint.sh grün. Nicht geprüft: die Anzeige in NetBox und in der Compliance mit einem echten Gast; die Compliance zählt Ports im Zustand unknown weiter als undokumentiert, wenn sie keine App nennt.

Refs #46 d4e9083 meldet eine fehlgeschlagene jq-Auswertung als "unbekannt". Offen blieb der Fall, dass `nft -j list ruleset` selbst nichts ausgibt: die Auswertung lief auf einem leeren Regelsatz und meldete `iac_loaded: false` und den Zustand `none` für jeden Port, also "not loaded" in NetBox und rot in iac-compliance. Kein gelesener Regelsatz gibt jetzt `iac_loaded: null` und `unknown` je Port. Ein lesbarer Regelsatz ohne die Tabelle von iac bleibt `none`. iac-provisioner (`unreadable`) und iac-compliance (`firewall.unreadable`) lesen null schon. Geprüft: `tests/host.sh` prüft beide Fälle und schlägt mit dem alten Code an; im Dev-Container mit einem `nft`, das mit 1 endet, ist der Bericht vollständig und zeigt "unknown (not readable)", `security.json` hat `iac_loaded: null` und `unknown`; `check-modules.sh security-report` und `lint.sh` grün. Nicht geprüft: die Anzeige in NetBox und in der Compliance mit einem echten Gast; die Compliance zählt Ports im Zustand `unknown` weiter als undokumentiert, wenn sie keine App nennt.
Report a ruleset that nft did not print as unknown
All checks were successful
/ lint (pull_request) Successful in 14s
/ lint (push) Successful in 13s
a541cd58de
d4e9083 made a failing jq evaluation report the firewall as unknown. The
other case stayed: when "nft -j list ruleset" itself printed nothing, the
evaluation ran on an empty ruleset and reported iac_loaded false and the
state "none" for every port. NetBox then said "not loaded" and
iac-compliance rated it red, although the state was only unknown.

No ruleset read gives iac_loaded null and the state "unknown" for every
listening port. A readable ruleset without the table of iac stays
"none". iac-provisioner and iac-compliance already read null as
unreadable (firewall.unreadable).

Tested: tests/host.sh checks both cases and fails on the old code; in a
dev container with an nft that exits 1 the report is complete, says
"Firewall of iac loaded: unknown (not readable)" and security.json has
iac_loaded null and the port state "unknown"; tools/check-modules.sh
security-report and tools/lint.sh green.

Refs #46
Sign in to join this conversation.
No description provided.