Environment Variables¶
WireBuddy can be configured via environment variables in settings.env (Docker) or .env (local development).
Required Variables¶
WIREBUDDY_SECRET_KEY¶
Required encryption key for secrets and session management.
Generate a secure key:
# Using OpenSSL
openssl rand -base64 32
# Using Python
python3 -c "import secrets; print(secrets.token_urlsafe(32))"
Security Critical
- Never commit this to version control
- Use a different key for each environment
- Regenerating this key will invalidate all sessions and encrypted data
Optional Variables¶
LOG_LEVEL¶
Logging verbosity level.
Options:
DEBUG- Verbose logging (development only)INFO- Standard logging (recommended)WARNING- Warnings and errors onlyERROR- Errors onlyCRITICAL- Critical errors only
Default: INFO
PORT¶
Web server port.
Default: 8000
Note
When using network_mode: host, the port must be available on the host.
HOST¶
Web server bind address.
Options:
0.0.0.0- Listen on all interfaces (default)127.0.0.1- Localhost only- Specific IP - Bind to specific interface
Default: 0.0.0.0
UVICORN_WORKERS¶
Number of Uvicorn worker processes.
Default: 1
WireBuddy web mode is single-worker only. Values greater than 1 are not supported and are forced back to 1 by the Docker entrypoint.
SERVER_MODE¶
Deployment mode for multi-node architecture.
Options:
master- Full application with web UI, database, and API (default)node- Lightweight WireGuard-only mode for remote nodes
Default: master
Multi-Node Deployment
See Multi-Node Deployment for complete setup guide.
WIREBUDDY_ENROLLMENT_TOKEN¶
Node enrollment token (node mode only).
Required when SERVER_MODE=node. Obtain this token from the master's Nodes page.
Single-Use Token
The token is invalidated after successful enrollment. Store securely.
WIREBUDDY_MASTER_URL¶
Master server API URL (node mode only).
Legacy variable for node mode.
Current node enrollment tokens already include the master URL, so this variable is usually not needed.
Firewall Configuration
Ensure the node can reach the master's sync endpoints: /api/nodes/enroll, /api/nodes/heartbeat, /api/nodes/config, /api/nodes/events
WIREBUDDY_ENROLLMENT_VERIFY_KEY¶
Optional enrollment token HMAC verification key (node mode only).
If set, the node verifies enrollment token signatures locally before contacting the master. In production, this is required by the node daemon.
WIREBUDDY_MASTER_CA_FILE¶
Path to a custom CA certificate file for master TLS verification (node mode only).
If unset, system CA certificates are used.
WIREBUDDY_NODE_SYNC_INTERVAL¶
Normal sync interval in seconds (node mode only).
Default: 30
WIREBUDDY_NODE_SYNC_INTERVAL_FAST¶
Fast sync interval in seconds used when SSE is disconnected (node mode only).
Default: 5
WIREBUDDY_ENROLLMENT_RETRY_ATTEMPTS¶
Number of enrollment retry attempts on transient errors (node mode only).
Default: 3 (minimum effective value: 1)
WIREBUDDY_NO_FIREWALL_FIX¶
Disable automatic iptables DNS rule adjustments on node startup.
Default: disabled (automatic firewall fix is enabled)
WIREBUDDY_SKIP_NETWORK_CHECK¶
Skip container network mode verification (CI/CD only).
Default: Not set
Warning
Only use for testing. WireBuddy requires host network mode for full functionality.
DATABASE_PATH¶
Custom database location.
Default: data/wirebuddy.db
DATA_DIR¶
Base data directory.
Default: data/
TSDB_PATH¶
Time-series database location.
Default: data/tsdb/
GEOIP_DATA_DIR¶
GeoLite2 database directory.
Default: data/geolite2/
DNS_LOG_PATH¶
Unbound DNS log file location.
Default: data/dns/queries.log
CERT_DIR¶
ACME certificate storage directory.
Default: data/certs/
Advanced Variables¶
WIREBUDDY_STATUS_TRUSTED_PROXY_CIDRS¶
Comma-separated list of trusted proxy CIDRs for the /status endpoint.
Default: unset
Behavior:
- Loopback proxy hops are trusted automatically
- Other proxy hops are trusted only when listed here
- Used for accepting
X-Forwarded-FororX-Real-IPon/status
SESSION_COOKIE_NAME¶
Custom session cookie name.
Default: wirebuddy_session
SESSION_COOKIE_SECURE¶
Require HTTPS for session cookies.
Default: false (auto-detect when behind reverse proxy)
SESSION_COOKIE_HTTPONLY¶
Prevent JavaScript access to session cookies.
Default: true (recommended)
SESSION_COOKIE_SAMESITE¶
SameSite cookie attribute.
Options:
Strict- Strictest (may break some workflows)Lax- Balanced (recommended)None- Least strict (requiresSESSION_COOKIE_SECURE=true)
Default: Lax
RATELIMIT_ENABLED¶
Enable rate limiting.
Default: true
RATELIMIT_LOGIN_ATTEMPTS¶
Maximum login attempts before lockout.
Default: 5
RATELIMIT_LOGIN_WINDOW¶
Login rate limit window (minutes).
Default: 15
SWAGGER_ENABLED¶
Enable Swagger/OpenAPI documentation endpoint.
Default: true (can disable in production)
Access at: http://localhost:8000/swagger
CORS_ORIGINS¶
Allowed CORS origins (comma-separated).
Default: Not set (CORS disabled)
TZ¶
Timezone for scheduled tasks. Scheduled backups run at 03:00 in the resolved application timezone, using TZ when set and otherwise falling back to the system timezone configuration. Uses standard IANA timezone names.
See: List of tz database time zones
Default: Etc/UTC
Example Configuration Files¶
Production (settings.env)¶
# Required
WIREBUDDY_SECRET_KEY=<generated-secret-key>
# Application
LOG_LEVEL=INFO
PORT=8000
WORKERS=4
# Security
SESSION_COOKIE_SECURE=true
RATELIMIT_ENABLED=true
SWAGGER_ENABLED=false
# Optional
TZ=America/New_York
Development (.env)¶
# Required
WIREBUDDY_SECRET_KEY=dev-secret-key-change-me
# Application
LOG_LEVEL=DEBUG
PORT=8000
WORKERS=1
# Security (relaxed for dev)
SESSION_COOKIE_SECURE=false
RATELIMIT_ENABLED=false
SWAGGER_ENABLED=true
# Optional
DATA_DIR=./dev-data
Docker Compose¶
services:
wirebuddy:
image: giiibates/wirebuddy:latest
env_file:
- settings.env
environment:
- LOG_LEVEL=INFO
- PORT=8000
Precedence¶
Environment variables follow this precedence (highest to lowest):
- Docker Compose
environmentsection - Docker Compose
env_file - Shell environment
.envfile- Application defaults
Security Best Practices¶
Secret Management¶
Don't:
- ❌ Commit secrets to Git
- ❌ Use weak secrets (
admin,password123) - ❌ Reuse secrets across environments
- ❌ Share secrets in plain text (email, Slack)
Do:
- ✅ Generate strong random secrets
- ✅ Use different secrets per environment
- ✅ Store secrets in secure vault (1Password, Bitwarden, Vault)
- ✅ Rotate secrets periodically
- ✅ Use
.env.examplefor documentation (no real secrets)
File Permissions¶
Protect environment files:
# settings.env should be readable only by owner
chmod 600 settings.env
# Verify
ls -la settings.env
# -rw------- 1 user user 123 Mar 15 10:00 settings.env
Docker Secrets¶
For Docker Swarm, use Docker secrets:
services:
wirebuddy:
secrets:
- wirebuddy_secret_key
environment:
- WIREBUDDY_SECRET_KEY_FILE=/run/secrets/wirebuddy_secret_key
secrets:
wirebuddy_secret_key:
external: true
Troubleshooting¶
Changes Not Applied¶
Problem: Environment variable changes not taking effect
Solutions:
-
Restart container:
-
Verify variable is set:
-
Check for typos in variable names
Invalid Secret Key¶
Error: Failed to decrypt data
Cause: WIREBUDDY_SECRET_KEY changed or lost
Solutions:
- Restore correct secret key from backup
- Or reinitialize database (loses encrypted data):
Port Already in Use¶
Error: Address already in use
Solutions:
- Change
PORTto unused port - Or stop conflicting service: