AW: Creating a backup of incoming mail

2014-09-01 Thread Patrick De Zordo
To backup all mail (incoming and outgoing), BCC all mails, you could do the 
following..

Add to your "/etc/postfix/main.cf" the following:
---8<-
# Auto-Backup all mails
transport_maps = hash:/etc/postfix/transport
backuplmtp_destination_recipient_limit = 1
lmtp_destination_recipient_limit = 1
recipient_bcc_maps = pcre:/etc/postfix/backup_bcc.pcre
sender_bcc_maps = pcre:/etc/postfix/backup_bcc.pcre
---8<-

Create a domain called "backup.local" in postfixadmin or whatever you use to 
edit your accounts..

Add every domain for which you like to activate incoming backup to " 
/etc/postfix/backup_bcc.pcre":
---8<-
/^(.*)@spamreducer\.eu$/  spamreducer.eu@backup.local
---8<-

Add to your "/etc/postfix/master.cf" the following:
---8<-
backuplmtp  unix  -   -   n   -   -   lmtp
---8<-

Add to your "/etc/postfix/transport" the following:
---8<-
[backup.local] backuplmtp
---8<-

Don't forget to issue " postmap /etc/postfix/transport"..

For making folders based on "year/month" you have to use an appropriate sieve 
script.

Give me a feedback!
Bye!

-
Mit freundlichen Grüßen / Distinti saluti / Kind regards
De Zordo Patrick
patr...@spamreducer.eu

> -Ursprüngliche Nachricht-
> Von: dovecot [mailto:dovecot-boun...@dovecot.org] Im Auftrag von
> LuKreme
> Gesendet: Samstag, 30. August 2014 18:26
> An: dovecot@dovecot.org
> Betreff: Creating a backup of incoming mail
> 
> This is my master.cf line for dovecot virtual users:
> 
> dovecot unix-   n   n   -   -  pipe flags=DRhu 
> user=vpopmail:vchkpw
> argv=/usr/local/libexec/dovecot/dovecot-lda -f ${sender} -d
> ${user}@${nexthop} -m ${extension}
> 
> I would like to also write every mail, before delivery to the user, to a 
> backup
> location like /backup/imap/mm/dd
> 
> Possible?
> 
> --
> 'On whose authority?' demanded Wert. Trymon turned his grey eyes on him.
> 'Mine. I need no other.' --The Light Fantastic


smime.p7s
Description: S/MIME cryptographic signature


Re: Master user and non-plaintext auth does not work

2014-09-01 Thread Patrick Domack


Quoting SATOH Fumiyasu :


I want to use CRAM-MD5 or DIGEST-MD5 (non-plaintext) authentication
for master users, but Dovecot 2.2.13 rejects it with the following log:

  auth_mechanisms = plain login cram-md5 digest-md5
  disable_plaintext_auth = yes
  auth_master_user_separator = %

  passdb {
driver = passwd-file
args = /etc/dovecot/passwd.masterusers
master = yes
pass = yes
  }

  # don't work too
  #passdb {
  #  driver = checkpassword
  #  args = /opt/osstech/etc/dovecot/checkpassword.masterusers
  #  master = yes
  #  pass = yes
  #}

  passdb {
driver = ldap
args = /etc/dovecot/dovecot-ldap.conf.ext
  }

Is this a bug or a restriction of Dovecot?


This is a restriction of CRAM-MD5 and DIGEST-MD5
They require plaintext passwords, you can't use password hashes on the  
server if you wish to use them. Or you have to use the special  
cram/digest-md5 password hash format.


There is nothing really to be gained from using these formats, it's  
just better to require TLS.


dovecot 2.2.13: LMTP delivery with multiple recipients incorrectly mixes users

2014-09-01 Thread Arkadiusz Miśkiewicz

Hi.

I'm using exim that delivers email over LMTP to dovecot 2.2.13.

I noticed that dovecot LMTP service is sometimes (reare but repeats) mixing 
users. Example below.
There is one mail (msgid=<1ACE53B70631CA45B62348E4EE8757493731A59E@KRMXA41>)
that is going to be delivered to multiple local recipients.

Some recipients are delivered properly:

Sep  1 05:40:33 host dovecot: lmtp(3176): Connect from local
Sep  1 05:40:34 host dovecot: lmtp(3176, gbuser1): TDO+HNDpA1RoDAAA16XVAg: 
msgid=<1ACE53B70631CA45B62348E4EE8757493731A59E@KRMXA41>: saved mail to INBOX
Sep  1 05:40:34 host dovecot: lmtp(3176, jpuser2): TDO+HNDpA1RoDAAA16XVAg: 
msgid=<1ACE53B70631CA45B62348E4EE8757493731A59E@KRMXA41>: saved mail to INBOX
Sep  1 05:40:34 host dovecot: lmtp(3176, rkuser3): TDO+HNDpA1RoDAAA16XVAg: 
msgid=<1ACE53B70631CA45B62348E4EE8757493731A59E@KRMXA41>: saved mail to INBOX
Sep  1 05:40:34 host dovecot: lmtp(3176, gbruser4): TDO+HNDpA1RoDAAA16XVAg: 
msgid=<1ACE53B70631CA45B62348E4EE8757493731A59E@KRMXA41>: saved mail to INBOX
Sep  1 05:40:34 host dovecot: lmtp(3176, pbauser5): TDO+HNDpA1RoDAAA16XVAg: 
msgid=<1ACE53B70631CA45B62348E4EE8757493731A59E@KRMXA41>: saved mail to INBOX
Sep  1 05:40:34 host dovecot: lmtp(3176, mwauser6): TDO+HNDpA1RoDAAA16XVAg: 
msgid=<1ACE53B70631CA45B62348E4EE8757493731A59E@KRMXA41>: saved mail to INBOX
Sep  1 05:40:34 host dovecot: lmtp(3176, mdyuser7): TDO+HNDpA1RoDAAA16XVAg: 
msgid=<1ACE53B70631CA45B62348E4EE8757493731A59E@KRMXA41>: saved mail to INBOX

but some are not:

Sep  1 05:40:34 host dovecot: lmtp(3176, lkrzyuser8): Error: 
lstat(/var/lib/dovecot/control/gbuser1/.INBOX/dovecot-uidlist.lock) failed: 
Permission denied
Sep  1 05:40:34 host dovecot: lmtp(3176, lkrzyuser8): Error: 
file_dotlock_create(/var/lib/dovecot/control/gbuser1/.INBOX/dovecot-uidlist) 
failed: Permission denied (euid=28371() egid=17373() missing 
+x perm: 
/var/lib/dovecot/control/gbuser1, dir owned by 67593:17373 mode=0700)

Notice it was trying to deliver to user "lkrzyuser8" but it tries to access 
some other user files (dovecot-uidlist).
euid=28371 is indeed "lkrzyuser8" but why it tries to access "gbuser1" files?

Sep  1 05:40:34 host dovecot: lmtp(3176, lkrzyuser8): Error: 
lstat(/var/lib/dovecot/control/gbuser1/.INBOX/dovecot-uidlist.lock) failed: 
Permission denied
Sep  1 05:40:34 host dovecot: lmtp(3176, lkrzyuser8): Error: 
file_dotlock_create(/var/lib/dovecot/control/gbuser1/.INBOX/dovecot-uidlist) 
failed: Permission denied (euid=28371() egid=17373() missing 
+x perm: 
/var/lib/dovecot/control/gbuser1, dir owned by 67593:17373 mode=0700)
Sep  1 05:40:34 host dovecot: lmtp(3176, lkrzyuser8): TDO+HNDpA1RoDAAA16XVAg: 
msgid=<1ACE53B70631CA45B62348E4EE8757493731A59E@KRMXA41>: save failed to INBOX: 
BUG: Unknown internal error

Above is again the same case.

Sep  1 05:40:34 host dovecot: lmtp(3176, wm1user9): Error: 
lstat(/var/lib/dovecot/control/gbuser1/.INBOX/dovecot-uidlist.lock) failed: 
Permission denied
Sep  1 05:40:34 host dovecot: lmtp(3176, wm1user9): Error: 
file_dotlock_create(/var/lib/dovecot/control/gbuser1/.INBOX/dovecot-uidlist) 
failed: Permission denied (euid=128065() egid=17373() missing 
+x perm: 
/var/lib/dovecot/control/gbuser1, dir owned by 67593:17373 mode=0700)
Sep  1 05:40:34 host dovecot: lmtp(3176, wm1user9): Error: 
lstat(/var/lib/dovecot/control/gbuser1/.INBOX/dovecot-uidlist.lock) failed: 
Permission denied
Sep  1 05:40:34 host dovecot: lmtp(3176, wm1user9): Error: 
file_dotlock_create(/var/lib/dovecot/control/gbuser1/.INBOX/dovecot-uidlist) 
failed: Permission denied (euid=128065() egid=17373() missing 
+x perm: 
/var/lib/dovecot/control/gbuser1, dir owned by 67593:17373 mode=0700)
Sep  1 05:40:34 host dovecot: lmtp(3176, wm1user9): TDO+HNDpA1RoDAAA16XVAg: 
msgid=<1ACE53B70631CA45B62348E4EE8757493731A59E@KRMXA41>: save failed to INBOX: 
BUG: Unknown internal error

And here again the same problem but with user "wm1user9"

Sep  1 05:40:34 host dovecot: lmtp(3176): Disconnect from local: Successful quit


# doveadm user gbuser1
field   value
uid 67593
gid 17373
home/var/mail/gbuser1/
mailmaildir:/var/mail/gbuser1/:CONTROL=/var/lib/dovecot/control/gbuser1


# doveadm user lkrzyuser8
field   value
uid 28371
gid 17373
home/var/mail/lkrzyuser8/
mail
maildir:/var/mail/lkrzyuser8/:CONTROL=/var/lib/dovecot/control/lkrzyuser8


# doveadm user wm1user9
field   value
uid 128065
gid 17373
home/var/mail/wm1user9/
mailmaildir:/var/mail/wm1user9/:CONTROL=/var/lib/dovecot/control/wm1user9


Later exim retries delivery and dovecot lmtp succeeds:

Sep  1 05:41:34 host dovecot: lmtp(4737): Connect from local
Sep  1 05:41:34 host dovecot: lmtp(4737, lkrzyuser8): b9F+OsHqA1SBEgAA16XVAg: 
msgid=<1ACE53B70631CA45B62348E4EE8757493731A59E@KRMXA41>: saved mail to INBOX
Sep  1 05:41:34 host dovecot: lmtp(4737, wm1user9): b9F+OsHqA1SBEgAA16XVAg: 
msgid=<1ACE53B70631CA45B62348E4EE8757493731A59E@KRMXA41>: saved mail to INBOX
Sep  1 05:41:34 host dovecot: lmtp

Re: Master user and non-plaintext auth does not work

2014-09-01 Thread SATOH Fumiyasu
Hi,

At Mon, 01 Sep 2014 05:07:07 -0400,
Patrick Domack wrote:
> > I want to use CRAM-MD5 or DIGEST-MD5 (non-plaintext) authentication
> > for master users, but Dovecot 2.2.13 rejects it with the following log:
> > 
> >   auth_mechanisms = plain login cram-md5 digest-md5
> >   disable_plaintext_auth = yes
> >   auth_master_user_separator = %
> > 
> >   passdb {
> > driver = passwd-file
> > args = /etc/dovecot/passwd.masterusers
> > master = yes
> > pass = yes
> >   }
> > 
> >   # don't work too
> >   #passdb {
> >   #  driver = checkpassword
> >   #  args = /opt/osstech/etc/dovecot/checkpassword.masterusers
> >   #  master = yes
> >   #  pass = yes
> >   #}
> > 
> >   passdb {
> > driver = ldap
> > args = /etc/dovecot/dovecot-ldap.conf.ext
> >   }
> > 
> > Is this a bug or a restriction of Dovecot?
> 
> This is a restriction of CRAM-MD5 and DIGEST-MD5
> They require plaintext passwords, you can't use password hashes on the server 
> if you wish to use them. Or you have to use the special cram/digest-md5 
> password hash format.

I have plaintext passwords in the master passdb.

Dovecot debug log with auth_debug=yes and auth_debug_passwords=yes seems
that the master's plaintext password (masterpass) from the master passdb
is overrided by user's password (userpass) from the passdb:

Sep 01 09:49:26 auth: Debug: client in: AUTH3   CRAM-MD5
service=imapsecured no-penalty  session=1hIb6/0BXwAKAAEU
lip=10.0.103.100rip=10.0.1.20lport=143   rport=40031
Sep 01 09:49:26 auth: Debug: client passdb out: CONT3   
PDk0NDAwNTk4NzgwNzM5MzUuMTQwOTU2NDk2NkBsb2NhbGhvc3QubG9jYWxkb21haW4+
Sep 01 09:49:26 auth: Debug: client in: CONT3   
dTAwMDJAZWR1LnR1dC5hYy5qcCVzaGliYm8gYjk1NWUwODliZDQxMDE2N2NkNGI3ZWRlMjE1ODk2N2U=
 (previous base64 data may contain sensitive data)
Sep 01 09:49:26 auth: Debug: 
passwd-file(masteruser,10.0.1.20,master,<1hIb6/0BXwAKAAEU>): Master user lookup 
for login: u0...@example.jp
Sep 01 09:49:26 auth: Debug: 
passwd-file(masteruser,10.0.1.20,master,<1hIb6/0BXwAKAAEU>): lookup: 
user=masteruser file=/etc/dovecot/passwd.masterusers
Sep 01 09:49:26 auth: Debug: 
passwd-file(masteruser,10.0.1.20,master,<1hIb6/0BXwAKAAEU>): Generating 
CRAM-MD5 from user 'masteruser', password 'masterpass'
Sep 01 09:49:26 auth: Debug: 
ldap(u0...@example.jp,10.0.1.20,<1hIb6/0BXwAKAAEU>): pass search: 
base=ou=users,dc=edu,dc=tut,dc=ac,dc=jp scope=subtree filter=(uid=u0001) 
fields=personMailCanonicalAddress,personMailPassword
Sep 01 09:49:26 auth: Debug: 
ldap(u0...@example.jp,10.0.1.20,<1hIb6/0BXwAKAAEU>): result: 
personMailCanonicalAddress=u0...@example.jp personMailPassword=userpass; 
personMailPassword,personMailCanonicalAddress unused
Sep 01 09:49:26 auth: Debug: 
ldap(u0...@example.jp,10.0.1.20,<1hIb6/0BXwAKAAEU>): result: 
personMailCanonicalAddress=u0...@example.jp personMailPassword=userpass
Sep 01 09:49:26 auth: Debug: 
ldap(u0...@example.jp,10.0.1.20,<1hIb6/0BXwAKAAEU>): Generating CRAM-MD5 from 
user 'masteruser', password 'userpass'
Sep 01 09:49:26 auth: Debug: 
ldap(u0...@example.jp,10.0.1.20,<1hIb6/0BXwAKAAEU>): Credentials: 
ff5d74b19e3cb9b2b9f4fcb548fe023aeb44f67f231a5a89714d08b5fec22b78
Sep 01 09:49:28 auth: Debug: client passdb out: FAIL3   
user=u0...@example.jpauthz   original_user=masteruser
auth_user=masteruser

> There is nothing really to be gained from using these formats, it's just 
> better to require TLS.

I need CRAM-MD5 and DIGEST-MD5 authentication for clients.

Thanks.

-- 
-- Name: SATOH Fumiyasu @ OSS Technology Corp. (fumiyas @ osstech co jp)
-- Business Home: http://www.OSSTech.co.jp/
-- GitHub Home: https://GitHub.com/fumiyas/
-- PGP Fingerprint: BBE1 A1C9 525A 292E 6729  CDEC ADC2 9DCA 5E1C CBCA


dsync full sync

2014-09-01 Thread Atıf CEYLAN

Hi all,
I have 2 question.

First:
I use dovecot (version 2.2.9) with mdbox mail format. When I run dsync 
tool with "mirror" or "backup" parameters my source and destination 
directory synchronize correctly but if I delete some messages in user 
mailbox, deleted messages does not synced to destination.


For example :
a...@domain.com  path is /mail/domain.com/atif/ and its size is 1GB.
after first running the "dsync -u a...@domain.com backup 
mdbox:/backup/domain.com/atif/" command, size of 
"/backup/domain.com/atif/" is 1GB


I deleted 300mb messages in atif mailbox then /mail/domain.com/atif/ is 
decreased to 700MB and I launched dsync command again. But 
/backup/domain.com/atif/ is not decreased to 700Mb. My backup directory 
still 1GB .


I tried dsync with "-f , backup, mirror" parameters.

Second problem, the first time the backup atif's quota size is 
increasing to x2.

before backup : a...@domain.com quota size 1GB
after backup: a...@domain.com quota size 2GB

so I must run "doveadm quota recalc" command. Why?

What is correct usage of mdbox mail format and dsync tool?

--
M.Atıf CEYLAN


Escape comma in the LDAP passdb subquery configuration

2014-09-01 Thread Francesco Fiore

Hi
I have to configure the LDAP passdb to execute a subquery defining 
dinamically the new DN to use.


For example:
pass_attrs = @mail=mail=%{login_user},dc=%{login_domain},dc=example,dc=com,\
   =proxy=y,\
   =host=%{ldap:mailHost@mail}

In the previous example, the problem is the use of ","  for DN 
representation, which is also the separator for the attribute template 
in the pass_attr parameter value.

I tried to escape it with '\' or '%' but it doesn't work.
Dovecot version is 2.2.13.
How can I resolve this issue?

Thanks in advance


Re: Creating a backup of incoming mail

2014-09-01 Thread LuKreme

On 01 Sep 2014, at 01:33 , Patrick De Zordo  wrote:

> To backup all mail (incoming and outgoing), BCC all mails, you could do the 
> following..
> 
> Add to your "/etc/postfix/main.cf" the following:
> ---8<-
> # Auto-Backup all mails
> transport_maps = hash:/etc/postfix/transport
> backuplmtp_destination_recipient_limit = 1
> lmtp_destination_recipient_limit = 1
> recipient_bcc_maps = pcre:/etc/postfix/backup_bcc.pcre
> sender_bcc_maps = pcre:/etc/postfix/backup_bcc.pcre
> ---8<-
> 
> Create a domain called "backup.local" in postfixadmin or whatever you use to 
> edit your accounts..
> 
> Add every domain for which you like to activate incoming backup to " 
> /etc/postfix/backup_bcc.pcre":
> ---8<-
> /^(.*)@spamreducer\.eu$/  spamreducer.eu@backup.local
> ---8<-
> 
> Add to your "/etc/postfix/master.cf" the following:
> ---8<-
> backuplmtp  unix  -   -   n   -   -   lmtp
> ---8<-
> 
> Add to your "/etc/postfix/transport" the following:
> ---8<-
> [backup.local] backuplmtp
> ---8<-
> 
> Don't forget to issue " postmap /etc/postfix/transport"..
> 
> For making folders based on "year/month" you have to use an appropriate sieve 
> script.
> 
> Give me a feedback!

Wow, that is a whole lot more work that what I did with procmail which was 
practically one line in the /usr/locale/etc/procmailrc right at the top.

YER=`date %Y`
MON=`date %m`

:0c
/backup/mail/$YER/$MON/

I'll start with Sieve (though I still haven't used it) and see what that can 
do, but this at least I can do, if sieve proves too annoying to get going.

-- 
Granny Weatherwax didn't hold with looking at the future, but now she
could feel the future looking at her. She didn't like its expression at
all.


Re: Creating a backup of incoming mail

2014-09-01 Thread LuKreme

On 30 Aug 2014, at 10:33 , Oscar del Rio  wrote:

> You could use a global "sieve_before" filter.
> 
> http://wiki2.dovecot.org/Pigeonhole/Sieve/Configuration

And, I get hampered on the very first step:

To use Sieve, you will first need to make sure you are using Dovecot LDA or 
LMTP for delivering incoming mail to users' mailboxes. Then, you need to enable 
the Pigeonhole Sieve plugin in your configuration:

protocol lda {
  mail_plugins = $mail_plugins sieve
}

OK, so I am using dovecot-lda via postfix/master.cf, but in my configuration I 
have a section tagged protocols, not protocol.

Don't know if this is the same thing, or a slightly different thing. I don't 
know where/what $mail_plugins refers to, and there is no "plugins" section of 
my configuration file. In fact, the string "plug" doesn't appear in 
dovecot.conf (there are some commented lines for mail_plugins in conf.d/ files).

Then, sieve_global_path is deprecated, but despite being tagged as deprecated, 
the example config uses the sieve_global_path. Shouldn't the example use 
sieve_default?

Looks like further down is the sieve_before, but really, the documentation 
feels almost like it has set out with the intention of being as obtuse as 
possible.

If I understand it, and I am sure I do not, what I need to add in to 
dovecot.conf is something like this:

protocol lda {
  mail_plugins = $mail_plugins sieve
}

(which is separate and unrelated to my "protocols = imap" existing line in 
dovecot.conf)

plugin {
   sieve = ~/.dovecot.sieve
   sieve_before = /var/lib/dovecot/sieve/archive.sieve
}

And then in archive.sieve I find out what the commands are to write a COPY of 
the mail to a location after getting the date info.

require ["variables","date","fileinto","mailbox"];

if currentdate :matches "year" "*" { set "year" "${1}"; }
if currentdate :matches "month" "*" { set "month" "${1}"; }

And a command like this, but not this, since i wan the backup stores in an 
absolute path outside the IMAP store and I obviously only want a copy of that 
message.

  fileinto :create "INBOX.Lists.${year}.${month}.dovecot";
}

-- 
Did they get you to trade your heroes for ghosts? Hot ashes for trees?
Hot air for a cool breeze? Cold comfort for change?


How to setup a dovecot lmtp proxy server ?

2014-09-01 Thread Webster Liang
Dear All :

 I want to setup a dovecot lmtp proxy server , my target as below :

Postfix (lmtp) -->dovecot lmtp proxy servers-->dovecot backend servers

but i don't know how to setup the dovecot lmtp proxy server , who can help
me ? thanks a lot .



--
View this message in context: 
http://dovecot.2317879.n4.nabble.com/How-to-setup-a-dovecot-lmtp-proxy-server-tp49553.html
Sent from the Dovecot mailing list archive at Nabble.com.