Cannot log in to IMAP server and logs are unclear as to why
I’m trying a super basic config based upon https://wiki.dovecot.org/HowTo/PostfixDovecotLMTP but before I work on shipping mail through Postfix to DoveCot, I wanted to make sure IMAP is working first, but I can’t even get a basic login to so I thought I’d see if the gurus on the list might be able to point out I’m doing wrong. The documentation is pretty good, but there were some gaps I had to guess at and I’m presuming that’s where I went wrong. I’ve turned SELinux to permissive mode, for now.
Here’s the doveconf -n:
# 2.2.36 (1f10bfa63): /etc/dovecot/dovecot.conf
# OS: Linux 3.10.0-1062.12.1.el7.x86_64 x86_64 CentOS Linux release 7.7.1908 (Core)
# Hostname: imap
first_valid_uid = 1000
listen = 192.168.1.207
mail_gid = vmail
mail_home = /var/vmail/%d/%n
mail_location = sdbox:~/mail
mail_uid = vmail
mbox_write_locks = fcntl
namespace inbox {
inbox = yes
location =
mailbox Drafts {
special_use = \Drafts
}
mailbox Junk {
special_use = \Junk
}
mailbox Sent {
special_use = \Sent
}
mailbox "Sent Messages" {
special_use = \Sent
}
mailbox Trash {
special_use = \Trash
}
prefix =
separator = /
}
passdb {
args = scheme=PLAIN username_format=%u /etc/dovecot/users
driver = passwd-file
}
protocols = imap lmtp
service lmtp {
group = vmail
unix_listener /var/spool/postfix/private/dovecot-lmtp {
group = postfix
mode = 0600
user = postfix
}
user = vmail
}
ssl = no
ssl_cert = </etc/pki/dovecot/certs/dovecot.pem
ssl_key = # hidden, use -P to show it
userdb {
args = username_format=%u /etc/dovecot/users
driver = passwd-file
}
I wasn’t sure how to set rights on the users file:
[sawozny@imap var]$ cat /etc/dovecot/users
test@test.com:{plain}test
[sawozny@imap var]$ ls -la /etc/dovecot/users
-rw-r--r--. 1 root root 26 Jun 3 23:31 /etc/dovecot/users
Also, didn’t know what rights to set on the /var/vmail directoy so I did this:
drwxrwx---. 3 vmail vmail 4096 Jun 3 20:52 vmail
This directory is also empty except for the lost+fond directory that comes with a disk mount point. My understanding is that the mail home and maildir will manifest automagically on first login, but if I need to prime the pump, please let me know what I need to do.
For my test, I did:
[sawozny@imap var]$ telnet 192.168.1.207 143
Trying 192.168.1.207...
Connected to 192.168.1.207.
Escape character is '^]'.
- OK [CAPABILITY IMAP4rev1 LITERAL+ SASL-IR LOGIN-REFERRALS ID ENABLE IDLE AUTH=PLAIN] Dovecot ready.
01 LOGIN test@test.com test
01 NO [UNAVAILABLE] Internal error occurred. Refer to server log for more information.
Connection closed by foreign host.
And the results in the /var/log/maillog file are:
Jun 3 23:35:34 imap dovecot: auth: Error: passwd-file /etc/dovecot/users: User test@test.com is missing userdb info
Jun 3 23:35:44 imap dovecot: auth: Error: passwd-file(test@test.com,192.168.1.207,<DBqafDan7ODAqAHP>): user not found from userdb
Jun 3 23:35:44 imap dovecot: imap: Error: Authenticated user not found from userdb, auth lookup id=843055105 (auth connected 0 msecs ago, handshake 0 msecs ago, request took 0 msecs, client-pid=12047 client-id=1)
Jun 3 23:35:44 imap dovecot: imap-login: Internal login failure (pid=12047 id=1) (internal failure, 1 successful auths): user=<test@test.com>, method=PLAIN, rip=192.168.1.207, lip=192.168.1.207, mpid=12049, secured, session=<DBqafDan7ODAqAHP>
I’m not sure where I’ve gone wrong. From my understanding of the documentation, all I need in the userdb is name and password. UID, GID and HOME are also indicated as required, but I set them at the system level, so why is the system telling me the user was not found? This definitely isn’t my first rodeo with Linux, but I know almost nothing about messaging so in that regard I’m a totally n00b and would really appreciate some guidance.
Thanks,
Scott
On 04/06/2020 02:51 Scott A. Wozny <sawozny@hotmail.com> wrote:
I’m trying a super basic config based upon https://wiki.dovecot.org/HowTo/PostfixDovecotLMTP but before I work on shipping mail through Postfix to DoveCot, I wanted to make sure IMAP is working first, but I can’t even get a basic login to so I thought I’d see if the gurus on the list might be able to point out I’m doing wrong. The documentation is pretty good, but there were some gaps I had to guess at and I’m presuming that’s where I went wrong. I’ve turned SELinux to permissive mode, for now.
Here’s the doveconf -n:
# 2.2.36 (1f10bfa63): /etc/dovecot/dovecot.conf
<snip/>
auth_username_format = %Ln
should fix your problem.
alternatively you need to change /etc/dovecot/users to have
test@test.com:....
instead of
test:....
and log in always with full username.
Aki
Hi Aki,
Thanks for the response. I'm, unfortunately, a little confused. This is the only line in /etc/dovecot/users:
test@test.com:{plain}test
Which matches your suggestion to use the full smtp address as the username and log in with it, which I did for my test. Can you specify what it was you thought I should try differently?
Regardless, I see your point about trying a less complex username. In the end, I want to host 3 small domains on one server which looks well within Dovecot's capability, but I'll try taking the use of the domain name out of the equation for now to try and narrow down / correct the errors.
Thanks,
Scott
From: Aki Tuomi <aki.tuomi@open-xchange.com> Sent: June 4, 2020 3:14 AM To: Scott A. Wozny <sawozny@hotmail.com>; dovecot@dovecot.org <dovecot@dovecot.org> Subject: Re: Cannot log in to IMAP server and logs are unclear as to why
On 04/06/2020 02:51 Scott A. Wozny <sawozny@hotmail.com> wrote:
I’m trying a super basic config based upon https://wiki.dovecot.org/HowTo/PostfixDovecotLMTP but before I work on shipping mail through Postfix to DoveCot, I wanted to make sure IMAP is working first, but I can’t even get a basic login to so I thought I’d see if the gurus on the list might be able to point out I’m doing wrong. The documentation is pretty good, but there were some gaps I had to guess at and I’m presuming that’s where I went wrong. I’ve turned SELinux to permissive mode, for now.
Here’s the doveconf -n:
# 2.2.36 (1f10bfa63): /etc/dovecot/dovecot.conf
<snip/>
auth_username_format = %Ln
should fix your problem.
alternatively you need to change /etc/dovecot/users to have
test@test.com:....
instead of
test:....
and log in always with full username.
Aki
Hi!
I tried with your config and I got:
Jun 05 08:43:30 auth-worker(11465): Error: passwd-file /etc/dovecot/users: User test@test.com is missing userdb info
This is because your line is missing sufficient amount of colons, try changing
test@test.com:{plain}test
into
test@test.com:{plain}test:::::::::::
Aki
On 05/06/2020 02:31 Scott A. Wozny <sawozny@hotmail.com> wrote:
Hi Aki,
Thanks for the response. I'm, unfortunately, a little confused. This is the only line in /etc/dovecot/users:
test@test.com:{plain}test
Which matches your suggestion to use the full smtp address as the username and log in with it, which I did for my test. Can you specify what it was you thought I should try differently?
Regardless, I see your point about trying a less complex username. In the end, I want to host 3 small domains on one server which looks well within Dovecot's capability, but I'll try taking the use of the domain name out of the equation for now to try and narrow down / correct the errors.
Thanks,
Scott
From: Aki Tuomi <aki.tuomi@open-xchange.com> Sent: June 4, 2020 3:14 AM To: Scott A. Wozny <sawozny@hotmail.com>; dovecot@dovecot.org <dovecot@dovecot.org> Subject: Re: Cannot log in to IMAP server and logs are unclear as to why
On 04/06/2020 02:51 Scott A. Wozny <sawozny@hotmail.com> wrote:
I’m trying a super basic config based upon https://wiki.dovecot.org/HowTo/PostfixDovecotLMTP but before I work on shipping mail through Postfix to DoveCot, I wanted to make sure IMAP is working first, but I can’t even get a basic login to so I thought I’d see if the gurus on the list might be able to point out I’m doing wrong. The documentation is pretty good, but there were some gaps I had to guess at and I’m presuming that’s where I went wrong. I’ve turned SELinux to permissive mode, for now.
Here’s the doveconf -n:
# 2.2.36 (1f10bfa63): /etc/dovecot/dovecot.conf
<snip/>
auth_username_format = %Ln
should fix your problem.
alternatively you need to change /etc/dovecot/users to have
test@test.com:....
instead of
test:....
and log in always with full username.
Aki
Hi Aki,
Again, thanks very much for your response. Your solution of adding the colons worked. Actually, I futzed with it a little bit and it works with as few as 2 added colons.
This is interesting since in the examples section of https://doc.dovecot.org/configuration_manual/authentication/passwd_file/ it explicitly states:
This file can be used as a passdb:
user:{plain}password
user2:{plain}password2
So I took that to mean it could also be used as a userdb (since I couldn’t find anything explicitly defining the minimum allowed userdb) as long as the needed values of UID, GID and HOME were somehow provided (in my case, these were set in global configuration). The examples had default_fields values provided for UID, GID and HOME, so I moved the setting of those fields there and tried again in case that was what was messing things up.
Here is the revised doveconf -n:
# 2.2.36 (1f10bfa63): /etc/dovecot/dovecot.conf
# OS: Linux 3.10.0-1062.12.1.el7.x86_64 x86_64 CentOS Linux release 7.7.1908 (Core)
# Hostname: imap
first_valid_uid = 1000
listen = 192.168.1.207
mail_location = sdbox:~/mail
mbox_write_locks = fcntl
namespace inbox {
inbox = yes
location =
mailbox Drafts {
special_use = \Drafts
}
mailbox Junk {
special_use = \Junk
}
mailbox Sent {
special_use = \Sent
}
mailbox "Sent Messages" {
special_use = \Sent
}
mailbox Trash {
special_use = \Trash
}
prefix =
separator = /
}
passdb {
args = scheme=PLAIN username_format=%u /etc/dovecot/users
driver = passwd-file
}
protocols = imap lmtp
service lmtp {
group = vmail
unix_listener /var/spool/postfix/private/dovecot-lmtp {
group = postfix
mode = 0600
user = postfix
}
user = vmail
}
ssl = no
ssl_cert = </etc/pki/dovecot/certs/dovecot.pem
ssl_key = # hidden, use -P to show it
userdb {
args = username_format=%u /etc/dovecot/users
default_fields = uid=vmail gid=vmail home=/var/vmail/%d/%n
driver = passwd-file
}
But when I tried logging in again, I had the same results. It only works with the 2 extra colons at the end of each passwd-file record.
I’m not sure if this makes it a bug, a lapse in documentation or if there was something I missed that explains all this. What do you think?
In the end I now have my fix, so I very much appreciate your assistance.
Thanks,
Scott
From: Aki Tuomi <aki.tuomi@open-xchange.com> Sent: June 5, 2020 1:44 AM To: Scott A. Wozny <sawozny@hotmail.com>; dovecot@dovecot.org <dovecot@dovecot.org> Subject: Re: Cannot log in to IMAP server and logs are unclear as to why
Hi!
I tried with your config and I got:
Jun 05 08:43:30 auth-worker(11465): Error: passwd-file /etc/dovecot/users: User test@test.com is missing userdb info
This is because your line is missing sufficient amount of colons, try changing
test@test.com:{plain}test
into
test@test.com:{plain}test:::::::::::
Aki
On 05/06/2020 02:31 Scott A. Wozny <sawozny@hotmail.com> wrote:
Hi Aki,
Thanks for the response. I'm, unfortunately, a little confused. This is the only line in /etc/dovecot/users:
test@test.com:{plain}test
Which matches your suggestion to use the full smtp address as the username and log in with it, which I did for my test. Can you specify what it was you thought I should try differently?
Regardless, I see your point about trying a less complex username. In the end, I want to host 3 small domains on one server which looks well within Dovecot's capability, but I'll try taking the use of the domain name out of the equation for now to try and narrow down / correct the errors.
Thanks,
Scott
From: Aki Tuomi <aki.tuomi@open-xchange.com> Sent: June 4, 2020 3:14 AM To: Scott A. Wozny <sawozny@hotmail.com>; dovecot@dovecot.org <dovecot@dovecot.org> Subject: Re: Cannot log in to IMAP server and logs are unclear as to why
On 04/06/2020 02:51 Scott A. Wozny <sawozny@hotmail.com> wrote:
I’m trying a super basic config based upon https://wiki.dovecot.org/HowTo/PostfixDovecotLMTP but before I work on shipping mail through Postfix to DoveCot, I wanted to make sure IMAP is working first, but I can’t even get a basic login to so I thought I’d see if the gurus on the list might be able to point out I’m doing wrong. The documentation is pretty good, but there were some gaps I had to guess at and I’m presuming that’s where I went wrong. I’ve turned SELinux to permissive mode, for now.
Here’s the doveconf -n:
# 2.2.36 (1f10bfa63): /etc/dovecot/dovecot.conf
<snip/>
auth_username_format = %Ln
should fix your problem.
alternatively you need to change /etc/dovecot/users to have
test@test.com:....
instead of
test:....
and log in always with full username.
Aki
On 05.06.20 22:42, Scott A. Wozny wrote:
Again, thanks very much for your response. Your solution of adding the colons worked. Actually, I futzed with it a little bit and it works with as few as 2 added colons.
This is interesting since in the examples section ofhttps://doc.dovecot.org/configuration_manual/authentication/passwd_file/ it explicitly states:
----------------------->
This file can be used as a passdb:
The error message in your log was:
Jun 3 23:35:34 imap dovecot: auth: Error: passwd-file /etc/dovecot/users: User test@test.com is missing userdb info
passdb != userdb
Kind Regards Christian Schmidt
-- No signature available.
participants (3)
-
Aki Tuomi
-
Christian Schmidt
-
Scott A. Wozny