Previously I housed all my (virtual) servers at rackspace.com. Rackspace has reasonable pricing and great technical support. Still, when the opportunity came up to get free commercial fiber to my office, I couldn’t resist moving to a bare metal environment. So far, the switch has saved me several hundred per month with no outages to speak of. Of course, I don’t have the redundancy of a Rackspace, but I do have a gas generator backup! Plus, I am not beholden to any server tech support. The buck stops here, so to speak (although network issues will still require 3rd party support).
Why an IMAP proxy?
Since I was migrating my email server along with all my other servers, I wanted to take the opportunity to update the incoming server names that my clients used to something more standard, like mail.magicbrain.net. Since I had about 200 clients to change over, I couldn’t move the server, change the name, then update the 200 clients. People would be sans email until I got around to updating their client configurations. Not good if you are the 199th and 200th client in line. I supposed I could have updated the old name in my DNS, but I didn’t want to have to introduce the name to my new server’s config, then forget it’s still live.
So, my plan was to create an IMAP proxy on my new server, mail.magicbrain.net, point it to my then-current email server, then once I changed the config settings for all my clients, make the actual move to the new server and remove the proxy.
This is not a usual use of an email proxy. Most of the time proxies are used for caching or security (firewalls). Still, the setup would be the same.
Imap Proxy Options
After looking around the Interweb for a free (as in beer) IMAP proxy, I found the two most popular were Squirrel Mail’s imapproxy and the Perdition Mail Retrieval Proxy. I started trying to work with imapproxy, and for some reason I gave up on it. I think it was due to a lack of support for SSL/STARTTLS.
So, I apt-get’ed Perdition:
It downloaded and started fine, or so I thought. Yet I hadn’t yet entered any forwarding server information, so I know it couldn’t be working properly yet. According to various docs, I needed to create/edit either perdition.imap4.conf or perdition.imap4. It turned out to be the former. Actually, I also edited perdition.imap4s.conf for SSL connections. The files are located in /etc/perdition and look something like this:
outgoing_server <my-old-server.com>:143 log_facility local5 no_lookup timeout 40 ssl_mode tls_listen ssl_cert_file /path/to/certs/ssl-bundle.crt ssl_key_file /path/to/certs/wildcard/ssl.key
outgoing_server <my-old-server.com>:993 log_facility local5 no_lookup timeout 40 ssl_mode ssl_listen ssl_cert_file /path/to/certs/ssl-bundle.crt ssl_key_file /path/to/certs/wildcard/ssl.key
I also truncated my perdition.conf file since it didn’t appear that any of the config info in the file was needed.
I restarted perdition (
service perdition restart), reconfigured my email clients to use the new server, and bingo — good to go!
The process actually took about 1.5 – 2 hours to complete. The big stumbling block was not knowing the correct name of the config files. I expected the perdtion.conf to have something like include *.conf, but it didn’t. The executable just knows to look for the above files.
The proxy server will also proxy POP and POPS, but I don’t use it so didn’t set it up. I think the config file names are similar (perdion.pop3.conf and perdition.pop3s.conf).