[Dovecot] Cannot get dovecot-sieve to work
Hi all
# dovecot --version
1.2.10
# dovecot -n
# 1.2.10: /etc/dovecot.conf
# OS: Linux 2.6.18-128.el5 x86_64 Red Hat Enterprise Linux Server release 5.3 (Tikanga)
log_path: /var/log/dovecot.log
info_log_path: /var/log/dovecot.log
ssl: no
login_dir: /var/run/dovecot/login
login_executable(default): /usr/libexec/dovecot/imap-login
login_executable(imap): /usr/libexec/dovecot/imap-login
login_executable(pop3): /usr/libexec/dovecot/pop3-login
mail_location: mbox:~/mail:INBOX=/var/mail/%u
mail_debug: yes
mail_executable(default): /usr/libexec/dovecot/imap
mail_executable(imap): /usr/libexec/dovecot/imap
mail_executable(pop3): /usr/libexec/dovecot/pop3
mail_plugin_dir(default): /usr/lib/dovecot/imap
mail_plugin_dir(imap): /usr/lib/dovecot/imap
mail_plugin_dir(pop3): /usr/lib/dovecot/pop3
lda:
mail_plugins: sieve
auth default:
debug: yes
passdb:
driver: pam
userdb:
driver: passwd
plugin:
sieve: ~/.dovecot.sieve
sieve_dir: ~/
log_path: /var/log/dovecot.log
Here is my ~/.dovecot.sieve
$ cat .dovecot.sieve
require "fileinto";
if not header :contains "subject" "GRE:99" {
discard;
stop;
} else {
keep;
}
I only want to accept emails with GRE:99 as the subject, I'm not interested in any other mails.
However when I send myself an email via the mail command all emails go into my INBOX whatever the subject is.
I don't really get any info in the logs either:
Jan 27 17:34:20 dovecot: Info: Dovecot v1.2.10 starting up (core dumps disabled)
Jan 27 17:34:21 auth(default): Info: new auth connection: pid=495
Jan 27 17:34:21 auth(default): Info: new auth connection: pid=496
Jan 27 17:34:21 auth(default): Info: new auth connection: pid=497
Jan 27 17:34:21 auth(default): Info: new auth connection: pid=498
Jan 27 17:34:21 auth(default): Info: new auth connection: pid=499
Jan 27 17:34:21 auth(default): Info: new auth connection: pid=500
Jan 27 17:34:32 auth(default): Info: client in: AUTH 1 PLAIN service=imap lip=192.168.10.208 rip=192.168.10.207 lport=143 rport=22688 resp=<hidden>
Jan 27 17:34:32 auth-worker(default): Info: pam(nickl,192.168.10.207): lookup service=dovecot
Jan 27 17:34:32 auth-worker(default): Info: pam(nickl,192.168.10.207): #1/1 style=1 msg=Password:
Jan 27 17:34:32 auth(default): Info: client out: OK 1 user=nickl
Jan 27 17:34:32 auth(default): Info: master in: REQUEST 1 500 1
Jan 27 17:34:32 auth(default): Info: passwd(nickl,192.168.10.207): lookup
Jan 27 17:34:32 auth(default): Info: master out: USER 1 nickl system_groups_user=nickl uid=503 gid=503 home=/home/nickl
Jan 27 17:34:32 imap-login: Info: Login: user=<nickl>, method=PLAIN, rip=192.168.10.207, lip=192.168.10.208
Jan 27 17:34:32 IMAP(nickl): Info: Effective uid=503, gid=503, home=/home/nickl
Jan 27 17:34:32 IMAP(nickl): Info: mbox: data=~/mail:INBOX=/var/mail/nickl
Jan 27 17:34:32 IMAP(nickl): Info: fs: root=/home/nickl/mail, index=, control=, inbox=/var/mail/nickl
Jan 27 17:34:32 auth(default): Info: new auth connection: pid=513
Im sure my .dovecot.sieve is not getting processed but I cannot prove it.
Any help would be appreciated.
Many thanks
Nick .
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
On Wed, 27 Jan 2010, Nick Lunt wrote:
Im sure my .dovecot.sieve is not getting processed but I cannot prove it.
Do you have a .dovecot.sievec (Note the 'c' at the end) file?
Did you configured your MTA to use Dovecot deliver as LDA? http://wiki.dovecot.org/LDA
Regards,
Steffen Kaiser -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.6 (GNU/Linux)
iQEVAwUBS2Bd77+Vh58GPL/cAQKAnAf/T9XbCg17adg+kqi00UvDB15em07zVC4c QzwJOvCBw0qmR1Qg+tlzlehW9SMbz3X04++1k008wBaGfdQQ+d/ihWpe7e/54JuM iuCgN6oL7Pcv3dGVhIxW/H6ZKwfmyMjIjrhJMpKbLggXdRrvVEaceA26my5xXG2n XrSivtNWhaYTGKMWUIq8uBH0X+SeNKtLOn0ix5XrL5tceN24nwVqcwqe8A+0ujd+ HTIjDz2c1vguUchjKMzO0t0AP+b6JjihX++Dr7b71QztKTiKizHZ2IBuMKs6ek9e V6Zeh/Yabm9IKr8xv2vU2nUjCdQZ5beHmSalGy2oVU5Yy1fbSb+qSA== =NdYw -----END PGP SIGNATURE-----
On Wed, 27 Jan 2010, Nick Lunt wrote:
Im sure my .dovecot.sieve is not getting processed but I cannot prove it.
Do you have a .dovecot.sievec (Note the 'c' at the end) file?
Did you configured your MTA to use Dovecot deliver as LDA? http://wiki.dovecot.org/LDA
We have dovecot already setup and it receives mail as desired. The organisation now only wants mail with the correct subject header to appear in the inbox. I am not aware that I have to change the config within sendmail for this.
No I do not have a .dovecot.sievec file I'm afraid. When I run sievec on the .dovecot.sieve it creates a .dovecot.svbin
Many thanks, Nick.
__________ Information from ESET NOD32 Antivirus, version of virus signature database 4810 (20100127) __________
The message was checked by ESET NOD32 Antivirus.
Nick Lunt wrote:
I don't really get any info in the logs either:
<snip> > > Im sure my .dovecot.sieve is not getting processed but I cannot prove > it. >
Your sieve file will be processed at delivery time, when the MTA (f.i. postfix) will hand off mail to the dovecot LDA, deliver. Your log file shows only activity about an IMAP login. This has no use in debugging your problem.
- Check your MTA config and see if it calls deliver
- Send yourself a mail
- Check MTA logs and see if handing the mail to deliver works as intended
- Check dovecot logs for activity from deliver.
Regards, Tom
-----Original Message----- From: Tom Hendrikx [mailto:tom@whyscream.net] Sent: 27 January 2010 15:53 To: Nick Lunt; dovecot@dovecot.org Subject: Re: [Dovecot] Cannot get dovecot-sieve to work
Your sieve file will be processed at delivery time, when the MTA (f.i. postfix) will hand off mail to the dovecot LDA, deliver. Your log file shows only activity about an IMAP login. This has no use in debugging your problem.
- Check your MTA config and see if it calls deliver
- Send yourself a mail
- Check MTA logs and see if handing the mail to deliver works as intended
- Check dovecot logs for activity from deliver.
Were using sendmail as the MTA. I have edited sendmail.cf as documented at http://wiki.dovecot.org/LDA/Sendmail. However this documentation states the following:
"The following describes how to configure Sendmail to use deliver where root permission is not granted and Dovecot runs under a single user ID. It may need some adjustment for more typical setups. Other assumptions are that Sendmail is configured for virtual hosting and that local-system mail delivery is not handled by deliver."
Our sendmail setup is not configured for virtual hosting.
Here is what I have put in sendmail.cf
Mdovecot, P=/usr/libexec/dovecot/deliver, F=DFMPhnu9, S=EnvFromSMTP/HdrFromSMTP, R=EnvToSMTP/HdrFromSMTP, T=DNS/RFC822/X-Unix, A=deliver -d $u
I restarted both sendmail and dovecot but still my test emails do not get processed by dovecot/dovecot-sieve. There is nothing in the dovecot or sendmail logs pointing to dovecot-sieve.
All I want to do is discard mail depending on the subject.
Any help appreciated, Many thanks Nick.
__________ Information from ESET NOD32 Antivirus, version of virus signature database 4812 (20100128) __________
The message was checked by ESET NOD32 Antivirus.
-----Original Message----- From: dovecot-bounces+nick.lunt=patech-solutions.com@dovecot.org [mailto:dovecot-bounces+nick.lunt=patech-solutions.com@dovecot.org] On Behalf Of Nick Lunt Sent: 28 January 2010 08:50 To: dovecot@dovecot.org Subject: Re: [Dovecot] Cannot get dovecot-sieve to work
-----Original Message----- From: Tom Hendrikx [mailto:tom@whyscream.net] Sent: 27 January 2010 15:53 To: Nick Lunt; dovecot@dovecot.org Subject: Re: [Dovecot] Cannot get dovecot-sieve to work
Your sieve file will be processed at delivery time, when the MTA (f.i. postfix) will hand off mail to the dovecot LDA, deliver. Your log file shows only activity about an IMAP login. This has no use in debugging your problem.
- Check your MTA config and see if it calls deliver
- Send yourself a mail
- Check MTA logs and see if handing the mail to deliver works as intended
- Check dovecot logs for activity from deliver.
Were using sendmail as the MTA. I have edited sendmail.cf as documented at http://wiki.dovecot.org/LDA/Sendmail. However this documentation states the following:
"The following describes how to configure Sendmail to use deliver where root permission is not granted and Dovecot runs under a single user ID. It may need some adjustment for more typical setups. Other assumptions are that Sendmail is configured for virtual hosting and that local-system mail delivery is not handled by deliver."
Our sendmail setup is not configured for virtual hosting.
Here is what I have put in sendmail.cf
Mdovecot, P=/usr/libexec/dovecot/deliver, F=DFMPhnu9, S=EnvFromSMTP/HdrFromSMTP, R=EnvToSMTP/HdrFromSMTP, T=DNS/RFC822/X-Unix, A=deliver -d $u
I restarted both sendmail and dovecot but still my test emails do not get processed by dovecot/dovecot-sieve. There is nothing in the dovecot or sendmail logs pointing to dovecot-sieve.
All I want to do is discard mail depending on the subject.
Right, I've ditched sendmail and were now running postfix.
Here's my .dovecot.sieve
require "fileinto"; if not header :contains "subject" "ORG:11" { fileinto "discard"; stop; }
When I send a mail without "ORG:11" in the header, the mail goes into the discard folder, great. However when I send a mail with "ORG:11" in the header I get the following error:
==> /var/log/maillog <== Jan 28 12:36:26 psl-dev sendmail[16599]: o0SCaQAX016599: from=nickl, size=31, class=0, nrcpts=1, msgid=201001281236.o0SCaQAX016599@psl-dev.patech-solutions.com, relay=nickl@localhost Jan 28 12:36:26 psl-dev postfix/smtpd[16600]: connect from localhost.localdomain[127.0.0.1] Jan 28 12:36:26 psl-dev postfix/smtpd[16600]: B1BC9194D63: client=localhost.localdomain[127.0.0.1] Jan 28 12:36:26 psl-dev postfix/cleanup[16603]: B1BC9194D63: message-id=201001281236.o0SCaQAX016599@psl-dev.patech-solutions.com Jan 28 12:36:26 psl-dev postfix/qmgr[16096]: B1BC9194D63: from=nickl@psl-dev.patech-solutions.com, size=600, nrcpt=1 (queue active) Jan 28 12:36:26 psl-dev sendmail[16599]: o0SCaQAX016599: to=nickl, ctladdr=nickl (503/503), delay=00:00:00, xdelay=00:00:00, mailer=relay, pri=30031, relay=[127.0.0.1] [127.0.0.1], dsn=2.0.0, stat=Sent (Ok: queued as B1BC9194D63) Jan 28 12:36:26 psl-dev postfix/smtpd[16600]: disconnect from localhost.localdomain[127.0.0.1] Jan 28 12:36:26 psl-dev postfix/local[16604]: B1BC9194D63: to=nickl@psl-dev.patech-solutions.com, relay=local, delay=0.06, delays=0.05/0/0/0.01, dsn=4.3.0, status=deferred (temporary failure)
==> /var/log/dovecot.log <== Jan 28 12:36:26 deliver(nickl): Info: Loading modules from directory: /usr/lib/dovecot/lda Jan 28 12:36:26 deliver(nickl): Info: Module loaded: /usr/lib/dovecot/lda/lib90_sieve_plugin.so Jan 28 12:36:26 deliver(nickl): Info: mbox: data=/home/nickl/mail:INBOX=/var/mail/nickl Jan 28 12:36:26 deliver(nickl): Info: fs: root=/home/nickl/mail, index=, control=, inbox=/var/mail/nickl Jan 28 12:36:26 deliver(nickl): Info: sieve: using sieve path for user's script: /home/nickl/.dovecot.sieve Jan 28 12:36:26 deliver(nickl): Info: sieve: opening script /home/nickl/.dovecot.sieve Jan 28 12:36:26 deliver(nickl): Info: sieve: executing compiled script /home/nickl/.dovecot.sieve Jan 28 12:36:26 deliver(nickl): Error: file_dotlock_create(/var/mail/nickl) failed: Permission denied (euid=503(nickl) egid=503(nickl) missing +w perm: /var/mail) (set mail_privileged_group=mail) Jan 28 12:36:26 deliver(nickl): Error: sieve: msgid=201001281236.o0SCaQAX016599@psl-dev.patech-solutions.com: failed to store into mailbox 'INBOX': Internal error occurred. Refer to server log for more information. [2010-01-28 12:36:26] Jan 28 12:36:26 deliver(nickl): Error: sieve: script /home/nickl/.dovecot.sieve failed with unsuccessful implicit keep
Here are the permissions on /var/mail/ # ls -ld /var/spool/mail drwxrwxr-x 2 root mail 4096 Jan 28 11:02 /var/spool/mail
# ls -l /var/mail/ total 528 -rw-rw---- 1 nickl mail 0 Jan 28 11:02 nickl -rw------- 1 root root 517203 Jan 28 04:02 root
Here is dovecot -n
# dovecot -n # 1.2.10: /etc/dovecot.conf # OS: Linux 2.6.18-128.el5 x86_64 Red Hat Enterprise Linux Server release 5.3 (Tikanga) log_path: /var/log/dovecot.log info_log_path: /var/log/dovecot.log ssl: no login_dir: /var/run/dovecot/login login_executable(default): /usr/libexec/dovecot/imap-login login_executable(imap): /usr/libexec/dovecot/imap-login login_executable(pop3): /usr/libexec/dovecot/pop3-login mail_access_groups: mail mail_privileged_group: mail mail_location: mbox:~/mail:INBOX=/var/mail/%u mail_debug: yes mail_executable(default): /usr/libexec/dovecot/imap mail_executable(imap): /usr/libexec/dovecot/imap mail_executable(pop3): /usr/libexec/dovecot/pop3 mail_plugin_dir(default): /usr/lib/dovecot/imap mail_plugin_dir(imap): /usr/lib/dovecot/imap mail_plugin_dir(pop3): /usr/lib/dovecot/pop3 lda: postmaster_address: root@localhost mail_plugins: sieve auth default: debug: yes passdb: driver: pam userdb: driver: passwd plugin: sieve: ~/.dovecot.sieve sieve_dir: ~/ log_path: /var/log/dovecot.log
Many thanks, Nick.
__________ Information from ESET NOD32 Antivirus, version of virus signature database 4813 (20100128) __________
The message was checked by ESET NOD32 Antivirus.
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
On Thu, 28 Jan 2010, Nick Lunt wrote:
Here is what I have put in sendmail.cf
Mdovecot, P=/usr/libexec/dovecot/deliver, F=DFMPhnu9, S=EnvFromSMTP/HdrFromSMTP, R=EnvToSMTP/HdrFromSMTP, T=DNS/RFC822/X-Unix, A=deliver -d $u
Did you configured mailertable to deliver the messages through the "dovecot" mailer?
I prefer:
dnl -f $g -- sender
dnl -d $u -- destination user account name
dnl -m $h -- mailbox to deliver to (+detail part of address)
dnl -n -- don't create new mailbox
FEATURE(local_procmail',
/etc/mail/smrsh/dovecot-deliver',
/etc/mail/smrsh/dovecot-deliver -e -f $g -d $u -m $h')dnl MAILER_DEFINITIONS MAILER(
local')dnl
MAILER(`smtp')dnl
Jan 28 12:36:26 deliver(nickl): Error: file_dotlock_create(/var/mail/nickl) failed: Permission denied (euid=503(nickl) egid=503(nickl) missing +w perm: /var/mail) (set ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ mail_privileged_group=mail)
Here are the permissions on /var/mail/ # ls -ld /var/spool/mail drwxrwxr-x 2 root mail 4096 Jan 28 11:02 /var/spool/mail ^^^^
mail_access_groups: mail mail_privileged_group: mail
Won't work with deliver, maybe only if it is SUID.
=====
If Dovecot is the only process accessing /var/mail/file, you could:
a) use another location for INBOX, b) use flock.
Regards,
Steffen Kaiser -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.6 (GNU/Linux)
iQEVAwUBS2F5LL+Vh58GPL/cAQKIewf/Ug9lYjHST2XRKN/tsdZGE9YUnKsM4HJb 5N9cYcYRCvfZ2jGmDRn8ED6LPPp2fzATLOe5nV9wo63s9p+x8+d3gV8Y3UTJVQys lWDqOsBJgl7+AIdUKiPAF/Dt1Y05b8avC9kGmq54JFZcSzRK/PZhXTyuXp38o+HT /FReiaWcjrynmswnw30OriLGLBlZL7ZnIQDEqvXhaJJD1uts4OuMVrkics7jkGbk Lmcsf1jyFTpO9t9bPflduO9pK6mtgIsCGpfXE7k6/13uWtG3eiJsEk8picyteT1O 16JCpiyPXdcZBV+BYUgyOWjA7ifhnmSDj/wGLRWnXOm6CwSkwxrcXA== =XxwE -----END PGP SIGNATURE-----
-----Original Message----- From: dovecot-bounces+nick.lunt=patech-solutions.com@dovecot.org [mailto:dovecot-bounces+nick.lunt=patech-solutions.com@dovecot.org] On Behalf Of Steffen Kaiser Sent: 28 January 2010 11:47 To: dovecot@dovecot.org Cc: dovecot@dovecot.org Subject: Re: [Dovecot] Cannot get dovecot-sieve to work
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
On Thu, 28 Jan 2010, Nick Lunt wrote:
Here is what I have put in sendmail.cf
Mdovecot, P=/usr/libexec/dovecot/deliver, F=DFMPhnu9, S=EnvFromSMTP/HdrFromSMTP, R=EnvToSMTP/HdrFromSMTP, T=DNS/RFC822/X-Unix, A=deliver -d $u
Did you configured mailertable to deliver the messages through the "dovecot" mailer?
I prefer: dnl -f $g -- sender dnl -d $u -- destination user account name dnl -m $h -- mailbox to deliver to (+detail part of address) dnl -n -- don't create new mailbox FEATURE(
local_procmail',
/etc/mail/smrsh/dovecot-deliver',/etc/mail/smrsh/dovecot-deliver -e -f $g -d $u -m $h')dnl MAILER_DEFINITIONS MAILER(
local')dnl MAILER(`smtp')dnlJan 28 12:36:26 deliver(nickl): Error: file_dotlock_create(/var/mail/nickl) failed: Permission denied (euid=503(nickl) egid=503(nickl) missing +w perm: /var/mail) (set ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ mail_privileged_group=mail)
Here are the permissions on /var/mail/ # ls -ld /var/spool/mail drwxrwxr-x 2 root mail 4096 Jan 28 11:02 /var/spool/mail ^^^^
mail_access_groups: mail mail_privileged_group: mail
Won't work with deliver, maybe only if it is SUID.
=====
If Dovecot is the only process accessing /var/mail/file, you could:
a) use another location for INBOX, b) use flock.
Hi Steffan
thank you for the pointers, however I have decided to move over to postfix. I have sent a message with a new error to the list.
Thanks Nick
__________ Information from ESET NOD32 Antivirus, version of virus signature database 4813 (20100128) __________
The message was checked by ESET NOD32 Antivirus.
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
On Thu, 28 Jan 2010, Nick Lunt wrote:
mail_access_groups: mail mail_privileged_group: mail
Won't work with deliver, maybe only if it is SUID.
=====
If Dovecot is the only process accessing /var/mail/file, you could:
a) use another location for INBOX, b) use flock.
thank you for the pointers, however I have decided to move over to postfix. I have sent a message with a new error to the list.
Those applies to any MTA.
Regards,
Steffen Kaiser -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.6 (GNU/Linux)
iQEVAwUBS2GEub+Vh58GPL/cAQKrgAf+MiZAH+3YCv3ZILmetMKZFyrR5saNw0Tf Qp8gFtRFWvrtoDZbhAC4PN8jm9nJ/XjESGzRMNMLfgvAIv+PeuC3p8FDW+JwWry1 fFe6QX5Y7W4iHGqpMCoeLGVRIdkRYCcTML93IIrli/Xu7Mkn39E6AcaBUhIK+GSK GgQMg/Ghdwr9YJDcLHpZQIjdnLZD+46evcvb7iXW0wxMbhWQa+cca/r3TrmPHRfH jtMFxVmk+V2R5uopTXtpUWETMIfLRscLdyMLSolto6NzGyZLFuo/h/dGfBoe8aGn OVozLr3mjzsHbt+J+HgVz7uhklA+G2X/ZcRH935yxkjh69cR3/4v5A== =sSUq -----END PGP SIGNATURE-----
participants (3)
-
Nick Lunt
-
Steffen Kaiser
-
Tom Hendrikx