Nightly network inventory (UniFi client list + nmap/vulners) and log review, summarised by a local Ollama model. The model only gets read-only tools: it writes recommendations and never changes anything.
SCAN_CRON: scanner.py -> SQLite -> agent.py --mode full -> /data/reports (+ optional webhook)
LOGS_CRON: agent.py --mode logs (named Loki queries) -> /data/reports (+ optional webhook)
Each full report has two parts:
- Findings written by the model: severity, summary, up to 8 findings with evidence, actions and how to verify, and a watch list.
- Appendix generated directly from the scan database (never AI-written): every device with its UniFi name, MAC, network and connection (switch and port, or AP, band, SSID and signal), and every open service with detected version, CVE counts, CISA known-exploited matches and internet exposure.
- CVE matches are grouped per service and ranked; CVEs on the CISA Known Exploited Vulnerabilities
list (downloaded daily, cached in
/data/kev.json) rank first. - Versions nmap can't pin down (e.g. Samba reported as
3.X - 4.X) are marked low-confidence, and the model is told not to trust their CVE matches. cve_notesattaches context to specific CVEs (client-side-only, AD-DC-only, ...);suppress_cvesdrops verified false positives.known_devices,accepted_risksandinternet_exposedinconfig.yamltell the model what is expected on your network.- Severity "critical" is enforced in code: it requires a known-exploited CVE on a service listed in
internet_exposed. Anything else the model rates critical is capped at high.
- An Ollama instance with a tool-calling model (tested with
qwen3:14b). - Optional: a UniFi OS gateway (local view-only account) for the client inventory.
- Optional: Loki, for log review.
alloy.configis an example Grafana Alloy setup.
Search NetSentry in the Apps tab, or copy the template from
https://github.com/netadmindave/unraid-netsentry into /boot/config/plugins/dockerMan/templates-user/
and use Docker → Add Container. On first start the container writes
/mnt/user/appdata/netsentry/config/config.yaml and waits; edit it and restart.
The container is named NetSentry (Docker names are case-sensitive).
Unraid notes:
- Runs with host networking and
NET_RAWso nmap can SYN-scan and see MAC addresses. - A SYN scan of the machine you're scanning from misses Docker-published ports, so the host's own
addresses are automatically re-scanned with a TCP connect scan (
self_connect_scan). - If other containers use a custom
br0(macvlan/ipvlan) network, enable Host access to custom networks in Docker settings or the scanner can't reach them.
docker exec NetSentry python /app/scanner.py
docker exec NetSentry python /app/agent.py --mode full
docker logs -f NetSentry
- Ollama:
OLLAMA_FLASH_ATTENTION=1andOLLAMA_KV_CACHE_TYPE=q8_0roughly halve KV-cache VRAM, which makesnum_ctx: 32768practical on a 16 GB card. - Ports scanned are nmap's top 1000 (
top_ports) plusextra_ports, which covers common homelab apps outside that list (Home Assistant 8123, Node-RED 1880, Proxmox 8006, Plex 32400, the *arr apps...). -sVprobes can upset cheap IoT devices; list fragile IPs inscan.exclude.- Use MAC addresses in
known_deviceswhere you can; they survive DHCP changes. - The first full run is the baseline; change detection starts with the second.
- Only scan networks you own or are authorised to test.
- The nmap
vulnersscript sends detected product/version strings (CPEs) to vulners.com. Remove--script vulnersfromnmap_argsfor fully offline operation. - CVE matches are based on version strings and include false positives; verify before acting.
Pushing to main builds ghcr.io/netadmindave/netsentry:latest via GitHub Actions; a weekly
scheduled rebuild picks up base-image and nmap security fixes.
MIT for this repository. The container image also includes third-party software under its own licenses, notably Nmap (Nmap Public Source License) and Python/Debian packages.