Author Topic: Can't login using crypt password in mysql  (Read 7549 times)

Offline McDexter

  • Newbie
  • *
  • Posts: 2
Can't login using crypt password in mysql
« on: January 02, 2013, 05:11:23 PM »
I use version 0.8.4. I have working mail instance: postfix & mysql & courier imap-ssl, pop-ssl & sasl
In mysql database I have users passwords stored in 2 columns: plain text and also in crypt version (php crypt / mysql encrypt)
I can successfully connect using outlook and thunderbird with ssl support (mech_list: plain login). Sasl and courier uses crypted password from database. It works when clear password column is empty.

My problem is with roundcube. I can login to roundcube (https) only if the clear password is available in database. For some reason roundcube searches for column with clear password instead of crypt password.
Please kindly advise why?

log:
IMAP Error: Login failed for user@mail.com from 80.200.300.400. AUTHENTICATE CRAM-MD5: A0001 NO Login failed. in /srv/www/htdocs/roundcubemail/program/include/rcube_imap.php on line 191 (GET /?_task=mail&_action=check-recent&_mbox=INBOX.Szkice&_list=1&_quota=1&_remote=1&_unlock=0&_=1357164855413)
« Last Edit: January 02, 2013, 05:17:20 PM by McDexter »

Online alec

  • Hero Member
  • *****
  • Posts: 1,165
Re: Can't login using crypt password in mysql
« Reply #1 on: January 03, 2013, 02:33:26 AM »
CRAM-MD5 requires clear-text passwords. Configure your IMAP server or Roundcube to use different authentication method, e.g. PLAIN.

Offline McDexter

  • Newbie
  • *
  • Posts: 2
Re: Can't login using crypt password in mysql
« Reply #2 on: January 03, 2013, 06:41:59 AM »
Thanks. PLAIN did the trick :)

Offline insha

  • Newbie
  • *
  • Posts: 2
Re: Can't login using crypt password in mysql
« Reply #3 on: March 19, 2013, 03:42:44 PM »
Hi,

I was having the same issue, so I tried this suggestion, but it did not work for me.

Here’s my situation:
1. I have setup the mail server using the guide at: http://flurdy.com/docs/postfix/
2. I can send and receive email from all major email clients (Apple Mail, Mobile Mail on iOS, etc.).
3. I tested the mail server using telnet as described in the guide (see #1).
4. I was able to install Roundcube and configure it.
5. At the “Testing Config” stage of the Roundcube installer, everything is OK, except Test IMAP Config.

my <rcube root>/config/main.inc.php:
Code: [Select]
// ----------------------------------
// IMAP
// ----------------------------------
$rcmail_config['default_host'] = 'ssl://localhost';

// TCP port used for IMAP connections
$rcmail_config['default_port'] = 143;

// IMAP AUTH type (DIGEST-MD5, CRAM-MD5, LOGIN, PLAIN or empty to use
// best server supported one)
$rcmail_config['imap_auth_type'] = ‘LOGIN';

// If you know your imap's folder delimiter, you can specify it here.
// Otherwise it will be determined automatically
$rcmail_config['imap_delimiter'] = 'INBOX';

The IMAP config test keeps failing with the following error message:

Code: [Select]
Connecting to ssl://localhost...
IMAP connect:  NOT OK(Login failed for username@example.com from XX.XXX.XX.XXX. AUTHENTICATE CRAM-MD5: A0001 NO Login failed.)


mail.log shows this when the ‘Check Login’ button is clicked:
Code: [Select]
Mar 19 19:18:41 ip-10-10-23-234 imapd-ssl: Connection, ip=[::ffff:127.0.0.1]
Mar 19 19:18:42 ip-10-10-23-234 authdaemond: received auth request, service=imap, authtype=cram-md5
Mar 19 19:18:42 ip-10-10-23-234 authdaemond: authmysql: trying this module
Mar 19 19:18:42 ip-10-10-23-234 authdaemond: cram: challenge=PDgwQkJCM0UyRkE4ODBBNDM4OTQzNDIzNUY1RkZGRTFGQGlwLTEwLTEwLTIzLTIzND4=, response=ZmFyaGFuQHdpcmVkdG9tYXRvLmNvbSBkNzVjMDQwYTNkMmFhMjRiYTQ3YjBkNzM2Y2Y2NDg5Mg==
Mar 19 19:18:42 ip-10-10-23-234 authdaemond: cram: decoded challenge/response, username ‘username@example.com'
Mar 19 19:18:42 ip-10-10-23-234 authdaemond: authmysqllib: connected. Versions: header 50517, client 50529, server 50529
Mar 19 19:18:42 ip-10-10-23-234 authdaemond: SQL query: SELECT id, crypt, "", uid, gid, home, concat(home, '/', maildir), "", name, "" FROM users WHERE id = ‘username@example.com'  AND (enabled=1)
Mar 19 19:18:42 ip-10-10-23-234 authdaemond: authmysql: REJECT - try next module
Mar 19 19:18:42 ip-10-10-23-234 authdaemond: FAIL, all modules rejected
Mar 19 19:18:42 ip-10-10-23-234 imapd-ssl: LOGIN FAILED, method=CRAM-MD5, ip=[::ffff:127.0.0.1]

For comparison heres the mail.log for when I use the Mobile mail on my iPhone:
Code: [Select]
Mar 19 19:18:43 ip-10-10-23-234 imapd: Connection, ip=[::ffff:XX.XXX.XX.XXX]
Mar 19 19:18:43 ip-10-10-23-234 authdaemond: received auth request, service=imap, authtype=login
Mar 19 19:18:43 ip-10-10-23-234 authdaemond: authmysql: trying this module
Mar 19 19:18:43 ip-10-10-23-234 authdaemond: SQL query: SELECT id, crypt, "", uid, gid, home, concat(home, '/', maildir), "", name, "" FROM users WHERE id = ‘username@example.com'  AND (enabled=1)
Mar 19 19:18:43 ip-10-10-23-234 authdaemond: password matches successfully
Mar 19 19:18:43 ip-10-10-23-234 authdaemond: authmysql: sysusername=<null>, sysuserid=5000, sysgroupid=5000, homedir=/var/spool/mail/virtual, address=username@example.com, fullname=username, maildir=/var/spool/mail/virtual/username/, quota=<null>, options=<null>
Mar 19 19:18:43 ip-10-10-23-234 authdaemond: Authenticated: sysusername=<null>, sysuserid=5000, sysgroupid=5000, homedir=/var/spool/mail/virtual, address=username@example.com, fullname=farhan, maildir=/var/spool/mail/virtual/username/, quota=<null>, options=<null>

So I have two questions:

1. Why is RoundCube not sending the request using the auth type set to ‘LOGIN’, when that is what is defined in the configuration file?
2. Even when I set the auth type to ‘PLAIN’ the IMAP config test fails with the same error message.

Any help will be greatly appreciated.

Cheers,
Insha 

Offline SKaero

  • Administrator
  • Hero Member
  • *****
  • Posts: 5,566
    • http://SKaero.com/
Re: Can't login using crypt password in mysql
« Reply #4 on: March 19, 2013, 03:55:37 PM »
The installer doesn't seem to read the auth from the config file all of the time. Try actually logging into RoundCube and see if it works.

Offline insha

  • Newbie
  • *
  • Posts: 2
Re: Can't login using crypt password in mysql
« Reply #5 on: March 19, 2013, 04:29:48 PM »
Thanks. I am able to login. Thank you so much for the pointer.

Best,
Insha : )