OBM 3.2 introduces a new feature: global sieve filters.
This allows an administrator to implement default filtering rules applied to all users of an obm installation, automatically.
## Configuration
### Create the global Sieve script
You have to create the script to enable the feature. The exact contents of the script depends on what you are trying to achieve, but it's a regular Sieve script, following the same syntax as user scripts.
As an example, a global script could look like this:
require "fileinto";
if header :contains "X-Spam-Flag" "YES" {
fileinto "Junk";
stop;
}
The above script would place all mails marked with a `X-Spam-Flag` header to the _Junk_ folder.
The script must be put under `/var/lib/imap/sieve/global/main.script` on CentOS or `/var/spool/sieve/global/main.script` on Debian.
This can be done by using the Sieve network protocol by authenticationg as a Cyrus Sieve admin.
### Compile the global script
The Sieve script, as any regular user script, must be compiled. To do this, simply run the following commands
cd /var/lib/imap/sieve/global
/usr/lib/cyrus-imapd/sievec main.script main.bc
on CentOS, or
cd /var/spool/sieve/global/
/usr/lib/cyrus/bin/sievec main.script main.bc
on Debian.
### Enable the required extensions in imapd.conf
To allow the global script to be included in user scripts, the `include` extension must be loaded by Cyrus. To do so, you must add or edit the *sieve_extensions* directive to the `/etc/imapd.conf` file:
sieve_extensions: fileinto reject vacation imapflags notify include envelope body relational regex subaddress copy
### Enable global script support in OBM
Edit the file `/etc/obm/obm_conf.ini` and add (or uncomment) the following line
useGlobalSieveScript = true
in the `[automate]` section.
## Initial setup
To enable the global sieve filter for all users, you have to run the automaton (aka. the "yellow pill") globally on your OBM domain. To do this, simply run the following command:
/usr/share/obm/auto/update.pl --global --domain-name
on CentOS, or
/usr/share/obm/www/auto/update.pl --global --domain-name
on Debian.Apparel