IMAP Error: Login failed - Roundcube

cookie picture cookie · Sep 22, 2013 · Viewed 44k times · Source

I'm trying to login to Roundcube only the program won't let me.

roundcube login

I can login to the said account from the shell and mail is setup and working correctly on my server for user 'admin'. It's RC that is the problem. If I check my logs:

/usr/local/www/roundcube/logs/errors

they show:

[21-Sep-2013 17:19:02 +0100]: IMAP Error: Login failed for admin from ip.ip.ip.ip. Could not connect to ip.ip.ip.ip:143: 
Connection refused in /usr/local/www/roundcube/program/lib/Roundcube/rcube_imap.php on line 184 
(POST /roundcube/?_task=login&_action=login)

which doesn't give me many clues really, just leads me to:

public function connect($host, $user, $pass, $port=143, $use_ssl=null) {}

from

rcube_imap.php

Stuff I've tried, editing:

/usr/local/www/roundcube/config/main.inc.php

with:

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

// Log IMAP conversation to <log_dir>/imap or to syslog
$rcmail_config['imap_debug'] = /var/log/imap;

With a failed login attempt

/var/log/imap

doesn't even get written to, leaving me no clues. I'm using dovecot and Sendmail on a FreeBSD box with full root access. It's not an incorrect username password combination for sure.

Several Googles on the string 'Roundcube: Connection to storage server failed' are fruitless.

EDIT:

I needed an entry in

/etc/rc.conf

dovecot_enable="YES"

Schoolboy error.

Answer

Tobias Ernst picture Tobias Ernst · Apr 7, 2020

I had the same problem with a letsencrypt certificate and resolve it by disabling peer authentication:

$config['imap_conn_options'] = array(
    'ssl' => array('verify_peer' => true, 'verfify_peer_name' => false),
    'tls' => array('verify_peer' => true, 'verfify_peer_name' => false),
);

Afterwards you can set the connection string like this (starttls):

$config['default_host'] = 'tls://your-host.tld';
$config['default_port'] = '143';
$config['smtp_server'] = 'tls://your-host.tld';
$config['smtp_port'] = '25';

Or like this (ssl approach):

$config['default_host'] = 'ssl://your-host.tld';
$config['default_port'] = '993';
$config['smtp_server'] = 'ssl://your-host.tld';
$config['smtp_port'] = '587';

Make sure you use the fully qualified hostname of the certificate in the connection string (like your-host.tld) and not an internal hostname (like localhost).

Hope that helps someone else.