Postfix not... doing anything.

Discussion in 'HOWTO-Related Questions' started by torg, Jan 17, 2010.

  1. torg

    torg New Member

    Hello everyone! I've been following Virtual Users And Domains With Postfix, Courier, MySQL And SquirrelMail (Fedora 12 x86_64) closely, and I thought I'd followed the steps precisely, but obviously not, because I've hit a wall.

    I'd greatly appreciate any answers, or even clues. I'm using FC12 32bit, with the latest postfix and rpmbuild'd courier.

    So, I have 2 problems. The first is that when I send an email to a virtual user who is also a local user, PostFix doesn't create the /home/vmail/domain/user directory; and when I log in, pop3d can't find that directory, and gives me a 'chdir... no such file or directory'.

    Here's /var/log/maillog, after mailx'ing a mail and attempting to login via POP3 to read it.
    Code:
    postfix/master[9128]: daemon started -- version 2.6.5, configuration /etc/postfix
    postfix/pickup[9130]: 58C81282F7: uid=0 from=<root>
    postfix/cleanup[9135]: 58C81282F7: message-id=<20100117002132.58C81282F7@mydomain.com>
    postfix/qmgr[9131]: 58C81282F7: from=<root@mydomain.com>, size=410, nrcpt=1 (queue active)
    postfix/local[9142]: 58C81282F7: to=<test@mydomain.com>, relay=local, delay=0.6, delays=0.36/0.17/0/0.07, dsn=2.0.0, status=sent (delivered to maildir)
    postfix/qmgr[9131]: 58C81282F7: removed
    pop3d: Connection, ip=[::ffff:192.168.1.2]
    authdaemond: received auth request, service=pop3, authtype=login
    authdaemond: authmysql: trying this module
    authdaemond: authmysqllib: connected. Versions: header 50141, client 50141, server 50141
    authdaemond: SQL query: SELECT email, password, "", 5000, 5000, "/home/vmail", CONCAT(SUBSTRING_INDEX(email,'@',-1),'/',SUBSTRING_INDEX(email,'@',1),'/'), quota, "", "" FROM users WHERE email = 'test@mydomain.com' 
    authdaemond: password matches successfully
    authdaemond: authmysql: sysusername=<null>, sysuserid=5000, sysgroupid=5000, homedir=/home/vmail, address=test@mydomain.com, fullname=<null>, maildir=mydomain.com/test/, quota=10485760, options=<null>
    authdaemond: authmysql: clearpasswd=<null>, passwd=LwHeXDvbAn9BU
    authdaemond: Authenticated: sysusername=<null>, sysuserid=5000, sysgroupid=5000, homedir=/home/vmail, address=test@mydomain.com, fullname=<null>, maildir=mydomain.com/test/, quota=10485760, options=<null>
    authdaemond: Authenticated: clearpasswd=test, passwd=LwHeXDvbAn9BU
    pop3d: chdir mydomain.com/test/: No such file or directory
    

    This is what /home/vmail looks like after sending the mail :
    Code:
    [root@torg ~]# ls -ld `find /home/vmail`
    drwx------ 4 vmail vmail 4096 2010-01-16 22:20 /home/vmail
    -rw-r--r-- 1 vmail vmail   18 2009-12-11 11:51 /home/vmail/.bash_logout
    -rw-r--r-- 1 vmail vmail  176 2009-12-11 11:51 /home/vmail/.bash_profile
    -rw-r--r-- 1 vmail vmail  124 2009-12-11 11:51 /home/vmail/.bashrc
    drwxr-xr-x 2 vmail vmail 4096 2009-09-24 01:21 /home/vmail/.gnome2
    drwxr-xr-x 4 vmail vmail 4096 2009-12-26 00:56 /home/vmail/.mozilla
    drwxr-xr-x 2 vmail vmail 4096 2009-07-27 04:01 /home/vmail/.mozilla/extensions
    drwxr-xr-x 2 vmail vmail 4096 2009-07-27 04:01 /home/vmail/.mozilla/plugins
    


    But this is what ~test (the virtual & local user) looks like :
    Code:
    [root@torg ~]# ls -ld `find /home/test`
    drwx------ 5 test test 4096 2010-01-16 21:06 /home/test
    -rw------- 1 test test   10 2010-01-16 21:06 /home/test/.bash_history
    -rw-r--r-- 1 test test   18 2009-12-11 11:51 /home/test/.bash_logout
    -rw-r--r-- 1 test test  176 2009-12-11 11:51 /home/test/.bash_profile
    -rw-r--r-- 1 test test  124 2009-12-11 11:51 /home/test/.bashrc
    drwxr-xr-x 2 test test 4096 2009-09-24 01:21 /home/test/.gnome2
    drwx------ 5 test test 4096 2010-01-13 00:28 /home/test/Maildir
    drwx------ 2 test test 4096 2010-01-13 00:23 /home/test/Maildir/cur
    drwx------ 2 test test 4096 2010-01-17 00:21 /home/test/Maildir/new
    -rw------- 1 test test  488 2010-01-16 20:50 /home/test/Maildir/new/1263675056.Vfd00I282e9M727108.torg.thepit
    -rw------- 1 test test  480 2010-01-16 21:07 /home/test/Maildir/new/1263676051.Vfd00I282e8M240595.torg.thepit
    -rw------- 1 test test  481 2010-01-16 21:29 /home/test/Maildir/new/1263677364.Vfd00I273b5M435625.torg.thepit
    -rw------- 1 test test  496 2010-01-16 22:52 /home/test/Maildir/new/1263682337.Vfd00I282edM656610.torg.thepit
    -rw------- 1 test test  489 2010-01-16 22:58 /home/test/Maildir/new/1263682727.Vfd00I282ecM322565.torg.thepit
    -rw------- 1 test test  494 2010-01-16 23:13 /home/test/Maildir/new/1263683604.Vfd00I282eeM615181.torg.thepit
    -rw------- 1 test test  492 2010-01-16 23:17 /home/test/Maildir/new/1263683856.Vfd00I282efM454629.torg.thepit
    -rw------- 1 test test  494 2010-01-16 23:21 /home/test/Maildir/new/1263684116.Vfd00I282f1M127725.torg.thepit
    -rw------- 1 test test  494 2010-01-16 23:27 /home/test/Maildir/new/1263684448.Vfd00I282f0M794913.torg.thepit
    -rw------- 1 test test  494 2010-01-16 23:50 /home/test/Maildir/new/1263685844.Vfd00I282f2M727594.torg.thepit
    -rw------- 1 test test  488 2010-01-17 00:21 /home/test/Maildir/new/1263687692.Vfd00I282eaM750710.torg.thepit
    drwx------ 2 test test 4096 2010-01-17 00:21 /home/test/Maildir/tmp
    drwxr-xr-x 4 test test 4096 2009-12-26 00:56 /home/test/.mozilla
    drwxr-xr-x 2 test test 4096 2009-07-27 04:01 /home/test/.mozilla/extensions
    drwxr-xr-x 2 test test 4096 2009-07-27 04:01 /home/test/.mozilla/plugins
    

    The second problem is that when I send an email to a virtual user who does not have a local account, it bounces with 'unknown user' :
    Code:
    postfix/master[9505]: daemon started -- version 2.6.5, configuration /etc/postfix
    postfix/pickup[9507]: 6998D282F9: uid=0 from=<root>
    postfix/cleanup[9512]: 6998D282F9: message-id=<20100117002945.6998D282F9@mydomain.com>
    postfix/qmgr[9508]: 6998D282F9: from=<root@mydomain.com>, size=423, nrcpt=1 (queue active)
    postfix/local[9519]: 6998D282F9: to=<moo@mydomain.com>, relay=local, delay=0.38, delays=0.27/0.05/0/0.06, dsn=5.1.1, status=bounced (unknown user: "moo")
    postfix/cleanup[9512]: A92CE282FA: message-id=<20100117002945.A92CE282FA@mydomain.com>
    postfix/qmgr[9508]: A92CE282FA: from=<>, size=2059, nrcpt=1 (queue active)
    postfix/bounce[9520]: 6998D282F9: sender non-delivery notification: A92CE282FA
    postfix/qmgr[9508]: 6998D282F9: removed
    postfix/local[9519]: A92CE282FA: to=<root@mydomain.com>, relay=local, delay=0.14, delays=0.06/0.01/0/0.07, dsn=2.0.0, status=sent (delivered to maildir)
    postfix/qmgr[9508]: A92CE282FA: removed
    

    Here are my innards :

    postconf -n
    Code:
    alias_database = hash:/etc/aliases
    alias_maps = hash:/etc/aliases
    broken_sasl_auth_clients = yes
    command_directory = /usr/sbin
    config_directory = /etc/postfix
    daemon_directory = /usr/libexec/postfix
    data_directory = /var/lib/postfix
    debug_peer_level = 7
    debug_peer_list = $myhostname $mydomain
    home_mailbox = Maildir/
    html_directory = no
    inet_interfaces = all
    inet_protocols = all
    mail_owner = postfix
    mailq_path = /usr/bin/mailq.postfix
    manpage_directory = /usr/share/man
    mydestination = mydomain.com, localhost, localhost.localdomain
    mydomain = $myhostname
    myhostname = mydomain.com
    mynetworks = 192.168.1.0/24
    mynetworks_style = subnet
    newaliases_path = /usr/bin/newaliases.postfix
    proxy_read_maps = $local_recipient_maps $mydestination $virtual_alias_maps $virtual_alias_domains $virtual_mailbox_maps $virtual_mailbox_domains $relay_recipient_maps $relay_domains $canonical_maps $sender_canonical_maps $recipient_canonical_maps $relocated_maps $transport_maps $mynetworks $virtual_mailbox_limit_maps
    queue_directory = /var/spool/postfix
    readme_directory = /usr/share/doc/postfix-2.6.5/README_FILES
    relay_domains =
    relayhost = smtp1.bethere.co.uk:25
    sample_directory = /usr/share/doc/postfix-2.6.5/samples
    sendmail_path = /usr/sbin/sendmail.postfix
    setgid_group = postdrop
    smtpd_recipient_restrictions = permit_mynetworks, permit_sasl_authenticated, reject_unauth_destination
    smtpd_sasl_auth_enable = yes
    smtpd_sasl_authenticated_header = yes
    smtpd_sasl_local_domain = $myhostname
    smtpd_sasl_security_options = noanonymous
    smtpd_tls_auth_only = yes
    smtpd_tls_cert_file = /etc/postfix/smtpd.cert
    smtpd_tls_key_file = /etc/postfix/smtpd.key
    smtpd_tls_loglevel = 3
    smtpd_tls_security_level = encrypt
    smtpd_use_tls = yes
    transport_maps = proxy:mysql:/etc/postfix/mysql-virtual_transports.cf
    unknown_local_recipient_reject_code = 550
    virtual_alias_domains =
    virtual_alias_maps = proxy:mysql:/etc/postfix/mysql-virtual_forwardings.cf, mysql:/etc/postfix/mysql-virtual_email2email.cf
    virtual_gid_maps = static:5000
    virtual_mailbox_base = /home/vmail
    virtual_mailbox_domains = proxy:mysql:/etc/postfix/mysql-virtual_domains.cf
    virtual_mailbox_maps = proxy:mysql:/etc/postfix/mysql-virtual_mailboxes.cf
    virtual_uid_maps = static:5000
    
    MySQL tables : users,
    Code:
    mysql> select * from users;
    +-----------------+---------------+----------+
    | email           | password      | quota    |
    +-----------------+---------------+----------+
    | test@mydomain.com | LwHeXDvbAn9BU | 10485760 |
    | moo@mydomain.com  | y7Sdd0s.9ixxU | 10485760 |
    +-----------------+---------------+----------+
    2 rows in set (0.00 sec)
    
    and the others :
    Code:
    mysql> select * from domains, forwardings, transport;
    Empty set (0.00 sec)
    

    mysql-virtual_domains.cf
    Code:
    user = mail_admin
    password = mail_admin_password
    dbname = mail
    query = SELECT domain AS virtual FROM domains WHERE domain='%s'
    hosts = 127.0.0.1
    mysql-virtual_forwardings.cf
    Code:
    user = mail_admin
    password = mail_admin_password
    dbname = mail
    query = SELECT destination FROM forwardings WHERE source='%s'
    hosts = 127.0.0.1
    mysql-virtual_mailbox_limit_maps.cf
    Code:
    user = mail_admin
    password = mail_admin_password
    dbname = mail
    query = SELECT quota FROM users WHERE email='%s'
    hosts = 127.0.0.1
    mysql-virtual_email2email.cf
    Code:
    user = mail_admin
    password = mail_admin_password
    dbname = mail
    query = SELECT email FROM users WHERE email='%s'
    hosts = 127.0.0.1
    mysql-virtual_mailboxes.cf
    Code:
    user = mail_admin
    password = mail_admin_password
    dbname = mail
    query = SELECT CONCAT(SUBSTRING_INDEX(email,'@',-1),'/',SUBSTRING_INDEX(email,'@',1),'/') FROM users WHERE email='%s'
    hosts = 127.0.0.1
    mysql-virtual_transports.cf
    Code:
    user = mail_admin
    password = mail_admin_password
    dbname = mail
    query = SELECT transport FROM transport WHERE domain='%s'
    hosts = 127.0.0.1



    Can anyone offer any advice, or pointers? I don't really know where to start looking.

    Thanks in advance.
     
  2. falko

    falko Super Moderator

    The problem is that you can use one domain either with system users or virtual users, but not both at the same time. If you want to use mydomain.com with virtual users, you must remove it from mydestination in your main.cf and add it to the domains table.
     
  3. torg

    torg New Member

    You, sir... are an absolute star!

    Thank you!
     

Share This Page