Virtual Users And Domains With Postfix, Courier And MySQL (+ SMTP-AUTH, Quota, SpamAs

Discussion in 'Installation/Configuration' started by skluz, Jan 15, 2006.

  1. skluz

    skluz New Member

    I just finished running through Falko's Virtual Users And Domains With Postfix, Courier And MySQL (+ SMTP-AUTH, Quota, SpamAssassin, ClamAV) tutorial which was very straight forward. Unfortunately I still haven't been able to get everything to work.

    My current problem is that rather than saving email messages in the /home/vmail directory they're being saved in the user's home directory... which won't be very useful for my other domains.

    I'm also not able to successfully connect via the pop connection:
    link:/var/log# telnet localhost pop3
    Trying 127.0.0.1...
    Connected to localhost.localdomain.
    Escape character is '^]'.
    +OK Hello there.
    user skluz@xactlydev.com
    +OK Password required.
    pass myTempPass
    -ERR Maildir: No such file or directory
    Connection closed by foreign host.
    link:/var/log#

    Any Ideas?

    I searched through all the previous threads and didn't find any that had this exact problem... If I did miss a thread I apologize in advance.

    Thanks for any help you can give.

    Skluz
     
    Last edited: Jan 15, 2006
  2. till

    till Super Moderator Staff Member ISPConfig Developer

    The pop3 error occures because you had not send an email successfully to the vmail user yet.

    Did your vmail users have the same username then real system users? Try to make a vmail users with a name that does not correspond to a system user.
     
  3. falko

    falko Super Moderator ISPConfig Developer

    Please compare your configuration files with the ones from the tutorial. Maybe you made a typo somewhere. Also take care about the format of the configuration files (whitespaces, tabs, ...), especially Courier is very finicky about this.
     
  4. skluz

    skluz New Member

    Tutorial redo

    I have run through the tutorial 3 times to make sure that I don't have any typos... I did find a few whitespaces on the end of the /etc/postfix/main.cf file after ='s without trailing information. Unfortunately it doesn't seem to have changed anything. I had heard that this was important in the /etc/courier/authmysqlrc file so it had already had all of it's extra whitespace removed.

    /etc/courier/authmysqlrc
    Code:
    MYSQL_SERVER            localhost
    MYSQL_USERNAME          mail_admin
    MYSQL_PASSWORD          myTempAdminPass
    MYSQL_PORT              0
    MYSQL_DATABASE          mail
    MYSQL_USER_TABLE        users
    MYSQL_CRYPT_PWFIELD     password
    #MYSQL_CLEAR_PWFIELD    password
    MYSQL_UID_FIELD         5000
    MYSQL_GID_FIELD         5000
    MYSQL_LOGIN_FIELD       email
    MYSQL_HOME_FIELD        "/home/vmail"
    #MYSQL_MAILDIR_FIELD    maildir
    MYSQL_MAILDIR_FIELD     CONCAT(SUBSTRING_INDEX(email,'@',-1),'/',SUBSTRING_INDEX(email,'@',1),'/')
    #MYSQL_NAME_FIELD
    MYSQL_QUOTA_FIELD       quota
    
    /etc/postfix/main.cf
    Code:
    smtpd_banner = $myhostname ESMTP $mail_name (Debian/GNU)
    biff = no
    append_dot_mydomain = no
    myhostname = xactlydev.com
    alias_maps = hash:/etc/aliases
    alias_database = hash:/etc/aliases
    myorigin = /etc/mailname
    mydestination = xactlydev.com, localhost, localhost.localdomain
    relayhost =
    mynetworks = 127.0.0.0/8
    mailbox_command =
    mailbox_size_limit = 0
    recipient_delimiter = +
    inet_interfaces = all
    smtpd_sasl_local_domain =
    smtpd_sasl_auth_enable = yes
    smtpd_sasl_security_options = noanonymous
    broken_sasl_auth_clients = yes
    smtpd_recipient_restrictions = permit_mynetworks,permit_sasl_authenticated, reject_unauth_destination
    smtpd_tls_auth_only = no
    smtp_use_tls = yes
    smtpd_use_tls = yes
    smtp_tls_note_starttls_offer = yes
    smtpd_tls_key_file = /etc/postfix/smtpd.key
    smtpd_tls_cert_file = /etc/postfix/smtpd.cert
    smtpd_tls_CAfile = /etc/postfix/ssl/cacert.pem
    smtpd_tls_loglevel = 1
    smtpd_tls_received_header = yes
    smtpd_tls_session_cache_timeout = 3600s
    tls_random_source = dev:/dev/urandom
    home_mailbox = Maildir/
    virtual_alias_domains =
    virtual_alias_maps = proxy:mysql:/etc/postfix/mysql-virtual_forwardings.cf, proxy:mysql:/etc/postfix/mysql-virtual_email2email.cf
    virtual_mailbox_domains = proxy:mysql:/etc/postfix/mysql-virtual_domains.cf
    virtual_mailbox_maps = proxy:mysql:/etc/postfix/mysql-virtual_mailboxes.cf
    virtual_mailbox_base = /home/vmail
    virtual_uid_maps = static:5000
    virtual_gid_maps = static:5000
    transport_maps = proxy:mysql:/etc/postfix/mysql-virtual_transports.cf
    virtual_create_maildirsize = yes
    virtual_mailbox_extended = yes
    virtual_mailbox_limit_maps = proxy:mysql:/etc/postfix/mysql-virtual_mailbox_limit_maps.cf
    virtual_mailbox_limit_override = yes
    virtual_mailbox_limit_message = "The user you are trying to reach is over quota."
    virtual_overquota_bounce = yes
    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
    content_filter = amavis:[127.0.0.1]:10024
    receive_override_options = no_address_mappings
    virtual_maildir_limit_message = "The user you are trying to reach is over quota."
    

    I have also tried sending email to an email user that isn't a system user. It was bounced because the user was "unknown".

    Code:
    Jan 15 11:45:42 link postfix/smtpd[2339]: connect from localhost.localdomain[127
    .0.0.1]
    Jan 15 11:45:42 link postfix/smtpd[2339]: 5873C4AF48: client=localhost.localdoma
    in[127.0.0.1]
    Jan 15 11:45:42 link postfix/cleanup[2329]: 5873C4AF48: message-id=<200601151745
    38.A42F44AF45@xactlydev.com>
    Jan 15 11:45:42 link postfix/qmgr[2325]: 5873C4AF48: from=<root@xactlydev.com>, 
    size=743, nrcpt=1 (queue active)
    Jan 15 11:45:42 link postfix/smtpd[2339]: disconnect from localhost.localdomain[
    127.0.0.1]
    Jan 15 11:45:42 link amavis[1574]: (01574-01) Passed, <root@xactlydev.com> -> <b
    eth@xactlydev.com>, Message-ID: <20060115174538.A42F44AF45@xactlydev.com>, Hits:
     -1.536
    Jan 15 11:45:42 link postfix/local[2343]: 5873C4AF48: to=<beth@xactlydev.com>, r
    elay=local, delay=0, status=bounced (unknown user: "beth")
    Jan 15 11:45:42 link postfix/smtp[2333]: A42F44AF45: to=<beth@xactlydev.com>, re
    lay=127.0.0.1[127.0.0.1], delay=4, status=sent (250 2.6.0 Ok, id=01574-01, from 
    MTA: 250 Ok: queued as 5873C4AF48)
    Jan 15 11:45:42 link postfix/qmgr[2325]: A42F44AF45: removed
    Jan 15 11:45:42 link postfix/cleanup[2329]: C12864AF4C: message-id=<200601151745
    42.C12864AF4C@xactlydev.com>
    Jan 15 11:45:42 link postfix/qmgr[2325]: C12864AF4C: from=<>, size=2341, nrcpt=1
     (queue active)
    Jan 15 11:45:42 link postfix/qmgr[2325]: 5873C4AF48: removed
    Jan 15 11:45:42 link postfix/local[2343]: C12864AF4C: to=<root@xactlydev.com>, r
    elay=local, delay=0, status=sent (delivered to maildir)
    Jan 15 11:45:42 link postfix/qmgr[2325]: C12864AF4C: removed
    
     
    Last edited: Jan 15, 2006
  5. skluz

    skluz New Member

    mysql problem

    It turns out that a lot of my problem was with mysql permissions. I was able to add permissions on for %, which seemed to get me past a few problems.

    I then manually added the directory structure under /home/vmail in order to allow the users to successfully log into the pop3 connection. So pop3 works.

    SMTP still not quite right. I'm still having the problem with the mail delivery. The SMTP system is still using the system accounts rather than the mysql information. There's definitely some disconnect here that I haven't been able to put my finger on yet.
     
    Last edited: Jan 15, 2006
  6. skluz

    skluz New Member

    Back to the system user

    okay...now I'm really confused. Email's are being delivered to the system user account, but the pop checks the virtual directory like it's supposed to.

    I tried playing around with the /etc/postfix/main.cf but I'm still not able to get things delivered to the correct location.
     
  7. till

    till Super Moderator Staff Member ISPConfig Developer

    You still not answered my question:

    Did your vmail users have the same username then real system users? Try to make a vmail users with a name that does not correspond to a system user.
     
  8. skluz

    skluz New Member

    sending to non-system users

    I've tried sending email to non-system users...and the emails get bounced.

    The email then get's forwarded to root's Maildir.
     
  9. skluz

    skluz New Member

    virtual mail...

    At one point I had removed my primary domain from the domain mysql table. This was causing the problem.

    I've added a virtual domain, and it seems to be working correctly.
    So should I removed my primary domain from the main.cf file so that all the domains are virtual?

    Basically all emails at xactlydev.com are not working...but my virtual domain, skluz.com, seems to be working fine. VERY ODD...
     
  10. skluz

    skluz New Member

    Whhheeewwww

    I think I've finally got this thing under wraps.

    By removing my primary domain from the mydestination line in the /etc/postfix/main.cf I was able to get everything working as expected. I still haven't figured out the IMAP stuff as I hadn't used it before. Maybe I'll dig around with that this week.

    Thanks for all your help. Keep up the great work and the great HOWTOs. I made the switch from SuSE to Debian because of your tutorial, and I'm glad to have another flavor of Linux under my belt.
     
  11. falko

    falko Super Moderator ISPConfig Developer

    Yes, all the domains that you use for virtual hosting must not be in the mydestination line!
     

Share This Page