Installing postfix, courier, etc, but mail login fails

Discussion in 'HOWTO-Related Questions' started by JimXL, Jul 12, 2007.

  1. JimXL

    JimXL New Member

    I installed a mail system according to the instructions at http://www.howtoforge.com/virtual_postfix_mysql_quota_courier_ubuntu_edgy

    However I cannot seem to log in. I attempted the following:

    [email protected]:/etc/postfix # telnet localhost 110
    Trying 127.0.0.1...
    Connected to localhost.
    Escape character is '^]'.
    +OK Hello there.
    user jim
    +OK Password required.
    pass secret
    -ERR Login failed.
    quit
    +OK Better luck next time.
    Connection closed by foreign host.

    I also tried user [email protected] where that is the actual value in the users table:

    +---------------+---------------+----------+
    | email | password | quota |
    +---------------+---------------+----------+
    | [email protected] | 7UAMl1biG6pKI | 10485760 |
    | [email protected] | pRxzjUz2Qs2iI | 10485760 |
    +---------------+---------------+----------+


    I noticed that the ENCRYPT command encrypts the password to a different string each time. Both the passwords were installed using the same password.

    The logs are unhelpful, all they say is that the login failed.

    Jul 12 09:31:44 largo courierpop3login: LOGIN FAILED, ip=[::ffff:127.0.0.1]
    Jul 12 09:32:13 largo courierpop3login: LOGIN FAILED, ip=[::ffff:127.0.0.1]

    No other messages at startup that would indicate a problem.

    So how do I go about debugging this problem? All the steps seemed go correctly.

    Thanks,
    Jim.
     
  2. JimXL

    JimXL New Member

    A little more...

    I just noticed a question about the same tutorial and a request for more info. So I've generated the same response here:


    (Substituted xxxxx.com for my domain name)

    [email protected]:/var/log # postfix check
    [email protected]:/var/log # postconf -n
    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
    inet_interfaces = all
    mailbox_size_limit = 0
    mydestination = xxxxx.com, localhost, localhost.localdomain
    myhostname = xxxxx.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
    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
    [email protected]:/var/log # ls -l /etc/postfix/smtpd.cert
    -rw-r--r-- 1 root root 1346 Jul 12 08:58 /etc/postfix/smtpd.cert

    I have mail in the /var/mail/jim directory. I noticed that the virtual mail boxes are at /home/vmail, but that directory is empty. Is mail supposed to go there instead of spool?

    Also I'd like to turn quotas off, how do I do that?

    I'm making progress. I had the domain name in both the mydestination and virtual_mailbox_domains, which resulted in a warning. I took it out and still can't log in, however there are now directories in /home/vmail.
     
    Last edited: Jul 12, 2007
  3. falko

    falko Super Moderator ISPConfig Developer

    Yes, mails must go to /home/vmail. Also, you must send at least one mail to a new account before you can use POP3.

    Try to use the value 0 for quota.
     
  4. JimXL

    JimXL New Member

    Still not working

    OK, thanks for the info. I have now mail in the /home/vmail/<domain>/<account> file, however I am still unable to log in.

    ls -lR /home/vmail/xxx.com/jim
    /home/vmail/xxx.com/jim:
    total 12
    drwx------ 2 vmail vmail 4096 Jul 12 10:33 cur
    drwx------ 2 vmail vmail 4096 Jul 12 10:33 new
    drwx------ 2 vmail vmail 4096 Jul 12 10:33 tmp

    /home/vmail/xxx.com/jim/cur:
    total 0

    /home/vmail/xxx.com/jim/new:
    total 4
    -rw------- 1 vmail vmail 2371 Jul 12 10:33 1184250802.V6200I407d3M407166.xxx.com

    /home/vmail/xxx.com/jim/tmp:
    total 0

    Where do I start looking?

    [email protected]:/etc/postfix # mysql -u root -p mail
    Enter password:
    Reading table information for completion of table and column names
    You can turn off this feature to get a quicker startup with -A

    Welcome to the MySQL monitor. Commands end with ; or \g.
    Your MySQL connection id is 159 to server version: 5.0.22-Debian_0ubuntu6.06.2-log

    Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

    mysql> select * from users;
    +---------------+---------------+----------+
    | email | password | quota |
    +---------------+---------------+----------+
    | [email protected] | ZxzAXQJc1jx/Q | 10485760 |
    | [email protected] | pRxzjUzqQs2iI | 10485760 |
    +---------------+---------------+----------+
    2 rows in set (0.00 sec)

    mysql> update users set quota=0;
    Query OK, 2 rows affected (0.02 sec)
    Rows matched: 2 Changed: 2 Warnings: 0

    mysql> update users set password=ENCRYPT('secret') where email like 'jim%';
    Query OK, 1 row affected (0.00 sec)
    Rows matched: 1 Changed: 1 Warnings: 0

    mysql> select * from users;
    +---------------+---------------+-------+
    | email | password | quota |
    +---------------+---------------+-------+
    | [email protected] | ZxzAXQJc1jx/Q | 0 |
    | [email protected] | Gy7uL5oicjncc | 0 |
    +---------------+---------------+-------+
    2 rows in set (0.00 sec)



    telnet localhost 110
    Trying 127.0.0.1...
    Connected to localhost.
    Escape character is '^]'.
    +OK Hello there.
    user [email protected]
    +OK Password required.
    PASS secret
    -ERR Login failed.
    quit
    +OK Better luck next time.
    Connection closed by foreign host.

    Jim.
     
  5. falko

    falko Super Moderator ISPConfig Developer

  6. JimXL

    JimXL New Member

    I think so

    Are the blank lines important? I didn't leave them all in. Here are what I think are the two courier files and a test to be sure the mail_admin user works with mysql.

    I also tried setting the port to 3306, but that didn't help. And yes I restarted courier after any changes per the instructions on the referenced page.

    [email protected]:/tmp # grep authmodulelist /etc/courier/authdaemonrc
    ##NAME: authmodulelist:0
    #authmodulelist="authpam"
    #authmodulelist="authshadow"daemons=3authdaemonvar=/var/lib/courier/authdaemonDEBUG_LOGIN=0DEFAULTOPTIONS=""
    authmodulelist="authmysql"
    ##NAME: authmodulelistorig:1
    authmodulelistorig="authcustom authcram authuserdb authldap authpgsql authmysql authpam"

    [email protected]:/tmp # cat /etc/courier/authmysqlrc
    MYSQL_SERVER localhost

    MYSQL_USERNAME mail_admin

    MYSQL_PASSWORD *******

    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 CONCAT(SUBSTRING_INDEX(email,'@',-1),'/',SUBSTRING_INDEX(email,'@',1),'/')
    #MYSQL_NAME_FIELD
    MYSQL_QUOTA_FIELD quota
    [email protected]:/tmp # mysql -u mail_admin -p
    Enter password:
    Welcome to the MySQL monitor. Commands end with ; or \g.
    Your MySQL connection id is 190 to server version: 5.0.22-Debian_0ubuntu6.06.2-log

    Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

    mysql> use mail;
    Reading table information for completion of table and column names
    You can turn off this feature to get a quicker startup with -A

    Database changed
    mysql> select * from users;
    +---------------+---------------+-------+
    | email | password | quota |
    +---------------+---------------+-------+
    | [email protected] | ZxzAXQJc1jx/Q | 0 |
    | [email protected] | Gy7uL5oicjncc | 0 |
    +---------------+---------------+-------+
    2 rows in set (0.00 sec)

    mysql> quit
    [email protected]:/tmp #

    Thanks,
    Jim.
     
  7. falko

    falko Super Moderator ISPConfig Developer

    Can you try
    Code:
    MYSQL_SERVER 127.0.0.1
    instead in /etc/courier/authmysqlrc?
    What's the output of
    Code:
    netstat -tap
    ? What's in /etc/hosts?
     
  8. JimXL

    JimXL New Member

    Sorry for the delay, I've been out of town. I made the change to the file and restarted all the courier scripts but it didn't help.

    Thanks,
    Jim

    [email protected]:/tmp # netstat -tpa
    Active Internet connections (servers and established)
    Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
    tcp 0 0 localhost:10024 *:* LISTEN 24779/amavisd (mast
    tcp 0 0 localhost:10025 *:* LISTEN 25301/master
    tcp 0 0 localhost:mysql *:* LISTEN 2969/mysqld
    tcp 0 0 xxx.com:domain *:* LISTEN 2771/named
    tcp 0 0 localhost:domain *:* LISTEN 2771/named
    tcp 0 0 *:smtp *:* LISTEN 25301/master
    tcp 0 0 localhost:953 *:* LISTEN 2771/named
    tcp6 0 0 *:imaps *:* LISTEN 2839/couriertcpd
    tcp6 0 0 *:pop3s *:* LISTEN 2874/couriertcpd
    tcp6 0 0 *:pop3 *:* LISTEN 3443/couriertcpd
    tcp6 0 0 *:imap2 *:* LISTEN 3407/couriertcpd
    tcp6 0 0 *:www *:* LISTEN 2119/apache2
    tcp6 0 0 *:ssh *:* LISTEN 3119/sshd
    tcp6 0 0 ip6-localhost:953 *:* LISTEN 2771/named
    tcp6 0 0 *:https *:* LISTEN 2119/apache2
    tcp6 0 1968 xxx.com:ssh adsl-062-063-047-:50494 ESTABLISHED21094/sshd: jwl [pr
     
  9. falko

    falko Super Moderator ISPConfig Developer

    Do you have special characters in your MySQL password? That might be the problem.
     
  10. JimXL

    JimXL New Member

    Simple pw

    The password is "secret" All alpha, no special characters.
     
  11. falko

    falko Super Moderator ISPConfig Developer

    Hm, that's ok. Then I'd suggest that you double- and triple-check your configuration and comapre it with the one from the tutorial. Maybe you've made a typo somewhere.
     
  12. JimXL

    JimXL New Member

    OK, what I meant was the password is the word "secret" not that it was a secret.

    I'll look the config over again and see if it looks OK. Can you suggest which files might be at fault? Or which ones wouldn't cause that problem?

    Thanks,
    Jim.
     

Share This Page