RustPost

Running a server

Security

How RustPost protects mail in transit and at rest, the threat model of end-to-end encryption in the webmail, and how to report a vulnerability.

On this page

RustPost has not had an external security audit yet; one is part of the 1.0 milestone. Treat it as pre-release software.

Reporting a vulnerability

Email security@rustpost.org with a description, the version or commit, and steps to reproduce. Please do not open a public issue for a vulnerability, and give the project time to release a fix before you disclose it.

Transport security

  • TLS library: rustls with the aws-lc-rs provider; TLS 1.2 and 1.3 only, with the library's default cipher suites. OpenSSL is not used.
  • Logins require TLS. IMAP advertises LOGINDISABLED and refuses passwords on a plain connection; submission offers AUTH (PLAIN, LOGIN) only after TLS; ManageSieve refuses PLAIN before STARTTLS; the web server serves HTTPS only.
  • Inbound SMTP offers STARTTLS. Commands pipelined after STARTTLS are refused (command injection), and a bare CR or LF in a message is refused (SMTP smuggling).
  • Outbound SMTP uses TLS opportunistically: it prefers TLS, records a certificate that does not verify, and still delivers. MTA-STS and DANE, which would make TLS mandatory per destination, are planned. Smarthosts always get TLS with a verified certificate.
  • Certificates are read at startup; restart after renewing (see TLS certificates).

Accounts and sessions

  • Passwords are hashed with Argon2. Unknown accounts take as long to check as known ones, so timing does not reveal which addresses exist.
  • Three failed logins end an IMAP or SMTP session. Sending is limited per account and hour (max_recipients_per_hour, counted per node), and WKD and autoconfiguration are limited per client network. Login throttling across sessions is not built yet.
  • The webmail uses a __Host- session cookie and requires a custom header on every API call, which blocks cross-site requests; sessions are stored in the database and expire. Resetting a password signs the user out of other web sessions.
  • Autodiscover does not reveal whether a mailbox exists.

The webmail

  • Messages are rendered in a sandboxed frame after sanitizing (DOMPurify), under a strict Content Security Policy with per-response nonces.
  • Remote images and other remote content are always blocked.
  • Private keys are kept inside a Web Worker and are never sent to the server.

Data at rest

Message bodies are stored as files, and metadata in PostgreSQL, without encryption at rest in RustPost itself. Use disk or volume encryption on the host if you need it, protect your backups the same way, and remember that anyone with the database and the blobs can read every message that is not end-to-end encrypted.

End-to-end encryption: threat model

OpenPGP and S/MIME in the webmail are designed so that the server never sees private keys, passphrases or the content of encrypted messages. What that protects against, and what it does not:

ThreatResult
Someone watching the networkDefeated by TLS, and encrypted content is encrypted end to end.
Servers a message passes throughSee only ciphertext, but the headers (From, To, Cc, date, Message-ID), size and timing travel in clear, and so does the subject unless S/MIME subject hiding is on.
A stolen database or backupEncrypted mail and encrypted drafts stay safe. Key copies on the server are only as strong as their passphrase (Argon2id for OpenPGP, PBKDF2 with 600,000 iterations for S/MIME, which is weaker). Public keys, who writes to whom, and all mail metadata are exposed.
Write access to the databaseTampering with key copies is detected. Swapping a correspondent's public key is not prevented; keys you have verified or pinned catch it.
The server's administratorCannot read encrypted mail through the console, which never shows key material. Can read mail that is not encrypted.
A malicious or compromised serverCan serve modified webmail code that captures passphrases, keys and plaintext. Nothing in the browser can prevent this. If you do not trust the server's operator, use a desktop mail app for encrypted mail.
A script injection (XSS) in the webmailMitigated by the CSP, sanitizing and the sandbox. If one got through, keys stay inside the Worker, but it could ask for decryptions while keys are unlocked; that is why the default unlock time is short.
EFAIL-style attacksBlocked: remote content is blocked and integrity protection (MDC or AEAD) is required.
Forged senders planting keysAutocrypt keys are collected only from authenticated senders, but Autocrypt is still trust on first use. WKD trusts the recipient's domain by design.
A stolen laptopThe browser holds only the passphrase-protected key and nothing decrypted.

Also by design: spam and virus filters cannot see inside encrypted messages; there are no post-quantum keys; a lost passphrase cannot be recovered by anyone. Key lookups are made by the server with protections against server-side request forgery and rate limits, and no key material is written to logs.

Supply chain

  • The Rust code forbids unsafe. cargo deny checks licenses, advisories and sources of every dependency; exceptions are documented one by one.
  • Third-party protocol libraries are kept behind wrapper crates.
  • The provenance policy keeps code from other mail servers out.
  • The web repository checks the licenses of every npm dependency in CI.