Configuration Reference

Mezite is configured through a YAML file, typically located at /etc/mezite/mezite.yaml. Every setting can also be overridden via environment variables. This page documents every field, its type, default value, and the corresponding environment variable.


Config Loading Order

Settings are resolved in the following order, with later sources taking precedence:

  1. Built-in defaults — Sensible values baked into the binary.
  2. Config file — Loaded from the path given by --config.
  3. Environment variables — Prefixed with MEZITE_, these override any value set in the config file.
Environment variables always win. This makes it easy to inject secrets (like database passwords and CA passphrases) without writing them to disk.

Minimal Config

The smallest useful configuration — just enough to start a combined-mode server with SQLite (the default):

mezite.yaml — minimal (SQLite) yaml
cluster_name: my-cluster

auth:
  local_auth_enabled: true

ssh:
  enabled: true

For PostgreSQL, set the driver and connection fields:

mezite.yaml — minimal (PostgreSQL) yaml
cluster_name: my-cluster

database:
  driver: postgres
  host: localhost
  port: 5432
  user: mezite
  password: mezite
  name: mezite
  sslmode: disable

auth:
  local_auth_enabled: true

ssh:
  enabled: true

Full Example

Below is a complete mezite.yaml with every field and its default value. In practice you only need to specify values that differ from the defaults.

mezite.yaml — complete reference yaml
# ─── Cluster ─────────────────────────────────────────────
cluster_name: my-cluster

# ─── Logging ─────────────────────────────────────────────
log:
  level: info
  format: json

# ─── Database ────────────────────────────────────────────
database:
  driver: sqlite          # sqlite (default) or postgres
  host: localhost          # PostgreSQL only
  port: 5432               # PostgreSQL only
  user: mezite             # PostgreSQL only
  password: mezite         # PostgreSQL only
  name: mezite             # PostgreSQL only
  sslmode: require         # PostgreSQL only

# ─── Auth Service ────────────────────────────────────────
auth:
  local_auth_enabled: true
  session_ttl: 12h
  ca_key_passphrase: ""

# ─── Proxy Service ───────────────────────────────────────
proxy:
  public_addr: localhost:3080
  listen_addr: 0.0.0.0:3080
  ssh_listen_addr: 0.0.0.0:3023
  tunnel_listen_addr: 0.0.0.0:3024

# ─── SSH Service ─────────────────────────────────────────
ssh:
  enabled: false

Cluster

FieldTypeDefaultEnv VarDescription
cluster_namestringmeziteMEZITE_CLUSTER_NAMEUnique identifier for this cluster. Embedded in all certificates and used to namespace audit events. Must be a valid DNS label.

Logging

FieldTypeDefaultEnv VarDescription
log.levelstringinfoMEZITE_LOG_LEVELMinimum log level. One of debug, info, warn, error.
log.formatstringjsonMEZITE_LOG_FORMATLog serialization format. json for structured output, text for human-readable.

Database

Mezite supports SQLite and PostgreSQL backends. SQLite is the simplest option for self-hosted deployments (zero external dependencies). PostgreSQL 16+ is recommended for production and managed deployments.

FieldTypeDefaultEnv VarDescription
database.driverstringsqliteMEZITE_DB_DRIVERDatabase backend: sqlite or postgres.
database.urlstring""MEZITE_DB_URLConnection URL. For SQLite: file path. For PostgreSQL: DSN. When empty, built from fields below (PG) or defaults to <data_dir>/mezhub.db (SQLite).
database.hoststringlocalhostMEZITE_DB_HOSTPostgreSQL hostname or IP address.
database.portinteger5432MEZITE_DB_PORTPostgreSQL port.
database.userstringmeziteMEZITE_DB_USERDatabase user (PostgreSQL only).
database.passwordstring""MEZITE_DB_PASSWORDDatabase password (PostgreSQL only).
database.namestringmeziteMEZITE_DB_NAMEName of the PostgreSQL database.
database.sslmodestringrequireMEZITE_DB_SSLMODEPostgreSQL TLS mode. Accepts: disable, require, verify-ca, verify-full.
SQLite (simplest — no external database) bash
export MEZITE_DB_DRIVER=sqlite
export MEZITE_DB_URL=/var/lib/mezite/mezhub.db
PostgreSQL (production) bash
export MEZITE_DB_DRIVER=postgres
export MEZITE_DB_HOST=db.internal.example.com
export MEZITE_DB_PORT=5432
export MEZITE_DB_USER=mezite
export MEZITE_DB_PASSWORD='$(vault kv get -field=password secret/mezite/db)'
export MEZITE_DB_NAME=mezite
export MEZITE_DB_SSLMODE=verify-full

Auth

FieldTypeDefaultEnv VarDescription
auth.local_auth_enabledbooleantrue--Enable username/password authentication. Set to false in production if you require all users to authenticate via SSO.
auth.session_ttlduration12h--Maximum lifetime for user certificates issued at login.
auth.ca_key_passphrasestring""MEZITE_CA_KEY_PASSPHRASEPassphrase used to encrypt Certificate Authority private keys at rest in the database.
auth.oidc.issuer_urlstring""--OIDC provider issuer URL. When set, enables OIDC-based SSO login.
auth.oidc.client_idstring""--OAuth 2.0 client ID registered with the OIDC provider.
auth.oidc.client_secretstring""--OAuth 2.0 client secret.
auth.oidc.redirect_urlstring""--Callback URL the OIDC provider redirects to after authentication.

Proxy

FieldTypeDefaultEnv VarDescription
proxy.public_addrstringlocalhost:3080--The address that clients use to reach this proxy.
proxy.listen_addrstring0.0.0.0:3080--Bind address for the HTTPS listener.
proxy.ssh_listen_addrstring0.0.0.0:3023--Bind address for the SSH listener.
proxy.tunnel_listen_addrstring0.0.0.0:3024--Bind address for the reverse-tunnel listener.

SSH

FieldTypeDefaultEnv VarDescription
ssh.enabledbooleanfalse--Enable the built-in SSH service on this node.

Port Reference

PortProtocolComponentDescription
3025gRPCAuth ServiceInternal auth API. Should not be exposed publicly.
3080HTTPSProxy ServiceWeb UI, REST API, OIDC callbacks.
3023SSHProxy ServiceSSH client connections via msh.
3024gRPCProxy ServiceAgent reverse-tunnel connections.
5432PostgreSQLDatabaseState store (only when using PostgreSQL backend).

Agent Configuration

The mezd binary is configured entirely via environment variables.

VariableRequiredDescription
MEZITE_JOIN_TOKENYes (first run)One-time join token. Only needed on first join.
MEZITE_AUTH_ADDRYesAddress of the Auth service (e.g. mezite.example.com:3025).
MEZITE_PROXY_ADDRYesAddress of the Proxy tunnel listener (e.g. mezite.example.com:3024).
MEZITE_NODE_NAMENoNode name shown in msh ls. Defaults to hostname.
MEZITE_NODE_LABELSNoComma-separated key=value labels for RBAC matching (e.g. env=prod,role=web).
MEZITE_DATA_DIRNoData directory for identity and recordings. Default: /var/lib/mezite.
MEZITE_RECORDING_MODENoRecording mode: node-sync (real-time streaming) or node (async upload after session). The cluster default is node-sync. See Session Recording.
MEZITE_TLS_WRAPNoWrap tunnel connection in TLS. Required when connecting through a TLS-terminating load balancer. See Reverse Proxy.
MEZITE_BPF_ENABLEDNoEnable eBPF enhanced recording (Linux only, requires privileged mode). Captures command executions in addition to terminal I/O.
MEZITE_PAM_SERVICENoPAM service name for session hooks (Linux only).
MEZITE_AUTH_H2CNoRun gRPC auth in h2c (HTTP/2 cleartext) mode. Use when a TLS-terminating load balancer sits in front (Fly.io, ALB, Istio/Linkerd service mesh). Also suitable for local development.
Agent startup example bash
MEZITE_JOIN_TOKEN=d4f8a2e1-7b3c-4d9e-a5f6-1234567890ab \
MEZITE_AUTH_ADDR=mezite.example.com:3025 \
MEZITE_PROXY_ADDR=mezite.example.com:3024 \
MEZITE_NODE_NAME=web-server-01 \
MEZITE_NODE_LABELS="env=production,role=webserver" \
mezd start

Environment Variables

VariableConfig EquivalentDescription
MEZITE_CLUSTER_NAMEcluster_nameCluster name
MEZITE_DB_DRIVERdatabase.driverDatabase backend (sqlite or postgres)
MEZITE_DB_URLdatabase.urlConnection URL (file path for SQLite, DSN for PostgreSQL)
MEZITE_DB_HOSTdatabase.hostPostgreSQL host
MEZITE_DB_PORTdatabase.portPostgreSQL port
MEZITE_DB_USERdatabase.userPostgreSQL user
MEZITE_DB_PASSWORDdatabase.passwordPostgreSQL password
MEZITE_DB_NAMEdatabase.namePostgreSQL database name
MEZITE_DB_SSLMODEdatabase.sslmodePostgreSQL TLS mode
MEZITE_LOG_LEVELlog.levelLog verbosity
MEZITE_LOG_FORMATlog.formatLog format (json or text)
MEZITE_CA_KEY_PASSPHRASEauth.ca_key_passphraseCA private key encryption passphrase
MEZITE_AUTH_H2C-Run gRPC in h2c mode (required behind a TLS-terminating LB)
MEZITE_GRPC_ALLOW_HTTPauth.grpc_allow_httpEnable h2c mode for gRPC without full insecure mode
MEZITE_TRUSTED_IP_HEADERproxy.trusted_ip_headerHTTP header to read real client IP from (e.g. X-Forwarded-For)
MEZITE_RECORDING_BACKENDrecording.backendRecording storage backend: local (default) or s3
MEZITE_S3_BUCKET-S3 bucket for recording storage
MEZITE_S3_REGION-S3 region (default: us-east-1)
MEZITE_S3_ENDPOINT-Custom S3 endpoint (for MinIO or other S3-compatible stores)
MEZITE_RECORDING_ENC_KEY-32-byte hex-encoded AES-256 key for recording encryption at rest
Example: SQLite with env vars (simplest self-hosted) bash
MEZITE_CLUSTER_NAME=production \
MEZITE_DB_DRIVER=sqlite \
MEZITE_DB_URL=/var/lib/mezite/mezhub.db \
MEZITE_LOG_LEVEL=info \
MEZITE_CA_KEY_PASSPHRASE='another-secret' \
mezhub
Example: PostgreSQL with env vars bash
MEZITE_CLUSTER_NAME=production \
MEZITE_DB_HOST=db.internal.example.com \
MEZITE_DB_PORT=5432 \
MEZITE_DB_USER=mezite \
MEZITE_DB_PASSWORD='hunter2' \
MEZITE_DB_NAME=mezite \
MEZITE_DB_SSLMODE=verify-full \
MEZITE_LOG_LEVEL=info \
MEZITE_LOG_FORMAT=json \
MEZITE_CA_KEY_PASSPHRASE='another-secret' \
mezhub

Production Config

mezite.yaml — production yaml
cluster_name: production

log:
  level: info
  format: json

database:
  driver: postgres
  host: db.internal.example.com
  port: 5432
  user: mezite
  # password set via MEZITE_DB_PASSWORD
  name: mezite
  sslmode: verify-full

auth:
  local_auth_enabled: false  # SSO only
  session_ttl: 8h
  # ca_key_passphrase set via MEZITE_CA_KEY_PASSPHRASE
  oidc:
    issuer_url: https://accounts.google.com
    client_id: your-client-id
    # client_secret set via environment
    redirect_url: https://mezite.example.com:443/v1/oidc/callback

proxy:
  public_addr: mezite.example.com:443
  listen_addr: 0.0.0.0:3080
  ssh_listen_addr: 0.0.0.0:3023
  tunnel_listen_addr: 0.0.0.0:3024

ssh:
  enabled: false  # dedicated proxy node, not an SSH target

Next Steps

  • Quickstart — Apply this configuration in a working setup.
  • Architecture — Understand how auth, proxy, and agent components interact.
  • SSH Access Guide — Deep dive into SSH certificate authentication and session recording.
  • SSO Guide — Configure OIDC or SAML authentication.