On 01/04/2017 12:47 PM, Wietse Venema wrote: > Matthias Andree: >> Greetings and a happy new year, >> >> >> I still am in a situation where I occasionally need to have an SMTP >> client (preferable Postfix's) talk through an SSH tunnel. >> >> I know we have the smtp(8) client, and we have the pipe(8) client for >> injecting RFC5322 stuff into commands, but what I need is some form of >> the smtp(8) client talk to the ssh command (with certain arguments) >> instead of establishing the TCP connection by itself. The current >> workaround is to establish SSH port forwarding asynchronously, and that >> is a fragile setup that I would like to replace by something synchronous >> that doesn't need to set up TCP tunnels when I can instead have "ssh -W >> host:port" that talks through stdin/stdout. >> >> I haven't seen such a feature in the 3.1 release notes - what needs to >> happen that smtp can - perhaps via special syntax - be made to talk >> through a command's stdio rather than through BSD sockets? > You need to make smtp(8) talk to a TCP port (or UNIX-domain port), > an arrange for a little daemon that listens on that port, and that > invokes ssh when a connection is established to that port. Then > the little daemon shuttles bits up and down. Such an on-demand > TCP relay could be done in Perl, Python, or any capable language. > > Wietse
I think that socat can do that. https://linux.die.net/man/1/socat John