# Cyber Range Runbook ## Safety checks before every session 1. Run `python lab.py preflight`. 2. Keep Security Onion and GOAD stopped while using heavyweight container profiles. 3. Use only `127.0.0.1` bindings and host-only VM networks. 4. Scan only lab services or systems you own/are authorized to test. 5. Snapshot VMs before attacks and restore them afterward. ## WAF + Juice Shop exercise Start the lightweight stack: ```bash python lab.py up core ``` 1. Browse `http://127.0.0.1:8080` and confirm it is Juice Shop. 2. Send a normal request and record the response. 3. Send the controlled SQLi-like test from the README and inspect the WAF result. 4. Work through a Juice Shop challenge using the [official companion guide](https://pwning.owasp-juice.shop/companion-guide/latest/). 5. Inspect logs without mounting the Docker socket: ```bash docker compose logs waf ``` For detection-only comparison, copy `.env.example` to `.env`, set `WAF_MODE=DetectionOnly`, and recreate the core profile. Restore `WAF_MODE=On` afterward. DetectionOnly is a learning mode, not protection. ## Nmap exercise The controller accepts IPs, CIDRs, hostnames, and Compose service names. It rejects shell metacharacters, unexpected options, and implicit targets. ```bash python lab.py scan juice-shop python lab.py scan waf -- -sV --top-ports 100 python lab.py scan juice-shop -- -sT -p 3000 ``` Allowed flags are `-sV`, `-sT`, `-sS`, `-Pn`, `-O`, `--open`, `--top-ports`, and `-p`. Run arbitrary Nmap options manually only inside your own range if you understand their impact; the controller intentionally uses a small allowlist. ## Wazuh exercise Install once with `python lab.py wazuh-setup`, then open `https://127.0.0.1:5443`. 1. Explore the manager, indexer, and dashboard in **Threat Hunting**. 2. Add a disposable endpoint VM using the official Wazuh agent documentation. 3. Keep agent ports localhost-only unless the endpoint is an explicitly isolated VM. If remote agent access is needed, create a separate host-only override rather than binding to `0.0.0.0`. 4. Generate harmless events such as failed local authentication attempts and file-integrity changes on the disposable endpoint. 5. Correlate endpoint events with WAF `error.log`, which the manager reads from the shared read-only volume. The official local dashboard default is `admin` / `SecretPassword`. Change credentials before any non-local use; this package intentionally does not expose the stack remotely. ## AI analyst exercise Start `python lab.py up ai`. Optionally download the local model with `python lab.py pull-model`. - `/healthz` reports liveness. - `/reports.json` returns processed reports, newest first. - `/` shows escaped report cards and refreshes every 15 seconds. - Reports are stored in the `copilot_reports` named volume as `triage.jsonl`. - Only Wazuh alerts at rule level 10 or above are processed by default. - Existing alerts are skipped on first startup; set `PROCESS_EXISTING_ALERTS=1` only when intentionally importing them. Stop Ollama or withhold the model to test deterministic fallback. Reports then contain `analysis_source: deterministic-fallback` and may contain `ai_error`. No report triggers a response action. Offline fallback test: ```bash python lab.py triage examples/alerts.json ``` ## Security Onion and GOAD Use their separate VM guides. They are not fake Compose services and are not included in `all-containers`. ## Backup Stop the relevant profile first. The following example backs up WAF logs on a host with Docker: ```bash docker run --rm -v cyber-range-waf-logs:/data:ro -v "${PWD}:/backup" alpine:3.22 tar -czf /backup/waf-logs.tar.gz -C /data . ``` Back up Wazuh using its official persistent-volume guidance. Copilot reports can be copied from the `copilot_reports` volume with the same read-only mount pattern. Store backups outside the range and protect any sensitive alert content. ## Non-destructive stop ```bash python lab.py down ``` This preserves named volumes and downloaded Wazuh files. ## Destructive reset A reset permanently deletes evidence, reports, models, and application state. First make backups and stop every related service. Root Compose volumes: ```bash docker compose down -v --remove-orphans ``` External shared volumes must be removed explicitly, only after Wazuh is stopped: ```bash docker volume rm cyber-range-wazuh-logs cyber-range-waf-logs ``` For Wazuh's remaining volumes, use its official Compose file from `.vendor/wazuh-docker/single-node` with `down -v`. Do not delete `.vendor` while containers still reference it. For VMs, revert to a clean snapshot or use the official GOAD destroy workflow. Never delete VM files while the hypervisor is running them.