1

I've been cracking my head on this for hours. I want to create a master user that has access to all dovecot accounts. I've followed the tutorial on dovecot website, however, it still it either says "Authentication failed" or "Waiting for authentication process to respond" and it never works. What could I possibly be doing wrong here? Thanks

//dovecot.conf

# 2.0.16: /usr/local/etc/dovecot/dovecot.conf
# OS: FreeBSD 8.2-RELEASE amd64  
auth_master_user_separator = *
disable_plaintext_auth = no
mail_location = maildir:~/Maildir
namespace {
  inbox = yes
  location = 
  prefix = INBOX.
  separator = .
  type = private
}

passdb {
  args = /usr/local/etc/dovecot/dovecot-sql.conf
  driver = sql
}
passdb {
  args = /usr/local/etc/dovecot/passwd.master
  driver = passwd-file
  master = yes
}
protocols = imap pop3
service auth {
  client_limit = 6000
}
service imap {
  process_limit = 2048
  vsz_limit = 1256 M
}
service pop3 {
  process_limit = 2048
}

userdb {
  args = /usr/local/etc/dovecot/dovecot-sql.conf
  driver = sql
}
userdb {
  driver = passwd
}
protocol pop3 {
  pop3_uidl_format = UID%u-%v
}
    --> as instructed from http://wiki.dovecot.org/Authentication/MasterUsers

cat passwd.master

master:{SHA}E9RIKlmYWisBS3ObR16GwKUZNZg=  

telnet localhost 143

 Trying 127.0.0.1...
    Connected to localhost.
    Escape character is '^]'.
    a login loginuser*master mypassword
    * OK Waiting for authentication process to respond..
    * OK Waiting for authentication process to respond..                                                                                                                   
    * BYE Disconnected for inactivity.                                                                                                                                     
    Connection closed by foreign host.

or

telnet localhost 143                                                                                                         
Trying 127.0.0.1...                                                                                                                                                    
Connected to localhost.                                                                                                                                                
Escape character is '^]'.                                                                                                                                              
* OK [CAPABILITY IMAP4rev1 LITERAL+ SASL-IR LOGIN-REFERRALS ID ENABLE IDLE STARTTLS AUTH=PLAIN                                                
1 login loginuser*master mypassword                                                                                                                      
1 NO [AUTHENTICATIONFAILED] Authentication failed.                                                                                                                     
* BYE Disconnected for inactivity.                                                                                                                                     
Connection closed by foreign host.  

//dovecot -n

# 2.0.16: /usr/local/etc/dovecot/dovecot.conf
# OS: FreeBSD 8.2-RELEASE amd64  
auth_master_user_separator = *
disable_plaintext_auth = no
login_greeting = CFI mail server ready.
mail_location = maildir:~/Maildir
namespace {
  inbox = yes
  location = 
  prefix = INBOX.
  separator = .
  type = private
}

passdb {
  args = /usr/local/etc/dovecot/dovecot-sql.conf
  driver = sql
}
passdb {
  args = /usr/local/etc/dovecot/passwd.master
  driver = passwd-file
  master = yes
}
protocols = imap pop3
service auth {
  client_limit = 6000
}
service imap {
  process_limit = 2048
  vsz_limit = 1256 M
}
service pop3 {
  process_limit = 2048
}

userdb {
  args = /usr/local/etc/dovecot/dovecot-sql.conf
  driver = sql
}
userdb {
  driver = passwd
}
protocol pop3 {
  pop3_uidl_format = UID%u-%v
}
David Okwii
  • 324
  • 1
  • 5
  • 13
  • From the "testing" section in the in the manual you linked to: *"If you had any problems, set `auth_debug=yes` and look at the logs."* – HBruijn Apr 11 '16 at 21:18
  • @HBruijn with auth_debug=yes set, it says "dovecot: auth: plain(?,127.0.0.1): Username character disallowed by auth_username_chars: 0x2a (username: loginuser*master) ". apparently 0x2a is a space character, but I don't have a space character in my username. – David Okwii Apr 25 '16 at 08:25
  • 0x2a is the asterisk `*` not a space. - It might be that the check against the list of allowed input in the username parser is performed before the asterisk `*` is recognised as the auth_master_user_separator. Either select an alternative character, or add it to the `auth_username_chars` setting. – HBruijn Apr 25 '16 at 08:47
  • @HBruijn isn't the option "auth_master_user_separator = *" supposed to do just that? Anyway i added auth_username_chars = * and it still gives the same error – David Okwii Apr 27 '16 at 14:37

1 Answers1

4

Finally got it work! First, I had to auth_master_user_separator = + instead of with *. This removed the complaint from dovecot that Username character disallowed by auth_username_chars: 0x2a (username: loginuser*master)

Then realized I was adding master password records using the htpasswd command to the wrong file /usr/local/etc/dovecot/dovecot.master yet in my configs it the right file is /usr/local/etc/dovecot/passwd.master. I don’t know how i failed to see that quickly.

Lastly I wasn’t testing the master user logins well using telnet. I was using 1 login loginuser+master mypassword instead of 1 login existing_user@example.com+master mypassword

Lastly my configs in dovecot.conf look something like

auth_master_user_separator = +                                                                                                                            
#auth_username_chars = *  #dovecot complains about the “*” character                                                                                                                               
auth_verbose = yes                                                                                                                                             
auth_debug = yes                                                                                                                                               
auth_debug_passwords = yes                                                                                                                                     
passdb {                                                                                                                                                       
        driver = passwd-file                                                                                                                                   
        args = /usr/local/etc/dovecot/passwd.master                                                                                                            
        master = yes                                                                                                                                           
        #pass = yes                                                                                                                                            

}                                                                                                                                                              
passdb {                                                                                                                                          
        #driver = shadow                                                                                                                                       
        driver = pam                                                                                                                                           
}                                                                                                                                                              
userdb {                                                                                                                                                       
  driver = passwd                                                                                                                                              
}
DMKE
  • 105
  • 2
David Okwii
  • 324
  • 1
  • 5
  • 13