Skip to content

Overview

A running proxy is managed through its management interface, a TLS listener declared by the [admin] table. The listener serves two things: a web interface for administrators, and the management API that the interface itself uses and that scripts can call directly. Both authenticate with the same management token, and both can do the same things: observe sessions, destinations and the cache, move accounts between destinations, disconnect sessions and, when admin.config_write is enabled, change the configuration file and apply the change live.

The configuration file remains the source of truth. Every change made through the interface or the API is validated, written to the file and kept in a history of previous versions; a change made by hand is applied with a reload. Only the [admin] table itself, which controls the management plane, can never be changed through the interface. Who may reach the interface, and what a signed-in administrator can do with it, is covered under Security.

The other management pages describe the web interface, the management API, security, observability, cache invalidation and troubleshooting.

At startup, the proxy reads and validates its configuration, and exits with an error when validation fails. A configuration problem is therefore reported before any connection is served. The proxy then binds its listeners and the management interface, and starts accepting connections. The management interface is part of the process: when it cannot bind its address or stops unexpectedly, the whole proxy shuts down, so a proxy never runs without a way to manage it.

On SIGINT or SIGTERM, the proxy stops accepting connections and waits for established sessions to finish, for at most server.shutdown_grace. Sessions still open when the grace period ends are closed, and the process exits. No other signal is handled; in particular, there is no reload on SIGHUP.

Choosing shutdown_grace is a tradeoff. A long grace period avoids interrupting long transfers during a planned restart, while a short one bounds how long a restart takes. The service manager matters as well. The systemd unit of the install script stops the proxy with SIGINT, so a service restart lets sessions finish, but it sets no stop timeout of its own: systemd’s default stop timeout (90 seconds unless changed in system.conf) applies, and a longer shutdown_grace is cut short. The init.d script waits 30 seconds after SIGINT before it kills the process, so a shutdown_grace above 30 seconds is cut short there. The launchd property list sets no exit timeout either, so launchd’s default of 20 seconds applies on macOS.

A configuration file edited on the host is applied with a reload: the Reload from disk button on the configuration page of the web interface, or a request to the API:

Terminal window
TOKEN=$(sudo cat /etc/proxy/admin-token)
curl -sk -X POST -H "Authorization: Bearer $TOKEN" \
https://127.0.0.1:9443/api/v1/config/reload

The new file is validated in full and the complete new configuration is built, including certificates, the mapping store and any new listener sockets, before anything changes. Only when every step succeeds does the proxy switch to it, and the response carries the new revision and the settings that still need a restart. An invalid file is rejected with 422 and the list of errors, and the proxy keeps its previous configuration. A reload is therefore safe on a live deployment. Changes saved through the web interface or the API go through the same steps, as described under Applying changes.

A reload applies every section, including listeners, which bind, rebind or close their sockets live. The proxy keeps whatever state is still valid:

  • The lookup cache is kept when [mapping], routing.default_destination and the set of declared destination names are all unchanged, and the content of the mapping file is the same; any change starts with an empty cache. The cache hit and miss counters follow the cache.
  • The health state of a destination is kept when its host, server name, certificate verification, client certificate, forwarded, source addresses and protocol endpoints (port, TLS mode and forwarding) are unchanged, and starts fresh otherwise. A change to hide_auth_errors or allow_plaintext_auth keeps the health state. A removed destination loses it.
  • Open sessions continue with the configuration they started with, and the registry of connections that kick and delay act on is kept.
  • Management sessions remain signed in, unless the management token changed, which signs every session out.

A few settings are read only at startup: server.threads, server.log_level, admin.bind, and the presence of the [admin] table. A change to them is accepted and reported in restart_required, and the web interface shows a restart banner, until the service is restarted. A reloaded server.shutdown_grace applies to the next shutdown.

Three environment variables affect the proxy binary:

  • PROXY_CONFIG supplies the path of the configuration file, when none is given on the command line.
  • RUST_LOG overrides server.log_level with a tracing filter expression, which is convenient for raising the verbosity temporarily.
  • PROXY_ADMIN_TOKEN supplies the management token, and takes precedence over bearer_token_file and bearer_token in the file, so that a secret manager can provide it. It is read again on every reload and configuration change.

The install script places these variables in the environment file, /etc/proxy.env, which the service reads before starting. The container image adds PROXY_ADMIN_BIND, read only by its entrypoint on first start, which passes it to proxy init as the management address, as described under Container image.