RustPost

Running a server

Configuration reference

Every section and key of rustpost.toml, with its default, plus the environment variables and the settings that live in the database.

On this page

The configuration file holds only what a node needs before it can reach the database. Settings that administrators change while the server runs (antispam, mail filter policy) live in the database and are edited from the admin console.

The server reads rustpost.toml from the working directory, or the path in --config / -c, or in the RUSTPOST_CONFIG environment variable (the Docker image sets /etc/rustpost/rustpost.toml). Unknown keys are refused, so a typo stops the server with an error instead of being ignored.

The repository has two complete examples: deploy/rustpost.example.toml (a server installed directly on a host) and deploy/rustpost.docker.toml (the compose file's high ports).

Environment variables

VariableUsed for
RUSTPOST_CONFIGPath to the configuration file. Default rustpost.toml.
PGPASSWORDThe database password, when [store] url has none. Keeps it out of the file.
RUSTPOST_PASSWORDThe password for rustpost user add.
RUST_LOGLog filter, for example info (default) or rp_smtp=debug,info.

Top level

KeyDefaultDescription
hostnamerequiredThe mail host's name, for example mail.example.org. Used in SMTP greetings, in client autoconfiguration and as the default outbound name. It must be on the TLS certificate.

[store]

KeyDefaultDescription
urlrequiredA PostgreSQL URL such as postgres://rustpost@localhost/rustpost. Every node of a cluster points at the same database. Leave the password out and set PGPASSWORD.

PostgreSQL is the only database. An old file with kind = "sqlite" or a path gets an error that explains the change.

[blobs]

KeyDefaultDescription
pathrequiredDirectory for message bodies and attachments, stored once per organization and addressed by hash. Back it up with the database.

[tls]

KeyDefaultDescription
certrequired in the sectionPEM file with the certificate chain (for example certbot's fullchain.pem).
keyrequired in the sectionPEM file with the private key.

The section is optional, but without it there is no submission, IMAP logins are refused, ManageSieve has no STARTTLS, autoconfiguration is off and HTTPS needs allow_insecure_http. The files are read at startup: restart the server after renewing the certificate.

[smtp]

KeyDefaultDescription
listenrequiredAddress for inbound SMTP, usually 0.0.0.0:25 or [::]:25.

[submission]

KeyDefaultDescription
listennoneSTARTTLS submission, usually 0.0.0.0:587.
tls_listennoneImplicit-TLS submission, usually 0.0.0.0:465.

Without the section there is no submission listener. Both need [tls].

[outbound]

KeyDefaultDescription
hostnametop-level hostnameName used in EHLO and as the sender of delivery reports. Should match the PTR record of the sending address.
queue_workertrueRun the delivery worker on this node. At least one node must, or queued mail is never sent.
max_recipients_per_hour1000Recipients each account may send to per hour, counted per node.
dkim_ed25519falseAlso sign with Ed25519 next to RSA. Publish both DKIM records first.
nameservers[]Name servers for delivery lookups (ip:port) instead of the system's. For closed networks and tests.
smtp_port25Port used to contact MX hosts. Tests only.
allow_loopbackfalseDeliver to MX hosts on loopback addresses. Tests only.

[[outbound.smarthost]]

Relay through another server when port 25 is blocked. Repeat the table for several relays. Smarthosts always get TLS with a verified certificate.

KeyDefaultDescription
hostrequiredThe relay's host name.
portrequiredUsually 465 or 587.
tlsrequired"implicit" (port 465) or "starttls" (port 587).
username, passwordnoneCredentials; give both or neither.
sender_domains[]Sending domains that use this relay. Empty: every domain no other relay lists.
[[outbound.smarthost]]
host = "smtp.relay.example"
port = 465
tls = "implicit"
username = "relay-user"
password = "relay-password"
sender_domains = ["example.org"]

[imap]

KeyDefaultDescription
listennoneIMAP with STARTTLS, usually 0.0.0.0:143.
tls_listennoneIMAP with implicit TLS, usually 0.0.0.0:993.
allow_plaintext_authfalseAllow logins without TLS. Tests on loopback only.

[managesieve]

KeyDefaultDescription
listennone (off)ManageSieve, usually 0.0.0.0:4190, with STARTTLS on the same port.
allow_plaintext_authfalseAllow PLAIN before STARTTLS. Tests on a closed network only.

[http]

KeyDefaultDescription
listenrequired in the sectionHTTPS address, usually 0.0.0.0:443.
web_rootnoneDirectory with the webmail build (index.html). Without it, / only says the webmail is not installed.
admin_rootnoneDirectory with the admin console build, served under /admin/.
allow_insecure_httpfalseServe plain HTTP when there is no [tls]. Local development only: passwords and session cookies would cross the network in clear.

Without the section there is no web server at all.

[antispam]

Checks on mail arriving on port 25. Mail that signed-in users send through submission is never filtered. These are starting values: the first time an administrator saves antispam settings in the console, they are copied to the database, every node reads them from there, and this section is ignored from then on, except nameservers.

KeyDefaultDescription
enabledtrueVerify SPF, DKIM and DMARC, score messages and act on the result.
junk_threshold5.0Score at which a message goes to Junk.
reject_threshold12.0Score at which a message is refused. Must be at least junk_threshold.
dnsbl[]DNS blocklist zones to look client addresses up in.
dnsbl_action"reject""reject" refuses a listed client (554); "junk" delivers to Junk.
nameservers[]Resolvers for these checks (ip or ip:port), for example a local Unbound.

What happens before the score: if DMARC fails and the sender's domain publishes p=reject, the message is refused (550); with p=quarantine it goes to Junk; an SPF hard fail without a DMARC record goes to Junk. DNS that does not answer never counts against a message.

Blocklists and public resolvers

Large blocklists such as Spamhaus refuse queries that come through public resolvers (8.8.8.8, 1.1.1.1 and most cloud defaults). Use them only with your own recursive resolver in nameservers, or with a Spamhaus Data Query Service key set in the console. Read each list's terms of use first.

[antispam.weights]

Each signal adds its weight to the score; 0 turns it off. The X-Spam-Status header lists the signals that fired.

SignalDefaultMeaning
DMARC_FAIL3.0Fails DMARC, whatever the domain's policy.
SPF_FAIL3.0SPF says the client may not send for the domain.
SPF_SOFTFAIL1.5SPF says it probably may not.
NO_DKIM1.0No DKIM signature that verifies.
DNSBL_LISTED5.0Client is on a blocklist (with dnsbl_action = "junk").
MISSING_DATE1.0No Date header.
MISSING_MESSAGE_ID1.0No Message-ID header.
MISSING_FROM2.5No From header.
NO_RDNS2.0Client has no reverse DNS that points back to it.
HELO_IP2.0Client said HELO with an IP address.
HELO_UNRESOLVED1.5Client's HELO name has no address.

[tracking]

The message trace behind the console's tracking center.

KeyDefaultDescription
enabledtrueRecord one trace per message received or submitted. false records nothing.
retention_days30Days a trace is kept before it is deleted. At least 1.

[calendar]

KeyDefaultDescription
enabledtrueCalendars in the webmail and CalDAV at /dav/.
default_time_zone"Etc/UTC"IANA zone for floating and all-day events when their calendar has no zone of its own.

[contacts]

KeyDefaultDescription
enabledtrueContacts in the webmail, CardDAV at /dav/ and the directory.
dav_directorytrueList the directory in every CardDAV address book home. With false it is still at /dav/directory/ and in the webmail.

[crypto]

OpenPGP and S/MIME in the webmail, key storage, WKD at https://openpgpkey.<domain>/, recipient key lookups and Autocrypt. The server never sees a private key or a passphrase.

KeyDefaultDescription
enabledtruefalse turns all of it off.
nameservers[]Resolvers for key lookups (ip:port).
fetch_roots[]Extra PEM root certificates for key lookups (closed networks).
allow_private_fetch, fetch_port, keyserveroffTests only. allow_private_fetch would expose the server to SSRF.

[autoconfig]

Client autoconfiguration: Autodiscover for Outlook, Mozilla autoconfig for Thunderbird and others, and the Apple profile. Clients are told the configured IMAP and submission listeners on hostname, implicit TLS first. Needs [tls].

KeyDefaultDescription
enabledtrueAnswer autoconfiguration requests.
imaps_port993Public port announced for IMAP with TLS.
imap_port143Public port announced for IMAP with STARTTLS.
submissions_port465Public port announced for submission with TLS.
submission_port587Public port announced for submission with STARTTLS.
https_port443Public HTTPS port (for CalDAV, CardDAV and Autodiscover).
autodiscover_hostsee textHost that Autodiscover v2 sends clients to. Default: autodiscover.<domain> if the certificate names it, else hostname.

The ports are the public ones. Change them only when clients reach a listener on a non-standard port (a NAT or port mapping); with the compose files the defaults are right, except https_port = 8443 with the development compose.yaml.

Settings in the database

Edited in the admin console and shared by every node, without a restart:

  • Antispam: switch, thresholds, weights, blocklists (with DQS keys), allowed and blocked senders.
  • Mail filters: run users' filters, allow automatic replies, ManageSieve on or off, script limits, forwarding policy, per-domain overrides.
  • Users' directory details and visibility.
  • DKIM keys.

The encryption policy (key backups on the server, external lookups, the public key server) and per-domain WKD exist in the admin API but have no console page yet.