I was asked to write an IMAP proxy that would act as a 'real' IMAP server, except that it would translate all requests from clients to the backend IMAP server. In this setup, the client connects to proxy directly and doesn't necessarily know about the backend. The idea is to have the proxy monitor all the mail the client fetches.
I have been looking into Twisted for accomplishing this task, because Twisted has a proxy
module and it also has implementations of IMAP4 for client and server.
I would like to know if there are any difficulties with secure connections that one should be aware of. The program must monitor all traffic, thus it must maintain two secure connections with two different certificates. Is this feasible if the proxy has a certificate that the client trusts? Are there any pitfalls?
Also, is it possible to use the proxy
module for this? I've seen a simple IMAP proxy written with this module, but the docs say it's for HTTP proxying.