Mailutils' retrieve_envelope() only ever resolved "from". Add mu_envelope_set_recipient()/mu_envelope_sget_recipient() to libmailutils, mirroring the existing sender accessor pair 1:1 (same struct field, callback slot, and header-derived fallback via a new message_envelope_recipient()), so "to" now resolves the same way "from" always did. Packaged as a separate patch (0004) for independent upstream review, wired into both the Gentoo overlay ebuild and the Debian Trixie build script. Verified against Mailutils' own upstream Sieve test suite (107/107, zero regressions), against a standalone program replicating Bongo's exact message-construction path (positive and negative match), and live through bongo.service (two consecutive SIEVE-04 passes).
4.3 KiB
Sieve filtering and ManageSieve
Bongo stores each user's server-side mail rules independently from the mail
payloads. bongosieve provides the ManageSieve management protocol, while
bongorules evaluates the active script as mail passes through the Queue.
Thunderbird and other ManageSieve clients can therefore maintain filters
without editing server files.
Listener and authentication
ManageSieve is disabled by the base template until it is required. Its
suffixless sieve document has conservative loopback defaults:
{
"enabled": false,
"listen_address": "127.0.0.1",
"port": 4190,
"allow_legacy_tls": false,
"proxy_protocol_enabled": false,
"proxy_protocol_networks": [],
"maximum_script_size": 1048576,
"maximum_connections": 64
}
The greeting offers STARTTLS; GNU GSASL mechanisms are advertised only
after TLS. Authentication uses the same Bongo user and app-password policy as
the mail protocols, with the Sieve service scope. Cleartext received after a
STARTTLS command is discarded before negotiation. PROXY protocol has the
same source-restricted rules as the other mail listeners.
Management protocol
The RFC 5804 service implements CAPABILITY, STARTTLS, AUTHENTICATE,
HAVESPACE, PUTSCRIPT, CHECKSCRIPT, LISTSCRIPTS, GETSCRIPT,
SETACTIVE, RENAMESCRIPT, DELETESCRIPT, NOOP, and LOGOUT. Script
names and literals are bounded, syntax is validated before activation, an
active script cannot be deleted accidentally, and scripts are isolated by
authenticated user.
The implementation advertises fileinto, envelope, body, variables,
vacation, and vacation-seconds. envelope and body (RFC 5173) are
not implemented by the stock Mailutils Sieve engine at all -- confirmed
directly against Mailutils' own sieve reference tool, independent of
Bongo -- so the Gentoo net-mail/mailutils ebuild this project builds
against carries local patches adding both: a small require.c fix so
require ["envelope"]; resolves the standard test Mailutils already
implements but never lets a bare require reach, and a new body.c test
module (using only Mailutils' own MIME/message API, no new dependency)
implementing :raw, :content <types>, and :text (default) per
RFC 5173. Upstream Mailutils' envelope test only ever resolved the
"from" envelope-part (retrieve_envelope() hard-coded that one string
and returned no-match for anything else, "to" included); a second local
patch adds a mu_envelope_set_recipient()/mu_envelope_sget_recipient()
accessor pair to libmailutils mirroring the existing sender accessor
1:1 (same struct/callback shape, same lazy header-derived fallback via a
new message_envelope_recipient(), checking X-Envelope-Recipient,
X-Envelope-To, Delivered-To, X-Original-To, and To in that order),
so "to" now resolves the same way "from" always did. Neither envelope
part is a true SMTP-level value -- Bongo hands Mailutils raw message
bytes with no separate envelope channel -- so both are header-derived
best-effort proxies, consistent with each other. All of this is verified
against Mailutils' own upstream Sieve test suite (zero regressions) plus
live execution; see the release testing evidence for SIEVE-04. Actions
include keep, discard, file into a
folder, redirect, reject, and vacation response. Vacation history is durable
so repeated delivery does not generate an immediate reply loop. Scripts and
vacation state live in the owning user's authoritative Bongo Store and are
accessed by bongosieve and bongorules through NMAP. Include the user's
complete Store directory in backups.
Filters in Webmail
The Web filter editor and ManageSieve are two interfaces to the same intended
user rule model. A filter may match senders or other message properties and
deliver matching messages to a folder such as Family. Mailing-list
recognition is one possible filter condition, not a separate replacement for
the filter system. Future JMAP support must map to the same rules rather than
creating a third incompatible store.
Test script upload, syntax rejection, activation, rename, retrieval, deletion, folder delivery, redirect, reject, vacation deduplication, and quota limits before exposing the service. The 0.7 release cases are SIEVE-01 through SIEVE-05 in release-testing-0.7.md.