Roundcube Community Forum

News and Announcements => General Discussion => Topic started by: cmonty14 on January 07, 2025, 08:38:53 PM

Title: Login fails with error: Could not connect to ssl://localhost:993: Unknown reason
Post by: cmonty14 on January 07, 2025, 08:38:53 PM
Hi,
I have completed setup of self-hosted mailserver based on Dovecot, Postfix and Nginx.
Using a mail client I can receive and send e-mails.

Then I deployed roundcube by installing these Debian packages:
roundcube
roundcube-core
roundcube-pgsql

I can open roundcube WebUI entering this URL: webmail.mydomain.com.

When I try to authenticate using username and password, I get this error message:
[08-Jan-2025 00:51:27 +0000]: <bsmdnvvt> IMAP Error: Login failed for [email protected] against localhost from 5.56.204.204. Could not connect to ssl://localhost:993: Unknown reason in /usr/share/roundcube/program/lib/Roundcube/rcube_imap.php on line 211 (POST /?_task=login&_action=login)

The error is related to my roundcube configuration:
$config = [];

// Do not set db_dsnw here, use dpkg-reconfigure roundcube-core to configure database!
include("/etc/roundcube/debian-db-roundcube.php");

// IMAP host chosen to perform the log-in.
// See defaults.inc.php for the option description.
$config['imap_host'] = 'localhost:993';


After modifying this config
//$config['imap_host'] = 'localhost:993';
$config['imap_host'] = 'localhost:143';

the error is not reproducible.

However I want to use IMAPS: 993/tcp that is working with any other mail client.

Please advise how to fix this issue.

THX
Title: Re: Login fails with error: Could not connect to ssl://localhost:993: Unknown reason
Post by: JohnDoh on January 08, 2025, 12:21:04 PM
The issue is that you are trying to connect to localhost and PHP cannot validate your cert because the hostname and the CN on the cert do not match. see https://github.com/roundcube/roundcubemail/wiki/FAQ#problems-connecting-imapsmtp-server-via-ssltls

Given you are connecting to localhost I don't think you need SSL/TLS because its the local interface.