mirror of
https://github.com/docker-mailserver/docker-mailserver
synced 2026-11-27 16:14:45 +01:00
Since the Dovecot 2.4 migration, DMS registered one `sieve_script` block
per script it generates. Any other script placed in
`/usr/lib/dovecot/sieve-global/{before,after}/` (e.g. via
`user-patches.sh`) compiled but was silently ignored, unlike up to v15
where `sieve_before` / `sieve_after` pointed at the directories.
Register both directories as `before` / `after` script storages in
`90-sieve.conf` instead. Pigeonhole runs every `*.sieve` file in them in
file name order, which matches the previous execution order of the
scripts DMS generates itself (`50-`, `60-` and `70-` prefixes). The
per-file `sieve_script` blocks are removed.
- docs: describe the drop-in directories in the Sieve page
- tests: add a regression test with a script added via `user-patches.sh`
- changelog: add a `Fixed` entry with upgrade notes
Closes #4847
19 lines
645 B
Bash
19 lines
645 B
Bash
#!/bin/bash
|
|
##
|
|
# This user script will be executed between configuration and starting daemons
|
|
# To enable it you must save it in your config directory as "user-patches.sh"
|
|
##
|
|
|
|
echo "[user-patches.sh] Adding a global (before) Sieve script to verify that all scripts in the Sieve directory are run"
|
|
|
|
cat >/usr/lib/dovecot/sieve-global/before/60-drop-in.sieve << EOF
|
|
require ["fileinto", "copy", "mailbox"];
|
|
|
|
if address :contains ["From"] "spam@spam.com" {
|
|
fileinto :copy :create "INBOX.drop-in";
|
|
}
|
|
EOF
|
|
|
|
sievec /usr/lib/dovecot/sieve-global/before/60-drop-in.sieve
|
|
chown dovecot:root /usr/lib/dovecot/sieve-global/before/60-drop-in.{sieve,svbin}
|