Skip to content

Environment Variables

Complete reference for environment variables used by Tunnet components.

Service URL bindings

These three URLs are the only service bindings you need to configure. Set them in the repository root .env for local development.

VariableDescriptionExample
DASHBOARD_URLDashboard origin (CORS, OAuth redirects, SSH browser auth)http://localhost:5173
MANAGEMENT_URLManagement API public URL (auth, REST API, CLI login)http://localhost:3000
CONTROL_PLANE_URLControl plane URL (agent enroll, edge register)http://localhost:8080
BETTER_AUTH_COOKIE_DOMAINOptional shared parent domain for dashboard/management auth cookiesexample.com

The management server derives the control plane admin API URL from CONTROL_PLANE_URL (same host, port 9091).

Secrets

VariableDescriptionExample
DATABASE_URLPostgreSQL connection stringpostgres://user:pass@localhost:5432/tunnet
BETTER_AUTH_SECRETAuth signing secret (32+ chars)a-long-random-string-at-least-32-characters
TUNNET_SERVICE_SECRETInternal API shared secret (management ↔ control)a-long-random-string-at-least-32-characters
TUNNET_AUDIT_HMAC_KEYAudit integrity key (32+ chars)another-long-random-string-at-least-32-chars
TUNNET_LICENSEOptional commercial license certificate/etc/tunnet/license.json

Agent (tunnet)

VariableDescriptionExample
TUNNET_STATE_DIRAgent state directory~/.local/state/tunnet
CONTROL_PLANE_URLControl plane URL (--control-url)http://127.0.0.1:8080
MANAGEMENT_URLManagement API URL (tunnet login)http://localhost:3000
TUNNET_ENROLL_TOKENEnrollment tokeneyJ...
TUNNET_ORG_SLUGOrganization slug (quick enroll)my-company
TUNNET_HOSTNAMEMachine hostnameapi-prod
TUNNET_IFNAMETUN interface nametunnet0
TUNNET_POLL_SECSSnapshot poll interval30
TUNNET_METRICS_BINDPrometheus metrics bind127.0.0.1:9100
TUNNET_DISABLE_GOSSIPDisable gossiptrue
TUNNET_RECORDEREnable SSH recordingtrue
TUNNET_JSON_LOGSJSON log formattrue

Control plane

VariableDescriptionDefault
TUNNET_BINDPublic API bind address0.0.0.0:8080
TUNNET_ADMIN_BINDInternal admin API bind127.0.0.1:9091
TUNNET_INTERNAL_BINDMetrics/ready bind127.0.0.1:9090
TUNNET_LICENSECommercial license certificate (inline JSON, file path, or HTTPS URL). Unlocks Cloud/Enterprise features when valid.- (Community)
TUNNET_AUDIT_HMAC_KEYSecret used to protect the audit integrity chain (32+ characters, required for Managed)-
TUNNET_AUDIT_STREAM_WEBHOOK_URLOptional HTTP endpoint that receives batched audit events as JSON-
TUNNET_AUDIT_STREAM_WEBHOOK_HEADERSOptional comma-separated Header:Value pairs for the webhook-
TUNNET_AUDIT_BUFFER_SIZEIn-memory audit buffer capacity before drop8192
TUNNET_AUDIT_BATCH_SIZEMax events flushed together500
TUNNET_AUDIT_FLUSH_INTERVAL_MSMax flush interval in milliseconds1000

See Audit Logs for how the trail works in the dashboard and how to verify integrity.

Released under the AGPL-3.0 License.