Postfix dovecot and sieve

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Postfix dovecot and sieve

Per Laine
Hi all!

This is my first post to the list and i hope I can get some help.

I'm using postfix as MTA with dovecot IMAP on Ubuntu Karmic and I'm
trying to get server-side mail filtering with sieve. Everything seems
like it's working but it's not. I telnet localhost sive and list rules
and it seems like they are active. But it doesn't work. I host two
virtual domains with virtual users.

I think that maybe it's something with the transport from postfix =>
dovecot but i really don't have a clue.

Anyone with a similar setup who can be of any assistance?

Postfix version 2.6.5
Dovecot version 1.1.11

my main.cf:
smtpd_banner = $myhostname ESMTP $mail_name (Ubuntu)
biff = no
append_dot_mydomain = no
content_filter = scan:127.0.0.1:10026
receive_override_options = no_address_mappings
readme_directory = no
smtpd_tls_security_level=may
smtpd_tls_cert_file=/etc/ssl/smtpd.crt
smtpd_tls_key_file=/etc/ssl/smtpd.key
smtpd_use_tls=yes
smtpd_tls_loglevel = 1
smtpd_tls_received_header = yes
smtpd_sasl_type = dovecot
smtpd_sasl_path = private/auth
smtpd_sasl_auth_enable = yes
smtpd_sasl_authenticated_header = yes
broken_sasl_auth_clients = yes
smtpd_recipient_restrictions =
        permit_mynetworks
        permit_sasl_authenticated
        reject_unauth_destination
        check_policy_service inet:127.0.0.1:10023
myhostname = localhost
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
myorigin = /etc/mailname
relayhost =
mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128 192.168.1.0/24
mailbox_size_limit = 0
recipient_delimiter = +
inet_interfaces = all
home_mailbox = Maildir/
virtual_mailbox_domains = /etc/postfix/vhosts
virtual_mailbox_base = /home/vmail
virtual_mailbox_maps = hash:/etc/postfix/vmaps
virtual_minimum_uid = 1000
virtual_uid_maps = static:5000
virtual_gid_maps = static:5000
header_checks = pcre:/etc/postfix/header_checks

my master.cf:
smtp      inet  n       -       -       -       -       smtpd
        -o content_filter=spamassassin
# AV scan filter (used by content_filter)
scan      unix  -       -       n       -       16      smtp
        -o smtp_send_xforward_command=yes
# For injecting mail back into postfix from the filter
127.0.0.1:10025 inet  n -       n       -       16      smtpd
        -o content_filter=
        -o receive_override_options=no_unknown_recipient_checks,no_header_body_checks
        -o smtpd_helo_restrictions=
        -o smtpd_client_restrictions=
        -o smtpd_sender_restrictions=
        -o smtpd_recipient_restrictions=permit_mynetworks,reject
        -o mynetworks_style=host
        -o smtpd_authorized_xforward_hosts=127.0.0.0/8
submission inet n       -       -       -       -       smtpd
  -o smtpd_tls_security_level=encrypt
  -o smtpd_sasl_auth_enable=yes
  -o smtpd_client_restrictions=permit_sasl_authenticated,reject
pickup    fifo  n       -       -       60      1       pickup
cleanup   unix  n       -       -       -       0       cleanup
qmgr      fifo  n       -       n       300     1       qmgr
tlsmgr    unix  -       -       -       1000?   1       tlsmgr
rewrite   unix  -       -       -       -       -       trivial-rewrite
bounce    unix  -       -       -       -       0       bounce
defer     unix  -       -       -       -       0       bounce
trace     unix  -       -       -       -       0       bounce
verify    unix  -       -       -       -       1       verify
flush     unix  n       -       -       1000?   0       flush
proxymap  unix  -       -       n       -       -       proxymap
proxywrite unix -       -       n       -       1       proxymap
smtp      unix  -       -       -       -       -       smtp
relay     unix  -       -       -       -       -       smtp
        -o smtp_fallback_relay=
showq     unix  n       -       -       -       -       showq
error     unix  -       -       -       -       -       error
retry     unix  -       -       -       -       -       error
discard   unix  -       -       -       -       -       discard
local     unix  -       n       n       -       -       local
virtual   unix  -       n       n       -       -       virtual
lmtp      unix  -       -       -       -       -       lmtp
anvil     unix  -       -       -       -       1       anvil
scache    unix  -       -       -       -       1       scache

maildrop  unix  -       n       n       -       -       pipe
  flags=DRhu user=vmail argv=/usr/bin/maildrop -d ${recipient}

uucp      unix  -       n       n       -       -       pipe
  flags=Fqhu user=uucp argv=uux -r -n -z -a$sender - $nexthop!rmail ($recipient)

ifmail    unix  -       n       n       -       -       pipe
  flags=F user=ftn argv=/usr/lib/ifmail/ifmail -r $nexthop ($recipient)
bsmtp     unix  -       n       n       -       -       pipe
  flags=Fq. user=bsmtp argv=/usr/lib/bsmtp/bsmtp -t$nexthop -f$sender $recipient
scalemail-backend unix  -       n       n       -       2       pipe
  flags=R user=scalemail argv=/usr/lib/scalemail/bin/scalemail-store
${nexthop} ${user} ${extension}
mailman   unix  -       n       n       -       -       pipe
  flags=FR user=list argv=/usr/lib/mailman/bin/postfix-to-mailman.py
  ${nexthop} ${user}
spamassassin unix -     n       n       -       -       pipe
        user=spamd argv=/usr/bin/spamc -f -e
        /usr/sbin/sendmail -oi -f ${sender} ${recipient}
my dovecot.conf:
base_dir = /var/run/dovecot/
protocols = imap pop3 imaps pop3s managesieve
disable_plaintext_auth = no
shutdown_clients = yes
log_path = /var/log/dovecot
info_log_path = /var/log/dovecot.info
log_timestamp = "%Y-%m-%d %H:%M:%S "
ssl_disable = no
ssl_cert_file = /etc/ssl/smtpd.crt
ssl_key_file = /etc/ssl/smtpd.key
login_dir = /var/run/dovecot/login
login_chroot = yes
login_user = dovecot
login_greeting = Dovecot ready.
mail_location = maildir:/home/vmail/%d/%n
mmap_disable = no
valid_chroot_dirs = /var/spool/vmail
protocol imap {
  login_executable = /usr/lib/dovecot/imap-login
  mail_executable = /usr/lib/dovecot/imap
}
protocol managesieve {
  sieve=~/.dovecot.sieve
  sieve_storage=~/sieve
}
plugin {
  sieve=~/.dovecot.sieve
  sieve_dir=~/sieve
}
protocol lda {
  postmaster_address = [hidden email]
  log_path = /var/log/dovecot-deliver.log
  auth_socket_path = /var/run/dovecot/auth-worker.7525
            mode = 0660
            user = root
            group = root
}
protocol pop3 {
  login_executable = /usr/lib/dovecot/pop3-login
  mail_executable = /usr/lib/dovecot/pop3
  pop3_uidl_format = %08Xu%08Xv
}
auth_executable = /usr/lib/dovecot/dovecot-auth
auth_verbose = yes
auth default {
  mechanisms = plain login
  passdb passwd-file {
    args = /etc/dovecot/passwd
  }
  userdb passwd-file {
    args = /etc/dovecot/users
  }
  user = root
    socket listen {
        client {
            path = /var/spool/postfix/private/auth
            mode = 0660
            user = postfix
            group = postfix
        }
    }
}

Kind regards Pelle
Reply | Threaded
Open this post in threaded view
|

Re: Postfix dovecot and sieve

Eero Volotinen-2
Quoting Per Laine <[hidden email]>:

> Hi all!
>
> This is my first post to the list and i hope I can get some help.
>
> I'm using postfix as MTA with dovecot IMAP on Ubuntu Karmic and I'm
> trying to get server-side mail filtering with sieve. Everything seems
> like it's working but it's not. I telnet localhost sive and list rules
> and it seems like they are active. But it doesn't work. I host two
> virtual domains with virtual users.
>
> I think that maybe it's something with the transport from postfix =>
> dovecot but i really don't have a clue.
>
> Anyone with a similar setup who can be of any assistance?

Well, atleast you need to use dovecot deliver for mailbox command:

mailbox_command = /usr/libexec/dovecot/deliver

read the docs for sieve from dovecot.org

--
Eero


Reply | Threaded
Open this post in threaded view
|

Re: Postfix dovecot and sieve

Brian Evans - Postfix List
In reply to this post by Per Laine
On 1/12/2010 5:06 AM, Per Laine wrote:

> Hi all!
>
> This is my first post to the list and i hope I can get some help.
>
> I'm using postfix as MTA with dovecot IMAP on Ubuntu Karmic and I'm
> trying to get server-side mail filtering with sieve. Everything seems
> like it's working but it's not. I telnet localhost sive and list rules
> and it seems like they are active. But it doesn't work. I host two
> virtual domains with virtual users.
>
> I think that maybe it's something with the transport from postfix =>
> dovecot but i really don't have a clue.
>
> Anyone with a similar setup who can be of any assistance?
>  

This is because your virtual delivery is using the virtual(8) agent
which does not use sieve.
You need to define a pipe transport in master.cf that points to
dovecot's deliver agent.

A good reading is here:
http://www.postfix.org/VIRTUAL_README.html#in_virtual_other

> Postfix version 2.6.5
> Dovecot version 1.1.11
>
> my main.cf:
>  

We prefer 'postconf -n' because it makes it easier to read and it sees
what Postfix sees.

> virtual_mailbox_domains = /etc/postfix/vhosts
> virtual_mailbox_base = /home/vmail
> virtual_mailbox_maps = hash:/etc/postfix/vmaps
> virtual_minimum_uid = 1000
> virtual_uid_maps = static:5000
> virtual_gid_maps = static:5000
>  

A good start, but no virtual_transport statement.
Reply | Threaded
Open this post in threaded view
|

Re: Postfix dovecot and sieve

Brian Evans - Postfix List
In reply to this post by Eero Volotinen-2
On 1/12/2010 5:11 AM, Eero Volotinen wrote:

> Quoting Per Laine <[hidden email]>:
>
>> Hi all!
>>
>> This is my first post to the list and i hope I can get some help.
>>
>> I'm using postfix as MTA with dovecot IMAP on Ubuntu Karmic and I'm
>> trying to get server-side mail filtering with sieve. Everything seems
>> like it's working but it's not. I telnet localhost sive and list rules
>> and it seems like they are active. But it doesn't work. I host two
>> virtual domains with virtual users.
>>
>> I think that maybe it's something with the transport from postfix =>
>> dovecot but i really don't have a clue.
>>
>> Anyone with a similar setup who can be of any assistance?
>
> Well, atleast you need to use dovecot deliver for mailbox command:
>
> mailbox_command = /usr/libexec/dovecot/deliver
>

This would be good if the OP was using local domains instead of virtual.
Only local(8) uses mailbox_command.
Reply | Threaded
Open this post in threaded view
|

Re: Postfix dovecot and sieve

Per Laine
In reply to this post by Brian Evans - Postfix List
Ok, thanks for the reply. When I set "virtual_transport = dovecot" and add

dovecot   unix  -       n       n       -       -       pipe
  flags=DRhu user=vmail:vmail argv=/usr/lib/dovecot/deliver -f
${sender} -d ${recipient}

to master.cf I get Can't connect to auth server at
/var/run/dovecot//auth-master: No such file or directory in
dovecot-deliver.log. I guess that postfix is doing things right by now
but dovecot somehow is misconfigured.



On Tue, Jan 12, 2010 at 2:49 PM, Brian Evans - Postfix List
<[hidden email]> wrote:

> On 1/12/2010 5:06 AM, Per Laine wrote:
>> Hi all!
>>
>> This is my first post to the list and i hope I can get some help.
>>
>> I'm using postfix as MTA with dovecot IMAP on Ubuntu Karmic and I'm
>> trying to get server-side mail filtering with sieve. Everything seems
>> like it's working but it's not. I telnet localhost sive and list rules
>> and it seems like they are active. But it doesn't work. I host two
>> virtual domains with virtual users.
>>
>> I think that maybe it's something with the transport from postfix =>
>> dovecot but i really don't have a clue.
>>
>> Anyone with a similar setup who can be of any assistance?
>>
>
> This is because your virtual delivery is using the virtual(8) agent
> which does not use sieve.
> You need to define a pipe transport in master.cf that points to
> dovecot's deliver agent.
>
> A good reading is here:
> http://www.postfix.org/VIRTUAL_README.html#in_virtual_other
>
>> Postfix version 2.6.5
>> Dovecot version 1.1.11
>>
>> my main.cf:
>>
>
> We prefer 'postconf -n' because it makes it easier to read and it sees
> what Postfix sees.
>
>> virtual_mailbox_domains = /etc/postfix/vhosts
>> virtual_mailbox_base = /home/vmail
>> virtual_mailbox_maps = hash:/etc/postfix/vmaps
>> virtual_minimum_uid = 1000
>> virtual_uid_maps = static:5000
>> virtual_gid_maps = static:5000
>>
>
> A good start, but no virtual_transport statement.
>



--
Mvh Per Laine
Tel. 0703 - 82 50 84
[hidden email]