I'm having trouble with my mail server setup. I followed the Virtual Mailhosting System with Postfix Guide. First of all, i have to say that i don't host virtual domains. I just have one host resolved to cad.cele.unam.mx.
What i want is to give my local users imap and web access, aswell as having many virtual users with mail and no shell access.
By now, i can send and recieve mail from thundebird using courier-imap-ssl, authenticating with a password stored in the database BUT ONLY with local users. Whenever i try to mail to a virtual user postfix complains about not finding the user and bounces the message.
I suspect it has something to do with postfix and not with courier-imap... here is the error:
Code: Select all
Aug 19 13:18:16 cad postfix/smtpd[2330]: < unknown[132.248.74.208]: AUTH PLAIN AGNlcmVhbGl0bwBob2xhMTIzNA==
Aug 19 13:18:16 cad postfix/smtpd[2330]: smtpd_sasl_authenticate: sasl_method PLAIN, init_response AGNlcmVhbGl0bwBob2xhMTIzNA==
Aug 19 13:18:16 cad postfix/smtpd[2330]: smtpd_sasl_authenticate: decoded initial response
Aug 19 13:18:16 cad postfix/smtpd[2330]: sql plugin Parse the username cerealito
Aug 19 13:18:16 cad postfix/smtpd[2330]: sql plugin try and connect to a host
Aug 19 13:18:16 cad postfix/smtpd[2330]: sql plugin trying to open db 'mailsql' on host 'localhost'
Aug 19 13:18:16 cad postfix/smtpd[2330]: sql plugin Parse the username cerealito
Aug 19 13:18:16 cad postfix/smtpd[2330]: sql plugin try and connect to a host
Aug 19 13:18:16 cad postfix/smtpd[2330]: sql plugin trying to open db 'mailsql' on host 'localhost'
Aug 19 13:18:16 cad postfix/smtpd[2330]: begin transaction
Aug 19 13:18:16 cad postfix/smtpd[2330]: sql plugin create statement from userPassword cerealito cad.cele.unam.mx
Aug 19 13:18:16 cad postfix/smtpd[2330]: sql plugin doing query SELECT clear FROM users WHERE email='cerealito';
Aug 19 13:18:16 cad postfix/smtpd[2330]: sql plugin create statement from cmusaslsecretPLAIN cerealito cad.cele.unam.mx
Aug 19 13:18:16 cad postfix/smtpd[2330]: sql plugin doing query SELECT clear FROM users WHERE email='cerealito';
Aug 19 13:18:16 cad postfix/smtpd[2330]: commit transaction
Aug 19 13:18:16 cad postfix/smtpd[2330]: sql plugin Parse the username cerealito
Aug 19 13:18:16 cad postfix/smtpd[2330]: sql plugin try and connect to a host
Aug 19 13:18:16 cad postfix/smtpd[2330]: sql plugin trying to open db 'mailsql' on host 'localhost'
Aug 19 13:18:16 cad postfix/smtpd[2330]: sql plugin Parse the username cerealito
Aug 19 13:18:16 cad postfix/smtpd[2330]: sql plugin try and connect to a host
Aug 19 13:18:16 cad postfix/smtpd[2330]: sql plugin trying to open db 'mailsql' on host 'localhost'
Aug 19 13:18:16 cad postfix/smtpd[2330]: > unknown[132.248.74.208]: 235 Authentication successful
Aug 19 13:18:16 cad postfix/smtpd[2330]: watchdog_pat: 0x809f3f0
Aug 19 13:18:16 cad postfix/smtpd[2330]: < unknown[132.248.74.208]: MAIL FROM:<cerealito@cad.cele.unam.mx> SIZE=389
Aug 19 13:18:16 cad postfix/smtpd[2330]: extract_addr: input: <cerealito@cad.cele.unam.mx>
Aug 19 13:18:16 cad postfix/smtpd[2330]: extract_addr: result: cerealito@cad.cele.unam.mx
Aug 19 13:18:16 cad postfix/smtpd[2330]: fsspace: .: block size 4096, blocks free 12860008
Aug 19 13:18:16 cad postfix/smtpd[2330]: smtpd_check_size: blocks 4096 avail 12860008 min_free 0 size 389
Aug 19 13:18:16 cad postfix/smtpd[2330]: connect to subsystem public/cleanup
Aug 19 13:18:16 cad postfix/smtpd[2330]: public/cleanup socket: wanted attribute: queue_id
Aug 19 13:18:16 cad postfix/smtpd[2330]: input attribute name: queue_id
Aug 19 13:18:16 cad postfix/smtpd[2330]: input attribute value: 87EEB8529
Aug 19 13:18:16 cad postfix/smtpd[2330]: public/cleanup socket: wanted attribute: (list terminator)
Aug 19 13:18:16 cad postfix/smtpd[2330]: input attribute name: (end)
Aug 19 13:18:16 cad postfix/smtpd[2330]: send attr flags = 2
Aug 19 13:18:16 cad postfix/smtpd[2330]: 87EEB8529: client=unknown[132.248.74.208], sasl_method=PLAIN, sasl_username=cerealito
Aug 19 13:18:16 cad postfix/smtpd[2330]: > unknown[132.248.74.208]: 250 Ok
Aug 19 13:18:16 cad postfix/smtpd[2330]: watchdog_pat: 0x809f3f0
Aug 19 13:18:16 cad postfix/smtpd[2330]: < unknown[132.248.74.208]: RCPT TO:<test@cad.cele.unam.mx>
Aug 19 13:18:16 cad postfix/smtpd[2330]: extract_addr: input: <test@cad.cele.unam.mx>
Aug 19 13:18:16 cad postfix/smtpd[2330]: extract_addr: result: test@cad.cele.unam.mx
Aug 19 13:18:16 cad postfix/smtpd[2330]: generic_checks: START
Aug 19 13:18:16 cad postfix/smtpd[2330]: generic_checks: name=permit_sasl_authenticated
Aug 19 13:18:16 cad postfix/smtpd[2330]: generic_checks: name=permit_sasl_authenticated status=1
Aug 19 13:18:16 cad postfix/smtpd[2330]: connect to subsystem private/rewrite
Aug 19 13:18:16 cad postfix/smtpd[2330]: send attr request = rewrite
Aug 19 13:18:16 cad postfix/smtpd[2330]: send attr rule = canonicalize
Aug 19 13:18:16 cad postfix/smtpd[2330]: send attr address = test@cad.cele.unam.mx
Aug 19 13:18:16 cad postfix/smtpd[2330]: private/rewrite socket: wanted attribute: address
Aug 19 13:18:16 cad postfix/smtpd[2330]: input attribute name: address
Aug 19 13:18:16 cad postfix/smtpd[2330]: input attribute value: test@cad.cele.unam.mx
Aug 19 13:18:16 cad postfix/smtpd[2330]: private/rewrite socket: wanted attribute: (list terminator)
Aug 19 13:18:16 cad postfix/smtpd[2330]: input attribute name: (end)
Aug 19 13:18:16 cad postfix/smtpd[2330]: rewrite_clnt: canonicalize: test@cad.cele.unam.mx -> test@cad.cele.unam.mx
Aug 19 13:18:16 cad postfix/smtpd[2330]: send attr request = resolve
Aug 19 13:18:16 cad postfix/smtpd[2330]: send attr address = test@cad.cele.unam.mx
Aug 19 13:18:16 cad postfix/smtpd[2330]: private/rewrite socket: wanted attribute: transport
Aug 19 13:18:16 cad postfix/smtpd[2330]: input attribute name: transport
Aug 19 13:18:16 cad postfix/smtpd[2330]: input attribute value: local
Aug 19 13:18:16 cad postfix/smtpd[2330]: private/rewrite socket: wanted attribute: nexthop
Aug 19 13:18:16 cad postfix/smtpd[2330]: input attribute name: nexthop
Aug 19 13:18:16 cad postfix/smtpd[2330]: input attribute value: cad.cele.unam.mx
Aug 19 13:18:16 cad postfix/smtpd[2330]: private/rewrite socket: wanted attribute: recipient
Aug 19 13:18:16 cad postfix/smtpd[2330]: input attribute name: recipient
Aug 19 13:18:16 cad postfix/smtpd[2330]: input attribute value: test@cad.cele.unam.mx
Aug 19 13:18:16 cad postfix/smtpd[2330]: private/rewrite socket: wanted attribute: flags
Aug 19 13:18:16 cad postfix/smtpd[2330]: input attribute name: flags
Aug 19 13:18:16 cad postfix/smtpd[2330]: input attribute value: 256
Aug 19 13:18:16 cad postfix/smtpd[2330]: private/rewrite socket: wanted attribute: (list terminator)
Aug 19 13:18:16 cad postfix/smtpd[2330]: input attribute name: (end)
Aug 19 13:18:16 cad postfix/smtpd[2330]: resolve_clnt_query: `test@cad.cele.unam.mx' -> t=`local' h=`cad.cele.unam.mx' r=`test@cad.cele.unam.mx'
Aug 19 13:18:16 cad postfix/smtpd[2330]: ctable_locate: install entry key test@cad.cele.unam.mx
Aug 19 13:18:16 cad postfix/smtpd[2330]: maps_find: recipient_canonical_maps: test@cad.cele.unam.mx: not found
Aug 19 13:18:16 cad postfix/smtpd[2330]: maps_find: recipient_canonical_maps: test: not found
Aug 19 13:18:16 cad postfix/smtpd[2330]: maps_find: recipient_canonical_maps: @cad.cele.unam.mx: not found
Aug 19 13:18:16 cad postfix/smtpd[2330]: mail_addr_find: test@cad.cele.unam.mx -> (not found)
Aug 19 13:18:16 cad postfix/smtpd[2330]: maps_find: canonical_maps: test@cad.cele.unam.mx: not found
Aug 19 13:18:16 cad postfix/smtpd[2330]: maps_find: canonical_maps: test: not found
Aug 19 13:18:16 cad postfix/smtpd[2330]: maps_find: canonical_maps: @cad.cele.unam.mx: not found
Aug 19 13:18:16 cad postfix/smtpd[2330]: mail_addr_find: test@cad.cele.unam.mx -> (not found)
Aug 19 13:18:16 cad postfix/smtpd[2330]: dict_mysql_lookup using sql query: select destination from virtual where email = 'test@cad.cele.unam.mx'
Aug 19 13:18:16 cad postfix/smtpd[2330]: dict_mysql: attempting to connect to host unix:/var/run/mysqld/mysqld.sock
Aug 19 13:18:16 cad postfix/smtpd[2330]: dict_mysql: successful connection to host unix:/var/run/mysqld/mysqld.sock
Aug 19 13:18:16 cad postfix/smtpd[2330]: dict_mysql: successful query from host unix:/var/run/mysqld/mysqld.sock
Aug 19 13:18:16 cad postfix/smtpd[2330]: dict_mysql_lookup: retrieved 0 rows
Aug 19 13:18:16 cad postfix/smtpd[2330]: maps_find: virtual_alias_maps: test@cad.cele.unam.mx: not found
Aug 19 13:18:16 cad postfix/smtpd[2330]: dict_mysql_lookup using sql query: select destination from virtual where email = 'test'
Aug 19 13:18:16 cad postfix/smtpd[2330]: dict_mysql: successful query from host unix:/var/run/mysqld/mysqld.sock
Aug 19 13:18:16 cad postfix/smtpd[2330]: dict_mysql_lookup: retrieved 0 rows
Aug 19 13:18:16 cad postfix/smtpd[2330]: maps_find: virtual_alias_maps: test: not found
Aug 19 13:18:16 cad postfix/smtpd[2330]: dict_mysql_lookup using sql query: select destination from virtual where email = '@cad.cele.unam.mx'
Aug 19 13:18:16 cad postfix/smtpd[2330]: dict_mysql: successful query from host unix:/var/run/mysqld/mysqld.sock
Aug 19 13:18:16 cad postfix/smtpd[2330]: dict_mysql_lookup: retrieved 0 rows
Aug 19 13:18:16 cad postfix/smtpd[2330]: maps_find: virtual_alias_maps: @cad.cele.unam.mx: not found
Aug 19 13:18:16 cad postfix/smtpd[2330]: mail_addr_find: test@cad.cele.unam.mx -> (not found)
Aug 19 13:18:16 cad postfix/smtpd[2330]: dict_mysql_lookup using sql query: select destination from alias where alias = 'test@cad.cele.unam.mx'
Aug 19 13:18:16 cad postfix/smtpd[2330]: dict_mysql: attempting to connect to host unix:/var/run/mysqld/mysqld.sock
Aug 19 13:18:16 cad postfix/smtpd[2330]: dict_mysql: successful connection to host unix:/var/run/mysqld/mysqld.sock
Aug 19 13:18:16 cad postfix/smtpd[2330]: dict_mysql: successful query from host unix:/var/run/mysqld/mysqld.sock
Aug 19 13:18:16 cad postfix/smtpd[2330]: dict_mysql_lookup: retrieved 0 rows
Aug 19 13:18:16 cad postfix/smtpd[2330]: dict_mysql_lookup using sql query: select maildir from users where email = 'test@cad.cele.unam.mx' and postfix = 'y'
Aug 19 13:18:16 cad postfix/smtpd[2330]: dict_mysql: attempting to connect to host unix:/var/run/mysqld/mysqld.sock
Aug 19 13:18:16 cad postfix/smtpd[2330]: dict_mysql: successful connection to host unix:/var/run/mysqld/mysqld.sock
Aug 19 13:18:16 cad postfix/smtpd[2330]: dict_mysql: successful query from host unix:/var/run/mysqld/mysqld.sock
Aug 19 13:18:16 cad postfix/smtpd[2330]: dict_mysql_lookup: retrieved 0 rows
Aug 19 13:18:16 cad postfix/smtpd[2330]: maps_find: local_recipient_maps: test@cad.cele.unam.mx: not found
Aug 19 13:18:16 cad postfix/smtpd[2330]: dict_mysql_lookup using sql query: select destination from alias where alias = 'test'
Aug 19 13:18:16 cad postfix/smtpd[2330]: dict_mysql: successful query from host unix:/var/run/mysqld/mysqld.sock
Aug 19 13:18:16 cad postfix/smtpd[2330]: dict_mysql_lookup: retrieved 0 rows
Aug 19 13:18:16 cad postfix/smtpd[2330]: dict_mysql_lookup using sql query: select maildir from users where email = 'test' and postfix = 'y'
Aug 19 13:18:16 cad postfix/smtpd[2330]: dict_mysql: successful query from host unix:/var/run/mysqld/mysqld.sock
Aug 19 13:18:16 cad postfix/smtpd[2330]: dict_mysql_lookup: retrieved 1 rows
Aug 19 13:18:16 cad postfix/smtpd[2330]: maps_find: local_recipient_maps: mysql:/etc/postfix/mysql-virtual-maps.cf: test = /home/vmail/test/.maildir
Aug 19 13:18:16 cad postfix/smtpd[2330]: mail_addr_find: test@cad.cele.unam.mx -> /home/vmail/test/.maildir
Aug 19 13:18:16 cad postfix/smtpd[2330]: > unknown[132.248.74.208]: 250 Ok
Aug 19 13:18:16 cad postfix/smtpd[2330]: watchdog_pat: 0x809f3f0
Aug 19 13:18:16 cad postfix/smtpd[2330]: < unknown[132.248.74.208]: DATA
Aug 19 13:18:16 cad postfix/smtpd[2330]: > unknown[132.248.74.208]: 354 End data with <CR><LF>.<CR><LF>
Aug 19 13:18:16 cad postfix/smtpd[2330]: public/cleanup socket: wanted attribute: status
Aug 19 13:18:16 cad postfix/cleanup[2337]: 87EEB8529: message-id=<4124A9B0.7020907@cad.cele.unam.mx>
Aug 19 13:18:16 cad postfix/smtpd[2330]: input attribute name: status
Aug 19 13:18:16 cad postfix/smtpd[2330]: input attribute value: 0
Aug 19 13:18:16 cad postfix/smtpd[2330]: public/cleanup socket: wanted attribute: reason
Aug 19 13:18:16 cad postfix/smtpd[2330]: input attribute name: reason
Aug 19 13:18:16 cad postfix/smtpd[2330]: input attribute value: (end)
Aug 19 13:18:16 cad postfix/smtpd[2330]: public/cleanup socket: wanted attribute: (list terminator)
Aug 19 13:18:16 cad postfix/smtpd[2330]: input attribute name: (end)
Aug 19 13:18:16 cad postfix/smtpd[2330]: > unknown[132.248.74.208]: 250 Ok: queued as 87EEB8529
Aug 19 13:18:16 cad postfix/smtpd[2330]: watchdog_pat: 0x809f3f0
Aug 19 13:18:16 cad postfix/qmgr[2020]: 87EEB8529: from=<cerealito@cad.cele.unam.mx>, size=673, nrcpt=1 (queue active)
Aug 19 13:18:16 cad postfix/smtpd[2330]: < unknown[132.248.74.208]: QUIT
Aug 19 13:18:16 cad postfix/smtpd[2330]: > unknown[132.248.74.208]: 221 Bye
Aug 19 13:18:16 cad postfix/smtpd[2330]: disconnect from unknown[132.248.74.208]
Aug 19 13:18:16 cad postfix/smtpd[2330]: master_notify: status 1
Aug 19 13:18:16 cad postfix/smtpd[2330]: connection closed
Aug 19 13:18:16 cad postfix/smtpd[2330]: watchdog_stop: 0x809f3f0
Aug 19 13:18:16 cad postfix/smtpd[2330]: watchdog_start: 0x809f3f0
Aug 19 13:18:16 cad postfix/local[2346]: 87EEB8529: to=<test@cad.cele.unam.mx>, relay=local, delay=0, status=bounced (unknown user: "test")
Aug 19 13:18:16 cad postfix/cleanup[2337]: AD0E88538: message-id=<20040819181816.AD0E88538@cad.cele.unam.mx>
Aug 19 13:18:16 cad postfix/qmgr[2020]: AD0E88538: from=<>, size=2233, nrcpt=1 (queue active)
Aug 19 13:18:16 cad postfix/local[2346]: AD0E88538: to=<cerealito@cad.cele.unam.mx>, relay=local, delay=0, status=sent (maildir)
Aug 19 13:19:56 cad postfix/smtpd[2330]: rewrite stream disconnect
Aug 19 13:19:56 cad postfix/smtpd[2330]: idle timeout -- exitingI've red many posts on the same subject, so i made some slight changes to the original guide setup:
1) email column in my users table holds just the user's username
2) /etc/sasl2/smtpd.conf holds this (for the newer versions of cyrus sasl)
Code: Select all
pwcheck_method: auxprop
auxprop_plugin: sql
mech_list: PLAIN LOGIN
log_level: 3
sql_engine: mysql
sql_hostnames: localhost
sql_database: mailsql
sql_user: mailsql
sql_passwd: blahblahblah
sql_select: SELECT clear FROM users WHERE email='%u'
sql_usessl: no
Code: Select all
alias_database = hash:/etc/mail/aliases
alias_maps = mysql:/etc/postfix/mysql-aliases.cf
broken_sasl_auth_clients = yes
command_directory = /usr/sbin
config_directory = /etc/postfix
daemon_directory = /usr/lib/postfix
debug_peer_level = 2
default_destination_concurrency_limit = 2
home_mailbox = .maildir/
inet_interfaces = all
local_destination_concurrency_limit = 2
local_recipient_maps = $alias_maps $virtual_mailbox_maps unix:passwd.byname
local_transport = local
mail_owner = postfix
mailq_path = /usr/bin/mailq
manpage_directory = /usr/share/man
mydestination = $myhostname, localhost.$mydomain $mydomain
mydomain = cele.unam.mx
myhostname = cad.cele.unam.mx
mynetworks_style = host
newaliases_path = /usr/bin/newaliases
queue_directory = /var/spool/postfix
readme_directory = /usr/share/doc/postfix-2.0.19/readme
relocated_maps = mysql:/etc/postfix/mysql-relocated.cf
sample_directory = /usr/share/doc/postfix-2.0.19/sample
sendmail_path = /usr/sbin/sendmail
setgid_group = postdrop
smtpd_recipient_restrictions = permit_sasl_authenticated, permit_mynetworks, reject_unauth_destination
smtpd_sasl_auth_enable = yes
smtpd_sasl_local_domain =
smtpd_sasl_security_options = noanonymous
smtpd_tls_CAfile = /etc/postfix/cacert.pem
smtpd_tls_cert_file = /etc/postfix/newcert.pem
smtpd_tls_key_file = /etc/postfix/newreq.pem
smtpd_tls_loglevel = 3
smtpd_tls_received_header = yes
smtpd_tls_session_cache_timeout = 3600s
smtpd_use_tls = yes
tls_random_source = dev:/dev/urandom
unknown_local_recipient_reject_code = 450
virtual_alias_maps = mysql:/etc/postfix/mysql-virtual.cf
virtual_gid_maps = static:1004
virtual_mailbox_base = /
virtual_mailbox_maps = mysql:/etc/postfix/mysql-virtual-maps.cf
virtual_minimum_uid = 1000
virtual_transport = virtual
virtual_uid_maps = static:1004

