[Dovecot] Using dovecot as LDA for postfix

2013-10-15 Thread Farzad Mahdikhani
Hi

Here is my environment:
Red Hat Enterprise Linux Server release 5.7 (Tikanga)
postfix-2.9.1-1.rhel5
dovecot 1.0.7

I want to config a complete postfix-dovecot mail server. First I configured 
postfix to use procmail, its default LDA and dovecot for pop3 and imap. I 
didn't changed main.cf a lot, just myhostname and a few other properties. I 
didn't set home_mailbox. About dovecot.conf here is the output of dovecot -n :
 
# 1.0.7: /etc/dovecot.conf
log_path: /var/log/dovecot.log
protocols: imap pop3
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_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/lib64/dovecot/imap
mail_plugin_dir(imap): /usr/lib64/dovecot/imap
mail_plugin_dir(pop3): /usr/lib64/dovecot/pop3
auth default:
  mechanisms: plain login
  passdb:
    driver: pam
  userdb:
    driver: passwd

As you can see mail_location is not set. At this time everything was OK and 
working. I was able to send email using SquirrelMail and thunderbird. I got two 
users, user1 and user2, in my linux machine and when I sent an email from 
us...@software.com to us...@software.com the sent mail was saved in 
/home/user1/mail/Sent and the received email was in /var/mail/user2. The log 
file for dovecot had entries like this for user1 and user2:

dovecot: Oct 14 14:44:52 Info: IMAP(user1): maildir: couldn't find root dir
dovecot: Oct 14 14:44:52 Info: IMAP(user1): mbox: root exists (/home/user1/mail)
dovecot: Oct 14 14:44:52 Info: IMAP(user1): mbox: INBOX exists (/var/mail/user1)
dovecot: Oct 14 14:44:52 Info: IMAP(user1): mbox: root=/home/user1/mail, 
index=/home/user1/mail, inbox=/var/mail/user1

At this point I tried to change the LDA from procmail to dovecot by the 
following settings:

I added/changed the following in the main.cf:

mailbox_command = /usr/libexec/dovecot/deliver
dovecot_destination_recipient_limit = 1
virtual_mailbox_domains = software.com
virtual_transport = dovecot


I added the following in the master.cf:

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

But it didn't work. When I send email from from user2 to user1 the sent email 
is correctly saved in /home/user2/mail/Sent but it seems that user1 doesn't 
receive the incoming email. dovecot.log had entries like the following:

dovecot: Oct 14 14:54:04 Info: imap-login: Login: user=user1, method=PLAIN, 
rip=:::172.27.7.8, lip=:::172.16.100.183, TLS
dovecot: Oct 14 14:54:04 Info: IMAP(user1): Effective uid=504, gid=504, 
home=/home/user1
dovecot: Oct 14 14:54:04 Info: IMAP(user1): maildir: 
access(/home/user1/Maildir, rwx): failed: No such file or directory
dovecot: Oct 14 14:54:04 Info: IMAP(user1): maildir: couldn't find root dir
dovecot: Oct 14 14:54:04 Info: IMAP(user1): mbox: root exists (/home/user1/mail)
dovecot: Oct 14 14:54:04 Info: IMAP(user1): mbox: INBOX exists (/var/mail/user1)
dovecot: Oct 14 14:54:04 Info: IMAP(user1): mbox: root=/home/user1/mail, 
index=/home/user1/mail, inbox=/var/mail/user1

Setting home_mailbox = Maildir/ in main.cf and mail_location = 
maildir:~/Maildir in dovecot.cf didn't help. I have been googling and reading 
and testing for 4 or 5 days for this but there was no chance. Now, I am stuck 
and any help would be really really appreciated.

Regards,
Ferez

Re: [Dovecot] Using dovecot as LDA for postfix

2013-10-15 Thread Charles Marcus

On 2013-10-14 12:43 PM, Farzad Mahdikhani farzad_...@yahoo.com wrote:

dovecot 1.0.7

I want to config a complete postfix-dovecot mail server.


So, please do not start with an ancient, unsupported version.

2.2.6 is  the latest stable, but at least use the latest 2.1 version...

--

Best regards,

*/Charles/*


Re: [Dovecot] Using dovecot as LDA for postfix

2013-10-15 Thread Mauricio Tavares
On Tue, Oct 15, 2013 at 11:08 AM, Charles Marcus
cmar...@media-brokers.com wrote:
 On 2013-10-14 12:43 PM, Farzad Mahdikhani farzad_...@yahoo.com wrote:

 dovecot 1.0.7

 I want to config a complete postfix-dovecot mail server.


 So, please do not start with an ancient, unsupported version.

 2.2.6 is  the latest stable, but at least use the latest 2.1 version...

  He's running redhat/centos 5.X; latest dovecot version for that
is 1.0.7. Only way out if he is using the redhat packages is to go to
redhat 6.X, which probably means a full reinstall... which he may not
be authorized to do. And even then he would be a 2.0.9.

Some of us do have to stick to the packages officially supported by a
distro; I had the very same issue, which is why I was stuck with 1.2.9
in ubuntu 10.04 and now 2.0.19 in 12.04LTS. Would I love to be at
least in 2.1? You betcha, but...

To the OP: you might want to see if epel or the other non-official
repositories have something newer and whether your boss allows you to
use them. As I mentioned above, I have run 1.2.9 until quite recently,
so I still have my configs available. Don't know how much 1.0.7
differs from 1.2.9 though; you will need to check
http://wiki1.dovecot.org/. But, I can paste them here. On thing I am
curious about is why you have maildir and mbox at the same time.


 --

 Best regards,

 */Charles/*


Re: [Dovecot] Using dovecot as LDA for postfix

2013-10-15 Thread /dev/rob0
On Mon, Oct 14, 2013 at 09:43:31AM -0700, Farzad Mahdikhani wrote:
 Here is my environment:
 Red Hat Enterprise Linux Server release 5.7 (Tikanga)
 postfix-2.9.1-1.rhel5
 dovecot 1.0.7

You used a third-party RPM or SRPM for Postfix, why not for Dovecot? 
Also, the latest in the Postfix 2.9 series is patchlevel 6 or so.

 I want to config a complete postfix-dovecot mail server. First I 
 configured postfix to use procmail, its default LDA and dovecot for

FWIW, procmail is NOT the default LDA for Postfix. Postfix has its 
own local(8) and [optional] virtual(8) LDAs. Procmail is very old and 
unmaintained (it makes Dovecot 1.x look recent!) Only old and well- 
established sites should be using procmail now. There are much better 
options for new sites in A.D. 2013.

 pop3 and imap. I didn't changed main.cf a lot, just myhostname and 
 a few other properties. I didn't set home_mailbox. About 
 dovecot.conf here is the output of dovecot -n :
  
 # 1.0.7: /etc/dovecot.conf
 log_path: /var/log/dovecot.log
 protocols: imap pop3
 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_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/lib64/dovecot/imap
 mail_plugin_dir(imap): /usr/lib64/dovecot/imap
 mail_plugin_dir(pop3): /usr/lib64/dovecot/pop3
 auth default:
   mechanisms: plain login
   passdb:
     driver: pam
   userdb:
     driver: passwd
 
 As you can see mail_location is not set. At this time everything 
 was OK and working. I was able to send email using SquirrelMail and 
 thunderbird. I got two users, user1 and user2, in my linux machine 
 and when I sent an email from us...@software.com to 
 us...@software.com the sent mail was saved in /home/user1/mail/Sent 
 and the received email was in /var/mail/user2. The log file for 
 dovecot had entries like this for user1 and user2:
 
 dovecot: Oct 14 14:44:52 Info: IMAP(user1): maildir: couldn't find root dir
 dovecot: Oct 14 14:44:52 Info: IMAP(user1): mbox: root exists 
 (/home/user1/mail)
 dovecot: Oct 14 14:44:52 Info: IMAP(user1): mbox: INBOX exists 
 (/var/mail/user1)
 dovecot: Oct 14 14:44:52 Info: IMAP(user1): mbox: root=/home/user1/mail, 
 index=/home/user1/mail, inbox=/var/mail/user1
 
 At this point I tried to change the LDA from procmail to dovecot
 by the following settings:
 
 I added/changed the following in the main.cf:
 
 mailbox_command = /usr/libexec/dovecot/deliver

This is used for the local domain class. It's not relevant for other 
address classes.

 dovecot_destination_recipient_limit = 1
 virtual_mailbox_domains = software.com

This defines the virtual mailbox domain address class. This says that 
addres...@software.com are virtual mailbox, NOT local, addresses. If 
you're using passwd and PAM as userdb/passdb, this is not what you 
want.

 virtual_transport = dovecot

And this is the default transport to be used for virtual mailboxes.

 I added the following in the master.cf:
 
 dovecot   unix  -   n   n   -   -   pipe
   flags=DRhu user=vmail:vmail argv=/usr/libexec/dovecot/deliver -f ${sender} 
 -d ${recipient}
 
 But it didn't work. When I send email from from user2 to user1 the 
 sent email is correctly saved in /home/user2/mail/Sent but it seems 
 that user1 doesn't receive the incoming email. dovecot.log had 
 entries like the following:
 
 dovecot: Oct 14 14:54:04 Info: imap-login: Login: user=user1, method=PLAIN, 
 rip=:::172.27.7.8, lip=:::172.16.100.183, TLS

That's a system user login (local user in Postfix terms.)

 dovecot: Oct 14 14:54:04 Info: IMAP(user1): Effective uid=504, gid=504, 
 home=/home/user1
 dovecot: Oct 14 14:54:04 Info: IMAP(user1): maildir: 
 access(/home/user1/Maildir, rwx): failed: No such file or directory
 dovecot: Oct 14 14:54:04 Info: IMAP(user1): maildir: couldn't find root dir
 dovecot: Oct 14 14:54:04 Info: IMAP(user1): mbox: root exists 
 (/home/user1/mail)
 dovecot: Oct 14 14:54:04 Info: IMAP(user1): mbox: INBOX exists 
 (/var/mail/user1)
 dovecot: Oct 14 14:54:04 Info: IMAP(user1): mbox: root=/home/user1/mail, 
 index=/home/user1/mail, inbox=/var/mail/user1
 
 Setting home_mailbox = Maildir/ in main.cf and mail_location = 

The home_mailbox setting IS relevant to local domains.

 maildir:~/Maildir in dovecot.cf didn't help. I have been googling 
 and reading and testing for 4 or 5 days for this but there was no 
 chance. Now, I am stuck and any help would be really really 
 appreciated.

This is mostly a Postfix question, BTW, so I will point to to the 
Postfix documentation. Don't confuse your address classes:

http://www.postfix.org/ADDRESS_CLASS_README.html
http://www.postfix.org/VIRTUAL_README.html
-- 
  http://rob0.nodns4.us/ -- system administration