Matthias Andree <matthias.and...@gmx.de> wrote: > 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?
Have you considered inetd/xinetd based solution? see "Running stunnel in inetd mode" at https://www.stunnel.org/howto.html It will allow you to execute "ssh forwarder" when connection is made to local ports of your choice. You may combine it with iptables based "transparent proxy". -- A. Filip