Re: sieve filter not working

2019-02-20 Thread Stephan Bosch via dovecot




Op 20-2-2019 om 9:30 schreef subin ks via dovecot:
I've Dovecot and dovecot-sieve v 2.2.27 installed on a Debian 9.6. I'm 
trying to set a Sieve filter which will redirect all emails from 
`info` (i.e. .info) TLD to another email. This is the filter:


require ["regex"];
# rule:[test]
if header :regex "from" "info$"
{
redirect "su...@domain.com ";
}

It's not being honored; all emails from .info TLD ends up in the inbox 
and none are redirected. Let me know what I'm doing wrong.


You should use the "address" test instead. This parses the header for 
addresses. Using the "header" test this way is unreliable. For example, 
an address wrapped in <...> is not handled well by your attempt.


So, this is better:

if address :matches :domain "from" "*.info" {
redirect "su...@domain.com ";
}

Regards,

Stephan.


Re: sieve filter not working -- matchtype

2019-02-20 Thread Martin Johannes Dauser via dovecot
Scott, you are right. And I guess it's computed faster too.

# rule:[test]
if header :matches "from" "*.info"
{
redirect "su...@domain.com";
}

Even a TLD like "*.superinfos" may be included:
"*@*.*info*"

Greetings
Martin

On Wed, 2019-02-20 at 08:47 +, Scott M. via dovecot wrote:
> Why do you use regex ?
> 
> You can just use matches: https://p5r.uk/blog/2011/sieve-tutorial.htm
> l#matchtype
> 
> 
> 
> 
> 
> On Wed, Feb 20, 2019 at 03:31 AM, subin ks via dovecot  ot.org> wrote:
> I've Dovecot and dovecot-sieve v 2.2.27 installed on a Debian 9.6.
> I'm trying to set a Sieve filter which will redirect all emails from
> `info` (i.e. .info) TLD to another email. This is the filter:
> 
> require ["regex"];
> # rule:[test]
> if header :regex "from" "info$"
> {
>   redirect "su...@domain.com";
> }
> 
> It's not being honored; all emails from .info TLD ends up in the
> inbox and none are redirected. Let me know what I'm doing wrong.
> 
> Thanks.
> 


Re: sieve filter not working -- wildcard missing

2019-02-20 Thread Martin Johannes Dauser via dovecot
On Wed, 2019-02-20 at 10:37 +0100, Martin Johannes Dauser via dovecot
wrote:
> On Wed, 2019-02-20 at 10:18 +0100, Martin Johannes Dauser via dovecot
> wrote:
> > Hi!
> > 
> > You forgot the wildcard '.*' (= Match zero or more instances of any
> > single character, except newline)
> > 
> > require ["regex"];
> > # rule:[test]
> > if header :regex "from" ".*info$"
> > {
> >     redirect "su...@domain.com";
> > }
> > 
> > With this rule, you are filtering emails from toplevel domain
> > '*.info'
> > or new domains that might occur in future (e.g '*.superinfo'). If
> > you
> > want to restrict to classic tld '*.info' change the regex to
> > 
> > ".*\.info$"
> 
> Oh, and if you want to include a TLD like "*.superinfos" The regex
> needs to be
> 
> ".*\..*info[^.]$"

ARGH, I forgot a star:
".*\..*info[^.]*$"

> 
> > 
> > 
> > The draft lists a table of common regex in section2:
> > https://tools.ietf.org/html/draft-murchison-sieve-regex-08#section-
> > 2
> > 
> > 
> > There are online regex checker like https://regex101.com thought
> > not
> > specific to sieve's regex, which can be used to test your regular
> > expressions. Sieve's regex are quite standard though.
> > 
> > Greetings
> > Martin
> > 
> > 
> > On Wed, 2019-02-20 at 14:00 +0530, subin ks via dovecot wrote:
> > > I've Dovecot and dovecot-sieve v 2.2.27 installed on a Debian
> > > 9.6.
> > > I'm trying to set a Sieve filter which will redirect all emails
> > > from
> > > `info` (i.e. .info) TLD to another email. This is the filter:
> > > 
> > > require ["regex"];
> > > # rule:[test]
> > > if header :regex "from" "info$"
> > > {
> > >   redirect "su...@domain.com";
> > > }
> > > 
> > > It's not being honored; all emails from .info TLD ends up in the
> > > inbox and none are redirected. Let me know what I'm doing wrong.
> > > 
> > > Thanks.
> > > 


Re: sieve filter not working -- wildcard missing

2019-02-20 Thread Martin Johannes Dauser via dovecot
On Wed, 2019-02-20 at 10:18 +0100, Martin Johannes Dauser via dovecot
wrote:
> Hi!
> 
> You forgot the wildcard '.*' (= Match zero or more instances of any
> single character, except newline)
> 
> require ["regex"];
> # rule:[test]
> if header :regex "from" ".*info$"
> {
>   redirect "su...@domain.com";
> }
> 
> With this rule, you are filtering emails from toplevel domain
> '*.info'
> or new domains that might occur in future (e.g '*.superinfo'). If you
> want to restrict to classic tld '*.info' change the regex to
> 
> ".*\.info$"

Oh, and if you want to include a TLD like "*.superinfos" The regex
needs to be

".*\..*info[^.]$"

> 
> 
> The draft lists a table of common regex in section2:
> https://tools.ietf.org/html/draft-murchison-sieve-regex-08#section-2
> 
> 
> There are online regex checker like https://regex101.com thought not
> specific to sieve's regex, which can be used to test your regular
> expressions. Sieve's regex are quite standard though.
> 
> Greetings
> Martin
> 
> 
> On Wed, 2019-02-20 at 14:00 +0530, subin ks via dovecot wrote:
> > I've Dovecot and dovecot-sieve v 2.2.27 installed on a Debian 9.6.
> > I'm trying to set a Sieve filter which will redirect all emails
> > from
> > `info` (i.e. .info) TLD to another email. This is the filter:
> > 
> > require ["regex"];
> > # rule:[test]
> > if header :regex "from" "info$"
> > {
> > redirect "su...@domain.com";
> > }
> > 
> > It's not being honored; all emails from .info TLD ends up in the
> > inbox and none are redirected. Let me know what I'm doing wrong.
> > 
> > Thanks.
> > 


Re: sieve filter not working -- wildcard missing

2019-02-20 Thread Martin Johannes Dauser via dovecot
Hi!

You forgot the wildcard '.*' (= Match zero or more instances of any
single character, except newline)

require ["regex"];
# rule:[test]
if header :regex "from" ".*info$"
{
    redirect "su...@domain.com";
}

With this rule, you are filtering emails from toplevel domain '*.info'
or new domains that might occur in future (e.g '*.superinfo'). If you
want to restrict to classic tld '*.info' change the regex to

".*\.info$"


The draft lists a table of common regex in section2:
https://tools.ietf.org/html/draft-murchison-sieve-regex-08#section-2


There are online regex checker like https://regex101.com thought not
specific to sieve's regex, which can be used to test your regular
expressions. Sieve's regex are quite standard though.

Greetings
Martin


On Wed, 2019-02-20 at 14:00 +0530, subin ks via dovecot wrote:
> I've Dovecot and dovecot-sieve v 2.2.27 installed on a Debian 9.6.
> I'm trying to set a Sieve filter which will redirect all emails from
> `info` (i.e. .info) TLD to another email. This is the filter:
> 
> require ["regex"];
> # rule:[test]
> if header :regex "from" "info$"
> {
>   redirect "su...@domain.com";
> }
> 
> It's not being honored; all emails from .info TLD ends up in the
> inbox and none are redirected. Let me know what I'm doing wrong.
> 
> Thanks.
> 


Re: sieve filter not working

2019-02-20 Thread Scott M. via dovecot
Why do you use regex ?

You can just use matches: 
https://p5r.uk/blog/2011/sieve-tutorial.html#matchtype 
(https://p5r.uk/blog/2011/sieve-tutorial.html#matchtype)
On Wed, Feb 20, 2019 at 03:31 AM, subin ks via dovecot  wrote: I've Dovecot and 
dovecot-sieve v 2.2.27 installed on a Debian 9.6. I'm trying to set a Sieve 
filter which will redirect all emails from `info` (i.e. .info) TLD to another 
email. This is the filter:
require ["regex"];
# rule:[test]if header :regex "from" "info$"{ redirect "su...@domain.com 
(mailto:su...@domain.com)";}

It's not being honored; all emails from .info TLD ends up in the inbox and none 
are redirected. Let me know what I'm doing wrong.
Thanks.


Re: sieve filter not working

2015-01-24 Thread Christian Kivalo

On 2015-01-24 17:13, Michael Williamson wrote:


OK, thanks.

Now I ask, am I better off enabling dovecot lda with the sieve spam
filter, or using postfix for filter?

I'd definitly go for dovecot lda, that way you can use sieve to filter 
your mails.


I am using lmtp from postfix to dovecot following the directions in:
http://wiki2.dovecot.org/HowTo/PostfixDovecotLMTP

The howto's linked to from the dovecot wiki contain much valuable 
information and helped me allot in configuring dovecot/postfix.


It depends on your distribution if postfix is chrooted or not and what 
path to the dovecot lmtp socket needs to be configured. In the wiki the 
postfix 'mailbox_transport' configuration is for a chrooted postfix 
instance as for example seen on Debian.



-Mike


- christian


Re: sieve filter not working

2015-01-24 Thread Michael Williamson
On 1/24/15, Christian Kivalo ml+dove...@valo.at wrote:

home_mailbox = Maildir/
 This tells postfix where to deliver the mails. dovecot is not configured to
 delivet mails.

 Take a look at dovecot wiki there are examples of how to incorporate dovecot
 lda into thendelivery process.

 I believe dovecot has actually nothing to do with delivering your
mails
 so no sieve filters are applied...

Is it postfix?

 yes, seems so


OK, thanks.

Now I ask, am I better off enabling dovecot lda with the sieve spam
filter, or using postfix for filter?

-Mike


Re: sieve filter not working

2015-01-24 Thread David Mehler
Hello,

I'd use Dovecot Lda for delivery if you want to use sieve.

Hth
Dave.


On 1/24/15, Michael Williamson michael.h.william...@gmail.com wrote:
 On 1/24/15, Christian Kivalo ml+dove...@valo.at wrote:

home_mailbox = Maildir/
 This tells postfix where to deliver the mails. dovecot is not configured
 to
 delivet mails.

 Take a look at dovecot wiki there are examples of how to incorporate
 dovecot
 lda into thendelivery process.

 I believe dovecot has actually nothing to do with delivering your
mails
 so no sieve filters are applied...

Is it postfix?

 yes, seems so


 OK, thanks.

 Now I ask, am I better off enabling dovecot lda with the sieve spam
 filter, or using postfix for filter?

 -Mike



Re: sieve filter not working

2015-01-24 Thread Christian Kivalo


Am 23. Jänner 2015 22:02:06 MEZ, schrieb Michael Williamson 
michael.h.william...@gmail.com
Hello,

 Another question:
 Local mail delivery of received mail from external sources does
indeed
 work?

Yes.

That is good.

 If so, was that log excerpt in one of the former mails an example of
 such delivery?

There are dovecot messages in /var/log/maillog showing only
imap-login  disconnected.
When I monitor /var/log/maillog while sending spam, there are no
messages containing 'dovecot'. I attached that output to a previous
post. It has only messages from postfix and amavis.

Ther should be messages from dovecot when receiving mail at least when dovecot 
lda has something to do with delivery.


home_mailbox = Maildir/
This tells postfix where to deliver the mails. dovecot is not configured to 
delivet mails.

Take a look at dovecot wiki there are examples of how to incorporate dovecot 
lda into thendelivery process.

 I believe dovecot has actually nothing to do with delivering your
mails
 so no sieve filters are applied...

Is it postfix?

yes, seems so

 Thanks,
 -Mike
- christian


Re: sieve filter not working

2015-01-23 Thread Michael Williamson
HI,

 You could set

 syslog_facility = local5

 and have all the log messages in the messages file.

According to the output of command

 # doveadm log find

every type of message goes to the file I was looking at, /var/spool/maillog.


 So, is it postfix doing the local mail delivery, not dovecot?

 To answer this question please post relevant parts of your postfix
 main.cf
 - mailbox_command
 - virtual_transport
 - mailbox_transport

Those three do not appear to be assigned in main.cf (two are commented out
and 'virtual_transport' not there):

# The mailbox_command parameter specifies the optional external
# command to use instead of mailbox delivery. The command is run as
# the recipient with proper HOME, SHELL and LOGNAME environment settings.
# Exception:  delivery for root is done as $default_user.
#
# Other environment variables of interest: USER (recipient username),
# EXTENSION (address extension), DOMAIN (domain part of address),
# and LOCAL (the address localpart).
#
# Unlike other Postfix configuration parameters, the mailbox_command
# parameter is not subjected to $parameter substitutions. This is to
# make it easier to specify shell syntax (see example below).
#
# Avoid shell meta characters because they will force Postfix to run
# an expensive shell process. Procmail alone is expensive enough.
#
# IF YOU USE THIS TO DELIVER MAIL SYSTEM-WIDE, YOU MUST SET UP AN
# ALIAS THAT FORWARDS MAIL FOR ROOT TO A REAL USER.
#
#mailbox_command = /some/where/procmail
#mailbox_command = /some/where/procmail -a $EXTENSION

# The mailbox_transport specifies the optional transport in master.cf
# to use after processing aliases and .forward files. This parameter
# has precedence over the mailbox_command, fallback_transport and
# luser_relay parameters.
#
# Specify a string of the form transport:nexthop, where transport is
# the name of a mail delivery transport defined in master.cf.  The
# :nexthop part is optional. For more details see the sample transport
# configuration file.
#
# NOTE: if you use this feature for accounts not in the UNIX password
# file, then you must update the local_recipient_maps setting in
# the main.cf file, otherwise the SMTP server will reject mail for
# non-UNIX accounts with User unknown in local recipient table.
#
#mailbox_transport = lmtp:unix:/var/lib/imap/socket/lmtp

Thanks,
-Mike


Re: sieve filter not working

2015-01-23 Thread Christian Kivalo

On 2015-01-23 18:04, Michael Williamson wrote:

HI,

Hello,




You could set

syslog_facility = local5

and have all the log messages in the messages file.


According to the output of command

 # doveadm log find

every type of message goes to the file I was looking at, 
/var/spool/maillog.


Ok, then the information should be in /var/log/messages when you up the 
verbosity in 10-logging.conf by setting


mail_debug=yes

and restart dovecot. This should work as expected and show what dovecot 
is doing.


Another question:
Local mail delivery of received mail from external sources does indeed 
work?
If so, was that log excerpt in one of the former mails an example of 
such delivery?





So, is it postfix doing the local mail delivery, not dovecot?


To answer this question please post relevant parts of your postfix
main.cf
- mailbox_command
- virtual_transport
- mailbox_transport


Those three do not appear to be assigned in main.cf (two are 
commented out

and 'virtual_transport' not there):

# The mailbox_command parameter specifies the optional external
# command to use instead of mailbox delivery. The command is run as
# the recipient with proper HOME, SHELL and LOGNAME environment 
settings.

# Exception:  delivery for root is done as $default_user.
#
# Other environment variables of interest: USER (recipient username),
# EXTENSION (address extension), DOMAIN (domain part of address),
# and LOCAL (the address localpart).
#
# Unlike other Postfix configuration parameters, the mailbox_command
# parameter is not subjected to $parameter substitutions. This is to
# make it easier to specify shell syntax (see example below).
#
# Avoid shell meta characters because they will force Postfix to run
# an expensive shell process. Procmail alone is expensive enough.
#
# IF YOU USE THIS TO DELIVER MAIL SYSTEM-WIDE, YOU MUST SET UP AN
# ALIAS THAT FORWARDS MAIL FOR ROOT TO A REAL USER.
#
#mailbox_command = /some/where/procmail
#mailbox_command = /some/where/procmail -a $EXTENSION

# The mailbox_transport specifies the optional transport in master.cf
# to use after processing aliases and .forward files. This parameter
# has precedence over the mailbox_command, fallback_transport and
# luser_relay parameters.
#
# Specify a string of the form transport:nexthop, where transport is
# the name of a mail delivery transport defined in master.cf.  The
# :nexthop part is optional. For more details see the sample transport
# configuration file.
#
# NOTE: if you use this feature for accounts not in the UNIX password
# file, then you must update the local_recipient_maps setting in
# the main.cf file, otherwise the SMTP server will reject mail for
# non-UNIX accounts with User unknown in local recipient table.
#
#mailbox_transport = lmtp:unix:/var/lib/imap/socket/lmtp

Ok, none set. Could you post the output of postconf to the list so we 
are able to see your running postfix config.


I believe dovecot has actually nothing to do with delivering your mails 
so no sieve filters are applied...



Thanks,
-Mike

- christian


Re: sieve filter not working

2015-01-23 Thread Michael Williamson
On 1/23/15, Christian Kivalo ml+dove...@valo.at wrote:
 On 2015-01-23 18:04, Michael Williamson wrote:
 HI,
 Hello,


 You could set

 syslog_facility = local5

 and have all the log messages in the messages file.

 According to the output of command

  # doveadm log find

 every type of message goes to the file I was looking at,
 /var/spool/maillog.

 Ok, then the information should be in /var/log/messages when you up the
 verbosity in 10-logging.conf by setting

 mail_debug=yes

 and restart dovecot. This should work as expected and show what dovecot
 is doing.

I tried this again (set mail_debug=yes and restart dovecot) but no
dovecot messages appear in /var/log/messages. I sent spam email,
too. Also, no change appears in the output of

 # doveadm log find

 Another question:
 Local mail delivery of received mail from external sources does indeed
 work?

Yes.

 If so, was that log excerpt in one of the former mails an example of
 such delivery?

There are dovecot messages in /var/log/maillog showing only
imap-login  disconnected.
When I monitor /var/log/maillog while sending spam, there are no
messages containing 'dovecot'. I attached that output to a previous
post. It has only messages from postfix and amavis.



 So, is it postfix doing the local mail delivery, not dovecot?

 To answer this question please post relevant parts of your postfix
 main.cf
 - mailbox_command
 - virtual_transport
 - mailbox_transport

 Those three do not appear to be assigned in main.cf (two are
 commented out
 and 'virtual_transport' not there):

 # The mailbox_command parameter specifies the optional external
 # command to use instead of mailbox delivery. The command is run as
 # the recipient with proper HOME, SHELL and LOGNAME environment
 settings.
 # Exception:  delivery for root is done as $default_user.
 #
 # Other environment variables of interest: USER (recipient username),
 # EXTENSION (address extension), DOMAIN (domain part of address),
 # and LOCAL (the address localpart).
 #
 # Unlike other Postfix configuration parameters, the mailbox_command
 # parameter is not subjected to $parameter substitutions. This is to
 # make it easier to specify shell syntax (see example below).
 #
 # Avoid shell meta characters because they will force Postfix to run
 # an expensive shell process. Procmail alone is expensive enough.
 #
 # IF YOU USE THIS TO DELIVER MAIL SYSTEM-WIDE, YOU MUST SET UP AN
 # ALIAS THAT FORWARDS MAIL FOR ROOT TO A REAL USER.
 #
 #mailbox_command = /some/where/procmail
 #mailbox_command = /some/where/procmail -a $EXTENSION

 # The mailbox_transport specifies the optional transport in master.cf
 # to use after processing aliases and .forward files. This parameter
 # has precedence over the mailbox_command, fallback_transport and
 # luser_relay parameters.
 #
 # Specify a string of the form transport:nexthop, where transport is
 # the name of a mail delivery transport defined in master.cf.  The
 # :nexthop part is optional. For more details see the sample transport
 # configuration file.
 #
 # NOTE: if you use this feature for accounts not in the UNIX password
 # file, then you must update the local_recipient_maps setting in
 # the main.cf file, otherwise the SMTP server will reject mail for
 # non-UNIX accounts with User unknown in local recipient table.
 #
 #mailbox_transport = lmtp:unix:/var/lib/imap/socket/lmtp

 Ok, none set. Could you post the output of postconf to the list so we
 are able to see your running postfix config.

OK. It is long (631 lines).

2bounce_notice_recipient = postmaster
access_map_defer_code = 450
access_map_reject_code = 554
address_verify_default_transport = $default_transport
address_verify_local_transport = $local_transport
address_verify_map =
address_verify_negative_cache = yes
address_verify_negative_expire_time = 3d
address_verify_negative_refresh_time = 3h
address_verify_poll_count = ${stress?1}${stress:3}
address_verify_poll_delay = 3s
address_verify_positive_expire_time = 31d
address_verify_positive_refresh_time = 7d
address_verify_relay_transport = $relay_transport
address_verify_relayhost = $relayhost
address_verify_sender = $double_bounce_sender
address_verify_sender_dependent_relayhost_maps =
$sender_dependent_relayhost_maps
address_verify_service_name = verify
address_verify_transport_maps = $transport_maps
address_verify_virtual_transport = $virtual_transport
alias_database = hash:/etc/aliases
alias_maps = hash:/etc/aliases
allow_mail_to_commands = alias, forward
allow_mail_to_files = alias, forward
allow_min_user = no
allow_percent_hack = yes
allow_untrusted_routing = no
alternate_config_directories =
always_add_missing_headers = no
always_bcc =
anvil_rate_time_unit = 60s
anvil_status_update_time = 600s
append_at_myorigin = yes
append_dot_mydomain = yes
application_event_drain_time = 100s
authorized_flush_users = static:anyone
authorized_mailq_users = static:anyone
authorized_submit_users = static:anyone
backwards_bounce_logfile_compatibility = yes

Re: sieve filter not working

2015-01-23 Thread Oscar del Rio

On 22/01/2015 2:11 PM, Michael Williamson wrote:

I put a sieve filter in users home directory, /home/user/.dovecot.sieve:

require [fileinto];
# Move spam to spam folder
if header :contains X-Spam-Flag [YES] {
   fileinto Maildir/.SPAM;
   stop;
}


http://wiki2.dovecot.org/Pigeonhole/Sieve/Examples

require fileinto;
if header :contains X-Spam-Flag YES {
  fileinto Spam;
}


Re: sieve filter not working

2015-01-22 Thread Michael Williamson
Hi,

OK. I tried your suggestion. I modified the dovecot config file
10-logging.conf, like so:

 log_path = syslog

and

 mail_debug = yes

It appears that the logging goes to /var/log/maillog, not messages
as I expected.
Restarting service dovecot produces info in the maillog file showing
the restart:
...
Jan 22 15:20:14 coe dovecot: imap: Server shutting down. bytes=3383/61998
Jan 22 15:20:15 coe dovecot: master: Dovecot v2.0.9 starting up (core
dumps disabled)

However, when I send a spam email to a user, the log has no dovecot messages:

Jan 22 15:11:15 coe postfix/pickup[27525]: E3CA72578F: uid=0 from=root
Jan 22 15:11:15 coe postfix/cleanup[27819]: E3CA72578F:
message-id=2015012225.e3ca725...@coe.tsuniv.edu
Jan 22 15:11:15 coe postfix/qmgr[10863]: E3CA72578F:
from=r...@coe.tsuniv.edu, size=10173, nrcpt=1 (queue active)
Jan 22 15:11:16 coe amavis[27456]: (27456-07) LMTP:[127.0.0.1]:10024
/var/spool/amavisd/tmp/amavis-20150122T150549-27456-7GX8WObe:
r...@coe.tsuniv.edu - mwilliam...@coe.tsuniv.edu SIZE=10173
Recei$
Jan 22 15:11:16 coe amavis[27456]: (27456-07) Checking: nS2V0oL2RKlj
r...@coe.tsuniv.edu - mwilliam...@coe.tsuniv.edu
Jan 22 15:11:18 coe postfix/smtpd[27825]: connect from
localhost.localdomain[127.0.0.1]
Jan 22 15:11:18 coe postfix/smtpd[27825]: 86B2223871:
client=localhost.localdomain[127.0.0.1]
Jan 22 15:11:18 coe postfix/cleanup[27819]: 86B2223871:
message-id=2015012225.e3ca725...@coe.tsuniv.edu
Jan 22 15:11:18 coe postfix/smtpd[27825]: disconnect from
localhost.localdomain[127.0.0.1]
Jan 22 15:11:18 coe postfix/qmgr[10863]: 86B2223871:
from=r...@coe.tsuniv.edu, size=10891, nrcpt=1 (queue active)
Jan 22 15:11:18 coe amavis[27456]: (27456-07) nS2V0oL2RKlj FWD from
r...@coe.tsuniv.edu - mwilliam...@coe.tsuniv.edu, BODY=7BIT 250
2.0.0 from MTA(smtp:[127.0.0.1]:10025): 250 2.0.0 Ok: queued as $
Jan 22 15:11:18 coe amavis[27456]: (27456-07) Passed SPAMMY
{RelayedTaggedInbound}, r...@coe.tsuniv.edu -
mwilliam...@coe.tsuniv.edu, Message-ID:
2015012225.e3ca725...@coe.tsuniv.edu, mail_i$
Jan 22 15:11:18 coe postfix/lmtp[27821]: E3CA72578F:
to=mwilliam...@coe.tsuniv.edu, relay=127.0.0.1[127.0.0.1]:10024,
delay=2.8, delays=0.11/0.04/0/2.6, dsn=2.0.0, status=sent (250 2.0.0
from MTA(smt$
Jan 22 15:11:18 coe postfix/qmgr[10863]: E3CA72578F: removed
Jan 22 15:11:18 coe postfix/local[27827]: 86B2223871:
to=mwilliam...@coe.tsuniv.edu, relay=local, delay=0.14,
delays=0.05/0.04/0/0.04, dsn=2.0.0, status=sent (delivered to maildir)
Jan 22 15:11:18 coe postfix/qmgr[10863]: 86B2223871: removed

I attached the above snippet of log file lines to this email.

However, just watching the maillog file, dovecot messages do appear, like these:

Jan 22 15:37:12 coe dovecot: imap-login: Login: user=burks,
method=PLAIN, rip=::1, lip=::1, mpid=29204, TLS
Jan 22 15:37:12 coe dovecot: imap(burks): Disconnected: Logged out bytes=94/856

So, is it postfix doing the local mail delivery, not dovecot? Could
dovecot debug messages be
going to a different log file? (They are not in /var/log/messages).

Thanks,
-Mike



On 1/22/15, Thomas Leuxner t...@leuxner.net wrote:
 * Michael Williamson michael.h.william...@gmail.com 2015.01.22 20:11:

 I have dovecot 2.0.9 running on a CentOS 6.6 email server for a small

 This is a notorious version. Not only is it hopelessly outdated, it used to
 contain broken features way back...

 require [fileinto];
 # Move spam to spam folder
 if header :contains X-Spam-Flag [YES] {
   fileinto Maildir/.SPAM;
   stop;
 }

 The mail is very awkwardly structured, I had trouble spotting the actual
 question FTR. You may set mail_debug to yes:

 $ grep mail_debug *
 10-logging.conf:#mail_debug = no

 This will then produce verbose logging and most likely will help spotting
 the reason why the mail is not filed. Inject a mail with logging raised and
 post the relevant log excerpt here for further analysis. I have a feeling
 that it should just say fileinto SPAM, but difficult to say without seeing
 log output.

 Current Dovecot versions also have the benefit of the sieve-test tool which
 lets you apply rules to mailboxes and see what would happen, or refilter
 mail if you're happy with the outcome of the dry-run.

 Regards
 Thomas



t1
Description: Binary data


Re: sieve filter not working

2015-01-22 Thread Christian Kivalo

On 2015-01-22 22:41, Michael Williamson wrote:

Hi,

Hello,



OK. I tried your suggestion. I modified the dovecot config file
10-logging.conf, like so:

 log_path = syslog

and

 mail_debug = yes


You could set

syslog_facility = local5

and have all the log messages in the messages file.

Also take a look at the logging dovecot wiki page

http://wiki2.dovecot.org/Logging


It appears that the logging goes to /var/log/maillog, not messages
as I expected.
Restarting service dovecot produces info in the maillog file showing
the restart:
...
Jan 22 15:20:14 coe dovecot: imap: Server shutting down. 
bytes=3383/61998

Jan 22 15:20:15 coe dovecot: master: Dovecot v2.0.9 starting up (core
dumps disabled)

However, when I send a spam email to a user, the log has no dovecot 
messages:


Jan 22 15:11:15 coe postfix/pickup[27525]: E3CA72578F: uid=0 
from=root

Jan 22 15:11:15 coe postfix/cleanup[27819]: E3CA72578F:
message-id=2015012225.e3ca725...@coe.tsuniv.edu
Jan 22 15:11:15 coe postfix/qmgr[10863]: E3CA72578F:
from=r...@coe.tsuniv.edu, size=10173, nrcpt=1 (queue active)
Jan 22 15:11:16 coe amavis[27456]: (27456-07) LMTP:[127.0.0.1]:10024
/var/spool/amavisd/tmp/amavis-20150122T150549-27456-7GX8WObe:
r...@coe.tsuniv.edu - mwilliam...@coe.tsuniv.edu SIZE=10173
Recei$
Jan 22 15:11:16 coe amavis[27456]: (27456-07) Checking: nS2V0oL2RKlj
r...@coe.tsuniv.edu - mwilliam...@coe.tsuniv.edu
Jan 22 15:11:18 coe postfix/smtpd[27825]: connect from
localhost.localdomain[127.0.0.1]
Jan 22 15:11:18 coe postfix/smtpd[27825]: 86B2223871:
client=localhost.localdomain[127.0.0.1]
Jan 22 15:11:18 coe postfix/cleanup[27819]: 86B2223871:
message-id=2015012225.e3ca725...@coe.tsuniv.edu
Jan 22 15:11:18 coe postfix/smtpd[27825]: disconnect from
localhost.localdomain[127.0.0.1]
Jan 22 15:11:18 coe postfix/qmgr[10863]: 86B2223871:
from=r...@coe.tsuniv.edu, size=10891, nrcpt=1 (queue active)
Jan 22 15:11:18 coe amavis[27456]: (27456-07) nS2V0oL2RKlj FWD from
r...@coe.tsuniv.edu - mwilliam...@coe.tsuniv.edu, BODY=7BIT 250
2.0.0 from MTA(smtp:[127.0.0.1]:10025): 250 2.0.0 Ok: queued as $
Jan 22 15:11:18 coe amavis[27456]: (27456-07) Passed SPAMMY
{RelayedTaggedInbound}, r...@coe.tsuniv.edu -
mwilliam...@coe.tsuniv.edu, Message-ID:
2015012225.e3ca725...@coe.tsuniv.edu, mail_i$
Jan 22 15:11:18 coe postfix/lmtp[27821]: E3CA72578F:
to=mwilliam...@coe.tsuniv.edu, relay=127.0.0.1[127.0.0.1]:10024,
delay=2.8, delays=0.11/0.04/0/2.6, dsn=2.0.0, status=sent (250 2.0.0
from MTA(smt$
Jan 22 15:11:18 coe postfix/qmgr[10863]: E3CA72578F: removed
Jan 22 15:11:18 coe postfix/local[27827]: 86B2223871:
to=mwilliam...@coe.tsuniv.edu, relay=local, delay=0.14,
delays=0.05/0.04/0/0.04, dsn=2.0.0, status=sent (delivered to maildir)
Jan 22 15:11:18 coe postfix/qmgr[10863]: 86B2223871: removed

I attached the above snippet of log file lines to this email.

However, just watching the maillog file, dovecot messages do appear, 
like these:


Jan 22 15:37:12 coe dovecot: imap-login: Login: user=burks,
method=PLAIN, rip=::1, lip=::1, mpid=29204, TLS
Jan 22 15:37:12 coe dovecot: imap(burks): Disconnected: Logged out 
bytes=94/856


So, is it postfix doing the local mail delivery, not dovecot? Could
dovecot debug messages be
going to a different log file? (They are not in /var/log/messages).

To answer this question please post relevant parts of your postfix 
main.cf

- mailbox_command
- virtual_transport
- mailbox_transport

I use lmtp delivery from postfix to dovecot with virtual users as 
described in


http://wiki2.dovecot.org/HowTo/PostfixDovecotLMTP

and that works very well.


Thanks,
-Mike


- christian





On 1/22/15, Thomas Leuxner t...@leuxner.net wrote:
* Michael Williamson michael.h.william...@gmail.com 2015.01.22 
20:11:



I have dovecot 2.0.9 running on a CentOS 6.6 email server for a small


This is a notorious version. Not only is it hopelessly outdated, it 
used to

contain broken features way back...


require [fileinto];
# Move spam to spam folder
if header :contains X-Spam-Flag [YES] {
  fileinto Maildir/.SPAM;
  stop;
}


The mail is very awkwardly structured, I had trouble spotting the 
actual

question FTR. You may set mail_debug to yes:

$ grep mail_debug *
10-logging.conf:#mail_debug = no

This will then produce verbose logging and most likely will help 
spotting
the reason why the mail is not filed. Inject a mail with logging 
raised and
post the relevant log excerpt here for further analysis. I have a 
feeling
that it should just say fileinto SPAM, but difficult to say without 
seeing

log output.

Current Dovecot versions also have the benefit of the sieve-test tool 
which
lets you apply rules to mailboxes and see what would happen, or 
refilter

mail if you're happy with the outcome of the dry-run.

Regards
Thomas



Re: sieve filter not working

2015-01-22 Thread Thomas Leuxner
* Michael Williamson michael.h.william...@gmail.com 2015.01.22 20:11:

 I have dovecot 2.0.9 running on a CentOS 6.6 email server for a small

This is a notorious version. Not only is it hopelessly outdated, it used to 
contain broken features way back...

 require [fileinto];
 # Move spam to spam folder
 if header :contains X-Spam-Flag [YES] {
   fileinto Maildir/.SPAM;
   stop;
 }

The mail is very awkwardly structured, I had trouble spotting the actual 
question FTR. You may set mail_debug to yes:

$ grep mail_debug *
10-logging.conf:#mail_debug = no

This will then produce verbose logging and most likely will help spotting the 
reason why the mail is not filed. Inject a mail with logging raised and post 
the relevant log excerpt here for further analysis. I have a feeling that it 
should just say fileinto SPAM, but difficult to say without seeing log output.

Current Dovecot versions also have the benefit of the sieve-test tool which 
lets you apply rules to mailboxes and see what would happen, or refilter mail 
if you're happy with the outcome of the dry-run. 

Regards
Thomas


signature.asc
Description: Digital signature


Re: sieve filter not working

2015-01-22 Thread Steffen Kaiser

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

On Thu, 22 Jan 2015, Michael Williamson wrote:



require [fileinto];
# Move spam to spam folder
if header :contains X-Spam-Flag [YES] {
 fileinto Maildir/.SPAM;
 stop;
}

It is not working. How do I diagnose the problem?


There should be an .err file in the location of the binary form of the 
Sieve script.


Also, the argument of fileinto looks wrong; maybe it was correct in v2.0, 
but current versions would require just SPAM;


- -- 
Steffen Kaiser

-BEGIN PGP SIGNATURE-
Version: GnuPG v1

iQEVAwUBVMH1lXz1H7kL/d9rAQLzLQgAsfIvOkAB4zP9WfIplriW9d/KlQa5wdOU
Fq4ZjHHD0huKedxAJeMH9HMpYFGhtZqtFFfrSIeKR3lfFNGHjjN9n4QE2z3aEmcQ
XHBAkR0DmcruAsGumRZJJK6SUeocdWCj9NrlMliz2nga+hJFHH6iTSuNwkjfz1hZ
R+/9h+Dq9jKot1jNPREo4dEM3lKi1sG5002xgxmCZ3hTz1ook/uT4WR0IMWMmcKW
LRDbaXExvYlb5nLC33q/xM81avgK2dVUgDL+NJS13beMKUJerap3cCSrYi5iLNiZ
S7mzABZZDm0V0kXC4bvILfNBM87L8Ru69lFH+gDpjO6Yjg9FYintBg==
=13MG
-END PGP SIGNATURE-