Skip to content

Commands Reference ​

rwarden provides a unified command-line interface for path testing, configuration verification, schema export, and gateway generation.


1. Test URL Paths & Queries (test) ​

Simulate candidate path extraction, normalization, and pattern matching on an arbitrary path without starting Traefik, Caddy, or NGINX:

# Test a sensitive file path (positional or --path)rwarden test /.envrwarden test --path "/.env"# Test double URL encoding anti-evasionrwarden test "/static/%252e%252e/.env"# Test query string inspection (-q or --query)rwarden test -q "file=secret.conf" /search# Test custom HTTP methods (-X, -m, or --method)rwarden test -X POST /wp-config.php# Test custom HTTP headers (-H or --header, repeatable)rwarden test -H "X-Forwarded-Uri: /.env" /api# Test against a custom RouteWarden config file (-c or --config)rwarden test -c routewarden.json /admin/dashboard# Test client IP whitelistingrwarden test -c routewarden.json --ip "10.0.0.1" /admin# Test request body payload inspection (-b or --body)rwarden test -X POST -b "grant_type=password&user=admin" --check-body /identity/token# Pipe configuration via stdincat routewarden.json | rwarden test -c - /admin

Flags ​

FlagTypeDefaultDescription
[path], --pathstring""Request path to evaluate (e.g. /.env or /api/v1)
-c, --configstring""Path to routewarden.json (or - for stdin)
-q, --querystring""Query string to evaluate for path evasion payloads
-b, --bodystring""Request body payload to evaluate for hostile content
-X, -m, --methodstring"GET"HTTP method (e.g. GET, POST, HEAD)
-H, --headerstring""Optional header in Key:Value format (repeatable)
--ipstring""Client IP address to evaluate against allowedIps
--check-querybooltrueEnable or disable query string inspection
--check-bodyboolfalseEnable or disable request body payload inspection

Example Output ​

🔍 Testing: GET /static/%252e%252e/.env  Candidate paths extracted (2):    - /static/%252e%252e/.env    - /.envResult: 🛑 BLOCKED (HTTP Status 403)  Reason:  block_pattern_match  Target:  /.env  Pattern: (?i)\.env

2. Validate Configurations (validate) ​

Validate a RouteWarden JSON or TCP Warden YAML configuration file before deploying:

# Validate routewarden.json directly (positional or --config)rwarden validate routewarden.jsonrwarden validate -c routewarden.json# Auto-detects routewarden.json in current directory if omittedrwarden validate# Validate tcp-warden.yaml configurationrwarden validate tcp-warden.yaml# Validate piped config via stdincat routewarden.json | rwarden validate -c -

Example Output ​

✔ Schema validation passed: routewarden.json is valid!  - 14 built-in block patterns active  - 5 allow rules configured  - Response mode: json (HTTP 403)  - 3 allowed IP CIDR blocks evaluated

3. Output JSON Schema (schema) ​

Output the official RouteWarden JSON Schemas directly to stdout:

# Output HTTP Gateway Schema (routewarden.json)rwarden schema > routewarden.schema.json# Output TCP Warden L4 Proxy Schema (tcp-warden.yaml)rwarden schema --tcp > tcp-warden.schema.json

4. Generate Gateway Configs (generate) ​

Compile a universal routewarden.json policy into target reverse proxy syntax:

# Traefik: dynamic YAML middleware definitionrwarden generate traefik-yaml routewarden.json > traefik-middleware.yaml# Traefik: dynamic TOML middleware definitionrwarden generate traefik-toml routewarden.json > traefik-middleware.toml# Traefik: Docker Compose labels blockrwarden generate traefik-labels routewarden.json# Caddy: Caddyfile directive blockrwarden generate caddy routewarden.json# NGINX / OpenResty: Lua init table for nginx.confrwarden generate nginx routewarden.json# TCP Warden: tcp-warden.yaml configurationrwarden generate tcp-warden routewarden.json > tcp-warden.yaml

Supported Targets ​

TargetAliasDescription
traefik-yamltraefik, yamlTraefik Dynamic File Provider YAML
traefik-tomltomlTraefik Dynamic File Provider TOML
traefik-labelslabels, composeDocker Compose container label syntax
caddycaddyfileNative Caddyfile routewarden directive block
nginxopenresty, luaOpenResty init_by_lua_block Lua table
tcp-wardentcp, l4TCP Warden daemon YAML configuration

5. Live Gateway Sandbox (sandbox) ​

Spin up an ephemeral, isolated container running Traefik, Caddy, or NGINX loaded with your security policy for live testing:

# Start a Traefik sandbox on localhost:8080rwarden sandbox traefik routewarden.json# Start a Caddy sandbox with automatic test suite executionrwarden sandbox caddy routewarden.json --test# Start an NGINX sandbox in detached background moderwarden sandbox nginx routewarden.json --detach# Dry-run: view generated container command without launchingrwarden sandbox traefik routewarden.json --dry-run

Sandbox Testing Probes ​

When running in sandbox mode, you can execute HTTP requests against http://localhost:8080:

# Sensitive file attack (should return 403 Forbidden)curl -i http://localhost:8080/.env# Directory traversal attempt (should return 403 Forbidden)curl -i "http://localhost:8080/static/..%2f.env"# Safe RFC endpoint (should return 200 or upstream response)curl -i http://localhost:8080/robots.txt

6. Cleanup Sandbox Containers (cleanup) ​

Stop and remove all running or detached RouteWarden sandbox test containers:

rwarden cleanup

7. Version Information (version) ​

Check installed binary version:

rwarden version

8. Observability Stack (dashboard) ​

Launch and manage a turnkey cloud-native observability stack (Grafana, Grafana Loki, and Grafana Alloy) using Docker Compose to visualize real-time blocked threats, attack rates, and top offender IPs:

# Launch Grafana, Loki, and Alloy stack via Docker Compose (default: port 3000)rwarden dashboardrwarden dashboard up# Check status of running observability stack containersrwarden dashboard status# Stop and tear down the observability stackrwarden dashboard down# Export Docker Compose, Alloy, and Grafana config files to diskrwarden dashboard export ./observability

Subcommands & Flags ​

Subcommand / FlagTypeDefaultDescription
up, startsubcommand—Spin up Grafana, Loki, and Alloy stack (default)
down, stopsubcommand—Stop and tear down running stack containers
status, pssubcommand—Check container health and service URLs
export [dir]subcommand./observabilityExport compose, Alloy, and Grafana assets to disk
--portint3000Port for Grafana dashboard UI
--loki-portint3100Port for Loki log engine
--dirstring~/.routewarden/observabilityWorking directory storing stack files
--no-openboolfalseDo not launch system default browser

👉 For full configuration, LogQL query cheat sheets, and custom alerts, see the Security Observability Stack Guide.

Released under the MIT License.