HomeNetSec is a dockerized home network security pipeline.
Continuous-operation references:
It produces a continuous dashboard and persistent alert/device state by combining:
- PCAP-based network telemetry (offline Zeek analysis)
- TLS fingerprint telemetry (offline Suricata → EVE JSON)
- DNS telemetry (AdGuard Home stats)
- Behavioral enrichment (RITA beacon/long-connection analysis)
- Baselines & anomaly candidates (local SQLite state)
The design is intentionally modular so you can swap out how PCAPs arrive (OPNsense, tcpdump, SPAN port, etc.) without rewriting analysis/reporting.
HomeNetSec runs on the continuous pipeline:
- Continuous ingest: merge eligible PCAPs, run Suricata + Zeek, queue merged artifacts
- Continuous analysis: update rolling baselines, detect alerts, update device inventory, run incremental RITA
- Live dashboard/API: serve current alerts, devices, pipeline health, and review actions
Entry point:
scripts/continuous_ingest.sh
Goal: keep PCAP processing incremental, flatten artifacts into the continuous layout, and enqueue work for analysis.
What it does:
- Reads eligible new PCAPs using
output/state/ingest_state.json. - Applies a safety lag and skips incomplete files.
- Merges eligible PCAPs and writes manifest metadata.
- Runs Suricata + Zeek on merged PCAPs.
- Flattens artifacts into the continuous layout.
- Queues merged artifacts for analysis.
Retention defaults (optimized for analysis quality vs disk usage):
- merged PCAPs: 3 days
- merged source PCAPs in
PCAP_SOURCE_DIR: 48 hours after successful merge (SOURCE_PCAP_DELETE_DELAY_HOURS=48) - Suricata EVE outputs + Zeek logs: 30 days minimum (needed for RITA's rolling window + baseline analysis)
- Recommended: 60 days for better baseline/anomaly detection
- Logs are tiny (~50-100 MB/day) compared to PCAPs (~5-20 GB/day)
This pipeline does not pull PCAPs and does not rerun Zeek/Suricata. It consumes the queue and artifact outputs from continuous ingest.
Typical command sequence:
./scripts/continuous_analysis.sh --process-queue./scripts/generate_dashboard.sh
If you want everything updated together, run:
scripts/run_ingest_and_analysis.sh
- Ingest/processing: PCAP ingest → merge → Suricata + Zeek
- Analysis/dashboard: rolling baselines + continuous detection + RITA + live dashboard
scripts/continuous_ingest.sh— queue-backed continuous ingest entrypointscripts/continuous_analysis.sh— queue-backed continuous analysis entrypointscripts/run_ingest_and_analysis.sh— unified continuous wrapperassets/docker-compose.yml— Zeek + RITA + Mongo + Suricata stackassets/rita-config.yaml.example— example RITA configreferences/— supporting docs
Runtime outputs are not committed (PCAPs/logs/reports/DB).
This pipeline assumes two independent inputs:
In my setup, PCAPs are generated by a firewall/router and periodically pulled onto the machine running HomeNetSec. The pipeline then processes those PCAPs offline.
Important: the rest of the pipeline does not care where PCAPs come from, only that they appear on disk in the expected folder structure.
Expected source path:
PCAP_SOURCE_DIR/lan-YYYY-MM-DD_*.pcap*
Continuous ingest copies and merges from PCAP_SOURCE_DIR into $HOMENETSEC_WORKDIR/output/pcaps/.
DNS telemetry is collected from AdGuard Home via its HTTP API.
Expected configuration is provided via environment variables (or a sourced env file):
ADGUARD_URLADGUARD_USERADGUARD_PASS
This is used only for summary stats in the report (e.g., top clients, top blocked domains). It is not required to run PCAP/Zeek/RITA.
All scripts automatically source .env from the repo root if present. Copy the example and customize:
cp .env.example .env
# Edit .env with your pathsThe .env file is gitignored — keep your local configuration there.
HOMENETSEC_WORKDIR— where PCAPs/logs/reports live (default:./output)
HOMENETSEC_LAN_BIND_IP— LAN IP to bind dashboard (required for dashboard)HOMENETSEC_TS_BIND_IP— Tailscale IP to bind dashboard (required for dashboard)HOMENETSEC_DASHBOARD_PORT— dashboard port (default:8088)HOMENETSEC_DASHBOARD_BASE_URL— base URL for dashboard links (optional)HOMENETSEC_DASHBOARD_MODE— keep aslive(legacy mode removed)HOMENETSEC_MIN_ALERT_CONFIDENCE— filter alerts in/api/alertsbelow this confidence (0.0to1.0, default0)HOMENETSEC_ALERT_SEVERITIES— comma-separated alert severities shown in/api/alerts(critical,high,med,low,infoby default)
Running the dashboard:
cd HomeNetSec
docker compose --env-file .env -f assets/dashboard-compose.yml up -dHomeNetSec copies PCAPs from a local source directory for processing.
Required env var:
PCAP_SOURCE_DIR— local directory where PCAPs are collected (REQUIRED - must be configured in.env)- PCAPs are merged into
$HOMENETSEC_WORKDIR/output/pcaps/ - A
.manifest.jsonsidecar is written for each merged PCAP - Source PCAPs are deleted from
PCAP_SOURCE_DIRafter the configured delay, not immediately - Merged PCAPs are retained for 3 days
- PCAPs are merged into
SAFETY_LAG_SECONDS— ignore files newer thannow - lag(default:120)MERGE_RETRIES— retries for merge+verify (default:1)VERIFY_MERGE— verify merged packet counts (default:1)SOURCE_PCAP_DELETE_DELAY_HOURS— delay before deleting successfully merged source PCAPs fromPCAP_SOURCE_DIR(default:48)RECENT_MERGE_INDEX_BACKFILL_HOURS— backfill window for reconstructing missing merge manifests from recent merged PCAPs (default:36)- Retention:
MERGED_PCAP_RETENTION_DAYS(default:3- PCAPs are large; logs contain extracted intelligence)HOURLY_ARTIFACT_RETENTION_DAYS(default:30- recommend60for better baseline analysis)RUN_RETENTION_CLEANUP(default:1)
RUN_RITA— set to0to skip continuous RITA (default:1for full environments)HOMENETSEC_RITA_STAGING_DIR— host path for flattened recent Zeek logs consumed by RITA (default:$HOMENETSEC_WORKDIR/state/zeek-flat-staging)SKIP_INGEST— set to1to skip the ingest phase inrun_ingest_and_analysis.shSKIP_ANALYSIS— set to1to skip the analysis phase inrun_ingest_and_analysis.shSKIP_DASHBOARD— set to1to skip dashboard regeneration inrun_ingest_and_analysis.shINGEST_EXPECT_NEXT_RUN_SECONDS— optional status hint for cron-driven ingest cadence
ADGUARD_ENV— path to an env file withADGUARD_URL/USER/PASS- default:
~/.config/homenetsec/adguard.env
- default:
HOMENETSEC_ADGUARD_QUERYLOG_LIMIT— max querylog records triage checks for source-IP/domain correlation (default:500)
HOMENETSEC_VISIBLE_DEVICE_CIDRS— comma-separated CIDRs considered relevant for device viewsHOMENETSEC_HIDDEN_DEVICE_CIDRS— comma-separated CIDRs suppressed as infrastructure ranges (for example Docker bridge networks)
cd HomeNetSec
python3 -m unittest discover -s tests -vcd HomeNetSec
export HOMENETSEC_WORKDIR="$PWD/output"
./scripts/continuous_ingest.sh --oncecd HomeNetSec
export HOMENETSEC_WORKDIR="$PWD/output"
./scripts/continuous_analysis.sh --process-queuecd HomeNetSec
export HOMENETSEC_WORKDIR="$PWD/output"
./scripts/run_ingest_and_analysis.shThe cleanest way to adapt HomeNetSec is to treat it as layers:
- Ingest layer: get PCAPs into
PCAP_SOURCE_DIR - Processing layer: merge + Suricata + Zeek
- Analysis layer: rolling baselines + detection + device inventory + RITA
- Dashboard layer: live API + static dashboard
You can replace the ingest layer without changing the rest.
- Do not commit PCAPs, Zeek logs, reports, or credential files.
- Keep secrets in environment variables or external env files.
- PCAPs may contain sensitive metadata/content; handle and share with care.