Dovecot can't log in Virtual user - please help

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Dovecot can't log in Virtual user - please help

Dovecot mailing list
Hello

Im having issues login to dovecot using imap through telnet.

Im running Linux 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 (dovecot -n output) configuration is:

-------------------------------------------------------------

# 2.2.27 (c0f36b0): /etc/dovecot/dovecot.conf
# Pigeonhole version 0.4.16 (fed8554)
# OS: Linux 4.9.0-11-amd64 x86_64 Debian 9.11
auth_debug = yes
auth_mechanisms = plain login
auth_verbose = yes
debug_log_path = /var/log/dovecot-debug.log
disable_plaintext_auth = no
info_log_path = /var/log/dovecot-info.log
listen = 192.168.2.2
log_path = /var/log/dovecot.log
mail_home = /var/mail/home/%d/%n
mail_location = mbox:~/mail:INBOX=/var/spool/mail/%d/%n
mail_privileged_group = virtualmail
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 =
}
passdb {
  driver = pam
}
passdb {
  args = username_format=%n /var/mail/%d/passwd
  driver = passwd-file
}
pop3_uidl_format = %g
protocols = imap pop3
service auth {
  unix_listener /var/spool/postfix/private/auth {
    group = postfix
    mode = 0660
    user = postfix
  }
  user = dovecot
}
ssl = no
userdb {
  driver = passwd
}
userdb {
  args = username_format=%n /var/mail/%d/passwd
  default_fields = uid=virtualmail gid=virtualmail home=/var/mail/%d/%n
  driver = passwd-file
}
verbose_proctitle = yes
----------------------------------------

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 "[hidden email]" "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([hidden email],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([hidden email],192.168.9.131,<RF4llXaXisPAqAmD>): lookup service=dovecot
Nov 16 14:20:47 auth-worker(9603): Debug: pam([hidden email],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([hidden email],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=[hidden email]
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([hidden email],192.168.9.131,<RF4llXaXisPAqAmD>): lookup
Nov 16 14:20:49 auth: Debug: passwd-file([hidden email],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 or guidance is appreciated!

I have also posted the issue on: https://serverfault.com/questions/992108/dovecot-cant-login-virtual-user

Thanks
A.


Reply | Threaded
Open this post in threaded view
|

Re: Dovecot can't log in Virtual user - please help

Dovecot mailing list


On 19.11.2019 19.21, Andrej Rehak via dovecot wrote:
Hello

Im having issues login to dovecot using imap through telnet.

Im running Linux 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 (dovecot -n output) configuration is:

-------------------------------------------------------------

# 2.2.27 (c0f36b0): /etc/dovecot/dovecot.conf
# Pigeonhole version 0.4.16 (fed8554)
# OS: Linux 4.9.0-11-amd64 x86_64 Debian 9.11
auth_debug = yes
auth_mechanisms = plain login
auth_verbose = yes
debug_log_path = /var/log/dovecot-debug.log
disable_plaintext_auth = no
info_log_path = /var/log/dovecot-info.log
listen = 192.168.2.2
log_path = /var/log/dovecot.log
mail_home = /var/mail/home/%d/%n
mail_location = mbox:~/mail:INBOX=/var/spool/mail/%d/%n
mail_privileged_group = virtualmail
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 =
}
passdb {
  driver = pam
}


Are you using PAM intentionally? You might want to drop this along with userdb with passwd as driver. the passwd-file one is ok. By dropping PAM you probably get quite nice speedup, too.


But I tested your configuration locally here and it seems to work. At least with following passwd file:


$ sudo cat /var/mail/owndomain.org/passwd
username:{PLAIN}password:::::


Aki

Reply | Threaded
Open this post in threaded view
|

Re: Dovecot can't log in Virtual user - please help

Dovecot mailing list
Hello

Actually im not using PAM at all. So yes its true i could drop that.
But i see that you have put additional empty double colons in your passwd file which i didn't.
So maybe this is the issue?
I will try.

Thank you


From: Aki Tuomi <[hidden email]>
Sent: Tuesday, November 19, 2019 10:49 PM
To: Andrej Rehak <[hidden email]>; [hidden email] <[hidden email]>
Subject: Re: Dovecot can't log in Virtual user - please help
 


On 19.11.2019 19.21, Andrej Rehak via dovecot wrote:
Hello

Im having issues login to dovecot using imap through telnet.

Im running Linux 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 (dovecot -n output) configuration is:

-------------------------------------------------------------

# 2.2.27 (c0f36b0): /etc/dovecot/dovecot.conf
# Pigeonhole version 0.4.16 (fed8554)
# OS: Linux 4.9.0-11-amd64 x86_64 Debian 9.11
auth_debug = yes
auth_mechanisms = plain login
auth_verbose = yes
debug_log_path = /var/log/dovecot-debug.log
disable_plaintext_auth = no
info_log_path = /var/log/dovecot-info.log
listen = 192.168.2.2
log_path = /var/log/dovecot.log
mail_home = /var/mail/home/%d/%n
mail_location = mbox:~/mail:INBOX=/var/spool/mail/%d/%n
mail_privileged_group = virtualmail
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 =
}
passdb {
  driver = pam
}


Are you using PAM intentionally? You might want to drop this along with userdb with passwd as driver. the passwd-file one is ok. By dropping PAM you probably get quite nice speedup, too.


But I tested your configuration locally here and it seems to work. At least with following passwd file:


$ sudo cat /var/mail/owndomain.org/passwd
username:{PLAIN}password:::::


Aki

Reply | Threaded
Open this post in threaded view
|

Re: Dovecot can't log in Virtual user - please help

Dovecot mailing list
Thank you very much.
It trully was a wrong passwd file format.
I fixed that and removed the PAM driver dependency and finally moved forward.
I encountered a differrent issue but i think i can tacke this one on my own.

So thank you very much!

From: dovecot <[hidden email]> on behalf of Andrej Rehak via dovecot <[hidden email]>
Sent: Wednesday, November 20, 2019 3:40 AM
To: Aki Tuomi <[hidden email]>; [hidden email] <[hidden email]>
Subject: Re: Dovecot can't log in Virtual user - please help
 
Hello

Actually im not using PAM at all. So yes its true i could drop that.
But i see that you have put additional empty double colons in your passwd file which i didn't.
So maybe this is the issue?
I will try.

Thank you


From: Aki Tuomi <[hidden email]>
Sent: Tuesday, November 19, 2019 10:49 PM
To: Andrej Rehak <[hidden email]>; [hidden email] <[hidden email]>
Subject: Re: Dovecot can't log in Virtual user - please help
 


On 19.11.2019 19.21, Andrej Rehak via dovecot wrote:
Hello

Im having issues login to dovecot using imap through telnet.

Im running Linux 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 (dovecot -n output) configuration is:

-------------------------------------------------------------

# 2.2.27 (c0f36b0): /etc/dovecot/dovecot.conf
# Pigeonhole version 0.4.16 (fed8554)
# OS: Linux 4.9.0-11-amd64 x86_64 Debian 9.11
auth_debug = yes
auth_mechanisms = plain login
auth_verbose = yes
debug_log_path = /var/log/dovecot-debug.log
disable_plaintext_auth = no
info_log_path = /var/log/dovecot-info.log
listen = 192.168.2.2
log_path = /var/log/dovecot.log
mail_home = /var/mail/home/%d/%n
mail_location = mbox:~/mail:INBOX=/var/spool/mail/%d/%n
mail_privileged_group = virtualmail
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 =
}
passdb {
  driver = pam
}


Are you using PAM intentionally? You might want to drop this along with userdb with passwd as driver. the passwd-file one is ok. By dropping PAM you probably get quite nice speedup, too.


But I tested your configuration locally here and it seems to work. At least with following passwd file:


$ sudo cat /var/mail/owndomain.org/passwd
username:{PLAIN}password:::::


Aki