[Dovecot] using 'socat' to relay Dovecot SASL's auth socket over TCP?

Roger Binns rogerb at rogerbinns.com
Sun Jun 17 10:19:09 EEST 2007


snowcrash wrote:
> which, iiuc (?), can bidirectionally bridge the Dovecot unix-socket to
> a TCP socket that Exim can talk/listen to.

I've used socat extensively on a completely unrelated project in order
to bridge UNIX domain sockets across machines.

I assume you currently have this:

  exim ->  /some/unix/socket -> dovecot-auth

If you want to use socat, then make sure it is installed on both
machines.  You can bridge using ssh (recommended) or just plain TCP/IP.

For ssh, run the following command on eximhost:

  socat -t 10 UNIX-LISTEN:/some/unix/socket,fork  \
    EXEC:"ssh user at dovecot-auth-host STDIO UNIX:/some/unix/socket"

The ssh will need to be able to complete without any form of prompting
(ie you need private/authorized keys setup).

If you don't care about security then you can use TCP connections
between the machines.

On eximhost run this replacing 9999 with your chosen port number:

 socat -t 10 UNIX-LISTEN:/some/unix/socket,fork \
    TCP4:dovecot-auth-host:9999

On dovecot-auth-host run:

 socat TCP4-LISTEN:9999,fork \
    UNIX:/some/unix/socket

The -t 10 option waits for 10 seconds after one direction is closed
before closing the other direction.  The socat default is .5 seconds
which I found problematic on higher latency links.

Roger



More information about the dovecot mailing list