#19: repair the compose stack and wire Rspamd to Redis

"docker compose up" could not work, which means the F0 acceptance
criterion was not being met:

  - ghcr.io/rspamd/rspamd:3.9 returns "denied" and clamav/clamav:1.3 does
    not exist. Both were verified against the registries; the working
    references are rspamd/rspamd:3.9 and clamav/clamav:1.4.

  - Rspamd received RSPAMD_REDIS_SERVERS and RSPAMD_REDIS_PASSWORD as
    environment variables it never reads. Confirmed in the container that
    it does not expand ${VAR} in UCL: the password reached Redis as that
    literal string. Greylisting and ratelimit keep their state in Redis,
    so both were silently doing nothing while appearing configured. The
    credential is now rendered at startup into override.d, a tmpfs, so it
    touches neither the image nor a volume.

  - The ratelimit module ships enabled with no rates defined, which
    accepts everything. ratelimit.conf defines the per-IP, per-user and
    per-recipient buckets of section 5.2.

Verified by bringing redis and rspamd up: the real password resolves, the
rates load, and a probe message returns "Action: greylist" with the state
written to Redis.

Services also gained an image: alongside build:, so the deploy host pulls
instead of compiling while "docker compose build" still works locally.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
Lucas RayanandClaude Opus 5 committed 2026-08-02 07:57:39 -03:00
1 parent 33d91fa247
commit 3deb328bbf
3 files changed
+71 -4

No files matched your search

+41
View File
@@ -0,0 +1,41 @@
# Rate limiting of PLAN.md section 5.2.
#
# This file exists because the module ships enabled but with no rates defined,
# which means it accepts everything: "rspamadm configdump ratelimit" on a
# stock image returns only whitelisted_rcpts. Without explicit buckets there
# is no limit at all, and the defence reads as present while doing nothing.
#
# Each rate is "<burst> / <period>". The bucket leaks over the period, so the
# burst is what a sender may do at once and the period sets the refill rate.
rates {
# Per connecting IP: generous enough for a busy legitimate MTA relaying a
# mailing list, tight enough to matter for a spam cannon.
to_ip = {
bucket = [
{ burst = 100; rate = "60 / 1min"; }
];
}
# Per authenticated sender. This is the containment for a compromised
# account, and it backs up the per-mailbox max_recipients_per_hour enforced
# in ProcessOutboundEmailUseCase - that one is authoritative, this one
# catches the same abuse earlier and without a database round trip.
user = {
bucket = [
{ burst = 50; rate = "30 / 1min"; }
];
}
# Per recipient, to blunt a dictionary attack enumerating local parts.
to = {
bucket = [
{ burst = 20; rate = "10 / 1min"; }
];
}
}
# Mail we authenticated ourselves is not what this limit is aimed at, but a
# compromised account is - so authenticated users stay limited, and only the
# addresses RFC 2142 requires to always be reachable are exempt.
whitelisted_rcpts = "postmaster,mailer-daemon,abuse";