Mysql – RoundCube: Connection to storage server failed

dovecotemailMySQLpostfix

This is probably the hardest challenge I have ever faced on Linux. I would never thought sending and receiving the ubiquitous Emails is such hell of a complication!
Following this tutorial on Setup Mail Server on CentOS 8 With Postfix, Dovecot, MySQL and RoundCube, I have been trying to create a mail server after my previous attempts failed, since this seemed to create a complete Email suite. I have double-checked all the steps including dovecot, postfix, php, mysql, and RoundCube installation and configuration with the tutorial and still I fail to log in to RoundCube. In the setup, I am using mysql to store mail users. Database and tables as well as users and everything has been set up correctly.
The error says:

Connection to storage server failed.

My current Roundcube config.inc.php is as follows:

/* Local configuration for Roundcube Webmail */

$config['db_dsnw'] = 'mysql://roundcube:PassWord@localhost/roundcubemail';

$config['default_host'] = 'ssl://mail.example.com';

$config['support_url'] = '';

$config['default_port'] = 143;


$config['des_key'] = 'AQI98mYP4asPYRIGW6dm4Pj5';

$config['plugins'] = array();

$config['language'] = 'en_US';

$config['spellcheck_engine'] = 'pspell';

//-----------
// SMTP
$config['smtp_server'] = 'ssl://mail.example.com';
$config['smtp_port'] = 587;
$config['smtp_user'] = '%u';
$config['smtp_pass'] = '%p';
$config['smtp_auth_type'] = 'LOGIN';
$config['debug_level'] = 1;
$config['smtp_debug'] = true;
$config['plugins'] = array('virtuser_query');
$config['virtuser_query'] = "SELECT Email FROM postfix_accounts.accounts_table WHERE Email = '%u'";

The current status of postfix and dovecot on the system:

● postfix.service - Postfix Mail Transport Agent
   Loaded: loaded (/usr/lib/systemd/system/postfix.service; enabled; vendor preset: disabled)
   Active: active (running) since Sun 2020-05-17 02:27:38 EDT; 2h 30min ago
  Process: 969 ExecStop=/usr/sbin/postfix stop (code=exited, status=0/SUCCESS)
  Process: 1012 ExecStart=/usr/sbin/postfix start (code=exited, status=0/SUCCESS)
  Process: 1010 ExecStartPre=/usr/libexec/postfix/chroot-update (code=exited, status=0/SUCCESS)
  Process: 1006 ExecStartPre=/usr/libexec/postfix/aliasesdb (code=exited, status=0/SUCCESS)
 Main PID: 1087 (master)
    Tasks: 7 (limit: 24008)
   Memory: 26.1M
   CGroup: /system.slice/postfix.service
           ├─ 1087 /usr/libexec/postfix/master -w
           ├─ 1089 qmgr -l -t unix -u
           ├─ 1393 tlsmgr -l -t unix -u
           ├─ 1394 anvil -l -t unix -u
           ├─ 7982 smtpd -n submission -t inet -u -o stress= -s 3 -o syslog_name=postfix/submission -o smtpd_tls_security_level=encrypt -o smtpd_sasl_auth_enable=no -o smtpd_tls_auth_only=yes -o smtpd_reject_unlisted_recipient=no -o smtpd_recipient_restrictions=permit_sasl_authenticated,reject -o smtpd_relay_restrictions=permit_sasl_authenticated -o milter_macro_daemon_name=ORIGINATINGmixed -o smtpd_reject_unlisted_recipient=no
           ├─13355 pickup -l -t unix -u
           └─19712 smtpd -n smtp -t inet -u -o stress= -s 3

May 17 04:57:33 mail.example.com postfix/submission/smtpd[7982]: connect from unknown[45.142.195.14]
May 17 04:57:35 mail.example.com postfix/smtpd[19712]: disconnect from unknown[45.142.195.13] ehlo=1 auth=0/1 rset=1 quit=1 commands=3/4
May 17 04:57:44 mail.example.com postfix/submission/smtpd[7982]: disconnect from unknown[45.142.195.14] ehlo=1 auth=0/1 rset=0/1 quit=1 commands=2/4
May 17 04:57:59 mail.example.com postfix/submission/smtpd[7982]: connect from unknown[45.142.195.14]
May 17 04:58:01 mail.example.com postfix/anvil[1394]: statistics: max connection rate 3/60s for (submission:45.142.195.14) at May 17 04:49:05
May 17 04:58:01 mail.example.com postfix/anvil[1394]: statistics: max connection count 1 for (submission:45.142.195.14) at May 17 04:48:12
May 17 04:58:01 mail.example.com postfix/anvil[1394]: statistics: max cache size 2 at May 17 04:49:26
May 17 04:58:10 mail.example.com postfix/submission/smtpd[7982]: disconnect from unknown[45.142.195.14] ehlo=1 auth=0/1 rset=0/1 quit=1 commands=2/4
May 17 04:58:25 mail.example.com postfix/submission/smtpd[7982]: connect from unknown[45.142.195.14]
May 17 04:58:36 mail.example.com postfix/submission/smtpd[7982]: disconnect from unknown[45.142.195.14] ehlo=1 auth=0/1 rset=0/1 quit=1 commands=2/4

● dovecot.service - Dovecot IMAP/POP3 email server
   Loaded: loaded (/usr/lib/systemd/system/dovecot.service; enabled; vendor preset: disabled)
   Active: active (running) since Sat 2020-05-16 14:24:57 EDT; 14h ago
     Docs: man:dovecot(1)
           http://wiki2.dovecot.org/
  Process: 16278 ExecStop=/usr/bin/doveadm stop (code=exited, status=0/SUCCESS)
  Process: 16322 ExecStart=/usr/sbin/dovecot (code=exited, status=0/SUCCESS)
  Process: 16300 ExecStartPre=/usr/libexec/dovecot/prestartscript (code=exited, status=0/SUCCESS)
 Main PID: 16349 (dovecot)
    Tasks: 5 (limit: 24008)
   Memory: 6.8M
   CGroup: /system.slice/dovecot.service
           ├─16349 /usr/sbin/dovecot
           ├─16373 dovecot/anvil
           ├─16374 dovecot/log
           ├─16376 dovecot/config
           └─28350 dovecot/auth

May 17 02:05:48 mail.example.com dovecot[16374]: pop3-login: Disconnected: Too many bad commands (no auth attempts in 0 secs): user=<>, rip=51.178.78.153, lip=178.238.237.150, session=<G9d61tGlquozsk6Z>
May 17 02:38:47 mail.example.com dovecot[16374]: pop3-login: Disconnected (no auth attempts in 0 secs): user=<>, rip=45.136.108.68, lip=178.238.237.150, session=<nkZmTNKllActiGxE>
May 17 02:48:21 mail.example.com dovecot[16374]: imap-login: Aborted login (no auth attempts in 7 secs): user=<>, rip=66.240.219.146, lip=178.238.237.150, session=<1QGqbtKlqKZC8NuS>
May 17 02:48:27 mail.example.com dovecot[16374]: imap-login: Disconnected (no auth attempts in 0 secs): user=<>, rip=66.240.219.146, lip=178.238.237.150, TLS, session=<b2IFb9Kl8rBC8NuS>
May 17 02:48:28 mail.example.com dovecot[16374]: imap-login: Disconnected (no auth attempts in 0 secs): user=<>, rip=66.240.219.146, lip=178.238.237.150, TLS handshaking: SSL_accept() failed: error:142090FC:SSL routines:tls_early_post_process_client_hello:unknown protocol, session=<psUVb9Kl9LFC8NuS>
May 17 02:51:01 mail.example.com dovecot[16374]: imap-login: Disconnected (no auth attempts in 156 secs): user=<>, rip=66.240.219.146, lip=178.238.237.150, TLS: Disconnected, session=<J9o0eNKlgK9C8NuS>
May 17 04:02:06 mail.example.com dovecot[16374]: pop3-login: Disconnected (no auth attempts in 0 secs): user=<>, rip=45.136.108.23, lip=178.238.237.150, session=<knxgdtOlaActiGwX>
May 17 04:17:12 mail.example.com dovecot[16374]: imap-login: Disconnected (no auth attempts in 0 secs): user=<>, rip=127.0.0.1, lip=127.0.0.1, TLS handshaking: SSL_accept() failed: error:14094418:SSL routines:ssl3_read_bytes:tlsv1 alert unknown ca: SSL alert number 48, session=</91qrNOlDJB/AAAB>
May 17 04:17:35 mail.example.com dovecot[16374]: imap-login: Disconnected (no auth attempts in 0 secs): user=<>, rip=127.0.0.1, lip=127.0.0.1, TLS handshaking: SSL_accept() failed: error:14094418:SSL routines:ssl3_read_bytes:tlsv1 alert unknown ca: SSL alert number 48, session=<5ILKrdOlDpB/AAAB>
May 17 04:24:38 mail.example.com dovecot[16374]: pop3-login: Disconnected (tried to use disallowed plaintext auth): user=<info@codezombie.ninja>, rip=185.234.219.224, lip=178.238.237.150, session=<GZ32xtOl+re56tvg>

I would really wish for a single solution to this, rather than having to plug-in so many nuts and bolts to get a simple mail server up and running!

Does anyone know what the problem is?

PS.

For some reason SSL is not working, so I changed default_host to localhost in the RoundCube config, also commented the two lines below in /etc/postfix/master.cf

#  -o smtpd_tls_security_level=encrypt   
#  -o smtpd_tls_auth_only=yes 

Now, RoundCube is working, although it seems I cannot receive Emails from Gmail. Although I have specified key and crt files for postfix, it does not work for some reason:

smtpd_tls_key_file = /etc/postfix/ssl/mykey.key           ##SSL Key
smtpd_tls_cert_file = /etc/postfix/ssl/mycertificate.crt  

So, that's all I have now! I hope someone can give a better solution for this than just disabling SSL.

Best Answer

This might work for you., try removing the authorization credentials in the config file and hit send.

$config['smtp_user'] = '';
$config['smtp_pass'] = '';