[Dovecot] mail_location and master_user rel 1.0.x

Robert Heller rah at rheller.net
Tue Oct 30 21:43:20 EET 2007


login me at mymail.net*theboss thebossespwd
this is a great piece of software, but it has some frustrating issues.  
i have included my two configurations below, just FYI.

the one (older) system is 1.0rc7 on mandriva 2007.0 and postfix 2.3.3 
and amavisd and spamassassin and using a maildir configuration

the newer system is 1.0.5 (soon to be 7) on mandriva 2008.0 and postfix 
2.4.5 amavisd and spamassassin and using a maildir configuration

first, i followed the instructions in this document 
http://wiki.dovecot.org/Authentication/MasterUsers to the letter and it 
works for neither the old server nor the new.  specifically i was using 
the first example configuration.  all i ever got was:

Connected to mail.mailserver.com
Escape character is '^]'.
* OK [CAPABILITY IMAP4rev1 SASL-IR SORT THREAD=REFERENCES MULTIAPPEND 
UNSELECT LITERAL+ IDLE CHILDREN NAMESPACE LOGIN-REFERRALS STARTTLS 
AUTH=LOGIN AUTH=PLAIN AUTH=DIGEST-MD5] Dovecot ready.
login him at mailserver.com*theboss thebossespwd
login BAD Error in IMAP command received by server.

and the auth_debug information was completely useless.  if someone goes 
to the trouble of writing great examples they really should test to make 
sure they actually work.

secondly:
this configuration on the old server (1.0rc7) works fine:
## Dovecot 1.0 configuration file
base_dir = /var/lib/dovecot
protocols = imap pop3 imaps
log_path = /var/log/dovecot/error.log
info_log_path = /var/log/dovecot/info.log
first_valid_uid = 60000
last_valid_uid = 60000
first_valid_gid=15
last_valid_gid=15
default_mail_env = maildir:/var/spool/mail/%d/%u
mailbox_check_interval = 60
maildir_copy_with_hardlinks = yes
mbox_locks = fcntl
umask = 0077
auth default {
    mechanisms = plain digest-md5
    user = dovecot
    passdb pgsql  {
            /etc/dovecot/dovecot-pgsql.conf
    }
    userdb pgsql {
            /etc/dovecot/dovecot-pgsql.conf
    }

    socket listen {

        master {
            path = /var/run/dovecot/auth-master
            mode = 0660
            user = postfix
            group = mail
        }

        client {
            path = /var/spool/postfix/private/auth
            mode = 0660
            user = postfix
            group = mail
        }
    }
}

but the same configuration on the newer version 1.0.5 does not work, the 
problem being in mail location (note changed from default_mail_location 
to mail_location).  so i had to make a number of changes...

## Dovecot configuration file
base_dir = /var/lib/dovecot/
protocols = imap pop3 imaps
disable_plaintext_auth = no
log_path = /var/log/dovecot/error.log
info_log_path = /var/log/dovecot/info.log
ssl_cert_file = /etc/pki/tls/certs/dovecot.pem
ssl_key_file = /etc/pki/tls/private/dovecot.pem
login_dir = /var/lib/dovecot/login
mail_location = maildir:/var/spool/mail/%d/%n:
namespace private {
   prefix =
   location = maildir:/var/spool/mail/%d/%n
   inbox = yes
}
mail_extra_groups = mail
first_valid_uid = 60000
last_valid_uid = 60000
first_valid_gid=15
last_valid_gid=15
maildir_copy_with_hardlinks = yes
maildir_copy_preserve_filename = yes
mbox_read_locks = fcntl
mbox_write_locks = fcntl
protocol imap {
login_greeting_capability = yes
}
protocol pop3 {
  pop3_uidl_format = %08Xu%08Xv
  pop3_client_workarounds =  outlook-no-nuls oe-ns-eoh
}
protocol lda {
  postmaster_address = postmaster at example.com
}
auth default {
  mechanisms = login plain digest-md5
  passdb sql {
                args = /etc/postfix/mysql/dovecot.conf
        }
  userdb sql {
                args = /etc/postfix/mysql/dovecot.conf
        }

  socket listen {
        master {
                path = /var/lib/dovecot/auth-master
                mode = 0660
                user = nobody
                group = mail
        }

        client {
                path = /var/spool/postfix/private/auth
                mode = 0660
                user = postfix
                group = mail
        }
  }
}

dict {
}

plugin {
}


or from the dovecot -n  command:

# 1.0.5: /etc/dovecot.conf
base_dir: /var/lib/dovecot/
log_path: /var/log/dovecot/error.log
info_log_path: /var/log/dovecot/info.log
protocols: imap pop3 imaps
ssl_cert_file: /etc/pki/tls/certs/dovecot.pem
ssl_key_file: /etc/pki/tls/private/dovecot.pem
disable_plaintext_auth: no
login_dir: /var/lib/dovecot/login
login_executable(default): /usr/lib64/dovecot/imap-login
login_executable(imap): /usr/lib64/dovecot/imap-login
login_executable(pop3): /usr/lib64/dovecot/pop3-login
login_greeting_capability(default): yes
login_greeting_capability(imap): yes
login_greeting_capability(pop3): no
first_valid_uid: 60000
last_valid_uid: 60000
first_valid_gid: 15
last_valid_gid: 15
mail_extra_groups: mail
mail_location: maildir:/var/spool/mail/%d/%n:
maildir_copy_with_hardlinks: yes
maildir_copy_preserve_filename: yes
mbox_write_locks: fcntl
mail_executable(default): /usr/lib64/dovecot/imap
mail_executable(imap): /usr/lib64/dovecot/imap
mail_executable(pop3): /usr/lib64/dovecot/pop3
mail_plugin_dir(default): /usr/share/dovecot//imap
mail_plugin_dir(imap): /usr/share/dovecot//imap
mail_plugin_dir(pop3): /usr/share/dovecot//pop3
pop3_uidl_format(default):
pop3_uidl_format(imap):
pop3_uidl_format(pop3): %08Xu%08Xv
pop3_client_workarounds(default):
pop3_client_workarounds(imap):
pop3_client_workarounds(pop3): outlook-no-nuls oe-ns-eoh
namespace:
  type: private
  location: maildir:/var/spool/mail/%d/%n
  inbox: yes
auth default:
  mechanisms: login plain digest-md5
  passdb:
    driver: sql
    args: /etc/postfix/mysql/dovecot.conf
  userdb:
    driver: sql
    args: /etc/postfix/mysql/dovecot.conf
  socket:
    type: listen
    client:
      path: /var/spool/postfix/private/auth
      mode: 432
      user: postfix
      group: mail
    master:
      path: /var/lib/dovecot/auth-master
      mode: 432
      user: nobody
      group: mail

what i found was that i HAD to add a namespace in order to be able to 
define my maildir location.  that was ok, /*except  */that the 
mail_location value is no longer being used for the pop3 server mail 
location.  so i could pick up mail using IMAP no problem, but POP wasn't 
working.  after a number of hours i modified my SQL script with 
'CONCAT(path, maildir)' so that the 'mail' path is returned complete 
from the sql statement:

in my initial SQL statement, works on the old server and the new version 
1.0.5 IMAP as:

user_query = SELECT maildir AS mail, 60000 AS uid, 15 AS gid FROM mailbox WHERE username = '%u' AND active='1'

but in order to get the POP3 version working i had to change it thus:

user_query = SELECT CONCAT('/var/spool/mail/', maildir) AS mail, 65534 AS uid, 12 AS gid FROM mailbox WHERE username = '%u' AND active='1'

one would have expected changing the SQL statement to this new format 
would have resulted in a location for the IMAP server now being 
constructed as:

/var/spool/mail/var/spool/mail/domain/user

but that did not happen.  they both (POP & IMAP) now can find the mail 
and folders.

like i said, thanks very much for writing this s/ware.  it is 
great...but needs some tweaking.

thanks for listening


-------------- next part --------------
A non-text attachment was scrubbed...
Name: rah.vcf
Type: text/x-vcard
Size: 237 bytes
Desc: not available
Url : http://dovecot.org/pipermail/dovecot/attachments/20071030/3bed31fa/attachment.vcf 


More information about the dovecot mailing list