Skip to content

Join the Nethesis Insights threat shield - #1887

Draft
gsanchietti wants to merge 3 commits into
update-banipfrom
nethesis_insights
Draft

Join the Nethesis Insights threat shield#1887
gsanchietti wants to merge 3 commits into
update-banipfrom
nethesis_insights

Conversation

@gsanchietti

@gsanchietti gsanchietti commented Sep 7, 2026

Copy link
Copy Markdown
Member

Summary

Firewalls block the attackers they see on their own, and the fleet never learns from them. Now the IPs blocked by the banIP log service are reported to the Nethesis Insights server, and the list it builds from the reports of all registered firewalls is blocked back locally.

banIP gained a ban_blockhook option for this: a script called once for every newly blocked IP. It only queues the event, a cron job sends it in batches, and only public addresses ever leave the firewall. The list comes back as a normal banIP feed (nethesisinsights).

Everything is enabled by the machine registration alone, and removed on unregistration.

How to test

On a registered unit with threat shield IP enabled:

  1. uci get banip.global.ban_blockhook returns /usr/libexec/ts-insights-hook
  2. logger "Exit before auth from 45.33.32.156" three times, then check the IP is in nft list set inet banIP blocklist.v4 and a line appeared in /var/run/ns-insights/threat-events.jsonl
  3. run /usr/sbin/ts-insights-report, then check /var/run/ns-insights/last_push.json and the syslog line
  4. repeat step 2 with a private address, e.g. 192.168.1.50: blocked locally, never reported
  5. /etc/init.d/banip reload, then /etc/init.d/banip status lists the nethesisinsights feed
  6. unregister the machine: hook and feed are both gone

The log service had no way to notify anything outside banIP when it blocked
an IP: the only signal was the syslog line written by f_log.

Add the ban_blockhook option: if it points to an executable, f_monitor calls
it once for every IP it adds to a blocklist Set, passing the address, the
protocol family, the log count that triggered the block and the Set expiry.
The call is fire and forget and never affects the control flow of the monitor
loop, which stays single threaded: the hook is expected to queue the event
and to do any real work elsewhere.

Assisted-by: Claude Code:claude-opus-5[1m]
Every firewall blocks the attackers it sees on its own, and the fleet has no
shared memory of them. Report what the banIP log service blocks to the
Nethesis Insights server and block back the list it aggregates from the
reports of all the registered firewalls.

Reporting side: ts-ip points banip.global.ban_blockhook at ts-insights-hook,
which only appends a JSON decision to /var/run/ns-insights, so that a burst
of blocked IPs never slows down the banIP log service. ts-insights-report
sends the spooled events to POST /v1/threat-events every 5 minutes, in
batches of at most 500, authenticating with the subscription credentials.
Only globally routable addresses leave the firewall: private, CGNAT,
link-local, reserved and documentation ranges are dropped locally, along with
the events older than the promotion window of the server. A failed push keeps
the events in the spool and retries at the next run, the server discards the
duplicated reports.

Blocking side: the new nethesisinsights feed points to GET /v1/blocklist, so
banIP downloads it as any other enterprise feed, with its own ETag handling
and its own fallback to the last good copy.

Both directions are enabled by the machine registration alone and are removed
on unregistration; a uci-default takes care of the units which are already
registered when the image is updated.

Assisted-by: Claude Code:claude-opus-5[1m]
@gsanchietti gsanchietti self-assigned this Sep 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant