Reference

Reference

Configuration reference

Every environment variable the Postern Hub reads, with its default, format, validation errors and where to set it for each install method.

This page has instructions for several ways of running the Hub. Each is shown under its name.

This page lists every setting the Hub reads, what it does and where you put it. The Hub has no configuration file of its own: it reads environment variables named POSTERN_* and a few command-line flags. A flag wins over the matching variable.

The Hub reads its configuration once, at start. After a change, restart it. Some settings can also be changed at runtime in the admin panel (Hub name, registration, Google and Microsoft app credentials); for the provider apps, a value set by environment variable wins and shows as coming from the environment.

Where to set variables #

Docker Compose

With Docker Compose, the Hub's settings live in ~/postern/, next to compose.yaml.

.env holds the variables that compose.yaml passes to the Hub or uses itself. Only these work in .env:

Variable Used by
POSTERN_PUBLIC_URL, POSTERN_TRUST_PROXY, POSTERN_RELAY_URL, POSTERN_LOG_FORMAT, TZ Passed into the Hub container
POSTERN_VERSION, POSTERN_BIND, POSTERN_DATA_VOLUME, POSTERN_KEY_VOLUME Compose itself (image tag, published port, volume names)
POSTERN_DOMAIN The optional caddy profile
POSTERN_VERSION=local
POSTERN_BIND=127.0.0.1:8080
POSTERN_PUBLIC_URL=https://mail.example.com
POSTERN_TRUST_PROXY=true
TZ=Europe/Berlin

compose.override.yaml holds every other variable. Docker Compose reads this file automatically when it sits next to compose.yaml, and merges it in. Put the variables under services: hub: environment:. Quote every value so YAML keeps it as text:

# ~/postern/compose.override.yaml
services:
  hub:
    environment:
      POSTERN_TRUSTED_PROXIES: "172.16.0.0/12"
      POSTERN_CLIENT_IP_HEADER: "CF-Connecting-IP"
      POSTERN_OIDC_ISSUER: "https://auth.example.com/application/o/postern/"
      POSTERN_OIDC_CLIENT_ID: "postern"
      POSTERN_OIDC_CLIENT_SECRET: "${OIDC_SECRET}"
      POSTERN_OIDC_NAME: "Authentik"
      POSTERN_BACKUP_KEEP: "14"
      POSTERN_MAX_UPLOAD_MB: "50"

${OIDC_SECRET} is filled in from .env (add OIDC_SECRET=... there), which keeps secrets out of the YAML file. A literal $ in a value must be written $$.

Apply the change, then check it:

cd ~/postern && docker compose up -d
docker compose exec hub postern-hub doctor

docker compose config prints the merged configuration if you want to see what the Hub gets.

Do not set POSTERN_DATA_DIR, POSTERN_KEY_FILE or POSTERN_LISTEN in Docker. The image sets them to /data, /key/hub.key and :8080, and the volumes, the port mapping and the health check depend on these values.

Debian and Ubuntu, Fedora and RHEL and Raspberry Pi OS

On a systemd install, the variables live in /etc/postern/hub.env (owner root, group postern, mode 0640). The unit /etc/systemd/system/postern-hub.service reads it with EnvironmentFile=. The template is deploy/systemd/hub.env; every line in it is commented out except the three basics.

Rules for the file:

  • One KEY=value per line. Lines starting with # are comments.
  • No comments at the end of a line: systemd would keep them as part of the value.
  • Quotes are optional. Use them for values with spaces (POSTERN_OIDC_NAME="Single sign-on").
  • The file can hold secrets. Keep it root:postern and 0640.

The unit also sets three defaults with Environment=, which hub.env overrides:

Environment=POSTERN_DATA_DIR=/var/lib/postern
Environment=POSTERN_KEY_FILE=/var/lib/postern-key/hub.key
Environment=POSTERN_LISTEN=127.0.0.1:8080

Edit the file, restart the Hub, then check it:

sudo editor /etc/postern/hub.env
sudo systemctl restart postern-hub
sudo -u postern sh -c 'set -a; . /etc/postern/hub.env; exec postern-hub doctor'

Commands you run by hand (like doctor above) do not see the unit's Environment= lines, only what you load from hub.env. Keep POSTERN_DATA_DIR and POSTERN_KEY_FILE in hub.env (the template has them) so the commands find the same data as the service.

For settings that are better kept out of a file (like POSTERN_KEY_PASSPHRASE), use a drop-in with sudo systemctl edit postern-hub.

Desktop app (built-in Hub)

Not applicable. The desktop app starts its built-in Hub itself and passes everything it needs on the command line: --data-dir, --key-file, --listen 127.0.0.1:<port> and --public-url http://localhost:<port>, plus POSTERN_LOG_FORMAT=json, POSTERN_TRUST_PROXY=false and POSTERN_EXIT_ON_STDIN_CLOSE=1. There is no file to edit and no setting in the app for Hub variables.

The built-in Hub inherits the environment the app was started from, so a POSTERN_* variable set there also reaches it. This is not a supported way to configure it.

The desktop app itself reads a few variables of its own: see Desktop app variables.

Value formats #

Type Accepted values Notes
String Any text Leading and trailing spaces are removed. An empty value counts as set (empty).
Boolean 1, true, yes, on (any case) Anything else, including an empty value, is false.
Integer A whole number, like 25 Anything else stops the Hub with an error.
Duration Go syntax: 30m, 12h, 24h, 168h, 1h30m; 0 There is no d unit: write 168h for a week. 0 turns the feature off.
URL An absolute http:// or https:// URL A trailing / is removed.
List Comma-separated, like 127.0.0.1,::1 Spaces around items are ignored.

Legacy names. Installs from before the rename to Postern used MC_* names (and MAILCLIENT_* for the Docker Compose, installer and desktop app variables). The Hub still reads MC_<name> when POSTERN_<name> is not set. When both are set, POSTERN_* wins; if the two values differ, the Hub logs a warning at start and postern-hub doctor warns:

! MC_LISTEN is ignored: POSTERN_LISTEN is set too, with another value (rename the old MC_* lines in your env file)

On a systemd install the unit's own POSTERN_DATA_DIR, POSTERN_KEY_FILE and POSTERN_LISTEN defaults win over old MC_* lines, so rename them. See Migrating from MailClient.

Errors at start #

When a value is invalid the Hub does not start. It prints the error on standard error, prefixed with error:, and exits with code 1. These are all the configuration errors:

Message Cause
POSTERN_PUBLIC_URL must be an absolute http(s) URL, got "mail.example.com" The URL has no http:// or https://, or no host.
POSTERN_TRUSTED_PROXIES: invalid CIDR "10.0.0/8" A list item with / is not a valid prefix.
POSTERN_TRUSTED_PROXIES: invalid IP address "proxy" A list item without / is not an IP address (host names are not allowed).
POSTERN_BACKUP_INTERVAL: time: invalid duration "1d" Not a Go duration.
POSTERN_BACKUP_KEEP: strconv.Atoi: parsing "seven": invalid syntax Not a whole number. The same form appears for POSTERN_MAX_UPLOAD_MB, POSTERN_BODY_CACHE_DAYS, POSTERN_BACKFILL_DAYS and POSTERN_HUB_MAIL_COPY_DAYS.
POSTERN_HUB_MAIL_COPY_DAYS must be at least 1, got 0 Zero or negative.
POSTERN_TLS_CERT and POSTERN_TLS_KEY must be set together Only one of the two is set.
POSTERN_ACCESS_CLIENT_ID and POSTERN_ACCESS_CLIENT_SECRET must be set together Only one of the two is set.
POSTERN_ACCESS_CLIENT_ID / POSTERN_ACCESS_CLIENT_SECRET: gateway header CF-Access-Client-Secret has an empty or too long value A value is longer than 1024 characters. A value with characters outside printable ASCII gives ... has a non-printable value.
flag --listen needs a value A global flag at the end of the command line without a value.
vault: key file is sealed; set POSTERN_KEY_PASSPHRASE The key file is sealed and no passphrase is set.
vault: wrong passphrase for sealed key file POSTERN_KEY_PASSPHRASE does not unlock the key file.
vault: malformed key file, vault: unrecognized key file format The key file is damaged or is not a Postern key file.
the data directory is in use by a running Hub (/var/lib/postern/hub.lock) Another Hub process already uses this data directory.

Core #

Variable Default Docker What it does
POSTERN_DATA_DIR ./data set by the image (/data) Data directory: hub.db, blobs/, backups/, acme/ and the lock and setup-code files (full list). Made absolute at start, created with mode 0700 if missing. Flag: --data-dir.
POSTERN_LISTEN :8080 set by the image (:8080) Address and port to listen on. :8080 means every interface; 127.0.0.1:8080 only this machine. The systemd unit sets 127.0.0.1:8080. Flag: --listen.
POSTERN_PUBLIC_URL empty .env The address people use to reach the Hub, like https://mail.example.com. Used for invite and pairing links, OAuth and single sign-on redirect URIs, passkeys and the same-origin check. Empty: derived from each request (Host, and X-Forwarded-Proto/X-Forwarded-Host with POSTERN_TRUST_PROXY). Flag: --public-url.
POSTERN_KEY_FILE <data dir>/hub.key set by the image (/key/hub.key) The master key file. Created with mode 0600 on first start if missing. Keep it outside the data directory and back it up separately: backups never contain it. See Encryption. Flag: --key-file.
POSTERN_KEY_PASSPHRASE empty override Unlocks a sealed key file (postern-hub keygen --sealed). Ignored for a plain key file. If it is set when the Hub creates a new key file on first start, that file is sealed with it.
POSTERN_LOG_LEVEL info override debug, info, warn (or warning), error. Any other value means info. Flag: --log-level.
POSTERN_LOG_FORMAT text .env text or json. Any other value means text. Logs go to standard error. See Logs.
POSTERN_TRUST_PROXY off .env Honor X-Forwarded-For, X-Forwarded-Proto and X-Forwarded-Host from a reverse proxy. Turn it on only when the Hub is reachable solely through your proxy. See Client IP behind a proxy.
POSTERN_TRUSTED_PROXIES 127.0.0.0/8,::1/128,10.0.0.0/8,172.16.0.0/12,192.168.0.0/16,fc00::/7 override IP addresses and CIDR prefixes of the proxies allowed to tell the Hub the client IP. Only used with POSTERN_TRUST_PROXY. Narrow it to your proxy's address when you can.
POSTERN_CLIENT_IP_HEADER empty override A header your proxy sets to the client IP, which then wins over X-Forwarded-For. Behind Cloudflare (a proxied DNS record or cloudflared): CF-Connecting-IP. Only honored from a trusted proxy.
POSTERN_DEV off override Development mode. Never use it on a real Hub. See Development settings. Flag: --dev.

Built-in HTTPS #

Usually a reverse proxy, Tailscale or Cloudflare handles HTTPS (see HTTPS). The Hub can also do it itself.

Variable Default Docker What it does
POSTERN_TLS_DOMAIN empty not useful Get a certificate from Let's Encrypt (ACME) for this domain. Certificates are cached in <data dir>/acme. The Hub also listens on :80 for ACME challenges and redirects to HTTPS. If POSTERN_LISTEN is exactly :8080 (the built-in default), the Hub listens on :443 instead.
POSTERN_TLS_EMAIL empty not useful Contact address for the ACME account (expiry notices).
POSTERN_TLS_CERT empty not useful Path to a PEM certificate (with chain). Set together with POSTERN_TLS_KEY. The Hub serves HTTPS on POSTERN_LISTEN; nothing listens on port 80.
POSTERN_TLS_KEY empty not useful Path to the PEM private key for POSTERN_TLS_CERT.

Important

The systemd unit sets POSTERN_LISTEN=127.0.0.1:8080, which is not the built-in :8080, so with POSTERN_TLS_DOMAIN the Hub would serve HTTPS on 127.0.0.1:8080. Set POSTERN_LISTEN=:443 in hub.env as well. Ports 80 and 443 also need the CAP_NET_BIND_SERVICE capability: replace CapabilityBoundingSet= and AmbientCapabilities= in the unit as its comments describe (sudo systemctl edit postern-hub).

With Docker Compose, the provided compose.yaml publishes only port 8080 and its health check uses plain HTTP on 8080, so built-in HTTPS does not fit. Use the caddy profile (POSTERN_DOMAIN) instead.

Access gateway (Cloudflare Access) #

Variable Default Docker What it does
POSTERN_ACCESS_CLIENT_ID empty override Client ID of a Cloudflare Access service token that guards the Hub's public address. Set together with POSTERN_ACCESS_CLIENT_SECRET.
POSTERN_ACCESS_CLIENT_SECRET empty override Its client secret.

With both set, the Hub hands the token only to apps that are already signed in: in the pairing QR code shown by a signed-in app, in the app sign-in redirect and in every sign-in result that carries a device token. The iOS, Android and desktop apps (and their mail engines) then send CF-Access-Client-Id and CF-Access-Client-Secret on every request to the Hub, WebSockets included. Browsers pass Access on their own (for example with a one-time email code). The token is a second lock in front of the Hub's own sign-in, never a replacement for it.

postern-hub doctor fetches /api/v1/info through the gateway with the token and reports when Access turns it away. Setup: Cloudflare.

Push notifications #

Variable Default Docker What it does
POSTERN_RELAY_URL empty (off) .env The push relay that wakes the iOS and Android apps through Apple and Google, like https://relay.example.org; for the App Store and TestFlight app, the official https://relay.posternmail.app. Empty: no relay push; Web Push and UnifiedPush still work. See Push relay and Run your own relay.

doctor checks that the relay answers. The relay has its own settings (RELAY_*, APNS_*, FCM_*), described in Run your own relay.

Updates #

Variable Default Docker What it does
POSTERN_UPDATE_FEED https://updates.posternmail.app compose.override.yaml Where the Hub looks for new versions. off stops the checks (Settings › Admin › Updates then says so).
POSTERN_SELF_UPDATE empty – systemd lets a Hub installed with the self-update units hand updates to the root helper. Set by postern-hub.service.d/self-update.conf, not by hand (deploy/systemd/README.md).
POSTERN_UPDATER_URL empty set by compose.yaml The compose updater service (http://updater:7342). Empty: the Hub doesn't update itself and shows the manual commands.
POSTERN_UPDATER_TOKEN_FILE /updater/token – The token the updater writes and the Hub reads.

How updates are checked and installed: Upgrades.

Single sign-on (OIDC) #

Variable Default Docker What it does
POSTERN_OIDC_ISSUER empty override Issuer URL of your identity provider, like https://auth.example.com/application/o/postern/. Single sign-on is on when this and the client ID are set.
POSTERN_OIDC_CLIENT_ID empty override Client ID registered with the identity provider.
POSTERN_OIDC_CLIENT_SECRET empty override Its client secret.
POSTERN_OIDC_NAME Single sign-on override Label of the button on the sign-in page, like Authentik.
POSTERN_OIDC_AUTO_REGISTER off override Create a Hub account for someone who signs in with SSO for the first time and has none. Off: only people who already have a linked account can sign in with SSO.
POSTERN_OIDC_LINK_BY_EMAIL off override On someone's first SSO sign-in, link the identity to an existing Hub account with the same email, if the provider says the email is verified. Off: existing accounts cannot sign in with SSO. Even when on, an account whose sign-in email changed in the last 7 days is not linked. Turn it on only if your provider verifies email addresses and nobody else can register one of your users' addresses there.

Register this redirect URI with your identity provider (the Hub asks for the scopes openid, email and profile):

https://mail.example.com/api/v1/auth/oidc/callback

The host is POSTERN_PUBLIC_URL, or the address the browser used when it is not set. More in Sign-in methods.

Mail providers #

Variable Default Docker What it does
POSTERN_GOOGLE_CLIENT_ID empty override Your own Google OAuth client for Gmail (API sign-in). Can also be set in the admin panel. See Gmail.
POSTERN_GOOGLE_CLIENT_SECRET empty override Its client secret. Set both or neither; doctor warns when only one is set.
POSTERN_MICROSOFT_CLIENT_ID empty override Your Microsoft Entra application (client) ID. Can also be set in the admin panel. See Microsoft.
POSTERN_MICROSOFT_TENANT common override common, organizations, consumers, or a tenant ID or domain.
POSTERN_GMAIL_QUOTA_SHARE Hub 0.6, device engine 0.3 override Share of Google's per-user Gmail API quota (15,000 units a minute) this process may use, as a number between 0 and 1, like 0.5. Values above 1 count as 1; zero, negative or unreadable values are ignored. Change it only if Google reports rate limits for an account.

Backups #

Variable Default Docker What it does
POSTERN_BACKUP_INTERVAL 24h override How often the Hub writes a scheduled backup. 0 (or a negative duration) turns scheduled backups off; doctor warns.
POSTERN_BACKUP_KEEP 7 override How many scheduled backups to keep. Older ones are deleted after each backup. Values below 1 count as 1.
POSTERN_BACKUP_DIR <data dir>/backups override Where backups go. Before a schema migration the Hub also writes pre-migrate-<time>.db here. On a systemd install a directory outside /var/lib/postern needs ReadWritePaths= in the unit.

Backups never contain the key file. See Backups.

Storage and sync #

Variable Default Docker What it does
POSTERN_MAX_UPLOAD_MB 25 override Largest attachment upload, in MB. 0 or less means 25.
POSTERN_BODY_CACHE_DAYS 30 override The Hub downloads message bodies newer than this many days ahead of time; older ones load when opened. 0 turns prefetching off.
POSTERN_BACKFILL_DAYS 0 override How far back the Hub syncs history, in days. 0 means everything.
POSTERN_HUB_MAIL_COPY_DAYS 30 override How many days after someone last used the web app the Hub deletes its copy of their mail. Minimum 1. See below.
POSTERN_RULES_ALLOW_LAN off override Let rule webhooks and alert channels (ntfy, Discord, Gotify) reach private networks: 10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16, 100.64.0.0/10, fc00::/7, for example a Gotify or Home Assistant on your LAN. Loopback and link-local addresses stay blocked. See Alerts and Webhooks.

The Hub's mail copy. The desktop and mobile apps read mail straight from your provider. Only the web app needs the Hub to hold a copy, so the Hub keeps one only while the web app is in use:

  1. For 7 days after your last web app visit, the copy is kept fully up to date.
  2. After that the Hub only watches each inbox (the last 7 days of headers) for notifications, rules, snoozes and the Screener. The copy stays where it is; the next web app visit catches up from where it stopped, usually in seconds.
  3. POSTERN_HUB_MAIL_COPY_DAYS days after your last visit, the copy is deleted. The next visit downloads the mailbox again, which takes minutes for a large one.

If POSTERN_HUB_MAIL_COPY_DAYS is below 7, stage 1 ends and the copy is deleted when that many days have passed. Each person can keep the copy for good with Settings → Reading & sending → Keep a full copy of my mail on my Hub.

Development settings #

Variable Default Docker What it does
POSTERN_DEV off override Development mode, see below.
POSTERN_WEB_DIR empty override Serve the web app from this directory instead of the copy built into the binary (for development or a custom web build).
POSTERN_EXIT_ON_STDIN_CLOSE off not used For the desktop app only. Exactly 1 makes postern-hub serve shut down when its standard input, a pipe held by the parent process, reaches its end. Never set it for a Hub run by systemd, Docker, launchd or a shell pipeline. Without it, and whenever standard input is not a pipe or socket (a terminal, /dev/null, a file), the Hub never stops because of its standard input.

POSTERN_DEV (or --dev) changes this:

  • The log level info becomes debug.
  • The image proxy, one-click unsubscribe, push endpoints, JMAP session URLs and rule webhooks may use private addresses and plain http://.
  • App sign-in accepts exp:// redirect URIs (Expo development builds).
  • The admin panel shows the warning "Development mode is on (POSTERN_DEV): security checks are relaxed."

Mail server autodiscovery reads the POSTERN_DEV variable itself (then it allows private addresses and maps *.test domains for the local test server), so the --dev flag alone does not relax autodiscovery.

Device engine variables #

The desktop app runs a mail engine (postern-hub engine, see CLI). It reads two more variables, which the app sets. You only need them to run an engine by hand.

Variable What it does
POSTERN_HUB_TOKEN The device's bearer token for the Hub. Required unless --token-file is given. Never accepted as a flag. The engine removes it from its environment after reading it.
POSTERN_HUB_EDGE_HEADERS The access gateway headers as a JSON object, like {"CF-Access-Client-Id":"...","CF-Access-Client-Secret":"..."}. Error when it is not a JSON object: POSTERN_HUB_EDGE_HEADERS must be a JSON object of header names to values.

The engine also reads POSTERN_DATA_DIR (required, or --data-dir), POSTERN_LISTEN (default 127.0.0.1:0, a free port), POSTERN_KEY_FILE (default <data dir>/engine.key), POSTERN_LOG_LEVEL, POSTERN_LOG_FORMAT, POSTERN_GMAIL_QUOTA_SHARE and POSTERN_DEV. It ignores the backup, public URL, TLS and relay settings.

Docker Compose variables #

compose.yaml itself reads these from .env. The Hub never sees them.

Variable Default What it does
POSTERN_VERSION latest Image tag of ghcr.io/theoriuhd/postern-hub. No images are published yet: build one from source and set POSTERN_VERSION=local (see Build from source).
POSTERN_BIND 127.0.0.1:8080 Host address and port the Hub's port 8080 is published on. 8080 or 0.0.0.0:8080 publishes it on every interface (LAN access over plain HTTP).
POSTERN_DOMAIN empty Domain for the optional caddy profile (docker compose --profile caddy up -d). Caddy gets a certificate for it; ports 80 and 443 must reach the host. The profile stops with caddy profile: set POSTERN_DOMAIN in .env when it is empty.
POSTERN_DATA_VOLUME postern_postern-data Name of the data volume (mounted at /data).
POSTERN_KEY_VOLUME postern_postern-key Name of the key volume (mounted at /key).
TZ UTC Time zone of the container. It sets the time in logs and the Hub's local zone, which is used for quiet hours, dates in search and rule time conditions when a person has not chosen a time zone.

The legacy names MAILCLIENT_VERSION, MAILCLIENT_BIND, MAILCLIENT_DOMAIN and MC_PUBLIC_URL, MC_TRUST_PROXY, MC_RELAY_URL, MC_LOG_FORMAT still work in .env. An install from before the rename keeps its volumes with POSTERN_DATA_VOLUME=mailclient_mailclient-data and POSTERN_KEY_VOLUME=mailclient_mailclient-key.

Installer variables #

deploy/install.sh downloads a release archive. No releases are published yet, so it does not work until the first release. It reads:

Variable Default What it does
POSTERN_VERSION the latest release Version to install, like 1.4.2. Same as --version 1.4.2.
POSTERN_REPO TheOriUHD/postern GitHub repository to download from.

MAILCLIENT_VERSION and MAILCLIENT_REPO are read as a fallback.

Desktop app variables #

The desktop app reads these from the environment it was started from. MAILCLIENT_* names work where the POSTERN_* one is not set.

Variable What it does
POSTERN_DISABLE_UPDATES=1 Turns off automatic updates. Updates only run in signed, packaged builds, which are not published yet.
POSTERN_DEVTOOLS=1 Adds View → Toggle Developer Tools to the menu of a packaged build (development builds always have it).
POSTERN_THEME=light or dark Forces the theme (for development and screenshots).

See Desktop app.

Client IP behind a proxy #

The Hub uses the client IP for rate limits (sign-in, setup, pairing, invites) and in the security log and device list. With POSTERN_TRUST_PROXY off it uses the address of the TCP connection, which behind a proxy is the proxy itself.

With POSTERN_TRUST_PROXY on, and only when the connection comes from an address in POSTERN_TRUSTED_PROXIES, it takes the first of these that is present:

  1. The header named in POSTERN_CLIENT_IP_HEADER (like CF-Connecting-IP).
  2. X-Forwarded-For, read from the right: the Hub skips entries that are trusted proxies and takes the first one that is not. Proxies such as nginx ($proxy_add_x_forwarded_for), Caddy, Cloudflare and cloudflared append to whatever the client sent, so the entries on the left are the client's to invent and are never used.
  3. X-Real-IP.

POSTERN_TRUSTED_PROXIES only limits the client IP. X-Forwarded-Proto and X-Forwarded-Host (used for the scheme, the derived public URL and the same-origin check) are honored from any connection while POSTERN_TRUST_PROXY is on. This is one more reason to keep the Hub's port reachable only by the proxy.

Typical settings:

Setup Settings
Caddy or nginx on the same host POSTERN_TRUST_PROXY=true, POSTERN_TRUSTED_PROXIES=127.0.0.1,::1
Tailscale serve on the same host POSTERN_TRUST_PROXY=true, POSTERN_TRUSTED_PROXIES=127.0.0.1,::1
A proxy in the same Docker network (the caddy profile, Traefik) POSTERN_TRUST_PROXY=true (the default list trusts private networks), or the network's subnet
Cloudflare Tunnel (cloudflared on the host) POSTERN_TRUST_PROXY=true, POSTERN_CLIENT_IP_HEADER=CF-Connecting-IP, POSTERN_TRUSTED_PROXIES=127.0.0.1,::1

With the default list (private networks trusted), a device on your LAN that talks to the Hub directly can choose the IP the Hub records. Narrow POSTERN_TRUSTED_PROXIES, or do not expose the Hub's port to the LAN.

Examples #

Docker Compose

Behind the caddy profile on a server (~/postern/.env):

POSTERN_VERSION=local
POSTERN_DOMAIN=mail.example.com
POSTERN_PUBLIC_URL=https://mail.example.com
POSTERN_TRUST_PROXY=true
TZ=Europe/Berlin

Start it with docker compose --profile caddy up -d.

At home over Tailscale (tailscale serve on the host proxies HTTPS to 127.0.0.1:8080):

POSTERN_VERSION=local
POSTERN_PUBLIC_URL=https://hub.tailnet-1234.ts.net
POSTERN_TRUST_PROXY=true

Docker sees Tailscale's connections as coming from its network gateway, a private address, so the default POSTERN_TRUSTED_PROXIES covers it.

LAN only, no HTTPS:

POSTERN_VERSION=local
POSTERN_BIND=8080
POSTERN_PUBLIC_URL=http://192.168.1.20:8080

Debian and Ubuntu, Fedora and RHEL and Raspberry Pi OS

Behind Caddy or nginx on the same server (/etc/postern/hub.env):

POSTERN_DATA_DIR=/var/lib/postern
POSTERN_KEY_FILE=/var/lib/postern-key/hub.key
POSTERN_LISTEN=127.0.0.1:8080
POSTERN_PUBLIC_URL=https://mail.example.com
POSTERN_TRUST_PROXY=true
POSTERN_TRUSTED_PROXIES=127.0.0.1,::1

At home over Tailscale (sudo tailscale serve --bg 8080):

POSTERN_DATA_DIR=/var/lib/postern
POSTERN_KEY_FILE=/var/lib/postern-key/hub.key
POSTERN_LISTEN=127.0.0.1:8080
POSTERN_PUBLIC_URL=https://hub.tailnet-1234.ts.net
POSTERN_TRUST_PROXY=true
POSTERN_TRUSTED_PROXIES=127.0.0.1,::1

LAN only, no HTTPS:

POSTERN_DATA_DIR=/var/lib/postern
POSTERN_KEY_FILE=/var/lib/postern-key/hub.key
POSTERN_LISTEN=0.0.0.0:8080
POSTERN_PUBLIC_URL=http://192.168.1.20:8080

Built-in HTTPS with Let's Encrypt (plus the capability change in the unit, see Built-in HTTPS):

POSTERN_DATA_DIR=/var/lib/postern
POSTERN_KEY_FILE=/var/lib/postern-key/hub.key
POSTERN_LISTEN=:443
POSTERN_PUBLIC_URL=https://mail.example.com
POSTERN_TLS_DOMAIN=mail.example.com
POSTERN_TLS_EMAIL=you@example.com

Desktop app (built-in Hub)

There is nothing to configure. The built-in Hub listens on 127.0.0.1:<port> and is reachable only from that computer. To use Postern from other devices, run a Hub on a server: see Setup.

Passkeys and Google sign-in need HTTPS (or localhost); on plain HTTP, password plus TOTP still works. postern-hub doctor warns about this.