Repository navigation
Description
Mail 2.0 adds an opt-in limit on how many messages each authenticated user can send (#8381), to stop a stolen password from being used to send spam. Today the limit can be configured only from the command line, with environment variables, and nobody is told when a user hits it.
More generally, a mail server can stop working well without any visible failure: messages pile up in the queue, the server IP or a mail domain ends up on a blocklist, the spam filter cannot resolve DNS names (see #8389), or a service is running but no longer answers. Administrators usually find out when users complain, or when the support team is called.
The purpose of this issue is to let administrators configure the rate limit from the user interface, and to have the Mail application raise alerts for the most common problems, through the existing Metrics application (ns8-metrics) and its notification channels (mail, cluster alert list, my.nethesis.it).
Proposed solution
A. Configure the rate limit from the user interface
- A new section in the Mail settings to turn the limit on or off and set the maximum number of messages per hour for each user (today
RSPAMD_RL_HOURLY). - Manage the list of users with a higher limit (bulk senders, like newsletters, scanners and applications) and the list of users without limits. Today these lists are Rspamd map files edited from the Rspamd web interface.
- The configuration is kept in the backup, and the current behavior (limit off) stays the default.
B. Metrics and alerts
The Mail application exports the metrics below and publishes alert rules to the Metrics application, as described in the ns8-metrics README (metrics_targets and metrics_alert_rules). Each alert has an English and Italian summary and description, and a warning or critical severity. The exact thresholds are decided during implementation, with sensible defaults.
- Mail queue filling up: number of messages in the Postfix queues (active, deferred, hold) and age of the oldest message. Alert when the deferred queue keeps growing, or when messages stay in the queue too long. This also catches outgoing spam, a smarthost that rejects messages, and a remote server that is unreachable.
- Blocklist (DNSBL) monitoring for our domains: check at regular intervals whether the public IP address used to send mail, and the hosted mail domains, are listed on the main DNS blocklists. Alert when a listing appears, naming the list. When all outgoing mail goes through a smarthost, the IP check may not apply. Queries must stay within the free-use terms of the blocklists (low frequency, no public DNS resolvers).
- DNS resolver sanity: Rspamd resolves names through its own resolver (Unbound). Run a test query at regular intervals and alert when it fails (for example with
SERVFAIL) for some minutes, because spam scores become wrong without any other sign (Mail: spam false positives when Rspamd starts without Internet access #8389). - Unresponsive services: check that each service answers, not only that its container runs. For example the SMTP greeting on ports 25 and 587, the IMAP greeting, the Rspamd ping, and the ClamAV ping. Alert when a service does not answer for some minutes.
- Users hitting the rate limit (the original follow-up of Mail: limit how many messages an authenticated user can send #8381): number of messages refused by the limit, for each user. Alert when a user hits the limit, so the administrator can check whether the password was stolen.
A Grafana dashboard for these metrics would be useful, but it is optional.
Out of scope
- Rate limit for clients that send without authentication from trusted networks (
mynetworks): postponed to a later issue.
Alternative solutions
- Ready-made exporters (a Postfix exporter, a blackbox prober, the Rspamd built-in metrics endpoint) cover only part of the list, and each adds a container or process to maintain. They can be reused where they fit, but a small exporter owned by the Mail application can cover all checks with one target.
- External monitoring services for blocklists: they need an account and send data about our installations to a third party.
Additional context
- The Dovecot statistics (OpenMetrics) endpoint already exists in the Mail application, but it is not published to the Metrics application.
- The Metrics application already watches node resources, disks, backups and TLS certificates, and can see whether an application's containers are running (
ns8_container_info).
See also
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsToDo
Activity