Postfix: Issue sending emails

Discussion in 'Server Operation' started by kule, Aug 23, 2009.

  1. kule

    kule New Member

    I've used the Ubuntu 8.04, postfix/courier with virtual users HOWTO which works great.

    I'm in the process of moving postfix to it's own slice, however it will still connect to the original mysql server (i.e. a different slice).

    I've changed all the mysql host settings. I can send emails via telnet and receiving email works great but for some reason I can't send from my mail client.

    It seems to take a long time sending then finally comes back asking for your password again. This makes me think it's trying to connect to mysql and timing out but I can connect to the mysql server no probs from the command line of the new postfix slice. I also can't see any related mysql errors in the mail.log/auth.log.

    Anybody have any ideas what it might be or how to fix this?

    Many Thanks
    Luke

    postconf -n
    Code:
    alias_database = hash:/etc/aliases
    alias_maps = hash:/etc/aliases
    append_dot_mydomain = no
    biff = no
    broken_sasl_auth_clients = yes
    config_directory = /etc/postfix
    content_filter = amavis:[127.0.0.1]:10024
    header_checks = regexp:/etc/postfix/header_checks
    html_directory = /usr/share/doc/postfix/html
    inet_interfaces = all
    mailbox_size_limit = 0
    mydestination = mail.[mydomain].com, localhost.localdomain, localhost
    myhostname = mail.[mydomain].com
    mynetworks = 127.0.0.0/8
    myorigin = /etc/mailname
    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
    readme_directory = /usr/share/doc/postfix
    receive_override_options = no_address_mappings
    recipient_delimiter = +
    relayhost = 
    smtp_tls_session_cache_database = btree:${queue_directory}/smtp_scache
    smtpd_banner = $myhostname ESMTP $mail_name (Ubuntu)
    smtpd_recipient_restrictions = permit_mynetworks, permit_sasl_authenticated, reject_unauth_destination
    smtpd_sasl_auth_enable = yes
    smtpd_tls_cert_file = /etc/postfix/smtpd.cert
    smtpd_tls_key_file = /etc/postfix/smtpd.key
    smtpd_tls_session_cache_database = btree:${queue_directory}/smtpd_scache
    smtpd_use_tls = yes
    transport_maps = proxy:mysql:/etc/postfix/mysql-virtual_transports.cf
    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
    
    netstat -tap
    Code:
    Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name
    tcp        0      0 localhost:10024         *:*                     LISTEN      2395/amavisd (maste
    tcp        0      0 localhost:10025         *:*                     LISTEN      3530/master     
    tcp        0      0 x.x.x.214:mysql      *:*                     LISTEN      2470/mysqld     
    tcp        0      0 *:sunrpc                *:*                     LISTEN      2149/portmap    
    tcp        0      0 *:www                   *:*                     LISTEN      3243/apache2    
    tcp        0      0 *:ftp                   *:*                     LISTEN      3065/pure-ftpd (SER
    tcp        0      0 *:smtp                  *:*                     LISTEN      3530/master     
    tcp        0      0 localhost:796           *:*                     LISTEN      3164/famd       
    tcp        0      0 x.x.x.214:39002      x.x.x.50:mysql       ESTABLISHED 2943/authdaemond
    tcp6       0      0 [::]:imaps              [::]:*                  LISTEN      2934/couriertcpd
    tcp6       0      0 [::]:pop3s              [::]:*                  LISTEN      2978/couriertcpd
    tcp6       0      0 [::]:pop3               [::]:*                  LISTEN      2956/couriertcpd
    tcp6       0      0 [::]:imap2              [::]:*                  LISTEN      2912/couriertcpd
    tcp6       0      0 [::]:ftp                [::]:*                  LISTEN      3065/pure-ftpd (SER
    tcp6       0      0 [::]:ssh                [::]:*                  LISTEN      2357/sshd       
    
    In mail.log, when I try to send
    Code:
    Aug 23 14:09:05 mail postfix/smtpd[3642]: connect from [myip]
    
    And after a long wait:
    Code:
    Aug 23 14:12:16 mail postfix/smtpd[3642]: warning: SASL authentication failure: Password verification failed
    Aug 23 14:12:16 mail postfix/smtpd[3642]: warning: [myip]: SASL PLAIN authentication failed: authentication failure
    Aug 23 14:12:16 mail postfix/smtpd[3642]: lost connection after AUTH from [myip]
    Aug 23 14:12:16 mail postfix/smtpd[3642]: disconnect from [myip]
    
     
  2. kule

    kule New Member

    Figured it out - it was mysql as I suspected. Incase this helps someone else:

    I couldn't see an error until I grep'd the log files and found some errors tucked away in auth.log

    Code:
    grep 'mysql' /var/log/*.log
    
    Gave this:
    
    auth.log:Aug 24 12:01:59 mail saslauthd[xxxx]: pam_mysql - MySQL error (Can't connect to MySQL server on 'x.x.x.x' (110))
    
    This led me to look at the /etc/pam.d/smtp file and I realised I'd put a mistyped my other servers IP address - doh.

    Oh well you live and learn!
     

Share This Page