Files
bongo/docs/sieve.md
T
Mario Fetka ba434bf79e Re-enable envelope/body now that the Mailutils Sieve engine supports them
The Gentoo mail-mta/bongo overlay's net-mail/mailutils ebuild now
carries a local patch (files/mailutils-3.21-sieve-envelope-body.patch)
that fixes require.c's registry lookup so require ["envelope"]; can
reach the standard test Mailutils already implements, and adds a new
body.c test module (RFC 5173, using only Mailutils' own MIME API) that
Mailutils never implemented in any form. Verified against Mailutils'
own upstream Sieve test suite (107/107, zero regressions, including
the real envelope.at case) plus live execution of both extensions.

Advertise both again in the ManageSieve CAPABILITY string and allow
them in safe_requirement(); update docs/sieve.md and drop the now-
resolved ROADMAP item about replacing the Sieve engine entirely.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-08-01 11:44:06 +02:00

74 lines
3.5 KiB
Markdown

# 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:
```json
{
"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 a local patch 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. Both are 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](release-testing-0.7.md).