SECURITY HARDENING EXAMPLES — November 11, 2026

These are illustrative lab examples, not an export of Matt's network or evidence
from the laptop incident. Addresses are reserved documentation addresses. Replace
them with individually approved targets. No production credentials are included.
PowerShell syntax and local open/closed TCP behavior were checked; OpenCanary and
Wazuh examples were checked against upstream documentation, not run on live hosts.
The Windows scheduler reader below also has offline mock tests; those tests do
not establish successful installation on an affected endpoint.

1. TEST EXPLICIT TCP PATHS

Copy matrix.example.csv to a private file and replace every documentation address.
Host must be a literal IPv4 or IPv6 address; hostnames are intentionally rejected.
Run from each actual source segment using a normal, clean test device:

  .\Test-Segmentation.ps1 -MatrixPath .\my-matrix.csv -SourceLabel VPN -OutputPath .\results.csv

Result means only that a TCP connection matched an expectation. A failed handshake
may mean DNS failure, no route, a stopped service, or host firewall rejection.
Confirm the service from an allowed source and correlate denied tests with firewall
logs. Test fresh connections after reviewing existing states. This does not test
UDP, all ports, application authorization, malware, or every IPv6 path. Add explicit
IPv6 targets if used. Avoid testing from a compromised endpoint.

2. OPENCANARY LAB VM

Use a fresh dedicated Ubuntu VM; the upstream README lists supported releases.
Patch it first and enforce external firewall policy before adding VLAN NICs.
For a multi-NIC sensor, disable bridging, IPv4 forwarding and IPv6 forwarding;
enforce egress restrictions on EVERY NIC outside the guest. Never turn the sensor
into a path between VLANs. Keep real data, mounts and production credentials out.

Example installation commands (review current upstream instructions first):

  sudo apt-get update
  sudo apt-get install -y python3-dev python3-pip python3-venv libssl-dev libpcap-dev
  sudo python3 -m venv /opt/opencanary/venv
  sudo /opt/opencanary/venv/bin/python -m pip install opencanary
  sudo /opt/opencanary/venv/bin/opencanaryd --copyconfig
  sudo useradd --system --user-group --no-create-home --shell /usr/sbin/nologin opencanary
  sudo install -d -o root -g opencanary -m 0750 /var/log/opencanary
  sudo install -o opencanary -g opencanary -m 0640 /dev/null /var/log/opencanary/events.json

Merge opencanary-config.fragment.json into the GENERATED config. Do not replace
the whole config with that fragment. Confirm no other default decoy service is
enabled unintentionally and that port 80 is free. The example disables fake SSH
to avoid conflicting with management SSH. Use separate management access or
deliberately reassign ports before enabling a fake SSH listener.

  sudo chown root:root /etc/opencanaryd/opencanary.conf
  sudo chmod 600 /etc/opencanaryd/opencanary.conf

Keep the venv and configuration root-owned. Logging objects load before privilege
drop. The service starts as root to bind low ports, then drops to opencanary.
Copy opencanary.service.example to /etc/systemd/system/opencanary.service.
--dev runs in the foreground so systemd can supervise the process.

  sudo systemctl daemon-reload
  sudo systemctl enable --now opencanary
  sudo systemctl status opencanary --no-pager

Keep the log directory root-owned and non-writable by the decoy user, because the
logger opens its file before dropping root. This prevents that user replacing the
log path with a symlink before a service restart.
Configure log rotation and verify the writer AND collector continue after rotation.
An example using logging.FileHandler needs coordinated service restart/reopen;
do not rename the file and assume the writer has switched to the new file.

3. WAZUH COLLECTION / RULE EXAMPLE

Keep the Wazuh manager, indexer and dashboard separate from the decoy. Install and
enroll its Linux agent using current official instructions. Inside the EXISTING
ossec_config element in /var/ossec/etc/ossec.conf add wazuh-agent.fragment.xml.
Ensure the agent can read the log and restart wazuh-agent. Default agent traffic
uses TCP 1514 to the manager; TCP 1515 is for enrollment. Keep management interfaces
restricted; agent collection does not require public dashboard/indexer/API access.

On the manager place opencanary_rules.xml in /var/ossec/etc/rules/ after choosing
an unused local ID (100000-120000 is Wazuh's recommended custom range).
This example intentionally matches only selected HTTP/SSH event types on one node;
it is not a catch-all rule. Severity 10 is an illustrative tuning choice.

  sudo /var/ossec/bin/wazuh-logtest

Paste synthetic-event.jsonl as one line. Expect JSON decoding and rule 100210 if
that is the ID you retained. Restart wazuh-manager to apply rules to live processing.
A successful rule test does not verify agent transport, indexing, dashboard or
notifications. Make one approved HTTP request to the lab decoy and trace that same
event through collection, dashboard and any configured notification. Request
/index.html explicitly (for example curl http://<lab-canary>/index.html): a plain
request to / can redirect without logging the expected HTTP GET event.

4. WINDOWS WAZUH SETUP / TASK LOOKUP DIAGNOSTIC

An actual setup failure on November 11 stopped at the first security check with
"The system cannot find the file specified." The private diagnostic showed that
the health audit had succeeded: PowerShell's ScheduledTasks lookup returned
HRESULT 0x80070002 while Windows' direct Schedule.Service interface could find
both monitoring tasks. Setup had stopped before its Windows Update audit.

A deployment-specific installer repair was prepared and passed 35 offline
regression checks. It uses the direct scheduler interface for task operations,
validates existing task identity and schedules, and resumes a validated connected
agent at its remaining audits. An affected-PC rerun was still unconfirmed when
these examples were published. This bundle contains the reusable READ-ONLY
diagnostic and scheduler reader, not that private installer or enrollment files.

Keep Check-Wazuh.cmd, Check-Wazuh.ps1 and WazuhSchedulerRead.psm1 together in a
trusted extracted local folder. Right-click Check-Wazuh.cmd and choose Run as
administrator for the full evidence. A normal run records access-denied queries
instead of attempting automatic elevation. Review Wazuh-diagnostic-COMPUTER.txt
beside the scripts and share it privately: it includes machine/task names, local
paths, file hashes and timings. Do not commit generated reports to a repository.

Defaults match the original audit task names and C:\ProgramData\OfficeWazuh.
To inspect another installation from an administrator Windows PowerShell console:

  .\Check-Wazuh.ps1 -AuditRoot 'C:\ProgramData\MyMonitoring' -TaskName '\Lab\Health','\Lab\Updates'

Optional -ExpectedHashes accepts a hashtable of script/module LEAF filenames to
their trusted 64-character SHA256 values. Obtain values from YOUR approved package;
none are embedded here. Without that parameter, file existence and actual hashes
are reported, but integrity is explicitly unverified (MatchesExpected is blank).
The diagnostic never reads enrollment credentials, agent keys, full agent
configuration, task arguments, task XML or event messages. Exception types and
HRESULT chains are retained without exception text or raw error IDs, which could
contain secrets.
Task history is limited to the newest 200 events from the past 48 hours.

WazuhSchedulerRead.psm1 can also be imported alone for direct read-only evidence:

  Import-Module .\WazuhSchedulerRead.psm1
  Get-WazuhScheduledTaskRead -TaskPath '\Lab\Health' | Format-List

QueryFailed (including access denied) is not proof that a task is missing.
MissingTaskOrFolder identifies a missing-task/path HRESULT. Task state/result
alone does not verify fresh health telemetry, agent connection or completed
installation. This helper never enables, starts, registers, deletes or changes a
task/service. Do not replace installer validation with a successful lookup.

Run the reader's parser and mock tests without connecting to a real scheduler:

  powershell.exe -NoProfile -ExecutionPolicy RemoteSigned -File .\Test-WazuhSchedulerRead.ps1

REFERENCES
https://github.com/thinkst/opencanary#installation-on-ubuntu
https://github.com/thinkst/opencanary/blob/master/opencanary/data/settings.json
https://github.com/thinkst/opencanary/blob/master/bin/opencanaryd
https://documentation.wazuh.com/current/quickstart.html
https://documentation.wazuh.com/current/user-manual/reference/ossec-conf/localfile.html
https://documentation.wazuh.com/current/user-manual/ruleset/rules/custom.html
https://documentation.wazuh.com/current/user-manual/ruleset/testing.html
https://learn.microsoft.com/en-us/windows/win32/taskschd/registeredtask
https://learn.microsoft.com/en-us/windows/win32/taskschd/taskfolder-gettask
