Skip to content

[BUG] 2nd multiDomain config still uses default IMAP server to connect #20

@cnaslain

Description

@cnaslain

Chart Name and Version

Helm chart https://github.com/encircle360-oss/helm-charts/tree/main/charts/roundcube
Version: 0.8.1 + image.tag=1.6.11-apache

BTW: The tag 1.6.11 which is the chart appVersion does not exists in the docker registry, need to choose between FPM or apache; see https://hub.docker.com/r/roundcube/roundcubemail/tags?name=1.6.11

Describe the bug

I already used roundcube 1.5.9-r8 on a swarm cluster, and my multi-server config was based on the roundcube $config['default_host'] parameter which can be an array of hosts:

$config['default_host'] = array(
                                'ssl://my1stserver.com:993',
                                'ssl://mail.my2ndserver.com:993',
                                'ssl://imap.googlemail.com:993'
                                );
$config['smtp_server'] = '%h';
$config['smtp_user'] = '%u';
$config['smtp_pass'] = '%p';

With a single roundcube URL we can choose a mail server from a list before trying to connect to it. This was working fine with the instrumentisto/roundcube:1.5.9-r8-fpm docker image.

I tried today to migrate the mailserver from swarm to k3s; using your chart and following the documentation.

The value roundcube.defaultHost is a string with only one IMAP server and we must use the roundcube.multiDomain.domains to describe multiple mail servers. Instead of the original roundcube host list management, the chart creates a custom configmap with a generated PHP code which is mounted into /var/roundcube/config/config.inc.php. I added some debug trace in this PHP code and the config is read well and applied when I use another URL to access roundcube (See DEBUG_CNAS traces in log).

When I enable the IMAP debug with $config['imap_debug'] = true; in the custom PHP code, I see that when I choose a second server such as mail.my2ndserver.com the IMAP server used seems to be the original default, not the overwritten one in the configmap code. The imap server is overwritten, but not used.

The DEBUG_CNAS are traces that we do well overwrite server config with the 2nd roundcube URI.

The key issues in the log are:

imap: <def9b442> [FB87] Connecting to ssl://my1stserver.com:993...
...
IMAP Error: Login failed for chris@my2ndserver.com against my1stserver.com

... we are supposed to connect mail.my2ndserver.com and not my1stserver.com.

To Reproduce

Deploy a mailserver with default 1rst mail host and a multiDomain with both 1st and 2nd mailserver (BTW, maybe it's not necessary to redifine the 1st one if this is the default?).

Expected behavior

Using the mail.my2ndserver.com, I should connect to the ssl://mail.my2ndserver.com:993 IMAP server.

Values used

Example of values (reduced for privacy and visibility):

---
image:
  tag: "1.6.11-apache"
persistence:
  enabled: false
roundcube:
  defaultHost: "ssl://my1stserver.com"
  smtpServer: "tls://my1stserver.com"
  multiDomain:
    enabled: true
    domains:
      - name: "mail.my1stserver.com"
        config: |
          $config['default_host'] = 'ssl://my1stserver.com:993';
          $config['smtp_server'] = 'tls://my1stserver.com:587';
      - name: "mail.my2ndserver.com"
        config: |
          $config['default_host'] = 'ssl://mail.my2ndserver.com:993';
          $config['smtp_server'] = 'tls://mail.my2ndserver.com:587';
ingress:
  enabled: true
  hosts:
    - host: mail.my1stserver.com
      paths:
        - path: /
          pathType: Prefix
    - host: mail.my2ndserver.com
      paths:
        - path: /
          pathType: Prefix

Environment:

  • Kubernetes Version: v1.32.3+k3s1
  • Helm Version: v3.16.2
  • Chart Version: 0.8.1

Logs

[Sun Nov 02 18:01:20.974558 2025] [php:notice] [pid 116:tid 116] [client 10.42.0.7:49662] DEBUG CNAS: current_host=mail.my2ndserver.com, referer: https://mail.my2ndserver.com/?_task=login
[Sun Nov 02 18:01:20.974574 2025] [php:notice] [pid 116:tid 116] [client 10.42.0.7:49662] DEBUG CNAS: default_host=ssl://mail.my2ndserver.com:993, referer: https://mail.my2ndserver.com/?_task=login

imap: <def9b442> [FB87] Connecting to ssl://my1stserver.com:993...
imap: <def9b442> [FB87] S: * OK [CAPABILITY IMAP4rev1 SASL-IR LOGIN-REFERRALS ID ENABLE IDLE LITERAL+ AUTH=PLAIN AUTH=LOGIN] Dovecot (Debian) ready.
imap: <def9b442> [FB87] C: A0001 AUTHENTICATE PLAIN ****** [41]
imap: <def9b442> [FB87] S: A0001 NO [AUTHENTICATIONFAILED] Authentication failed.
errors: <def9b442> IMAP Error: Login failed for chris@my2ndserver.com against my1stserver.com from 10.42.0.7 (X-Real-IP: 192.168.1.169,X-Forwarded-For: 192.168.1.169). AUTHENTICATE PLAIN: Authentication failed. in /var/www/html/program/lib/Roundcube/rcube_imap.php on line 211 (POST /?_task=login&_action=login)
10.42.0.7 - - [02/Nov/2025:18:01:20 +0000] "POST /?_task=login HTTP/1.1" 401 2838 "https://mail.my2ndserver.com/?_task=login" "Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Firefox/78.0"

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions