You are not logged in.

#1 2020-10-03 07:39:52

1ndeed
Member
Registered: 2018-09-28
Posts: 41

Mutt Failure: "Login failed."

I fallowed this wiki to build my mail server with a virtual user system.
I successfully built postfix, dovecot and roundcube. They all worked fine. But when I tried to connect to IMAP by using mutt.Mutt failed.

Login failed.

And the log of dovecot:

imap-login: Aborted login (auth failed, 2 attempts in 23 secs): user=<user>, method=PLAIN, rip=127.0.0.1, lip=127.0.0.1, TLS, session=<QGNpyr6aZZZ/AAAB>

Here's the full configuration of ~/.muttrc:

set imap_user=user@my_personal_domail.com
set imap_pass=some_easy_password
set folder=imaps://user@my_personal_domail.com/
set spoolfile   = +INBOX
mailboxes       = +INBOX
set mail_check = 120

/etc/dovecot/dovecot.conf

protocols = imap pop3
auth_mechanisms = plain
passdb {
    driver = sql
    args = /etc/dovecot/dovecot-sql.conf
}
userdb {
    driver = sql
    args = /etc/dovecot/dovecot-sql.conf
}
 
service auth {
    unix_listener auth-client {
        group = postfix
        mode = 0660
        user = postfix
    }
    user = root
}

mail_home = /home/vmail/%d/%n
mail_location = maildir:~

ssl_cert = </location.pem
ssl_key = </location.key
ssl_dh = </etc/dovecot/dh.pem

/etc/dovecot/dovecot-sql.conf

driver = mysql
connect = host=localhost dbname=postfix_db user=postfix_user password=00000
# It is highly recommended to not use deprecated MD5-CRYPT. Read more at http://wiki2.dovecot.org/Authentication/PasswordSchemes
default_pass_scheme = SHA512-CRYPT
# Get the mailbox
user_query = SELECT '/home/vmail/%d/%n' as home, 'maildir:/home/vmail/%d/%n' as mail, 5000 AS uid, 5000 AS gid, concat('dirsize:storage=',  quota) AS quota FROM mailbox WHERE username = '%u' AND active = '1'
# Get the password
password_query = SELECT username as user, password, '/home/vmail/%d/%n' as userdb_home, 'maildir:/home/vmail/%d/%n' as userdb_mail, 5000 as  userdb_uid, 5000 as userdb_gid FROM mailbox WHERE username = '%u' AND active = '1'
# If using client certificates for authentication, comment the above and uncomment the following
#password_query = SELECT null AS password, ‘%u’ AS user

What went wrong?

Last edited by 1ndeed (2020-10-03 07:45:49)

Offline

#2 2020-10-03 14:05:06

twelveeighty
Member
Registered: 2011-09-04
Posts: 1,456

Re: Mutt Failure: "Login failed."

It's possible that the stored SHA512-CRYPT password is incorrect. Using SQL tools, do a raw query on the "mailbox" table and compare the stored value for "password" to what `doveadm pw` generates for your chosen 'some_easy_password' - pay close attention to erroneous quotes, slashes, etc. and make sure that the encrypted password starts with $6$.

Offline

Board footer

Powered by FluxBB