Hello im running Linux <hostname> 4.9.0-11-amd64 #1 SMP Debian 4.9.189-3+deb9u1 (2019-09-20) x86_64 GNU/Linux
Im totally new to setting up mailservers.
I havesetup a postfix for SMTP and it can receive emails.
Postfix version is mail_version = 3.1.12
I have also installed Dovecot version:2.2.27 (c0f36b0)
My configuration is such that POSTFIX is configured to use DOVECOT SASL through local socket.
My system is configured to store emails in /var/mail/<owndomain.org>/<username>
. For each domain i have my own passwd file where dovecot is supposed to lookup usernames and passwords.
/var/mail/<owndomain.org>/passwd
.
I have created virtualuser
for accessing mails and authenticating users.
My dovecot configuration is:
In /etc/dovecot/dovecot.conf
i have added at the end of the file
userdb {
driver = passwd-file
args = username_format=%n /var/mail/%d/passwd
default_fields = uid=virtualmail gid=virtualmail home=/var/mail/%d/%n
}
passdb {
driver = passwd-file
args = username_format=%n /var/mail/%d/passwd
}
passwd file contents are in format:
<username_without_domain>:{plain}test
In /etc/dovecot/conf.d/10-auth.conf
i have set:
disable_plaintext_auth = no
auth_mechanisms = plain login
In /etc/dovecot/conf.d/10-mail.conf
i have set:
mail_home = /var/mail/home/%d/%n
mail_location = mbox:~/mail:INBOX=/var/spool/mail/%d/%n
mail_privileged_group = virtualmail
Now the problem: I was testing the configuration using telnet. POSTFIX receives email, stores it. No problem. When i tried to log in onto Dovecot IMAP using Telnet i get this message:
* OK [CAPABILITY IMAP4rev1 LITERAL+ SASL-IR LOGIN-REFERRALS ID ENABLE IDLE AUTH=PLAIN AUTH-LOGIN] Dovecot ready.
a login "username@owndomain.org" "test"
a NO [UNAVAILABLE] Internal error occured. Refer to server log for more information.
I have enabled verbose logging and this is the output of logs:
/var/log/dovecot.log
had this message:
Nov 16 14:20:49 auth: Error: plain(username@owndomain.org,192.168.9.131,<RF4llXaXisPAqAmD>): user not found from any userdbs
Nov 16 14:20:49 imap: Error: Authenticated user not found from userdb, auth lookup id=684589057 (client-pid=9601 client-id=1)
/var/log/dovecot-debug.log
had this message:
Nov 16 14:20:18 auth: Debug: Loading modules from directory: /usr/lib/dovecot/modules/auth
Nov 16 14:20:18 auth: Debug: Read auth token secret from /var/run/dovecot/auth-token-secret.dat
Nov 16 14:20:18 auth: Debug: auth client connected (pid=9601)
Nov 16 14:20:47 auth: Debug: client in: AUTH 1 PLAIN service=imap session=RF4llXaXisPAqAmD lip=192.168.2.2 rip=192.168.9.131 lport=143 rport=$
Nov 16 14:20:47 auth-worker(9603): Debug: Loading modules from directory: /usr/lib/dovecot/modules/auth
Nov 16 14:20:47 auth-worker(9603): Debug: pam(username@owndomain.org,192.168.9.131,<RF4llXaXisPAqAmD>): lookup service=dovecot
Nov 16 14:20:47 auth-worker(9603): Debug: pam(username@owndomain.org,192.168.9.131,<RF4llXaXisPAqAmD>): #1/1 style=1 msg=Password:
Nov 16 14:20:49 auth: Debug: passwd-file /var/mail/owndomain.org/passwd: Read 2 users in 0 secs
Nov 16 14:20:49 auth: Debug: passwd-file(username@owndomain.org,192.168.9.131,<RF4llXaXisPAqAmD>): lookup: user=username file=/var/mail/owndomain.org/passwd
Nov 16 14:20:49 auth: Debug: client passdb out: OK 1 user=username@owndomain.org
Nov 16 14:20:49 auth: Debug: master in: REQUEST 684589057 9601 1 a61dd67ee43390596ddf86e6c08db6f9 session_pid=9604 request_auth_token
Nov 16 14:20:49 auth-worker(9603): Debug: passwd(username@owndomain.org,192.168.9.131,<RF4llXaXisPAqAmD>): lookup
Nov 16 14:20:49 auth: Debug: passwd-file(username@owndomain.org,192.168.9.131,<RF4llXaXisPAqAmD>): lookup: user=username file=/var/mail/owndomain.org/passwd
Nov 16 14:20:49 auth: Debug: master userdb out: NOTFOUND 684589057
And i am completelly clueless what is the problem. Because it seems as if the password was found but the user is not? Password and user are looked up in the same passwd file. Have i forgotten something to setup? Any help is appreciated!
Best Answer
Ok i found out the problem. Or so it seems.
In the passwd file i used the format
but i did not added double colons for the rest of the empty values so the correct format should have been:
Issue solved.