I have to cope with a very unusual imap server behavior, but maybe stunnel can help me: Can stunnel send an imap command ("XX LOGOUT"), just before closing the tcp session?
Setup: I use stunnel for SSL/TLS offloading, both via extra port (993) and StartTLS emulation (143). Our imap server (Mercury) has a very peculiar feature: If a tcp connection is closed without properly closing the imap session first (LOGOUT), the server discards certain attributes, specifically, it "forgets" all deletions since last logout. Since many imap clients just tear down the connection in certain cases (for example Thunderbird going into offline mode, many webmailers or stunnel reaching it's "TIMEOUTidle"), this causes mails to be undeleted. We currently use an older version of the mailserver, since only the newest is broken.
Needless to say, this does not go well with our users. A fixed version of the imap server may never come, so, until we can switch all users to a new mail system: Is it possible to use stunnel to send an additional imap command before closing the tcp connection (something like "999 LOGOUT")? The command should be sent no matter why the connection is closed, either because the client closed it, a timeout is reached or stunnel is unloaded. If the connection is already cleanly logged out, this doesn't matter, in all other situations it would help.
Would it be possible to send such a command, or could this be added as a new feature?
Greetings Markus Borst
Markus Borst wrote:
I have to cope with a very unusual imap server behavior, but maybe stunnel can help me: Can stunnel send an imap command ("XX LOGOUT"), just before closing the tcp session?
[cut]
Would it be possible to send such a command, or could this be added as a new feature?
It is definitely possible, although a clean implementation doesn't seem to be easy. I'm not sure if it's a good idea to keep such a feature in stunnel (KISS principle). Maybe it's better to write a separate proxy just for this purpose, and to chain it between stunnel and Mercury.
Mike