Author Topic: [Solved] Problem connecting roundcube to imap  (Read 3925 times)

Offline Yeti

  • Newbie
  • *
  • Posts: 2
[Solved] Problem connecting roundcube to imap
« on: July 20, 2010, 04:04:14 PM »
Hello there,

I have a problem connecting my roundcube to my imap server.
So, here it is :
I have a working imap server (dovecot). I can successfully telnet it, or ssl it (from localhost or from another ip of my local network). I can even use my thunderbird from another local computer.


Then I installed roundcube on this server (0.3.1-3), but I cannot connect to my localhost imap server.

I enabled log in main.inc.php file ($rcmail_config['debug_level'] = 8;)
set auth as plain ($rcmail_config['imap_auth_type'] = 'plain';)

The roundcube log is not very talkative.

Looking in my dovecot log, i see two different behaviour. One is when it seems correct, and roundcube log in imap server, but is disconnect immediately :

2010-07-20 21:36:00 auth(default): Info: passwd-file(mylogin,127.0.0.1): lookup: user=mylogin file=/etc/dovecot/passwd
2010-07-20 21:36:00 auth(default): Info: master out: USER   6   mylogin   uid=8   gid=8   home=/var/mail/mylogin
2010-07-20 21:36:00 imap-login: Info: Login: user=, method=PLAIN, rip=127.0.0.1, lip=127.0.0.1, secured
2010-07-20 21:36:00 IMAP(mylogin): Info: Disconnected: Logged out bytes=39/431


Second is when server is refusing the password :

2010-07-20 21:36:37 auth(default): Info: passwd-file(mylogin,127.0.0.1): lookup: user=mylogin file=/etc/dovecot/passwd
2010-07-20 21:36:37 auth(default): Info: passwd-file(mylogin,127.0.0.1): Password mismatch
2010-07-20 21:36:37 auth(default): Info: passwd-file(mylogin,127.0.0.1): PLAIN(b��xHy���+bp�) != 'mypass_in_clear'



I am working with a plain text passwd, with no encryption at all. Does roundcube encrypt the password I type before to sent it to imap ? Regarding the log it seems so. Where can i disable it (didn't find in the main.inc.php options), as I don't want any encryption.

Is there any way to increase the log on roundcube ? The 8 value doesn't give me lot of traces about authentication.

I cannot explain the first behaviour, when roundcube sometimes managed to connect but disconnect immediately. I manage ONE time to reach my mailboxes, but i don't know how, and this never happens again.

Thanks in advance, if anybody has any clues about my problem...
« Last Edit: July 20, 2010, 06:57:31 PM by Yeti »

Offline SKaero

  • Administrator
  • Hero Member
  • *****
  • Posts: 5,876
    • SKaero - Custom Roundcube development
Problem connecting roundcube to imap
« Reply #1 on: July 20, 2010, 05:07:12 PM »
Try the SVN, and turn on imap_debug.

Offline Yeti

  • Newbie
  • *
  • Posts: 2
Problem connecting roundcube to imap
« Reply #2 on: July 20, 2010, 06:56:22 PM »
Finally I found the solution !

Setting $rcmail_config['debug_level'] = 4; (=show) was enough to show me the right trace on screen :

Warning: mcrypt_generic_init(): Iv size incorrect; supplied length: 13, needed: 8 in /usr/share/roundcube/program/include/rcmail.php on line 995

Actually, the length used in mcrypt is random. But roundcube works only with the length of 8. That's why sometimes, when I am lucky, mcrypt supply a 8 length and roundcube is happy and let me in (that explains my one successful attempt).

By the way, the issue is known : #1486307 (Roundcube freezes trying to open message) ? Roundcube Webmail
and i solved my problem by setting mbstring.func_overload = 0
in my php.ini

(that's a problem for egroupware because he needs to work with =7)

Offline qnrq

  • Jr. Member
  • **
  • Posts: 22
    • http://pipemail.org/
Problem connecting roundcube to imap
« Reply #3 on: July 21, 2010, 03:50:07 AM »
Quote from: Yeti;28861
Warning: mcrypt_generic_init(): Iv size incorrect; supplied length: 13, needed: 8 in /usr/share/roundcube/program/include/rcmail.php on line 995

Actually, the length used in mcrypt is random. But roundcube works only with the length of 8. That's why sometimes, when I am lucky, mcrypt supply a 8 length and roundcube is happy and let me in (that explains my one successful attempt).

The iv should never be random. In fact it should be equally long as the blocksize of the cipher used. For example, when using 3DES in CBC mode, the IV provided should be 8 bytes. The svn ver I've downloaded does the following:

$iv mcrypt_create_iv(mcrypt_enc_get_iv_size($td), MCRYPT_RAND);

mcrypt_enc_get_iv_size($td) equals the blocksize of 3DES in CBC mode and returns 8, which is completely correct. The "MCRYPT_RAND" part is just specifying the source for entropy that mcrypt should use. MCRYPT_RAND is the system random number generator. Usually one would use /dev/*random or a better CSPRNG. MCRYPT_RAND is probably used as a source to make it possible to use rc outside the posix enviornment.

Try the latest svn like skaero suggested and see if that solves the problem.
« Last Edit: July 21, 2010, 08:01:26 AM by qnrq »