1

I've configured postfix with dovecot and postfix admin with mysql based user storage. I changed maildir to /var/mail

/etc/dovecot/dovecot.conf:

mail_location = maildir:/var/mail/%d/%n:INDEX=/var/mail/%d/%n/indexes

/etc/dovecot/dovecot-mysql.conf:

user_query = SELECT '/var/mail/%d/%n' as home, 3000 AS uid, 3000 AS gid FROM mailbox WHERE username = '%u'

/etc/postfix/main.cf:

virtual_mailbox_base = /var/mail

concrete user "maildir" column value in mysql database:

example.com/tester/

I've figure out that when I create new user using postfix admin - directories are duplicated and store both in:

/var/spool/mail/
/var/mail/

postconf -e

alias_database = hash:/etc/aliases
alias_maps = hash:/etc/aliases
append_dot_mydomain = no
biff = no
config_directory = /etc/postfix
inet_interfaces = all
mailbox_size_limit = 0
mydestination = localhost
myhostname = <removed>
mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
myorigin = /etc/mailname
readme_directory = no
recipient_delimiter = +
relayhost =
smtpd_banner = $myhostname ESMTP $mail_name (Debian/GNU)
smtpd_recipient_restrictions = permit_sasl_authenticated, permit_mynetworks, reject_unauth_destination
smtpd_sasl_auth_enable = yes
smtpd_sasl_path = private/auth
smtpd_sasl_type = dovecot
smtpd_tls_auth_only = yes
smtpd_tls_cert_file = /etc/dovecot/dovecot.pem
smtpd_tls_key_file = /etc/dovecot/private/dovecot.pem
smtpd_use_tls = yes
virtual_alias_maps = mysql:/etc/postfix/mysql-virtual-alias-maps.cf
virtual_gid_maps = static:5000
virtual_mailbox_base = /var/mail
virtual_mailbox_domains = mysql:/etc/postfix/mysql-virtual-mailbox-domains.cf
virtual_mailbox_maps = mysql:/etc/postfix/mysql-virtual-mailbox-maps.cf
virtual_transport = lmtp:unix:private/dovecot-lmtp
virtual_uid_maps = static:5000

dovecot -n

# 2.1.7: /etc/dovecot/dovecot.conf
# OS: Linux 3.2.0-4-amd64 x86_64 Debian 7.8 ext4
auth_mechanisms = plain login
mail_location = maildir:/var/mail/%d/%n:INDEX=/var/mail/%d/%n/indexes
mail_privileged_group = mail
namespace inbox {
  inbox = yes
  location =
  mailbox Drafts {
    special_use = \Drafts
  }
  mailbox Junk {
    special_use = \Junk
  }
  mailbox Sent {
    special_use = \Sent
  }
  mailbox "Sent Messages" {
    special_use = \Sent
  }
  mailbox Trash {
    special_use = \Trash
  }
  prefix =
}
passdb {
  args = /etc/dovecot/dovecot-sql.conf.ext
  driver = sql
}
protocols = imap pop3 lmtp
service auth-worker {
  user = vmail
}
service auth {
  unix_listener /var/spool/postfix/private/auth {
    group = postfix
    mode = 0666
    user = postfix
  }
  unix_listener auth-userdb {
    mode = 0666
    user = vmail
  }
  user = dovecot
}
service imap-login {
  inet_listener imap {
    port = 0
  }
}
service lmtp {
  unix_listener /var/spool/postfix/private/dovecot-lmtp {
    group = postfix
    mode = 0666
    user = postfix
  }
}
service pop3-login {
  inet_listener pop3 {
    port = 0
  }
}
ssl = required
ssl_cert = </etc/dovecot/dovecot.pem
ssl_key = </etc/dovecot/private/dovecot.pem
userdb {
  args = uid=vmail gid=vmail home=/var/mail/%d/%n
  driver = static
}

/var/log/mail.log after receiving mail for this user:

Feb 22 01:05:13 mail postfix/smtpd[12507]: connect [removed]
Feb 22 01:05:13 mail dovecot: auth: Warning: sql: Ignoring changed user_query in /etc/dovecot/dovecot-sql.conf.ext, because userdb sql not used. (If this is intentional, set userdb_warning_disable=yes)
Feb 22 01:05:13 mail postfix/smtpd[12507]: 79050805D7: client=[removed]
Feb 22 01:05:13 mail postfix/cleanup[12516]: 79050805D7: message-id=<removed>
Feb 22 01:05:13 mail postfix/qmgr[12203]: 79050805D7: from=<removed>, size=1539, nrcpt=1 (queue active)
Feb 22 01:05:13 mail dovecot: lmtp(12519): Connect from local
Feb 22 01:05:13 mail dovecot: auth-worker(12520): mysql(127.0.0.1): Connected to database mailserver
Feb 22 01:05:13 mail postfix/smtpd[12507]: disconnect from [removed]
Feb 22 01:05:13 mail dovecot: lmtp(12519, removed): removed: msgid=<removed>: saved mail to INBOX
Feb 22 01:05:13 mail dovecot: lmtp(12519): Disconnect from local: Client quit (in reset)
Feb 22 01:05:13 mail postfix/lmtp[12518]: 79050805D7: to=<removed>, relay=removed[private/dovecot-lmtp], delay=0.45, delays=0.26/0.01/0.01/0.17, dsn=2.0.0, status=sent (250 2.0.0 <removed> removed Saved)
Feb 22 01:05:13 mail postfix/qmgr[12203]: 79050805D7: removed

What am I doing wrong? These directories and files (emails) are duplicates and are synchronized (new user is created in both locations). They aren't symlinks.

  • Please send test message to new accounts and post the maillog entry in the question above. Please post the output `postconf -n` command too. – masegaloeh Feb 21 '15 at 23:55
  • @masegaloeh I edited the question. – Andrzej Pindor Feb 22 '15 at 00:24
  • Okay. So postfix pass email to dovecot then delivers email to mailbox via LMTP. And there is warning message like 'dovecot: auth: Warning: sql: Ignoring changed user_query'. Can you post output of `dovecot -n`? – masegaloeh Feb 22 '15 at 00:33
  • 1
    Are you sure that they aren't symlinks? See [here](http://serverfault.com/a/351782/218590) – masegaloeh Feb 22 '15 at 04:08
  • You are absolutelty right! I don't know how I didn't notice! I checked this many times but maybe only in one direction... I feel stupid :) – Andrzej Pindor Feb 22 '15 at 09:13

0 Answers0