Security Assistant
Security Assistant is a custom Home Assistant integration that provides real-time network security monitoring for your home. It combines passive NetFlow/IPFIX traffic analysis with active network scanning, external IP threat intelligence, DNS blacklist checks, and vulnerability detection — all presented through a dedicated multi-view sidebar dashboard.
Website: https://domotic.monster/homesec.html
Features
Network Flow Analysis
- Listens for NetFlow v5, v9, and IPFIX datagrams on a configurable UDP port
- Classifies internal vs. external traffic using configurable CIDR ranges
- Tracks per-device flow counts, byte volumes, and connection history
- Detects suspicious patterns: outbound traffic to abused ports, port scanning, unusual egress volume
Example: Network Flow Analysis Map
Active Network Scanner
- Optional ping + port scan of all observed internal hosts (nmap-style, configurable interval)
- Configurable scan ports — specify individual ports, ranges, or both (e.g.
22,80,443,8000-9000). Defaults to 47 well-known ports: 21-23, 25, 53, 80, 110, 111, 135, 139, 143, 443, 445, 465, 515, 554, 587, 631, 993, 995, 1080, 1433, 1521, 1723, 1883, 2049, 2323, 3306, 3389, 4443, 5000, 5060, 5432, 5555, 5900, 6379, 6667, 8000, 8008, 8080, 8443, 8883, 8888, 9090, 9100, 9200, 27017, 49152 - Discovers open services and OS fingerprints even when hosts block ping
- HTTP fingerprinting — lightweight WhatWeb-style technology detection on HTTP(S) ports. Identifies CMS platforms (WordPress, WooCommerce, Joomla, Drupal, Magento), web servers (Tomcat, IIS, Caddy, Varnish, HAProxy), applications (Grafana, GitLab, Nextcloud, Jenkins, phpMyAdmin, Pi-hole, Synology DSM, UniFi, Elasticsearch, Prometheus), and runtimes (PHP, Node.js, ASP.NET) from response headers, cookies, and HTML content
- Reports scan results per host: alive status, ping latency, open ports, OS guess, detected technologies
Example: Active Network Scanner Hosts View
External IP Intelligence
- Enriches external IPs with ipwho.is (free, no auth), VirusTotal, and AbuseIPDB (all optional, API keys configurable)
- Background-only enrichment — all provider calls run in a background worker queue; on-demand lookups (IP detail panel) return cached results instantly, never blocking the UI
- Reverse DNS resolution for external IPs
- Traffic totals — each external IP shows the flows and bytes exchanged with your network since it was first seen (kept across restarts), the internal hosts involved and the destination ports used
- Checks external IPs and hostnames against threat intel blacklists (abuse.ch feeds by default, customizable)
- Severity-based retention — separate configurable windows for clean, suspicious, and malicious IPs (clean: default 24 h, suspicious: 48 h, malicious: 168 h / 7 days)
- Inbound traffic detection — external IPs that initiate connections to your internal servers (e.g. hosted services, exposed ports) are tracked and enriched exactly like outbound peers — same blacklist checks, same threat ratings, same retention rules
- Traffic direction — each external IP entry carries a direction badge:
↑ Outbound(your device reached out),↓ Inbound(it connected to one of your servers), or↕ Both. When both directions are observed and the internal hosts involved are different (an external IP contacted a host it never received outbound traffic from), an amber ⚠ warning is shown — a pattern consistent with C2 beacon-then-callback or post-reconnaissance probing
Example: External IP Intelligence Table
Vulnerability Detection
- NVD enrichment — queries the NIST National Vulnerability Database REST API 2.0 for CVEs matching detected service banners. Precise CPE vendor/product filtering for 20+ service mappings: SSH (OpenSSH, Dropbear), HTTP (Apache, nginx, lighttpd), MySQL/MariaDB, FTP (vsftpd, ProFTPD), SMTP (Postfix, Exim, Sendmail), Redis, MongoDB, PostgreSQL, SMB/NetBIOS/Microsoft-DS (Samba), IMAP (Dovecot), MQTT/MQTT-TLS (Mosquitto), ADB (Android Debug Bridge), DNS (BIND, dnsmasq), NTP (ntpd, Chrony), RTSP (Live555, GStreamer), and UPnP (MiniUPnP). Generic banner-based matching covers any other service with an identifiable version string
- CPE lookups — products with a known CPE (every mapped service and fingerprinted web technology) are fetched from NVD by CPE vendor/product instead of a full-text keyword search, so only CVEs whose affected-product list names that product are downloaded, and only the matching CPE entries are kept (for BIND: ~50 CVEs instead of ~1,300). Custom keywords and unmapped banners still use keyword search
- Service-aware prefetching — NVD keyword prefetch is scoped to services actually detected on the network, avoiding unnecessary API calls for products not present
- HTTP technology validation — CVEs for web applications (WordPress, WooCommerce, Drupal, etc.) are only reported if the technology was actually confirmed via HTTP fingerprinting, eliminating false positives
- CISA KEV integration — cross-references findings against the CISA Known Exploited Vulnerabilities catalog, flagging CVEs under active exploitation
- Version-range matching — uses CPE configuration data to check if the exact detected version falls within a vulnerable range
Example: Vulnerability Detection & NVD Browser
Device Fingerprinting & Enrichment
- Fingerprints devices from observed service ports and traffic behavior
- Infers device roles: gateway, camera, IoT, unknown, etc.
- Editable roles — correct any auto-detected role via dropdown in the Hosts view; overrides are persisted across restarts
- Enriches device identities from Home Assistant
device_trackerentities (IP, name, hostname, MAC) - Flags devices with known high/critical CVE vulnerabilities as "at risk"
Example: Device Fingerprinting & Enrichment Overview Cards
Baseline Learning Mode
- Automated normal-behavior profiling — enable training mode and the integration observes your network for a configurable duration (default 7 days) to build a baseline of normal hosts, external peers, open ports, DNS domains, and traffic volume
- Three modes:
Disabled(no baseline),Learning(actively training),Active(baseline ready, anomaly detection enabled) - Confidence scoring — baseline is rated
low,medium, orhighbased on the number of hosts and training snapshots observed - Anomaly detection — once active, flags deviations from the baseline as findings: new internal hosts, new external peers, newly opened ports, new DNS domain categories, and egress volume spikes (configurable multiplier)
- Persistent baseline — learned state is saved in Home Assistant storage (
.storage/homesec.baseline) and survives restarts and component updates - Network Map integration — the Network Map gains two extra view modes: Baseline Snapshot (the learned graph) and Live vs Baseline (overlay comparison highlighting new edges in a distinct colour)
- Controlled via four HA services:
start_baseline_training,stop_baseline_training,retrain_baseline, andclear_baseline, all callable from Developer Tools → Actions or automations - Overview card — a new Baseline card in the Overview shows current mode, training progress (elapsed / remaining time), baseline creation age, confidence level, and quick-action buttons
Example: Live vs Baseline comparison
Example: Baseline deviation summary
Suricata Alert Streaming
-
Suricata EVE alert listener — Home Security Assistant can receive Suricata alert events over TCP and ingest them into the sidebar dashboard and alert log.
-
Companion pusher script — the included
suricata_pusher.pyscript tails Suricata's EVE JSON alert file and streams each alert line to the listener. -
Alert visibility — Suricata alerts are shown in the sidebar dashboard and are persisted with the other runtime logs so they survive restarts.
-
Securing the listener — anyone who can reach the listener port can submit alerts, so set an auth token and/or allowed pusher sources in Settings → Suricata Alert Listener. Then start the pusher with the same token (the environment variable keeps it out of
psoutput):HSA_SURICATA_TOKEN='your-token' python3 suricata_pusher.py --ha-host 192.168.1.10 --ha-port 6343Every received field is type-checked and length-limited, and the stored timestamp is the time Home Assistant received the alert (the sensor's own timestamp is kept as
event_timestamp).
Example: Suricata overview card
Example: Suricata alerts view
Example: Suricata statistics
Security Findings
- Actionable findings for high/critical issues with severity, source IP, category, and occurrence count
- Categories: suspicious ports, port scanning, high egress, vulnerabilities, baseline anomalies (new host, new peer, new port, new DNS category, egress spike)
- Four view modes — By Category (default), By Host, By Severity, and Flat; mode buttons appear below the section title for both the active Security Findings section and the Dismissed section
- By Category — groups findings by their type with human-friendly labels (Vulnerability / CVE, Port Scan, Suspicious Open Port, High Egress Traffic); each group shows a severity badge, finding count, aggregated occurrences, and latest timestamp
- By Host — groups all findings for the same source IP into a single expandable card, sorted by severity then IP address
- By Severity — groups findings into Critical / High / Medium / Low / Info buckets
- Flat — individual per-finding cards unchanged
- Expand any group with ▶ to see per-item rows with individual dismiss or restore buttons
- Dismiss all — one-click button on each group dismisses every finding in that group simultaneously
- Regex dismiss — "🗑 Pattern…" button opens a modal with a regex input, a live preview of all matched findings, and an optional note field; matching findings across all groups are dismissed in one action
- Per-section search — each section (Baseline Anomalies, Security Findings, Dismissed) has its own live search bar filtering by summary, source IP, category, or CVE ID; active filter counts shown in the section header
- Unified Dismissed section — dismissed security findings and dismissed baseline anomalies are shown together; baseline items carry a teal
Baselinechip; the same four view modes and search bar apply - Dismissible findings — dismiss individual findings from the UI; a
POST /api/homesec/findings/dismiss_by_patternendpoint is also available for scripting - Hardening recommendations with expand panels — click any recommendation card to reveal affected hosts (IP, tracker name, role badge, CVE links) and related findings (severity badge, source IP, summary); cards without structured data remain static
Example: Security Findings & Recommendations
DNS Proxy
- Built-in DNS proxy server that intercepts all DNS queries on a configurable port and upstream resolver
- Checks every queried domain against the loaded threat-intel blacklists and blocks known-malicious lookups
- Per-category blocking — optionally restrict entire categories (e.g.
malware,phishing,ads) from configured blocklist feeds - Source filtering (
check_sources) — optionally limit blocking to queries forwarded from specific upstream resolvers - Answer cache — allowed answers from the upstream resolver are cached (up to 2,048 entries, at most 5 minutes and never beyond the record TTL, with TTLs counted down), so repeated lookups are answered locally. Every query is still checked and logged; the DNS proxy status reports
cache_entriesandcache_hits - DNS overrides — define custom
domain=iprules to resolve specific hostnames to fixed IPs, useful for local split-DNS or ad-hoc redirects - Maintains a rolling DNS query log (configurable retention; up to 10 000 entries in memory) showing timestamp, client IP, queried domain, query type, verdict (allowed / blocked), and matched source feed
- Fires a
homesec_malicious_dnsHA event whenever a blocked domain is queried, with src IP, domain, query type, and source feed - Automatic hiding — the DNS Queries sidebar nav item and the Overview DNS Proxy card are hidden when the proxy is not running, keeping the UI uncluttered
Example: DNS Proxy Query Log
Statistics Dashboard
A dedicated statistics view consolidates all operational metrics in one place:
- Activity Timeline (full-width) — three stacked bar charts covering the last 24 hours: Public IPs seen per hour, internal Hosts per hour, and DNS queries per hour (colour-coded: clean / blocked / malicious)
- Top N Public IPs — most-contacted external IPs ranked by flow count, with Pie / List toggle
- Top N Countries — contacted countries ranked by flow count, with Pie / List toggle
- Top N Internal Talkers — highest-traffic internal devices ranked by total bytes, with Pie / List toggle
- Top N Threat IPs — external IPs rated suspicious or malicious, with Pie / List toggle
- Blocked DNS Queries by Category — breakdown of blocked/malicious DNS queries by threat category, with Pie / List toggle
- Top N Blocked Queries by Client — internal hosts generating the most blocked/malicious DNS queries, with Pie / List toggle
- Top N Blocked / Malicious Domains (full-width) — table of most-queried blocked or malicious domains with category pills and query counts
- Enrichment Budget (full-width) — per-provider daily usage, budget, usage bar, status badge, detected tier/plan, and recent API errors
The configurable Statistics top N option (3–25, default 10) controls the depth of all ranked lists.
Example: Statistics Dashboard
Sidebar Dashboard
A dedicated multi-view single-page application registered in the HA sidebar:
- Overview — summary stats, Active Scan card (last scan time, duration, hosts found, scan interval), NetFlow listener health, recent alerts, DNS Proxy card (running/stopped, total queries, blocked count, blocked %), Baseline card (current mode, training progress or baseline age, confidence, and action buttons), and NVD keyword chips showing all active search keywords color-coded by source (violet for user-configured, green for scan-derived). Quick-access navigation links at the bottom of the overview jump directly to the Vulnerabilities, Statistics, and DNS Queries views. The DNS Proxy card and DNS Queries link are hidden when the proxy is disabled.
- Network Map — live force-directed graph with zoom/pan and draggable hosts (hosts linked to the one you drag follow it like an elastic chain), showing scanned hosts, flow-active hosts, at-risk devices, gateways, and top external peers. Filter toggles: All / Scanned / Flow only / External. When a baseline is available, two additional view modes are unlocked: Baseline Snapshot (the learned graph) and Live vs Baseline (overlay showing new edges in a distinct colour with a host/edge count chip)
- Hosts — searchable device inventory with inferred roles, scan results, and tracker-enriched names (alive hosts only)
- Findings — actionable security findings with four view modes (By Category, By Host, By Severity, Flat) and a live search bar per section. Dismissed security findings and dismissed baseline anomalies are consolidated in a single Dismissed section with teal
Baselinechips on baseline items. Regex dismiss, CVE details, and remediation hints included - External IPs — enriched external IP table with threat ratings, VirusTotal hits, AbuseIPDB scores, traffic volume (KB) column (sortable), direction badge (
↑ Outbound/↓ Inbound/↕ Both, sortable and filterable) with an amber ⚠ alert when the same external IP contacted a different internal host than the one that initiated the outbound relationship, last-seen timestamps, and on-demand lookup - Vulnerabilities — sortable vulnerability browser listing all cached NVD CVEs (not just network-detected) with CVSS scores, severity, affected service/technology, published date, CISA KEV flags, detected-on-network count, and a CVE detail modal showing full description and CPE criteria. CVEs not matching any host on the network are shown with a dimmed "not detected" indicator
- Statistics — at-a-glance operational dashboard. The Activity Timeline card (full-width) now contains three bar charts side-by-side: Public IPs per hour, Hosts per hour, and DNS queries per hour (stacked: clean/blocked/malicious). Below it: Top N Public IPs, Top N Countries, Top N Internal Talkers, and Top N Threat IPs (each with Pie/List toggle). Next row: Blocked DNS Queries by Category and Top N Blocked Queries by Client — both styled with the same Pie/List toggle as the other stat cards. Then a full-width Top N Blocked/Malicious Domains table, and finally the Enrichment Budget card with per-provider usage, daily bu
