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_coreprocessing 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.tomland applies changes to logging levels and rate-limit settings without restart. - Pluggable authentication: Supports file-based, LDAP, SQL, and OAuth2 backends
via the
rusmes_authcrate. - Connection limiting: Per-IP connection caps and idle-timeout enforcement via
the
connection_limitsmodule. - 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:
- Reads configuration from a TOML file (default
rusmes.toml, overridden by the first CLI argument). - Initialises storage, metrics, authentication, and rate-limiting.
- Spawns each enabled protocol server as an independent Tokio task.
- 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