Info:
Running Roundcube 1.3.1 on Ubuntu 16.04.3 x64 w/ Apache & PHP 7.0. The mail server is running Ubuntu 14.04.5 (Dovecot/Postfix)
When I upgraded the webserver to Ubuntu 16.04.3 / PHP 7 is when I started running into issues, everything worked fine on my previous server running 14.04 / PHP 5.5.9.
This is the error I'm receiving in logs/errors:
IMAP Error in /usr/share/roundcubemail/program/lib/Roundcube/rcube_imap.php (196): Login failed for [email protected] from {ip_addr}. Empty startup greeting (mail.example.com:993)
The mailserver itself is configured properly to the best of my knowledge as it's working perfectly fine when connected to from different clients.
I'm not 100% sure this is an issue in the program but just a configuration error on my part.
Here's my config.inc.php file:
<?php
/* Local configuration for Roundcube Webmail */
// ----------------------------------
// SQL DATABASE
// ----------------------------------
// Database connection string (DSN) for read+write operations
// Format (compatible with PEAR MDB2): db_provider://user:password@host/database
// Currently supported db_providers: mysql, pgsql, sqlite, mssql, sqlsrv, oracle
// For examples see http://pear.php.net/manual/en/package.database.mdb2.intro-dsn.php
// NOTE: for SQLite use absolute path (Linux): 'sqlite:////full/path/to/sqlite.db?mode=0646'
// or (Windows): 'sqlite:///C:/full/path/to/sqlite.db'
$config['db_dsnw'] = 'mysql://user:xxxx@localhost/database';
// ----------------------------------
// IMAP
// ----------------------------------
// The IMAP host chosen to perform the log-in.
// Leave blank to show a textbox at login, give a list of hosts
// to display a pulldown menu or set one host as string.
// To use SSL/TLS connection, enter hostname with prefix ssl:// or tls://
// Supported replacement variables:
// %n - hostname ($_SERVER['SERVER_NAME'])
// %t - hostname without the first part
// %d - domain (http hostname $_SERVER['HTTP_HOST'] without the first part)
// %s - domain name after the '@' from e-mail address provided at login screen
// For example %n = mail.domain.tld, %t = domain.tld
// WARNING: After hostname change update of mail_host column in users table is
// required to match old user data records with the new host.
$config['default_host'] = 'tls://mail.example.com';
// TCP port used for IMAP connections
$config['default_port'] = 993;
// ----------------------------------
// SMTP
// ----------------------------------
// SMTP server host (for sending mails).
// Enter hostname with prefix tls:// to use STARTTLS, or use
// prefix ssl:// to use the deprecated SSL over SMTP (aka SMTPS)
// Supported replacement variables:
// %h - user's IMAP hostname
// %n - hostname ($_SERVER['SERVER_NAME'])
// %t - hostname without the first part
// %d - domain (http hostname $_SERVER['HTTP_HOST'] without the first part)
// %z - IMAP domain (IMAP hostname without the first part)
// For example %n = mail.domain.tld, %t = domain.tld
$config['smtp_server'] = 'tls://mail.example.com';
// SMTP port (default is 25; use 587 for STARTTLS or 465 for the
// deprecated SSL over SMTP (aka SMTPS))
$config['smtp_port'] = 587;
// SMTP username (if required) if you use %u as the username Roundcube
// will use the current username for login
$config['smtp_user'] = '%u';
// SMTP password (if required) if you use %p as the password Roundcube
// will use the current user's password for login
$config['smtp_pass'] = '%p';
// provide an URL where a user can get support for this Roundcube installation
// PLEASE DO NOT LINK TO THE ROUNDCUBE.NET WEBSITE HERE!
$config['support_url'] = 'https://example.com/support';
// check client IP in session authorization
$config['ip_check'] = false;
// This key is used for encrypting purposes, like storing of imap password
// in the session. For historical reasons it's called DES_key, but it's used
// with any configured cipher_method (see below).
$config['des_key'] = 'xxxx';
// Name your service. This is displayed on the login screen and in the window title
$config['product_name'] = 'Webmail';
// ----------------------------------
// PLUGINS
// ----------------------------------
// List of active plugins (in plugins/ directory)
$config['plugins'] = array();
// the default locale setting (leave empty for auto-detection)
// RFC1766 formatted language name like en_US, de_DE, de_CH, fr_FR, pt_BR
$config['language'] = 'en_US';
$config['debug_level'] = 13;
Change $config['default_host'] = 'tls://mail.example.com'; to $config['default_host'] = 'ssl://mail.example.com';
in the IMAP section. Then it should work.
I tried that previously but it was giving me the following error:
[28-Oct-2017 12:20:03 +0000]: <0kp2sb6d> IMAP Error: Login failed for [email protected] from {my_ip}. Could not connect to ssl://mail.example.com:993: Unknown reason in /usr/share/roundcubemail/program/lib/Roundcube/rcube_imap.php on line 196 (POST /tools/roundcube//?_task=login&_action=login)
I've been looking into this "unknown reason" for the last few days and wasn't able to find anything.
imap_debug is set to true but itsn't creating the file in logs.
This is a connection error. Check firewall settings. It can also be ssl problem, e.g. self-signed cert, wrong hostname. In such a case use imap_conn_options config.
My implemetation of dovecot uses only TLSv1.2 and HIGH ciphers. I resolved the empty greeting error by adding the following to /config/config.inc.php based on https://php.net/manual/en/context.ssl.php. Works on SLES 15 / php7 / roundcube1.3.9
$config['imap_conn_options'] = array(
'ssl' => array(
'verify_peer' => true,
'verify_depth' => 3,
'ciphers' => HIGH,
),
);
not solved for me with the above steps
Didn't worked for me either
I had the same error right after installing Roundcube 1.4.8 from scratch, namely:
IMAP Error: Login failed for ... against ... from .... Empty startup greeting ...
And I couldn't log in to Roundcube at all. The only way I could solve this problem was to remove $config['default_port'] = 993; from config/config.inc.php. If you have $config['default_port'] = 143; in your configuration file, remove that too. I think this is a bug, and should be solved.
(I use Nginx 1.14.2, PHP 7.3, MariaDB 15.1)
@lucas-oliver-trondsen
That actually fixed it on my site! Thanks!
I can see why this is an error and it should be fixed as fast as possible as its still in the latest stable version 1.4.9
Resetting $config['default_port'] to 143 from 993 resolved this same issue for me as well. This only surfaced as an issue after re-configuring dovecot to NOT listen on port 143. Currently running 1.4.9, so who knows how long this has been an issue.
Also, it seems 143 is the default setting so removing the $config['default_port'] = 143; has no effect.
Most helpful comment
Change $config['default_host'] = 'tls://mail.example.com'; to $config['default_host'] = 'ssl://mail.example.com';
in the IMAP section. Then it should work.