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
| Variable | Used for |
|---|---|
RUSTPOST_CONFIG | Path to the configuration file. Default rustpost.toml. |
PGPASSWORD | The database password, when [store] url has none. Keeps it out of the file. |
RUSTPOST_PASSWORD | The password for rustpost user add. |
RUST_LOG | Log filter, for example info (default) or rp_smtp=debug,info. |
Top level
| Key | Default | Description |
|---|---|---|
hostname | required | The 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]
| Key | Default | Description |
|---|---|---|
url | required | A 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]
| Key | Default | Description |
|---|---|---|
path | required | Directory for message bodies and attachments, stored once per organization and addressed by hash. Back it up with the database. |
[tls]
| Key | Default | Description |
|---|---|---|
cert | required in the section | PEM file with the certificate chain (for example certbot's fullchain.pem). |
key | required in the section | PEM 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]
| Key | Default | Description |
|---|---|---|
listen | required | Address for inbound SMTP, usually 0.0.0.0:25 or [::]:25. |
[submission]
| Key | Default | Description |
|---|---|---|
listen | none | STARTTLS submission, usually 0.0.0.0:587. |
tls_listen | none | Implicit-TLS submission, usually 0.0.0.0:465. |
Without the section there is no submission listener. Both need [tls].
[outbound]
| Key | Default | Description |
|---|---|---|
hostname | top-level hostname | Name used in EHLO and as the sender of delivery reports. Should match the PTR record of the sending address. |
queue_worker | true | Run the delivery worker on this node. At least one node must, or queued mail is never sent. |
max_recipients_per_hour | 1000 | Recipients each account may send to per hour, counted per node. |
dkim_ed25519 | false | Also 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_port | 25 | Port used to contact MX hosts. Tests only. |
allow_loopback | false | Deliver 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.
| Key | Default | Description |
|---|---|---|
host | required | The relay's host name. |
port | required | Usually 465 or 587. |
tls | required | "implicit" (port 465) or "starttls" (port 587). |
username, password | none | Credentials; 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]
| Key | Default | Description |
|---|---|---|
listen | none | IMAP with STARTTLS, usually 0.0.0.0:143. |
tls_listen | none | IMAP with implicit TLS, usually 0.0.0.0:993. |
allow_plaintext_auth | false | Allow logins without TLS. Tests on loopback only. |
[managesieve]
| Key | Default | Description |
|---|---|---|
listen | none (off) | ManageSieve, usually 0.0.0.0:4190, with STARTTLS on the same port. |
allow_plaintext_auth | false | Allow PLAIN before STARTTLS. Tests on a closed network only. |
[http]
| Key | Default | Description |
|---|---|---|
listen | required in the section | HTTPS address, usually 0.0.0.0:443. |
web_root | none | Directory with the webmail build (index.html). Without it, / only says the webmail is not installed. |
admin_root | none | Directory with the admin console build, served under /admin/. |
allow_insecure_http | false | Serve 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.
| Key | Default | Description |
|---|---|---|
enabled | true | Verify SPF, DKIM and DMARC, score messages and act on the result. |
junk_threshold | 5.0 | Score at which a message goes to Junk. |
reject_threshold | 12.0 | Score 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.
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.
| Signal | Default | Meaning |
|---|---|---|
DMARC_FAIL | 3.0 | Fails DMARC, whatever the domain's policy. |
SPF_FAIL | 3.0 | SPF says the client may not send for the domain. |
SPF_SOFTFAIL | 1.5 | SPF says it probably may not. |
NO_DKIM | 1.0 | No DKIM signature that verifies. |
DNSBL_LISTED | 5.0 | Client is on a blocklist (with dnsbl_action = "junk"). |
MISSING_DATE | 1.0 | No Date header. |
MISSING_MESSAGE_ID | 1.0 | No Message-ID header. |
MISSING_FROM | 2.5 | No From header. |
NO_RDNS | 2.0 | Client has no reverse DNS that points back to it. |
HELO_IP | 2.0 | Client said HELO with an IP address. |
HELO_UNRESOLVED | 1.5 | Client's HELO name has no address. |
[tracking]
The message trace behind the console's tracking center.
| Key | Default | Description |
|---|---|---|
enabled | true | Record one trace per message received or submitted. false records nothing. |
retention_days | 30 | Days a trace is kept before it is deleted. At least 1. |
[calendar]
| Key | Default | Description |
|---|---|---|
enabled | true | Calendars 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]
| Key | Default | Description |
|---|---|---|
enabled | true | Contacts in the webmail, CardDAV at /dav/ and the directory. |
dav_directory | true | List 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.
| Key | Default | Description |
|---|---|---|
enabled | true | false 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, keyserver | off | Tests 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].
| Key | Default | Description |
|---|---|---|
enabled | true | Answer autoconfiguration requests. |
imaps_port | 993 | Public port announced for IMAP with TLS. |
imap_port | 143 | Public port announced for IMAP with STARTTLS. |
submissions_port | 465 | Public port announced for submission with TLS. |
submission_port | 587 | Public port announced for submission with STARTTLS. |
https_port | 443 | Public HTTPS port (for CalDAV, CardDAV and Autodiscover). |
autodiscover_host | see text | Host 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.