Skip to main content

Crate rusmes_server

Crate rusmes_server 

Source
Expand description

RusMES server orchestration library

This crate is the top-level runtime for the RusMES mail server. It brings together all protocol servers (SMTP, IMAP, POP3, JMAP), the mailet processing pipeline, storage backends, authentication, metrics collection, and connection management into a single, cohesive process.

§Key Features

  • Multi-protocol: Simultaneously runs SMTP, IMAP, POP3, and JMAP servers.
  • Mailet pipeline: Configurable chain of mail-processing mailets (spam filtering, local delivery, remote delivery, DKIM/SPF/DMARC checking, etc.) driven by the rusmes_core processing engine.
  • Graceful shutdown: Responds to SIGTERM and SIGINT with clean shutdown of all protocol listeners.
  • Hot configuration reload: On SIGHUP the server re-reads rusmes.toml and applies changes to logging levels and rate-limit settings without restart.
  • Pluggable authentication: Supports file-based, LDAP, SQL, and OAuth2 backends via the rusmes_auth crate.
  • Connection limiting: Per-IP connection caps and idle-timeout enforcement via the connection_limits module.
  • Structured session logging: UUID-based session IDs attached to every log event for easy per-connection trace reconstruction (see session_logging).

§Binary entry point

The crate ships a rusmes-server binary whose main function:

  1. Reads configuration from a TOML file (default rusmes.toml, overridden by the first CLI argument).
  2. Initialises storage, metrics, authentication, and rate-limiting.
  3. Spawns each enabled protocol server as an independent Tokio task.
  4. Enters a select! loop waiting for OS signals or server task failures.

§Brief Usage Example

# Run the server with the default config path
rusmes-server

# Or with a custom config:
rusmes-server /etc/rusmes/rusmes.toml

§Relevant Standards

Modules§

session_logging
Per-session structured logging

Macros§

session_debug
Log a debug message with session context
session_error
Log an error message with session context
session_info
Helper macros for session-aware logging
session_trace
Log a trace message with session context
session_warn
Log a warning message with session context