[Dovecot] dovecot-sieve with FreeBSD
Hello,
I've a test system with postfix (SMTP), dovecot (IMAP only) and covecot-LDA (MDA) under FreeBSD-6.1. Currently everything works fine. But I wasn't able to install dovecot-sieve from the CVS. Does anyone has a small documentation howto install dovecot-sieve on FreeBSD.
Thanks.
--
Der GMX SmartSurfer hilft bis zu 70% Ihrer Onlinekosten zu sparen! Ideal für Modem und ISDN: http://www.gmx.net/de/go/smartsurfer
Hi,
Peter Bauer wrote:
Hello,
I've a test system with postfix (SMTP), dovecot (IMAP only) and covecot-LDA (MDA) under FreeBSD-6.1. Currently everything works fine. But I wasn't able to install dovecot-sieve from the CVS. Does anyone has a small documentation howto install dovecot-sieve on FreeBSD.
Here are my little notes I've wrote while installing and testing. I'm still testing though, so, if you (or anyone else ;) find anything wrong, have questions, give feedback!
== Sieve plugin for dovecot LDA
- libsieve comes from the cyrus imap server (mail/cyrus-imapd23)
Obtain the sieve plugin from CVS:
cvs -d :pserver:anonymous@dovecot.org:/home/cvs co dovecot-sieve
On FreeBSD change the autogen.sh file contents to:
# using automake19, autoconf259, and libtool15 ports. aclocal19 -I /usr/local/share/aclocal autoheader259 libtoolize --force automake19 --add-missing autoconf259
Then, run it:
./autogen.sh
Install this sieve plugin:
# NB: Before you continue, make sure you didn't clean the dovecot # port when you've build it, eg: built it using: # # cd /usr/ports/mail/dovecot/ && make install # # You can clean it after you've build the sieve plugin though.
./configure
--prefix=/usr/local
--with-dovecot=/usr/ports/mail/dovecot/work/dovecot-1.0.rc7
make install
Configure dovecot to use the sieve plugin:
vim /usr/local/etc/dovecot.conf protocol lda { ... mail_plugins = cmusieve # ... other plugins ... }
Make a test sieve script:
cat <<"EOF" > /var/vmail/two.example.com/rgl/.dovecot.sieve require ["fileinto", "reject", "vacation"]; # * A sieve script is UTF-8 encoded. # # * folders are automatically created by the "fileinto" action. # # * By default (when no :comparator argument is given) all string # comparations are case-insensitive (in the ASCII range; # :comparator "i;ascii-casemap"). # See the "2.7.3. Comparators" section at # http://www.ietf.org/internet-drafts/draft-ietf-sieve-3028bis-09.txt # # See sieve information at # http://www.ietf.org/html.charters/sieve-charter.html # For "vacation" see # http://ietfreport.isoc.org/idref/draft-ietf-sieve-vacation/
# Moved SPAM marked messages to the Spam folder and stop processing. if header "X-Spam-Flag" "YES" { fileinto "Spam"; stop; }
# Move all mailer-daemon@ into a subfolder if header :contains ["To", "Cc", "Bcc", "Reply-To", "In-Reply-To"] [ "mailer-daemon@two.example.com", "mailer-daemon@example.com", "mailer-daemon@turbina.example.com" ] { fileinto "mailer-daemon"; stop; }
# OR, using :matches:
if header :matches ["To", "Cc", "Bcc", "Reply-To", "In-Reply-To"] ["mailer-daemon@*"] { fileinto "mailer-daemon"; stop; }
# move all mail @foxie.example.com to a subfolder. if header :matches "To" "*@foxie.example.com" { fileinto "foxie"; stop; }
# Some misc. tests follow.
if header :contains "subject" ["test1", "test3"] { fileinto "test-odd"; } elsif header :contains "subject" ["test2", "test4"] { fileinto "test-even"; } elsif header "subject" "reject" { reject "reject test!"; } elsif header "subject" "discard" { # discarded message are silently droped. discard; } elsif header "subject" "redirect" { # this will redirect the message to "root" user, without storing the # message in our mailbox. # NB: Because, in my case, the "postmaster" is an alias to this same # mailbox, so we also test the loop prevention mechanism of # dovecot LDA. # AND in this case we will NOT receive any message on our email # box. # sent emails ids are stored inside ~/.dovecot.lda-dupes redirect "postmaster@two.example.com"; } elsif header "subject" "redirect to bob" { redirect "bob@two.example.com"; } elsif header "subject" "vacation" { # sent emails ids are stored inside ~/.dovecot.lda-dupes in order to # detect loops. # List of auto replied senders are also stored here in order to # prevent multiple replies to the same sender for a given period of # time (defaults to 7 days [see src/libsieve/sieve.y]; min is 1 day, # max is 31 days) vacation "I'm out! I'll reply when I get back"; } EOF
NB: Errors on the sieve script are reported on the maillog and in a file named .dovecot.sieve.err near the normal .dovecot.sieve.
# In this little "tests", I have several test mailboxes, like # rgl@two.example.com, alice@two.example.com, etc, which are handled by # dovecot LDA with a sieve script.
printf 'Subject: test1\n\ntesting!\n' | sendmail rgl@two.example.com
printf 'Subject: reject\n\ntesting!\n' | sendmail rgl@two.example.com
printf 'Subject: discard\n\ntesting!\n' | sendmail rgl@two.example.com
printf 'Subject: redirect\n\ntesting!\n'
| sendmail -f alice@two.example.com rgl@two.example.com
printf 'Subject: redirect to bob\n\ntesting!\n'
| sendmail -f alice@two.example.com rgl@two.example.com
printf 'Subject: test2\nX-Spam-Status: Yes\n\ntesting!\n'
| sendmail rgl@two.example.com
printf 'Subject: vacation\n\ntesting!\n'
| sendmail -f alice@two.example.com rgl@two.example.com
HTH, Rui Lopes
Hello Rui Lopes,
dovecot-sieve built without any problems. Thank you very much. I'll test dovecot-sieve this evening on my test environment.
Thanks Peter Bauer.
Echte DSL-Flatrate dauerhaft für 0,- Euro*. Nur noch kurze Zeit! "Feel free" mit GMX DSL: http://www.gmx.net/de/go/dsl
On 2006-09-05 11:32:13 +0100, Rui Lopes wrote:
== Sieve plugin for dovecot LDA
- libsieve comes from the cyrus imap server (mail/cyrus-imapd23)
the dovecot-lda sieve has an intree copy of libsieve. no need to install the cyrus version.
darix
-- openSUSE - SUSE Linux is my linux openSUSE is good for you www.opensuse.org
Marcus Rueckert wrote:
On 2006-09-05 11:32:13 +0100, Rui Lopes wrote:
== Sieve plugin for dovecot LDA
- libsieve comes from the cyrus imap server (mail/cyrus-imapd23)
the dovecot-lda sieve has an intree copy of libsieve. no need to install the cyrus version.
You are right Marcus, that is just a note to self, saying from where the main sieve code comes from. I didn't wanted to imply that you need to install the mail/cyrus-imapd23 port or the cyrus imap server, because that would not even work because Timo has modified libsieve to fit into the dovecot plugin. (you probably known that, though ;)
-- Rui Lopes
Dear Rui Lopes,
Greet. I am looking for a sieve tutorial like this for a long time. And this is what I need :)
Thanks.
Rui Lopes wrote:
Hi,
Peter Bauer wrote:
Hello,
I've a test system with postfix (SMTP), dovecot (IMAP only) and covecot-LDA (MDA) under FreeBSD-6.1. Currently everything works fine. But I wasn't able to install dovecot-sieve from the CVS. Does anyone has a small documentation howto install dovecot-sieve on FreeBSD.
Here are my little notes I've wrote while installing and testing. I'm still testing though, so, if you (or anyone else ;) find anything wrong, have questions, give feedback!
== Sieve plugin for dovecot LDA
- libsieve comes from the cyrus imap server (mail/cyrus-imapd23)
Obtain the sieve plugin from CVS:
cvs -d :pserver:anonymous@dovecot.org:/home/cvs co dovecot-sieve
On FreeBSD change the autogen.sh file contents to:
# using automake19, autoconf259, and libtool15 ports. aclocal19 -I /usr/local/share/aclocal autoheader259 libtoolize --force automake19 --add-missing autoconf259
Then, run it:
./autogen.sh
Install this sieve plugin:
# NB: Before you continue, make sure you didn't clean the dovecot # port when you've build it, eg: built it using: # # cd /usr/ports/mail/dovecot/ && make install # # You can clean it after you've build the sieve plugin though.
./configure
--prefix=/usr/local
--with-dovecot=/usr/ports/mail/dovecot/work/dovecot-1.0.rc7 make installConfigure dovecot to use the sieve plugin:
vim /usr/local/etc/dovecot.conf protocol lda { ... mail_plugins = cmusieve # ... other plugins ... }
Make a test sieve script:
cat <<"EOF" > /var/vmail/two.example.com/rgl/.dovecot.sieve require ["fileinto", "reject", "vacation"]; # * A sieve script is UTF-8 encoded. # # * folders are automatically created by the "fileinto" action. # # * By default (when no :comparator argument is given) all string # comparations are case-insensitive (in the ASCII range; # :comparator "i;ascii-casemap"). # See the "2.7.3. Comparators" section at # http://www.ietf.org/internet-drafts/draft-ietf-sieve-3028bis-09.txt # # See sieve information at # http://www.ietf.org/html.charters/sieve-charter.html # For "vacation" see # http://ietfreport.isoc.org/idref/draft-ietf-sieve-vacation/
# Moved SPAM marked messages to the Spam folder and stop processing. if header "X-Spam-Flag" "YES" { fileinto "Spam"; stop; }
# Move all mailer-daemon@ into a subfolder if header :contains ["To", "Cc", "Bcc", "Reply-To", "In-Reply-To"] [ "mailer-daemon@two.example.com", "mailer-daemon@example.com", "mailer-daemon@turbina.example.com" ] { fileinto "mailer-daemon"; stop; }
# OR, using :matches:
if header :matches ["To", "Cc", "Bcc", "Reply-To", "In-Reply-To"] ["mailer-daemon@*"] { fileinto "mailer-daemon"; stop; }
# move all mail @foxie.example.com to a subfolder. if header :matches "To" "*@foxie.example.com" { fileinto "foxie"; stop; }
# Some misc. tests follow.
if header :contains "subject" ["test1", "test3"] { fileinto "test-odd"; } elsif header :contains "subject" ["test2", "test4"] { fileinto "test-even"; } elsif header "subject" "reject" { reject "reject test!"; } elsif header "subject" "discard" { # discarded message are silently droped. discard; } elsif header "subject" "redirect" { # this will redirect the message to "root" user, without storing the # message in our mailbox. # NB: Because, in my case, the "postmaster" is an alias to this same # mailbox, so we also test the loop prevention mechanism of # dovecot LDA. # AND in this case we will NOT receive any message on our email # box. # sent emails ids are stored inside ~/.dovecot.lda-dupes redirect "postmaster@two.example.com"; } elsif header "subject" "redirect to bob" { redirect "bob@two.example.com"; } elsif header "subject" "vacation" { # sent emails ids are stored inside ~/.dovecot.lda-dupes in order to # detect loops. # List of auto replied senders are also stored here in order to # prevent multiple replies to the same sender for a given period of # time (defaults to 7 days [see src/libsieve/sieve.y]; min is 1 day, # max is 31 days) vacation "I'm out! I'll reply when I get back"; } EOF
NB: Errors on the sieve script are reported on the maillog and in a file named .dovecot.sieve.err near the normal .dovecot.sieve.
# In this little "tests", I have several test mailboxes, like # rgl@two.example.com, alice@two.example.com, etc, which are handled by # dovecot LDA with a sieve script.
printf 'Subject: test1\n\ntesting!\n' | sendmail rgl@two.example.com
printf 'Subject: reject\n\ntesting!\n' | sendmail rgl@two.example.com
printf 'Subject: discard\n\ntesting!\n' | sendmail rgl@two.example.com
printf 'Subject: redirect\n\ntesting!\n'
| sendmail -f alice@two.example.com rgl@two.example.comprintf 'Subject: redirect to bob\n\ntesting!\n'
| sendmail -f alice@two.example.com rgl@two.example.comprintf 'Subject: test2\nX-Spam-Status: Yes\n\ntesting!\n'
| sendmail rgl@two.example.comprintf 'Subject: vacation\n\ntesting!\n'
| sendmail -f alice@two.example.com rgl@two.example.comHTH, Rui Lopes
-- Xueron Nee xueron@gmail.com
participants (4)
-
Marcus Rueckert
-
Peter Bauer
-
Rui Lopes
-
Xueron Nee