Hi,

You could use a plugin to do so :

Add this hook in init() function of your plugin :

        // Hooks
$this->add_hook('storage_connect', array($this, 'storage_connect'));

Then call this function :

    /**
     * Connection to IMAP server
     */
    public function storage_connect($args) {
        if ($args['driver'] == 'imap') {
            // Use an IMAP proxy ?
            if ($this->rc->config->get('use_imap_proxy', false)) {
$args['host'] = $this->rc->config->get('imap_proxy', null);
            }
        }
        return $args;
    }

Add 2 new config properties :
 'use_imap_proxy' => true,
 'imap_proxy' => <your imap host>



---
Thomas PAYEN
UNI/DETN/GMCD/PIAP
Direction du numérique | Secrétariat général

46 rue Saint Théobald BP 128 38081 L'Isle d'Abeau
Bureau : 117
Tel : +33 4 74 27 52 42 - Mobile : +33 7 49 17 29 05
www.ecologie.gouv.fr

                Secrétariat général

MINISTÈRES
AMÉNAGEMENT
DU TERRITOIRE
TRANSITION
ÉCOLOGIQUE

Le 13/06/2025 14:51, > nicolas.george a écrit :
Hi.

We have a mail server, let us call it clipper, and Roundcube running on
a distinct server, let us call it localhost. We already have users, with
their identities and their address books in the database.

I want to add imapproxy in the chain, to reduce the load on clipper. It
will run on localhost.

Unfortunately, if I just write:

$config['default_host'] = 'localhost';

… then for the database the mail_host column will be localhost instead
of clipper, and everybody will be considered a new user when connecting
the next time.

I could do
“UPDATE users SET mail_host = 'localhost' WHERE mail_host = 'clipper'”
but I do not want to: for reasons of elegance and the ability to move
back or to host multiple servers on the same instance, I want the
database to contain the real host name.

What are the options?

I found a hack: I added “127.0.0.2 clipper” in /etc/hosts and configured
imapproxy with a different FQDN for clipper. That way, Roundcube thinks
it is talking to clipper when it is really talking to the proxy. And
since the proxy is running on localhost I can dispense with TLS and all
the security theatre of certificates.

Before thinking of this hack, I tried another one that I got halfway
working: configure the firewall with a NAT chain “ip daddr $clipper
tcp dport 143 counter redirect to :143”. The solution with /etc/hosts is
simpler and more robust.

But these are hacks. Is there a clean supported solution?

Thanks in advance.
_______________________________________________
Users mailing list -- users@lists.roundcube.net
To unsubscribe send an email to users-le...@lists.roundcube.net

Reply via email to