Roundcube Community Forum

News and Announcements => General Discussion => Topic started by: espaanbroek on November 13, 2023, 05:46:09 AM

Title: Roundcube Migration to Docker - Connection Issue with Full Email Address
Post by: espaanbroek on November 13, 2023, 05:46:09 AM
Hello Roundcube Community,

I hope this message finds you well. I am currently in the process of migrating Roundcube from a traditional host to a Docker environment. While I've successfully restored the database within the Docker setup, I'm encountering an issue with the configuration when using the full email address for login.

Here's a snippet of my configuration in customconfig.inc.php:

$config['username_domain'] = 'domain.nl';
$config['imap_host'] = 'ssl://mail.domain.nl:993';
$config['smtp_host'] = 'tls://mail.domain.nl:587';


And in config.docker.inc.php (auto-generated):

  $config['imap_host'] = 'ssl://mail.domain.nl:993';
  $config['smtp_host'] = 'tls://mail.domain.nl:587';


The problem arises when attempting to log in using the full email address (e.g., [email protected]). It results in a timeout, and I noticed that Roundcube is trying to connect to hostname.domain.nl:143. Strangely, this hostname and port are not configured anywhere in my settings, and port 143 is closed on the host.

When logging in with just the username (without the domain part), everything works fine, and Roundcube establishes a connection to ssl://mail.domain.nl:993.

I want to ensure that Roundcube consistently connects to ssl://mail.domain.nl:993, regardless of whether only the name or the full email address is used for login. Can anyone shed light on where Roundcube might be picking up the hostname.domain.nl:143 configuration when using the full email address for login?

Any assistance or insights into resolving this issue would be greatly appreciated.

Thank you in advance!
Title: Re: Roundcube Migration to Docker - Connection Issue with Full Email Address
Post by: SKaero on November 13, 2023, 09:08:16 AM
When your starting the docker you need to set the env values:

ROUNDCUBEMAIL_DEFAULT_HOST
ROUNDCUBEMAIL_DEFAULT_PORT
ROUNDCUBEMAIL_SMTP_SERVER
ROUNDCUBEMAIL_SMTP_PORT


That will set the correct values in the config.docker.inc.php
Title: Re: Roundcube Migration to Docker - Connection Issue with Full Email Address
Post by: espaanbroek on November 13, 2023, 09:23:42 AM
Hello SKaero,

Thank you for your prompt response. I've ensured that the environment variables are set correctly when starting the Docker container. Here are the relevant lines from my docker-compose file:

  - ROUNDCUBEMAIL_DEFAULT_HOST=ssl://mail.domain.nl
  - ROUNDCUBEMAIL_DEFAULT_PORT=993
  - ROUNDCUBEMAIL_SMTP_SERVER=tls://mail.domain.nl
  - ROUNDCUBEMAIL_SMTP_PORT=587


Despite having these values set, the issue persists. When attempting to log in with the full email address (e.g., [email protected]), Roundcube seems to disregard these settings and tries to connect to hostname.domain.nl:143 instead of ssl://mail.domain.nl:993.

I've double-checked for any conflicting configurations and reviewed the logs for error messages, but haven't found any clues so far. Is there any additional step or configuration that I might be missing to ensure Roundcube consistently connects to ssl://mail.domain.nl:993, regardless of whether the full email address or just the username is used for login?

Your continued assistance is highly appreciated.

Best regards,
Emile.
Title: Re: Roundcube Migration to Docker - Connection Issue with Full Email Address
Post by: SKaero on November 13, 2023, 09:39:50 AM
Those values should end up in the config.docker.inc.php so it sounds like it isn't picking that up. Where those values set when you created the docker instance? 
Title: Re: Roundcube Migration to Docker - Connection Issue with Full Email Address
Post by: espaanbroek on November 13, 2023, 09:54:36 AM
Hi SKaero,

Thank you for your continued support. I appreciate your suggestion. To answer your question, yes, those values were set when I created the Docker instance. However, it seems like Roundcube is not picking up these values correctly.

I made an attempt to troubleshoot the issue further by removing the environment variables from docker-compose.yaml and directly setting the values in config/customconfig.inc.php. Surprisingly, this did not resolve the problem, and I encountered the same issue. Therefore, I reverted the changes back to the initial configuration. I will correct this in my initial post, because it seems I have pasted the wrong entries there.

Even after setting the environment variables again Roundcube still doesn't seem to pick up the correct settings when logging in with the full email address. It continues to attempt a connection to hostname.domain.nl:143 instead of ssl://mail.domain.nl:993.

If you have any additional insights or suggestions on how to ensure that Roundcube consistently uses the correct settings, I would greatly appreciate it.

Thank you for your time and assistance.
Title: Re: Roundcube Migration to Docker - Connection Issue with Full Email Address
Post by: SKaero on November 13, 2023, 02:26:14 PM
As far as I know the default docker doesn't pick up a customconfig.inc.php but I maybe wrong on that. My setup is picking up the values from the environment variables and sets them in the config.docker.inc.php. If you manually set the values in the config.docker.inc.php does it work?
Title: Re: Roundcube Migration to Docker - Connection Issue with Full Email Address
Post by: espaanbroek on November 14, 2023, 07:38:18 AM
Hello SKaero,

Thank you for your ongoing assistance and for sharing your insights.

Regarding the use of customconfig.inc.php in Docker, Roundcube's documentation says it does support the inclusion of custom configurations. You need to make sure that there is a proper mapping with the container's `/var/roundcube/config` directory. I have followed this approach, and the values in customconfig.inc.php are picked up by Rondcube.

However, the issue persists even when manually setting the values in config.docker.inc.php. This is a perplexing situation. I've observed some entries in the web server logs that might shed light on the problem:

Successful Login with Only the Username (Without Domain):
Nov 14 13:18:20 server3 docker/roundcubemail[28713]: sql: <39dc361b> [3] SELECT * FROM `users` WHERE `mail_host` = 'mail.domain.nl' AND `username` = '[email protected]';
Nov 14 13:18:20 server3 docker/roundcubemail[28713]: imap: <39dc361b> [3F80] Connecting to ssl://mail.domain.nl:993...
Nov 14 13:18:20 server3 docker/roundcubemail[28713]: imap: <39dc361b> [3F80] S: * OK [CAPABILITY IMAP4rev1 SASL-IR LOGIN-REFERRALS ID ENABLE IDLE SPECIAL-USE XLIST LITERAL+ AUTH=PLAIN AUTH=LOGIN] Dovecot (Debian) ready.


Failed Login with Full Email Address:
Nov 14 13:18:36 server3 docker/roundcubemail[28713]: sql: <809aad52> [3] SELECT * FROM `users` WHERE `mail_host` = 'hostname.domain.nl' AND `username` = '[email protected]';
Nov 14 13:18:36 server3 docker/roundcubemail[28713]: imap: <809aad52> [883A] Connecting to hostname.domain.nl:143...
Nov 14 13:19:36 server3 docker/roundcubemail[28713]: errors: <809aad52> IMAP Error: Login failed for [email protected] against hostname.domain.nl from 172.18.0.1. Could not connect to hostname.domain.nl:143: Connection timed out in /var/www/html/program/lib/Roundcube/rcube_imap.php on line 211 (POST /?_task=login&_action=login)


It's evident that the issue arises when logging in with the full email address, and Roundcube attempts to connect to `hostname.domain.nl:143` instead of `ssl://mail.domain.nl:993`. This behavior persists despite the correct configurations.

I'm truly stumped at this point and would appreciate any additional guidance or suggestions you, or any other forum member, may have to resolve this peculiar situation.

Thank you for your time and assistance!
Title: Re: Roundcube Migration to Docker - Connection Issue with Full Email Address
Post by: espaanbroek on November 14, 2023, 10:06:06 AM
Hi SKaero,

I wanted to provide an update on the connection issue I was facing during the Roundcube migration to Docker. After an extended debugging session, I am pleased to share that I have identified the root cause of the problem.

It turns out that the issue was caused by a specific Roundcube plugin. Upon deactivating this plugin, the login process started working seamlessly, and Roundcube consistently connected to ssl://mail.domain.nl:993, regardless of whether the full email address or just the username was used.

I appreciate your valuable input and time throughout this troubleshooting process. Thank you once again for your assistance.