Security
The management interface controls the whole proxy. With configuration writes enabled, a signed-in administrator can add listeners, repoint destinations, change the mapping store and upload certificates, and every change takes effect at once. Access to the interface is therefore as sensitive as root access to the proxy’s configuration, and is protected in layers: a network address that only administrators can reach, a long random token, limits on what the interface may configure that only the host can widen, and an audit trail of every change.
Network exposure
Section titled “Network exposure”The management interface listens only on admin.bind. Outside a container, proxy init binds it to 127.0.0.1:9443, so it is reachable from the proxy’s host only. An administrator on another machine reaches it through an SSH tunnel:
ssh -L 9443:127.0.0.1:9443 proxy.example.comand then opens https://127.0.0.1:9443/ui/ locally. Binding the interface to a routable address is appropriate only on a dedicated management network that clients and other tenants cannot reach. On every start and every applied change, a non-loopback bind is logged as a warning: admin.bind is not a loopback address: the management API is reachable from the network; bind it to loopback or a trusted management network. The bind is part of the read-only [admin] table, so it can only be changed in the file on the host, followed by a restart.
Containers
Section titled “Containers”Inside a container, a loopback bind would be unreachable from the host, so the image’s entrypoint initialises the interface on 0.0.0.0:9443, the value of PROXY_ADMIN_BIND. That address has consequences beyond the published port:
- Every other container on the same Docker network can reach the interface, whether or not the port is published, including the backends being migrated and any webmail or tooling container.
- Publishing the port without an address, as
-p 9443:9443, exposes it on every interface of the host, and Docker’s port publishing bypasses host firewalls such as ufw. Publish it as-p 127.0.0.1:9443:9443and use an SSH tunnel to the host. - With
--network host, the interface listens on every interface of the host.
PROXY_ADMIN_BIND is read only when the entrypoint creates the configuration on first start; changing it later has no effect, because the configuration in the volume is kept. To narrow the bind afterwards, for example to the container’s address on a dedicated management network, edit admin.bind in /etc/proxy/config.toml in the volume and restart the container. The container’s health check calls the URL in PROXY_HEALTHCHECK_URL, https://127.0.0.1:9443/healthz by default, so a bind that no longer covers 127.0.0.1:9443 needs that variable changed to match.
Reverse proxies
Section titled “Reverse proxies”The management interface is meant to be reached directly, not through a reverse proxy or load balancer. Its connection limits and its lockout are keyed on the TCP peer address, and it never reads X-Forwarded-For or a PROXY header. Behind a reverse proxy, every administrator appears with the reverse proxy’s address: all of them then share the eight connections allowed per client, one failed-sign-in counter locks them all out together, and anyone who can reach the reverse proxy can exhaust those connections, the health check included. The browser sessions, which are bound to the client address, would also no longer tell clients apart. Placing a reverse proxy in front of the management interface is therefore not supported; use an SSH tunnel or a management network instead.
First connection
Section titled “First connection”The certificate that proxy init creates is self-signed, so the browser asks whether to trust it on the first connection. Accept it only after comparing its SHA-256 fingerprint with the one proxy init printed (the container prints it to its log). A browser that accepts an unverified certificate over a network can hand the token to whoever intercepts the connection, and with it the whole management plane. A certificate from a trusted authority, uploaded under the name admin, removes the question; see Certificates.
Management token
Section titled “Management token”proxy init generates a token of 64 hexadecimal characters into admin-token next to the configuration, readable only by the account the proxy runs as. The token is never printed or logged. It can also be supplied by PROXY_ADMIN_TOKEN, which takes precedence over the file; the install script keeps this variable in /etc/proxy.env (or <prefix>/proxy.env for an installation under a prefix), owned by root and outside the configuration directory, so that nothing the proxy or the management interface can write is ever read by the service manager as root.
To rotate the token, replace the content of the file (at least min_token_len bytes) and reload the configuration. The new token takes effect at once and every browser session is signed out. The token is compared in constant time.
Configuration writes
Section titled “Configuration writes”With admin.config_write enabled, as proxy init sets it, the token or a browser session can change everything in the configuration except the [admin] table. Within the allowlist, that includes:
- Adding listeners that accept connections on new ports and relay them to any allowed destination host and port.
- Repointing destinations, including disabling backend certificate verification and allowing credentials to cross a backend connection in clear with
allow_plaintext_auth. - Changing the SQL queries of the mapping store, which run with the store’s credentials, and whose results the route lookup shows.
- Uploading certificates and pointing the mapping file at files inside the confined directories.
A stolen token or session on such a deployment is therefore worth the proxy’s service account plus the mapping store’s credentials. Masked secrets, the token and the store passwords, are never returned by the API and cannot be read back through it. Two measures limit the damage:
- Disable
config_writeonce the deployment is configured. The interface then shows the configuration read-only, and changes are made in the file on the host and applied with a reload; mapping changes, kicks and cache invalidation keep working. - Narrow the allowlist to the actual backends with
destination_hosts, so that a session cannot turn the proxy into a relay towards other internal services.
Every saved change is kept in the history, and changes to listeners and destinations are logged as warnings, as described under Audit trail.
Operator allowlist
Section titled “Operator allowlist”The [admin.allow] table limits what the management interface may configure. Like the rest of [admin], it is read-only through the interface and the API, so only someone with access to the file on the host can widen it. It has four lists, and an empty or absent list allows anything:
listener_addresseslists the networks, in CIDR notation, that listener binds must fall in, such as["192.0.2.0/24", "::/0"].listener_portslists the ports listeners may bind, as numbers or ranges such as"1024-65535".destination_hostslists the hosts destinations may point at: a host name (mail.example.com), a wildcard that covers subdomains but not the name itself (*.internal.example.com), or an address or network (10.0.0.0/8).destination_portslists the ports destination endpoints may use.
[admin.allow]listener_ports = [25, 143, 465, 587, 993, "1024-9442", "9444-65535"]destination_hosts = ["*.internal.example.com", "10.0.2.0/24"]destination_ports = [25, 143, 443, 465, 587, 993, 4190]proxy init writes the allowlist with two lists. listener_ports allows the usual mail and web ports (24, 25, 80, 110, 143, 443, 465, 587, 993 and 995) and every port from 1024 upwards except the management port. destination_ports allows 24, 25, 110, 143, 443, 465, 587, 993, 995, 4190, 8080 and 8443; port 80 is left out so that a destination cannot reach a cloud metadata service. listener_addresses and destination_hosts are left empty, so listeners may bind any address and destinations may point at any host. Until destination_hosts is set, a session can therefore reach any internal host on an allowed port, such as an internal web application on 443; setting it to the backends’ names or networks closes that gap.
A destination host given as an IP address is allowed only when it falls in one of the listed networks. A host name is allowed when it matches a listed name or wildcard. When it matches none, but the list contains networks, the name is accepted and checked when the proxy connects: the address actually reached must fall in one of the networks, otherwise the connection fails with backend address <address>:<port> is not allowed by admin.allow.destination_hosts. Hosts allowed by name are not checked again at connection time.
The allowlist is enforced whenever an [admin] table exists: at startup, on every reload, by the validation endpoint and on every change. The errors name the offending key:
listener.<name>.bind: <address> is not allowed by admin.allow.listener_addresseslistener.<name>.bind: <address> is not allowed by admin.allow.listener_portsdestination.<name>.host: "<host>" is not allowed by admin.allow.destination_hostsdestination.<name>.protocol.<p>.port: port <port> is not allowed by admin.allow.destination_ports
The web interface shows the allowlist on the listener and destination pages, and a Blocked by the operator banner when a change is refused by it.
Independently of the allowlist, the management port is reserved whenever the management interface binds a loopback or wildcard address. With a loopback bind, no listener may use that port on a loopback or wildcard address of either family; with a wildcard bind, no listener may use it on any address (<address> uses port <port> reserved by [admin] (bind <address>)). No listener can therefore intercept or shadow the management interface. A management interface on a specific routable address reserves nothing beyond its own address. The URLs of the Redis and SQL mapping stores are not covered by the allowlist.
Path confinement
Section titled “Path confinement”A change made through the interface or the API may only point file paths at files directly inside two directories next to the configuration file:
certs/, fortls.certificate.<name>.certandkey, and for a destination’stls_client_certandtls_client_keymappings/, formapping.file.path, and for the database file of a SQLitemapping.sql.url(an in-memory database is exempt)
Confinement keeps a session from reading or overwriting arbitrary files with the proxy’s permissions, for example by pointing a certificate at another service’s private key or the mapping file at a system file. The rules are strict:
- The path must be absolute and name a file directly inside the directory (
API edits may only reference a file directly inside <directory>). - The path must not contain
%(<path> contains '%'; percent-encoded paths are not accepted from the API), because SQLite URLs are percent-decoded and could otherwise name another file. - The directory must exist and must not be a symbolic link (
<directory> must be an existing directory, not a symlink). - An existing file must be a regular file, not a symbolic link (
<path> is not a regular file), with a single hard link (<path> has more than one hard link). A file that does not exist yet is accepted.
Only paths that a change introduces or modifies are checked, so paths written by hand elsewhere keep working until they are changed through the interface. The configuration file on the host is never confined: startup and reloads accept any path. A SQL query set through the API can still open other database files that the proxy’s account can read, which is one more reason to limit config_write as described above.
Connection limits
Section titled “Connection limits”The management interface protects itself from connection exhaustion with fixed limits:
- At most 64 connections at a time, of which 8 are reserved for loopback clients, so that the health check and an administrator on the host always get through.
- At most 8 connections from one client address, IPv6 addresses being grouped by their /64 prefix.
- At most 32 connections from non-loopback clients that have not authenticated yet. When a new connection would exceed this, the oldest unauthenticated connection of the client holding the most of them is closed.
A connection must complete its TLS handshake within 10 seconds and send its first request within another 10. An unauthenticated connection is closed after 5 seconds without a request, an authenticated one after 30 seconds, and every connection after 100 requests or 5 minutes. Connections over a limit are closed without a response, and logged as admin connection limit reached at most once a minute, with a count of the refusals suppressed in between.
Lockout
Section titled “Lockout”Failed authentications, a wrong or empty bearer token or a wrong token at sign-in, are counted per client address, IPv6 addresses again grouped by their /64 prefix. When an address reaches admin.lockout_threshold failures, each within admin.lockout_duration of the previous one, it is refused with 429 Too Many Requests and locked_out for lockout_duration, on every path including the web interface’s files. A successful authentication resets the count.
Two requests are exempt: /healthz, so that monitoring keeps working, and requests carrying a valid browser session cookie without a bearer header, so that an administrator already signed in is not locked out by someone else at the same address. Loopback addresses are not exempt. Clients behind a shared IPv4 address, or in the same IPv6 /64, share one counter, so one of them can keep the others from signing in; this is another reason to keep the interface off shared networks. The lockout table holds up to 16384 addresses; when it is full, expired entries are dropped first, then the address with the oldest failure. Lockouts are held in memory and end at a restart.
Audit trail
Section titled “Audit trail”The management interface records its security events in the log:
admin 401 unauthorized, with the client address and the path, for every rejected bearer tokenadmin session login failed, for a wrong token at sign-in, andadmin session loginandadmin session logout, with the session tagadmin client address locked out, with the address and the durationadmin connection limit reached, as described under Connection limitsadmin saved configuration, with the new revision, for every changeadmin changed listeners or destinations, as a warning, for every change that adds, removes or alters a listener or destination
The last line names the actor (bearer or session:<tag>), the client address, the revision and a summary such as listener imaps changed (imap tls=Implicit bind=[0.0.0.0:993]); destination legacy added (host 192.0.2.10), so that an unexpected new listener or destination stands out in the log. Mapping changes, kicks, delays, cache invalidations and health resets are logged at info level, with identifiers shortened to a hashed tag.
The same actions are recorded in the in-memory activity log, which the web interface shows, but that log holds only the last 512 events and is lost at a restart. For a durable record, collect the proxy’s log.
File locations
Section titled “File locations”A standard installation keeps the management plane’s files in these locations:
| Path | Content |
|---|---|
/etc/proxy/config.toml | Configuration file, rewritten by configuration changes and readable only by the proxy’s account |
/etc/proxy/admin-token | Management token |
/etc/proxy/certs/ | Certificates and keys, created by proxy init and by uploads |
/etc/proxy/mappings/ | Mapping files that the interface may reference |
/etc/proxy/config.toml.history/ | The last 10 replaced versions of the configuration, each readable only by the proxy’s account |
/etc/proxy.env | Environment file of the service, owned by root |
In the container image, the first five live in the /etc/proxy volume, and there is no environment file.