Skip to content

Troubleshooting

Most problems with the proxy fall into a few groups:

  • A configuration rejected at startup, or a change rejected when it is applied
  • A management interface that cannot be reached or refuses to sign in
  • An account routed to the wrong destination
  • A backend that cannot be reached
  • A TLS negotiation that fails on one of the two connections

The web interface, the management API and the logs described under observability are the diagnostic tools. Problems specific to a migration, such as split delivery, are covered by the migration guide’s troubleshooting page.

The configuration is validated at startup, and the error is reported in one of two ways. An error found while the file is parsed and validated stops the proxy with invalid configuration: configuration error: followed by every problem found, each prefixed with the dotted path of the key, for example invalid configuration: configuration error: routing.default_destination: undeclared destination "legacy". Errors found later in the startup, when the configuration is put to use, are logged as a fatal error line, one at a time. Examples of the latter are an unreadable certificate, mapping file or token file, an unreachable or invalid mapping store, and an address that cannot be bound.

A missing file stops the proxy with failed to read config <path>: No such file or directory, and a missing path with a usage message. A file that passes validation but declares neither listeners nor [admin] has nothing to run, and the proxy stops with a fatal error line carrying no listeners configured. The common validation errors are:

  • A listener without routing. Every listener needs [routing] with a default destination (listener.<name>: a listener requires a [routing] section with default_destination).
  • The default destination is not declared (routing.default_destination: undeclared destination "<name>").
  • The default destination lacks a protocol. Every protocol that a listener accepts, HTTP included, must be declared on the default destination, because accounts without a mapping go there; only SMTP and LMTP pass-through are exempt (listener.<name>.protocol: default_destination "<name>" does not declare protocol <p> required by this listener).
  • Credentials over plaintext. A destination that declares a protocol carrying credentials, HTTP included, with tls = "plain" is rejected (destination.<name>.protocol.<p>.tls: uses plaintext TLS but carries credentials; set allow_plaintext_auth to override). Encrypt the connection, or set the override if it is protected by other means.
  • TLS to an IP address without a server name (destination.<name>.tls_server_name: required: the host is an IP address and protocol <p> uses TLS).
  • An invalid certificate pin. tls_pinned_cert_sha256 must hold 64 hexadecimal characters, optionally separated by colons (tls_pinned_cert_sha256 is not valid hex).
  • No certificate for TLS. A TLS listener or the management interface needs at least one [tls.certificate.*] entry (tls.certificate: a TLS listener or [admin] needs a certificate; set allow_self_signed = true to serve a generated self-signed one).
  • A pass-through listener with STARTTLS, or without a pass-through destination. The errors are listed under SMTP and LMTP pass-through.
  • An optional PROXY header on a mail listener. proxy_protocol = "optional" is accepted only on HTTP listeners, and a listener that reads PROXY headers needs proxy_trusted (proxy_protocol is enabled but proxy_trusted is empty).
  • An HTTP route names an unusable destination (http.route[<index>].fallback: destination "<name>" does not declare the http protocol), as described under HTTP routing.
  • A mapping store without its table. source = "redis" and source = "sql" require [mapping.redis] and [mapping.sql]. A rediss:// Redis URL is rejected with invalid redis url: can't connect with TLS, the feature is not enabled.
  • The mapping file is missing, names an unknown destination, or has a malformed line. The file must exist at startup, even when it holds no entries yet (failed to read mapping file <path>). The other errors name the line: mapping file <path>:<line> references an undeclared destination and mapping file <path>:<line> is not <identifier> <destination>. Every destination named in the file must also declare the protocols of the listeners (mapped destination "<name>" does not declare protocol <p> required by a listener).
  • The management token is missing or short. Without a token, validation fails with admin.bearer_token: admin requires bearer_token_file, bearer_token, or PROXY_ADMIN_TOKEN. A short inline token fails with admin.bearer_token: shorter than min_token_len (32), and a short token from the file or the environment with the fatal error admin token is shorter than min_token_len (32). An unreadable token file reports failed to read admin token <path>.
  • Overlapping binds. Two listeners, or a listener and the management interface, cannot bind the same or overlapping addresses (listener.<name>.bind: <address> overlaps <address> bound by listener "<name>", listener.<name>.bind: <address> is already bound by [admin]). When the management interface binds a loopback or wildcard address, a listener on its port is refused with <address> uses port <port> reserved by [admin] (bind <address>): on a loopback or wildcard address when the management bind is loopback, and on any address when it is a wildcard.

Unknown keys stop startup: a misspelled key is reported as TOML parse: unknown field with the key’s name, the line and the keys that are accepted there.

An address that cannot be bound stops startup with listener <name>: failed to bind <address>: <reason>; the usual causes are another process holding the port, or a port below 1024 without the CAP_NET_BIND_SERVICE capability. When the management address cannot be bound, the log shows admin listener exited with the reason, followed by shutting down reason=the admin task exited unexpectedly, and the proxy exits.

A change saved from the web interface, sent to the API or applied with a reload goes through the same validation as startup, and in addition builds the complete new configuration and binds new listener addresses before anything is written. A rejected change is reported with 422 and the list of errors; the web interface shows them in a Validation failed dialog, and nothing is saved or applied. Besides the startup errors above, the following causes are specific to changes:

  • Blocked by the operator allowlist. An address, host or port outside [admin.allow] is refused with errors such as listener.<name>.bind: <address> is not allowed by admin.allow.listener_ports or destination.<name>.host: "<host>" is not allowed by admin.allow.destination_hosts. Only the configuration file on the host can widen the allowlist, as described under Operator allowlist.
  • A file outside the confined directories. A changed certificate, key or mapping file path must name a file directly inside certs/ or mappings/ next to the configuration file (API edits may only reference a file directly inside <directory>), as described under Path confinement.
  • The [admin] table was changed. The table is read-only through the interface and the API (the [admin] table is read-only through the API), including when a history version with a different [admin] table is restored.
  • A port moved between a wildcard and a specific address. Applied in one change, the new address cannot be bound while the old socket holds the port, and the error ends with <address> is still bound by a running listener, apply its removal first, then add <address> in a second apply. Remove the old bind in one change, then add the new one.
  • The file changed on disk. A change is based on the revision of the file it was made from; when the file changed in the meantime, the change is refused with 409 and the configuration changed on disk; reload and retry. The web interface reloads the page with the current file.
  • Writes are disabled. With admin.config_write unset or false, every change is refused with 403 and configuration writes are disabled (admin.config_write). Edit the file on the host and reload instead.

A change that was saved but could not be applied is reported with 503 and configuration saved but not applied; reload to apply it. The file on disk holds the new configuration, and a reload applies it.

Management interface cannot be reached or refuses sign-in

Section titled “Management interface cannot be reached or refuses sign-in”

The management interface listens only on admin.bind, which proxy init sets to 127.0.0.1:9443 outside a container. From another machine, reach it through an SSH tunnel (ssh -L 9443:127.0.0.1:9443 <host>) rather than binding it to a public address, as described under Security. A change to admin.bind takes effect only after a restart.

The common sign-in problems are:

  • The browser rejects the certificate. The certificate created by proxy init is self-signed. Compare its SHA-256 fingerprint with the one printed by the init step before accepting it. Without an admin certificate entry, the interface may present a certificate generated at each reload, which the browser reports as changed every time; see Certificates.
  • Invalid token. The interface reports Invalid token. Repeated failures lock this address out for a while. The token is the content of the token file, /etc/proxy/admin-token for a standard installation, or the value of PROXY_ADMIN_TOKEN, which takes precedence.
  • The address is locked out. After admin.lockout_threshold failed attempts (5 by default), the address is refused with 429 and too many failed attempts from this address for admin.lockout_duration (300 seconds by default), on every path except /healthz. The log shows admin client address locked out. Wait for the lockout to end; a restart also clears it.
  • The session ends unexpectedly. A session ends after admin.session_idle_timeout without activity, after admin.session_lifetime in total, when the client’s address changes, and when the management token changes. The interface then shows The session expired. Sign in again to continue.
  • The connection is dropped without a response. The management interface accepts a limited number of connections overall and per client address, and drops further ones without a reply; the log shows admin connection limit reached. The limits are described under Connection limits.

An account is routed to the wrong destination

Section titled “An account is routed to the wrong destination”

Start with the route lookup on the mappings page of the web interface, or GET /api/v1/mappings/lookup?identifier=<identifier>. It shows how an account resolves: the identifier after the master user suffix is removed, its normalised form, the value in the store, the destination, whether that is the default destination, and the state of its cache entry, without changing the cache. The usual causes are:

  • A cached lookup. The store changed, but the account still resolves to its previous destination until the cache entry expires. Invalidate it with Invalidate cache in the lookup panel, or POST /api/v1/cache/invalidate with the identifier in the JSON body, as described under Cache invalidation.
  • The mapping file was edited but not reloaded. The file is held in memory, so reload it with Reload store or POST /api/v1/mappings/reload, and then clear the cache.
  • A case mismatch in Redis or SQL. With normalize = "lowercase", the proxy looks up the lowercased identifier, so entries written directly to Redis or SQL must be lowercase. The file store lowercases its entries itself.
  • A master user suffix. When logins carry a master user suffix, master_user_separators must list the separator, so that the identifier is the mailbox owner and not the whole login.
  • A bare name and an address. The proxy does not relate alice to [email protected], so each login form needs its own entry.

When connections to a destination fail, the destination’s page in the web interface, or GET /api/v1/destinations, shows its state (up, degraded or down), its failure streak and the last failure with the stage it occurred at. A destination marked down refuses new connections for server.host_down_cooldown. After that, the next connection probes it. Once the cause is fixed, Reset health or POST /api/v1/destinations/<name>/reset returns it to service at once.

The failure count does not always point at the backend. A count that climbs while failure_sources stays at 1 and host_level_failure is false points at one client. The backend has usually banned that client’s address, which the proxy forwards, and rejects every connection opened for it. The destination is not marked down in that case. The API does not report the client’s address, but the proxy log does, in the peer field of the connection, unless the proxy itself sits behind a load balancer.

The response that clients receive also helps. While a backend is unreachable, mail clients receive the protocol’s temporary failure response (for example 421 in submission, or [UNAVAILABLE] in IMAP), not an authentication error. A temporary failure at sign-in therefore points at the backend, not at the credentials. HTTP clients receive 502 Bad Gateway, and pass-through SMTP connections are closed without a reply.

TLS is negotiated separately with the client and with the backend, so the first step is to find out which side fails:

  • The backend’s certificate is not trusted. By default, the backend’s certificate is verified against the platform’s trust store, with tls_server_name or host. A self-signed or privately issued certificate fails. Pin it with tls_pinned_cert_sha256, or, on a trusted network only, set tls_allow_invalid_certs.
  • Name mismatch. The backend’s certificate must cover tls_server_name, so set it to a name the certificate carries.
  • The backend does not offer STARTTLS. A starttls endpoint requires the backend to advertise and accept STARTTLS. Otherwise, the connection is closed, and never continued without encryption. Check the backend’s port, or use implicit or plain as appropriate.
  • The backend does not expect a PROXY header. A destination sends a PROXY header on every connection by default, including HTTP. A backend that does not expect one fails to read the connection, often reported as a TLS decode error. Set forwarding to the mode the backend understands, as described under Destinations.
  • Clients do not trust the proxy’s certificate. Configure a certificate for the name that clients use. A single certificate is presented for every name. With several, configure a default: when none matches and no default exists, the handshake fails (or, with tls.allow_self_signed, the proxy presents an untrusted self-signed certificate), and the proxy logs several certificates and none is the default: a client sending no or an unmatched SNI name fails the handshake. The admin certificate created by proxy init is the default until another certificate is made the default, so mail clients that receive the self-signed management certificate need a certificate for the mail host name marked as the default.

Client addresses are those of a load balancer

Section titled “Client addresses are those of a load balancer”

When the proxy sits behind a load balancer and the backends see the load balancer’s address instead of the client’s, the listener must accept the PROXY protocol, with proxy_protocol set to optional or required, and list the load balancer’s network in proxy_trusted. With optional, a header from an address outside the trusted networks is ignored. With required, such a connection is rejected. Either way, clients cannot forge their address.

The proxy refuses connections that would reach itself, with one of three messages, prefixed with configuration error: in the log:

  • proxying loop: destination is one of our own listeners: the destination’s host is an IP address that, with the endpoint’s port, equals a listener bind or the management bind.
  • proxying loop: backend connection reached one of our own listeners: the address actually reached, for a host name or with a wildcard bind, is the proxy itself.
  • proxying loop: forwarded TTL exhausted: the destination uses XCLIENT forwarding and server.proxy_ttl is 1 or less.

Check that no destination points back at an address or host name of the proxy itself, and that server.proxy_ttl has its default value. A loop is a configuration error, so it is not retried and does not mark the destination down. The checks are described under Loop prevention.