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.
--
Nicolas George, responsable adjoint du
Pôle numérique, pédagogique et scientifique,
École normale supérieure