INSTALL
author Stephan Bosch <stephan@rename-it.nl>
Thu May 19 23:41:02 2011 +0200 (12 months ago)
changeset 1291 3adf9046ded8
parent 1153 16bfc794d411
permissions -rw-r--r--
Added signature for changeset 7ce4e9e8646f
     1 For the most up-to-date information you are referred to the Dovecot wiki:
     2 
     3 http://wiki.dovecot.org/LDA/Sieve/Dovecot
     4 
     5 Compiling
     6 ---------
     7 
     8 Compilation is identical among the CMUSieve and the new Sieve plugin. Use 
     9 --with-dovecot=<path> to point to dovecot-config file's directory. There are two
    10 possibilities where this could exist:
    11 
    12   1. If you configured Dovecot with --enable-header-install, you'll have 
    13      dovecot-config installed in $prefix/lib/dovecot/ directory. For example:
    14 
    15      ./configure --with-dovecot=/usr/local/lib/dovecot
    16      make
    17      sudo make install
    18 
    19   2. Compiled Dovecot sources' root directory. For example:
    20 
    21      ./configure --with-dovecot=../dovecot-1.2.0/
    22      make
    23      make install
    24 
    25 If you downloaded the sources using Mercurial, you will need to execute 
    26 `./autogen.sh' first to build the automake structure in your source tree. This 
    27 process requires autotools and libtool to be installed.
    28 
    29 Dovecot Sieve includes several command line tools to perform tasks such as
    30 compile, verify and debug Sieve scripts (refer to the README file for more
    31 information). These are built only if you use method 2, because they need to
    32 link Dovecot's .a libraries, which can only be found from Dovecot's source tree
    33 (make install doesn't install them).
    34 
    35 Basic Configuration
    36 -------------------
    37 
    38 To use Sieve, you will first need to make sure you are using Dovecot's deliver
    39 for delivering incoming mail to users' mailboxes. Then, you need to enable the
    40 Sieve plugin in your dovecot.conf:
    41 
    42 protocol lda {
    43 ..
    44   # Support for dynamically loadable plugins. mail_plugins is a space separated
    45   # list of plugins to load.
    46   mail_plugins = sieve # ... other plugins like quota
    47 }
    48 
    49 The sieve plugin recognizes the following configuration options in the plugin
    50 section of the config file (default values are shown if applicable):
    51 
    52 sieve = ~/.dovecot.sieve
    53   The path to the user's main active script. 
    54 
    55 sieve_global_path
    56   A path to a global sieve script file, which gets executed ONLY if user's 
    57   private Sieve script doesn't exist, e.g. /var/lib/dovecot/default.sieve. Be 
    58   sure to pre-compile this script manually using the sievec command line tool,
    59   as explained in the README file. 
    60 
    61 sieve_global_dir =
    62   Directory for :global include scripts for the include extension. 
    63 
    64 sieve_dir = ~/
    65   Directory for :personal include scripts for the include extension. 
    66 
    67 sieve_extensions =
    68   Which Sieve language extensions are available to users. By default, all 
    69   supported extensions are available, except for deprecated extensions or those 
    70   that are still under development. Some system administrators may want to 
    71   disable certain Sieve extensions or enable those that are not available by 
    72   default. Supported extensions are listed on this page. This setting can use 
    73   '+' and '-' to specify differences relative to the default. For example 
    74   `sieve_extensions = +imapflags' will enable the deprecated imapflags extension
    75   in addition to all extensions enabled by default. 
    76 
    77 sieve_subaddress_sep = +
    78   The separator that is expected between the :user and :detail address parts 
    79   introduced by the subaddress extension. This may also be a sequence of
    80   characters (e.g. '--'). The current implementation looks for the separator
    81   from the left of the localpart and uses the first one encountered. The :user
    82   part is left of the separator and the :detail part is right.
    83 
    84 For example:
    85 
    86 plugin {
    87 ...
    88    # The location of the user's active script:
    89    sieve = ~/.dovecot.sieve
    90 
    91    # If the user has no personal active script (i.e. if the file 
    92    # indicated in sieve= does not exist), use this one:
    93    sieve_global_path = /var/lib/dovecot/sieve/default.sieve
    94 
    95    # The include extension fetches the :personal scripts from this 
    96    # directory. When ManageSieve is used, this is also where scripts 
    97    # are uploaded.
    98    sieve_dir = ~/sieve
    99 
   100    # The include extension fetches the :global scripts from this 
   101    # directory.
   102    sieve_global_dir = /var/lib/dovecot/sieve/global/
   103 }
   104 
   105 Configurable Limits
   106 -------------------
   107 
   108 sieve_max_script_size = 1M
   109   The maximum size of a Sieve script. The compiler will refuse to compile any
   110   script larger than this limit. 
   111 
   112 sieve_max_actions = 32
   113   The maximum number of actions that can be performed during a single script
   114   execution.
   115 
   116 sieve_max_redirects = 4
   117   The maximum number of redirect actions that can be performed during a single
   118   script execution.
   119 
   120 A value of 0 for these settings means that the limit is not enforced. 
   121 
   122 Per-user Sieve script location
   123 ------------------------------
   124 
   125 By default, the Dovecot Sieve plugin looks for the user's Sieve script file in
   126 the user's home directory (~/.dovecot.sieve). This requires that the home 
   127 directory is set for the user.
   128 
   129 If you want to store the script elsewhere, you can override the default using 
   130 the sieve setting, which specifies the path to the user's script file. This can 
   131 be done in two ways:
   132 
   133  1. Define the sieve setting in the plugin section of dovecot.conf.
   134  2. Return sieve extra field from userdb extra fields. 
   135 
   136 For example, to use a Sieve script file named <username>.sieve in 
   137 /var/sieve-scripts, use:
   138 
   139 plugin {
   140 ...
   141 
   142  sieve = /var/sieve-scripts/%u.sieve
   143 }
   144 
   145 You may use templates like %u, as shown in the example. See all variables.
   146 
   147 A relative path (or just a filename) will be interpreted to point under the 
   148 user's home directory.
   149 
   150 Executing Multiple Scripts Sequentially
   151 ---------------------------------------
   152 
   153 The Dovecot Sieve plugin allows executing multiple Sieve scripts sequentially.
   154 The extra scripts can be executed before and after the user's private script. 
   155 For example, this allows executing global Sieve policies before the user's 
   156 script. This is not possible using the sieve_global_path setting, because that
   157 is only used when the user's private script does not exist. The following 
   158 settings in the plugin section of the Dovecot config file control the execution
   159 sequence:
   160 
   161 sieve_before =
   162   Path to a script file or a directory containing script files that need to be
   163   executed before the user's script. If the path points to a directory, all the
   164   Sieve scripts contained therein (with the proper .sieve extension) are
   165   executed. The order of execution is determined by the file names, using a
   166   normal 8bit per-character comparison. 
   167 
   168 sieve_after =
   169   Identical to sieve_before, only the specified scripts are executed after the
   170   user's script (only when keep is still in effect!). 
   171 
   172 The script execution ends when the currently executing script in the sequence
   173 does not yield a "keep" result: when the script terminates, the next script is 
   174 only executed if an implicit or explicit "keep" is in effect. Thus, to end all
   175 script execution, a script must not execute keep and it must cancel the 
   176 implicit keep, e.g. by executing "discard; stop;". This means that the command 
   177 "keep;" has different semantics when used in a sequence of scripts. For normal
   178 Sieve execution, "keep;" is equivalent to "fileinto "INBOX";", because both 
   179 cause the message to be stored in INBOX. However, in sequential script 
   180 execution, it only controls whether the next script is executed. Storing the 
   181 message into INBOX (the default folder) is not done until the last script in 
   182 the sequence executes (implicit) keep. To force storing the message into INBOX
   183 earlier in the sequence, the fileinto command can be used (with ":copy" or 
   184 together with "keep;").
   185 
   186 Apart from the keep action, all actions triggered in a script in the sequence
   187 are executed before continuing to the next script. This means that when a script
   188 in the sequence encounters an error, actions from earlier executed scripts are
   189 not affected. The sequence is broken however, meaning that the script execution
   190 of the offending script is aborted and no further scripts are executed. An
   191 implicit keep is executed in stead.
   192 
   193 Just as for executing a single script the normal way, the Dovecot Sieve plugin
   194 takes care never to duplicate deliveries, forwards or responses. When vacation
   195 actions are executed multiple times in different scripts, the usual error is not
   196 triggered: the subsequent duplicate vacation actions are simply discarded.
   197 
   198 For example:
   199 
   200 plugin {
   201 ...
   202    # Scripts executed before the user's script.
   203    #   E.g. handling messages marked as dangerous
   204    sieve_before = /var/lib/dovecot/sieve/discard-virusses.sieve
   205 
   206    # Scripts executed after the user's script (if keep is still in effect)
   207    #   E.g. default mail filing rules.
   208    sieve_after = /var/lib/dovecot/sieve/after.d/
   209 }
   210 
   211 IMPORTANT: Be sure to manually pre-compile the scripts specified by sieve_before 
   212 and sieve_after using the sievec tool, as explained in the README file.
   213 
   214 Spamtest and Virustest Extensions
   215 ---------------------------------
   216 
   217 Using the spamtest and virustest extensions (RFC 5235), the Sieve language 
   218 provides a uniform and standardized command interface for evaluating spam and
   219 virus tests performed on the message. Users no longer need to know what headers 
   220 need to be checked and how the scanner's verdict is represented in the header 
   221 field value. They only need to know how to use the spamtest (spamtestplus) and 
   222 virustest extensions. This also gives GUI-based Sieve editors the means to 
   223 provide a portable and easy to install interface for spam and virus filter 
   224 configuration.
   225 
   226 The spamtest, spamtestplus and virustest extensions require explicit
   227 configuration and are not enabled for use by default. Refer to 
   228 doc/spamtest-virustest.txt for configuration information.  
   229 
   230 Migration from CMUSieve
   231 -----------------------
   232 
   233 For the most part, migration from CMUSieve to the new Sieve plugin is just a
   234 matter of changing the used plugin name from cmusieve to sieve in the
   235 mail_plugins option in the protocol lda section of the config file (as explained
   236 above). However, there are a few important differences:
   237 
   238  * The imapflags extension is now called imap4flags. The CMUSieve implementation
   239    is based on an old draft specification that is not completely compatible.
   240    Particularly, the mark and unmark commands were removed from the new
   241    specification. For backwards compatibility, support for the old imapflags
   242    extension can be enabled using the sieve_extensions setting (as explained
   243    above). This is disabled by default.
   244  
   245  * The notify extension is now called enotify. Sieve scripts need to be adjusted
   246    to incorporate this change: unlike imapflags, no backwards compatibility is
   247    provided currently.
   248  
   249  * The include extension now requires your script file names to end with 
   250    ".sieve" : include :personal "myscript"; won't work unless you rename
   251    "myscript" to "myscript.sieve" 
   252 
   253 Test Suite
   254 ----------
   255 
   256 This package includes a test suite to verify the basic processing of the Sieve
   257 interpreter on your particular platform. Note that the test suite is not
   258 available when this package is compiled against the Dovecot headers only. The
   259 test suite executes a list of test cases and halts when one of them fails. If it
   260 executes all test cases successfully, the test suite finishes. You can execute
   261 the test suite using `make test`.
   262 
   263 A failing test case is always a bug and a report is greatly appreciated.
   264