Author Topic: Roundcube docker cannot connect to mysql Host [SOLVED]  (Read 481 times)

Offline dave08

  • Jr. Member
  • **
  • Posts: 11
Roundcube docker cannot connect to mysql Host [SOLVED]
« on: December 21, 2020, 07:19:53 AM »
Hello there. My first post here...I'm evaluating Roundcube to replace squirrelmail.
I've installed successfully the 1.2.12 LTS version on a test machine, but due to php version <5.4 (oracle linux 6) the only way I have to use Roundcube Mail on my server is as docker.
The only way I can connect to the mysql database is if I use the --network=host parameter, which in turn is bad because along with -p 8080:80 it will try to use an already taken http port on my host.
Using --network=bridge I can never access the database even though I can access it via command line: mysql -h 172.17.0.1 -u roundcube -p roundcubemail.
I can ping the docker from my host, but there are no network tools inside the docker to test the access.
Any ideas please?
Thanks and regards.

ERROR: SQLSTATE[HY000] [2002] No route to host
ERROR: Failed to connect to database
« Last Edit: December 23, 2020, 06:29:04 AM by dave08 »

Offline dave08

  • Jr. Member
  • **
  • Posts: 11
Re: Roundcube docker cannot connect to mysql Host
« Reply #1 on: December 21, 2020, 09:21:53 AM »
Ok, so I've found out that when creating an iptables rule to allow access from source (my docker) 172.17.0.2 to port 3306, access to database is granted.
Now my docker starts, I can type in the login window bu I get:

chrome
Connection to storage server failed.

edge:
Connection to IMAP server failed

 [client ip:61034] PHP Warning:  stream_socket_client(): SSL operation failed with code 1. OpenSSL Error messages:\nerror:141A318A:SSL routines:tls_process_ske_dhe:dh key too small in /var/www/html/program/lib/Roundcube/rcube_imap_generic.php on line 1025, referer: http://10.0.1.8:8080/?_task=login
errors: <9dd4c441> IMAP Error: Login failed for user against imap.server from source.ip. Could not connect to ssl://imap.server:993: Unknown reason in /var/www/html/program/lib/Roundcube/rcube_imap.php on line 200 (POST /?_task=login&_action=login)

[Mon Dec 21 15:38:29.133606 2020] [php7:warn] [pid 50] [client :61034] PHP Warning:  stream_socket_client(): Failed to enable crypto in /var/www/html/program/lib/Roundcube/rcube_imap_generic.php on line 1025, referer: http://10.0.1.8:8080/?_task=login

[Mon Dec 21 15:38:29.133878 2020] [php7:warn] [pid 50] [client :61034] PHP Warning:  stream_socket_client(): unable to connect to ssl://imap.server:993 (Unknown error) in /var/www/html/program/lib/Roundcube/rcube_imap_generic.php on line 1025, referer: http://10.0.1.8:8080/?_task=login
- - [21/Dec/2020:15:38:29 +0000] "POST /?_task=login HTTP/1.1" 401 2815 "http://10.0.1.8:8080/?_task=login" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.88 Safari/537.36"


Also, it seems environment variables are that I pass to docker using "-e" run are found in /var/www/htm/config/config.inc.php
if passed via -v "full/path/config/:/var/roundcube/config/" , if i use a terminal inside the docker, the config.inc.php has the defaults value instead of those in my config.inc.php file.


Any ideas, please?
« Last Edit: December 21, 2020, 10:58:13 AM by dave08 »

Offline JohnDoh

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2,582
Re: Roundcube docker cannot connect to mysql Host
« Reply #2 on: December 22, 2020, 02:56:58 AM »
Quote
SSL routines:tls_process_ske_dhe:dh key too small
The error is on the IMAP server side see https://stackoverflow.com/questions/36417224/openssl-dh-key-too-small-error
Roundcube Plugins: Contextmenu, SpamAssassin Prefs, and moreā€¦

Offline dave08

  • Jr. Member
  • **
  • Posts: 11
Re: Roundcube docker cannot connect to mysql Host
« Reply #3 on: December 22, 2020, 04:17:49 AM »
Thank you so much for the reply.
The Imap server has a valid 2048 certificate and is recognizable as legit from any part of the world. Don't think there is a problem with it from any client. If I use the roundcubemail 1.2.12 LTS from a test machine connecting to the imap server, it works. Unfortunately I will have to use the docker on my web server.

Also, does anyone know how to setup this docker with https?
Thanks and regards!
« Last Edit: December 22, 2020, 04:20:51 AM by dave08 »