[CentOS] Virtual email with Postfix, MySQL and Dovecot problem

Lunix1618 lunix1618 at gmail.com
Fri Sep 5 17:22:07 UTC 2008


Hello all,

Anyone of you success to install virtual email with Postfix, MySQL and 
Dovecot on CentOS 5.2 ? I am running: mysql-server-5.0.45-7.el5, 
postfix-2.3.3-2.el5.centos.mysql_pgsql and dovecot-1.0.7-2.el5 on CentOS 
5.2 box and can not make it work.

All deamons (mysqld, postfix master, dovecot) are running but I can not 
make it deliver email to virtual user via Dovecot.
The log file show that postfix is not deliver email to virtual user but 
it deliver to all virtual aliased address.

The configuration file is working with my test on laptop that running 
Fedora 9 with mysql-server-5.0.51a-1.fc9.i386, postfix-2.5.1-2.fc9.i386 
and dovecot-1.0.15-10.fc9.i386

The version number is not too much different so I think it is not a problem.

Attached are config files that working on fedora 9 and I using it on 
CentOS but not work
This configuration I followed the guide at 
http://workaround.org/articles/ispmail-etch/

I am not native English speaker so my explanation above may not clearly 
enough, pls raise question for me if you need further information

Your advices are highly appreciates!

Thank you and regards,
lunix.

PS: below is mail log for a session that I use telnet to port 25, send 
an email for test, I've deleted some info and replaced with X and Y for 
privacy reason:
------------LOG BEGIN-----------
Sep  5 23:52:16 centos-svr dovecot: Dovecot v1.0.7 starting up
Sep  5 23:52:16 centos-svr dovecot: auth-worker(default): mysql: 
Connected to localhost (mailserver)
Sep  5 23:52:22 centos-svr sendmail[9442]: alias database /etc/aliases 
rebuilt by abc
Sep  5 23:52:22 centos-svr sendmail[9442]: /etc/aliases: 76 aliases, 
longest 10 bytes, 765 bytes total
Sep  5 23:52:22 centos-svr postfix/postfix-script: starting the Postfix 
mail system
Sep  5 23:52:22 centos-svr postfix/master[9488]: daemon started -- 
version 2.3.3, configuration /etc/postfix
Sep  5 23:52:28 centos-svr postfix/smtpd[9493]: connect from 
centos-svr.XXXX.local[127.0.0.1]
Sep  5 23:53:37 centos-svr postfix/smtpd[9493]: 6E4FA5B0091: 
client=centos-svr.XXXX.local[127.0.0.1]
Sep  5 23:53:41 centos-svr postfix/cleanup[9502]: 6E4FA5B0091: 
message-id=<20080905165337.6E4FA5B0091 at mail.XXXX.com>
Sep  5 23:53:41 centos-svr postfix/qmgr[9491]: 6E4FA5B0091: 
from=<XXXXX at XXX.com.YY>, size=363, nrcpt=2 (queue active)
Sep  5 23:53:44 centos-svr postfix/smtpd[9493]: disconnect from 
centos-svr.XXXX.local[127.0.0.1]
Sep  5 23:53:50 centos-svr postfix/smtp[9505]: 6E4FA5B0091: 
to=<XXX at gmail.com>, orig_to=<XXX at XXX.com>, 
relay=gmail-smtp-in.l.google.com[209.85.201.27]:25, delay=22, 
delays=14/0.01/5.8/2.4, dsn=2.0.0, status=sent (250 2.0.0 OK 1220633760 
22si669435wfi.14)
Sep  5 23:53:52 centos-svr postfix/smtp[9506]: 6E4FA5B0091: 
to=<XXX at XXX.com.YY>, orig_to=<XXX at XXXX.com>, 
relay=aspmx.l.google.com[209.85.201.27]:25, delay=24, 
delays=14/0.01/7.5/3.2, dsn=2.0.0, status=sent (250 2.0.0 OK 1220633763 
20si679269wfi.11)
Sep  5 23:53:52 centos-svr postfix/qmgr[9491]: 6E4FA5B0091: removed

------LOG END ---------


-------------- next part --------------
base_dir = /var/run/dovecot/
protocols = imap imaps pop3 pop3s
disable_plaintext_auth = no
mail_location = maildir:/home/vmail/%d/%n/Maildir
namespace private {
   separator = . 
   prefix = INBOX.
   inbox = yes
}
  
protocol pop3 {
}
protocol lda {
  postmaster_address = my-email at mydomain.com
   sendmail_path = /usr/sbin/sendmail
  auth_socket_path = /var/run/dovecot/auth-master
  log_path = /home/vmail/dovecot-deliver.log
}
auth default {
  mechanisms = plain login
  passdb sql {
    args = /etc/dovecot/dovecot-sql.conf
  }
  userdb static {
    args = uid=5000 gid=5000 home=/home/vmail/%d/%n allow_all_users=yes
  }
  user = root
  socket listen {
    master {
      path = /var/run/dovecot/auth-master
      mode = 0600
      user = vmail
    }
    client {
      path = /var/spool/postfix/private/auth
      mode = 0660
      user = postfix
      group = postfix	
    }
  }
}
dict {
}
plugin {
}
-------------- next part --------------
driver = mysql
connect = host=localhost dbname=mailserver user=mailuser password=mail-password
default_pass_scheme = PLAIN-MD5
password_query = SELECT email as user, password FROM view_users WHERE emai='%u';
-------------- next part --------------
queue_directory = /var/spool/postfix
command_directory = /usr/sbin
daemon_directory = /usr/libexec/postfix
data_directory = /var/lib/postfix
mail_owner = postfix
myhostname = mail.mydomain.com
mydomain = mydomain.com
myorigin = $mydomain
inet_interfaces = localhost
mydestination = $myhostname, localhost.$mydomain, localhost
unknown_local_recipient_reject_code = 550
mynetworks_style = host
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
home_mailbox = Maildir/
 
mailbox_transport = dbmail-lmtp:localhost:24
  
debug_peer_level = 2
debugger_command =
	 PATH=/bin:/usr/bin:/usr/local/bin:/usr/X11R6/bin
	 ddd $daemon_directory/$process_name $process_id & sleep 5
sendmail_path = /usr/sbin/sendmail.postfix
newaliases_path = /usr/bin/newaliases.postfix
mailq_path = /usr/bin/mailq.postfix
setgid_group = postdrop
html_directory = no
manpage_directory = /usr/share/man
sample_directory = /usr/share/doc/postfix-2.5.1/samples
readme_directory = /usr/share/doc/postfix-2.5.1/README_FILES
inet_protocols = all
virtual_mailbox_domains = mysql:/etc/postfix/mysql-virtual-mailbox-domains.cf
virtual_uid_maps = static:5000
virtual_gid_maps = static:5000
virtual_mailbox_maps = mysql:/etc/postfix/mysql-virtual-mailbox-maps.cf
virtual_alias_maps = mysql:/etc/postfix/mysql-virtual-alias-maps.cf,mysql:/etc/postfix/mysql-email2email.cf
virtual_transport = dovecot
dovecot_destination_recipient_limit = 1
-------------- next part --------------
#
# Postfix master process configuration file.  For details on the format
# of the file, see the master(5) manual page (command: "man 5 master").
#
# Do not forget to execute "postfix reload" after editing this file.
#
# ==========================================================================
# service type  private unpriv  chroot  wakeup  maxproc command + args
#               (yes)   (yes)   (yes)   (never) (100)
# ==========================================================================
smtp      inet  n       -       n       -       -       smtpd
#submission inet n       -       n       -       -       smtpd
#  -o smtpd_tls_security_level=encrypt
#  -o smtpd_sasl_auth_enable=yes
#  -o smtpd_client_restrictions=permit_sasl_authenticated,reject
#  -o milter_macro_daemon_name=ORIGINATING
#smtps     inet  n       -       n       -       -       smtpd
#  -o smtpd_tls_wrappermode=yes
#  -o smtpd_sasl_auth_enable=yes
#  -o smtpd_client_restrictions=permit_sasl_authenticated,reject
#  -o milter_macro_daemon_name=ORIGINATING
#628      inet  n       -       n       -       -       qmqpd
pickup    fifo  n       -       n       60      1       pickup
cleanup   unix  n       -       n       -       0       cleanup
qmgr      fifo  n       -       n       300     1       qmgr
#qmgr     fifo  n       -       n       300     1       oqmgr
tlsmgr    unix  -       -       n       1000?   1       tlsmgr
rewrite   unix  -       -       n       -       -       trivial-rewrite
bounce    unix  -       -       n       -       0       bounce
defer     unix  -       -       n       -       0       bounce
trace     unix  -       -       n       -       0       bounce
verify    unix  -       -       n       -       1       verify
flush     unix  n       -       n       1000?   0       flush
proxymap  unix  -       -       n       -       -       proxymap
proxywrite unix -       -       n       -       1       proxymap
smtp      unix  -       -       n       -       -       smtp
# When relaying mail as backup MX, disable fallback_relay to avoid MX loops
relay     unix  -       -       n       -       -       smtp
	-o smtp_fallback_relay=
#       -o smtp_helo_timeout=5 -o smtp_connect_timeout=5
showq     unix  n       -       n       -       -       showq
error     unix  -       -       n       -       -       error
retry     unix  -       -       n       -       -       error
discard   unix  -       -       n       -       -       discard
local     unix  -       n       n       -       -       local
virtual   unix  -       n       n       -       -       virtual
lmtp      unix  -       -       n       -       -       lmtp
anvil     unix  -       -       n       -       1       anvil
scache    unix  -       -       n       -       1       scache
#
# ====================================================================
# Interfaces to non-Postfix software. Be sure to examine the manual
# pages of the non-Postfix software to find out what options it wants.
#
# Many of the following services use the Postfix pipe(8) delivery
# agent.  See the pipe(8) man page for information about ${recipient}
# and other message envelope options.
# ====================================================================
#
# maildrop. See the Postfix MAILDROP_README file for details.
# Also specify in main.cf: maildrop_destination_recipient_limit=1
#
#maildrop  unix  -       n       n       -       -       pipe
#  flags=DRhu user=vmail argv=/usr/local/bin/maildrop -d ${recipient}
#
# ====================================================================
#
# The Cyrus deliver program has changed incompatibly, multiple times.
#
#old-cyrus unix  -       n       n       -       -       pipe
#  flags=R user=cyrus argv=/usr/lib/cyrus-imapd/deliver -e -m ${extension} ${user}
#
# ====================================================================
#
# Cyrus 2.1.5 (Amos Gouaux)
# Also specify in main.cf: cyrus_destination_recipient_limit=1
#
#cyrus     unix  -       n       n       -       -       pipe
#  user=cyrus argv=/usr/lib/cyrus-imapd/deliver -e -r ${sender} -m ${extension} ${user}
#
# ====================================================================
#
# See the Postfix UUCP_README file for configuration details.
#
#uucp      unix  -       n       n       -       -       pipe
#  flags=Fqhu user=uucp argv=uux -r -n -z -a$sender - $nexthop!rmail ($recipient)
#
# ====================================================================
#
# Other external delivery methods.
#
#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/local/sbin/bsmtp -f $sender $nexthop $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}
#dbmail-lmtp unix -       -       n       -       -       lmtp -v -o disable_dns_lookups=yes
dovecot    unix  -       n       n       -       -       pipe
    flags=DRhu user=vmail:vmail argv=/usr/libexec/dovecot/deliver -d ${recipient}
-------------- next part --------------
user = mailuser
password = mail-password
hosts = localhost
dbname = mailserver
query = SELECT email FROM view_users WHERE email = '%s'
-------------- next part --------------
user = mailuser
password = mail-password
hosts = localhost
dbname = mailserver
query = SELECT destination FROM view_aliases WHERE email = '%s'
-------------- next part --------------
user = mailuser
password= mail-password
host = localhost
dbname = mailserver
query = select 1 from virtual_domains where name='%s'
-------------- next part --------------
user = mailuser
password = mail-password
hosts = 127.0.0.1
dbname = mailserver
query = SELECT 1 FROM view_users WHERE email='%s'


More information about the CentOS mailing list