Skip to content
Snippets Groups Projects
README 9.09 KiB
Newer Older
Sieve implementation for Dovecot v1.2
Stephan Bosch's avatar
Stephan Bosch committed
(NOTE: This is the UNSTABLE development branch)
Introduction
------------

Stephan Bosch's avatar
Stephan Bosch committed
Sieve is a machine language specifically tailored for internet message 
filtering. This package compiles into a Sieve plugin for the Dovecot local 
delivery agent called Deliver. The plugin adds Sieve filtering support to the 
delivery process.  

Previously, the same functionality was provided by the cmusieve plugin for 
Dovecot. This old plugin is based on the CMU Sieve implementation included with
the Cyrus project. This new package provides a complete rewrite of the Sieve 
engine integrating it tightly with Dovecot. The actual execution of the Sieve 
actions is based on the original cmusieve plugin, but only on the code added to 
Stephan Bosch's avatar
Stephan Bosch committed
interface the CMU Sieve implementation with Dovocot. 

The main reason for rewriting the Sieve engine is to provide more reliable 
script execution and to provide better error messages to users and system 
Stephan Bosch's avatar
Stephan Bosch committed
administrators. Also, since the Sieve language evolves quickly, with new 
language extensions published every year, the aim is to provide support for 
quickly extending the engine with new features. 
Stephan Bosch's avatar
Stephan Bosch committed
Features
--------

Stephan Bosch's avatar
Stephan Bosch committed
* Well-structured 3-stage compiler:
 
  Uses dovecot framework and avoids using lex/yacc. Compiler doesn't bail on 
  first error, but tries to find more. Produced errors are aimed to be useful 
  and generally user-comprehensible. Things like 'Generic error' are a nuisance 
  of the past. 

* Highly extendable with new Sieve capabilities: 
Stephan Bosch's avatar
Stephan Bosch committed

  This keeps the possibility of plugins in mind. It should eventually provide 
  the necessary infrastructure for at least all currently known (proposed) 
  extensions. The goal is to keep the extension interface provided by sieve 
  engine as generic as possible, i.e. without explicit support for specific 
  extensions. New similar extensions can then use the same interface methods 
  without changes to the sieve engine code. If an extension is not loaded using 
  the require command, the compiler truly does not know of its existance. 

Stephan Bosch's avatar
Stephan Bosch committed
* Supports all extensions provided by the original CMUSieve plugin:
Stephan Bosch's avatar
Stephan Bosch committed
 
Stephan Bosch's avatar
Stephan Bosch committed
  In addition, it has support for the new and very useful variables extension
  (see next section). 

  NOTE: The original CMUSieve plugin is based on old specifications of the 
  imap4flags and enotify extension. Among other subtle differences, these 
  extensions were known as 'imapflags' and 'notify' for the CMU Sieve plugin.
Stephan Bosch's avatar
Stephan Bosch committed
  Support for the old imapflags extension is provided for backwards compatibility.
Stephan Bosch's avatar
Stephan Bosch committed

Stephan Bosch's avatar
Stephan Bosch committed
* Supports executing multiple scrips sequentially.
  
  Using this feature it is possible to execute administrator-controlled Sieve
  scripts before and after the user's Sieve script is executed. As long as the
  verdict is at least (implicit) keep, the execution will continue with the next
  script. Multiple scripts can be executed before or after the user's script by 
  specifying directories containing sieve files.

Stephan Bosch's avatar
Stephan Bosch committed
* Supported by ManageSieve service:

  This Sieve implementation is supported by the ManageSieve implementation for 
  Dovecot v1.2. Therefore, ManageSieve support can be added to Dovecot for the
  new Sieve plugin just as for the cmusieve plugin.

* Test suite included:
Stephan Bosch's avatar
Stephan Bosch committed
	
  This package includes a test suite to automatically asses whether the compiled 
  sieve engine works correctly. The test suite is an extension to the Sieve 
Stephan Bosch's avatar
Stephan Bosch committed
  language and is therefore easily extended with new tests. Currently, the 
Stephan Bosch's avatar
Stephan Bosch committed
  test suite is mostly limited to testing script processing. The performed actions 
  are not tested fully yet. 
Stephan Bosch's avatar
Stephan Bosch committed

Implementation Status
---------------------

The core of the language (as specified in RFC 5228) is fully supported. In
Stephan Bosch's avatar
Stephan Bosch committed
addition to that, this Sieve implementation features various extensions. The
following list outlines the implementation status of each supported extension:
  The language extensions defined in the base specification are fully supported:
Stephan Bosch's avatar
Stephan Bosch committed

    encoded-character (RFC 5228; page 10)
    fileinto (RFC 5228; page 23)
    envelope (RFC 5228; page 27)

  The following Sieve language extensions are also supported:

    copy (RFC 3894): fully supported
    body (RFC 5173): almost fully supported, but the text body-transform
      implementation is simple and some issues make it still not completely
      RFC compliant.
    environment (RFC 5183): basic support is provided (v0.1.5+)
    variables (RFC 5229): fully supported
    vacation (RFC 5230): fully supported
    relational (RFC 5231): fully supported
    imap4flags (RFC 5232): fully supported
    subaddress (RFC 5233): fully supported, but with limited configurability
    date (RFC 5260; page 3): fully supported (v0.1.12+)
    reject (RFC 5429; page 6): fully supported
    enotify (RFC 5435): fully supported (v0.1.3+), but only the mailto
      notification mechanism is available
    mailbox (RFC 5490; page 2): fully supported (v0.1.10+), but
      ACL permissions are not verified for mailboxexists
    include (draft): fully supported, but the interaction with
      ManageSieve is not according to specification.
    regex (draft): almost fully supported, but UTF-8 is not supported.

  The following deprecated extensions are supported for backwards
  compatibility:

    imapflags (obsolete draft): fully backwards compatible (v0.1.3+)
    notify (obsolete draft): fully backwards compatible (v0.1.15+)

    The availability of these deprecated extensions is disabled by default.

  The following extensions are under development:

    ereject (RFC 5429; page 4): implemented, but currently equal to reject
    spamtest and virustest (RFC 5235): implemented, but needs thorough testing

  Many more extensions to the language exist. Not all of these extensions are
  useful for Dovecot in particular, but many of them are. Currently, the
  author has taken notice of the following extensions:

    index (RFC 5260; page 7): planned
    editheader (RFC 5293): planned
    foreverypart, mime, replace, enclose, and extracttext (RFC 5703): planned

    These extensions will be added as soon as the necessary infrastructure is
    available.
Compiling and Configuring
-------------------------
The main purpose of this package is to replace the existing cmusieve plugin that 
Stephan Bosch's avatar
Stephan Bosch committed
is currently available for Dovecot's deliver. With this respect it is currently 
Stephan Bosch's avatar
Stephan Bosch committed
not very different from the cmusieve plugin implementation.
Stephan Bosch's avatar
Stephan Bosch committed
Unlike cmusieve, this sieve module logs runtime errors to <scriptfile>.log if 
it can and not <scriptfile>.err. It appends new timestamped log entries to the 
end of the logfile. If the log grows too large (currently > 10kB), the logfile 
is rotated to <scriptfile>.log.0 and <scriptfile>.log starts out empty again. 
Stephan Bosch's avatar
Stephan Bosch committed
The cmusieve plugin compiled the script into a file with an appended 'c', e.g. 
'test.sievec'. This new implementation recognizes scripts to have the .sieve 
extension. The binary is (by default) written to a file with extension .svbin. 
This means that the default .dovecot.sieve is compiled into .dovecot.svbin. 
Included scripts are currently always compiled into the main binary, meaning 
that no other files are written and no permission to do so is necessary for the 
global script directories. 

Stephan Bosch's avatar
Stephan Bosch committed
To test the sieve engine outside deliver, it is useful to try the commands that 
exist in the src/sieve-tools/ directory of this package. After installation, 
these are available at your $prefix/bin directory. The following commands are 
installed:
Stephan Bosch's avatar
Stephan Bosch committed
sievec     - Compiles sieve scripts into a binary representation for later 
             execution.
Stephan Bosch's avatar
Stephan Bosch committed
sieve-test - This is a universal Sieve test tool for testing the effect of a
Stephan Bosch's avatar
Stephan Bosch committed
             Sieve script on a particular message. It allows compiling, running 
Stephan Bosch's avatar
Stephan Bosch committed
             and testing Sieve scripts. It can either be used to display the
             actions that would be performed on the provided test message or it
Stephan Bosch's avatar
Stephan Bosch committed
             can be used to test the actual delivery of the message and show the
Stephan Bosch's avatar
Stephan Bosch committed
             messages that would normally be sent through SMTP.
Stephan Bosch's avatar
Stephan Bosch committed
sieved     - Dumps the content of a Sieve binary file for (development) 
             debugging purposes.

Stephan Bosch's avatar
Stephan Bosch committed
When installed, man pages are also available for these commands. In this package
Stephan Bosch's avatar
Stephan Bosch committed
the man pages are present in doc/man and can be viewed before install using e.g.: 

man -l doc/man/sieve-test.1
Stephan Bosch's avatar
Stephan Bosch committed

Various example scripts are bundled in the directory 'examples'. These scripts
were downloaded from various locations. View the top comment in the scripts for 
url and author information.
Known issues
------------

Most open issues are outlined in the TODO file. The more generic ones are (re-)
listed here:

- Compile errors are sometimes a bit obscure and long. This needs work. 
  Suggestions for improvement are welcome. 
- The documentation needs work. The wiki needs to be updated with the newly 
Stephan Bosch's avatar
Stephan Bosch committed
  supported features and extensions.
Stephan Bosch's avatar
Stephan Bosch committed
Authors
-------

Refer to AUTHORS file.

Contact Info
------------

Stephan Bosch <stephan at rename-it dot nl>
IRC: Freenode, #dovecot, S[r]us
Please use the Dovecot mailing list <dovecot at dovecot.org> for questions about 
this package. You can post to the list without subscribing, the mail then waits 
in a moderator queue for a while. See http://dovecot.org/mailinglists.html

Consent

On this website, we use the web analytics service Matomo to analyze and review the use of our website. Through the collected statistics, we can improve our offerings and make them more appealing for you. Here, you can decide whether to allow us to process your data and set corresponding cookies for these purposes, in addition to technically necessary cookies. Further information on data protection—especially regarding "cookies" and "Matomo"—can be found in our privacy policy. You can withdraw your consent at any time.