Re: smtp through a ssh tunnel to exim4 or other MTA
On Sun, Mar 11, 2007 at 10:29:28 -0700, peasthope@cablelan_XXX.net wrote:
> Wed, 28 Feb 2007 17:21:33 -0500, Roberto C. Sanchez said,
> "Do you have ssh access to P[machine belonging to ISP]?
> Were you planning on tunneling?"
> This is my configuration for sending mail from home.
> SSH is not needed on my LAN. This works with no problem.
> Oberon MUA at home ==LAN==> exim4 at home ==WAN==> ISP
> This is the trial configuration for sending mail from a
> remote location, most commonly from work.
> Remote Oberon MUA ==ssh tunnel==> exim4 at home ==WAN==> ISP
> It fails. exim4 appears to reject the ssh connection
> for relaying.
> Someone please tell me how to coerce exim4 into relaying
> a message submitted through a ssh tunnel.
> Where is the exim4 configuration stored? I have
> /etc/exim4/exim4.conf.template but no
> /etc/exim4/exim4.conf .
I cannot help you with exim4 configuration details, but I think that
maybe you just need to set up the ssh tunnel correctly. To do this for
"mailhost.tld" I have been successful with
smtp-forward='ssh -N -L 2525:localhost:25 mailhost.tld'
to forward my local port 2525 to port 25 of the mail host. Then I set up
my local MUA to use the smtp server at localhost:2525 and everything
worked. On the other hand, if I used
smtp-forward='ssh -N -L 2525:mailhost.tld:25 mailhost.tld'
it would be treated as an external connection by the mail host and the
mail was rejected. Could this be the problem with your setup?
Another possible solution is to run the sendmail command on the mailhost
via ssh and to feed your mail to it. I can tell you how to do that if
this is an option for you. (It depends on whether your local MUA can be
set up to use a redefined the sendmail command.) This approach can also
help if your local machine is on a dynamic IP that is in some spam
blacklists, because the ssh approach makes sure that this "bad" IP
address does not show up in the email header.