Discussion:
Smarthost with an alternate port
Martin Hicks
2003-11-08 01:19:10 UTC
Permalink
--

hello,

I've got a situation where I need to use SSH port forwarding magic to
get outbound SMTP. I want to use a smarthost, but due to some stupid
limitation of the ISP, I'm port forwarding port 25 on a report SMTP
server to port 9025 on the machine in question.

How can I specify a specific port to the smart host? Unfortunately, the
delimiter for multiple smart hosts is a :, which is the classic
host:port delimiter.

This is exim 3.36. If there is no way in this version, then is this
fixed in exim 4?

TIA
mh

--
Martin Hicks || ***@bork.org || PGP/GnuPG: 0x4C7F2BEE
--
Content-Description: This is a digitally signed message part

[ signature.asc of type application/pgp-signature deleted ]
--


--

## List details at http://www.exim.org/mailman/listinfo/exim-users Exim details at http://www.exim.org/ ##
Willie Viljoen
2003-11-10 09:58:43 UTC
Permalink
I think it's time to upgrade to Exim 4. There's no easy (and efficient) way
to do this in Exim 3. In Exim 4, it can be done very easily.

Place a normal Exim 4 style router in your configuration file at a point
where routing this makes sence (after virus scanning, etc). The router
should look like this:

smarthost_router:
driver = manualroute
transport = remote_smtp_over_ssh
route_list = !+local_domains 127.0.0.1

Note the difference in the transport line from the normal Exim 4 smarthost.
Here we use remote_smtp_over_ssh as opposed to remote_smtp normally used
here. Now, add this anywhere in the transports section of your configuration
file:

remote_smtp_over_ssh:
driver = smtp
port = 9025
allow_localhost

This transport operates exactly like the remote_smtp transport that would
normally be used, except that it allows you to deliver to localhost, and
changes the SMTP port to 9025.

I'm sure this can be done in Exim 3, but with great difficulty. I don't have
access to a sample Exim 3 installation to try a possible set of
configurations, so I can't get into that. I recommend upgrading to Exim 4
anyway.

Hope this helps.
Will

----- Original Message -----
From: "Martin Hicks" <***@bork.org>
To: <exim-***@exim.org>
Sent: Saturday, November 08, 2003 3:19 AM
Subject: [Exim] Smarthost with an alternate port
Post by Martin Hicks
--
hello,
I've got a situation where I need to use SSH port forwarding magic to
get outbound SMTP. I want to use a smarthost, but due to some stupid
limitation of the ISP, I'm port forwarding port 25 on a report SMTP
server to port 9025 on the machine in question.
How can I specify a specific port to the smart host? Unfortunately, the
delimiter for multiple smart hosts is a :, which is the classic
host:port delimiter.
This is exim 3.36. If there is no way in this version, then is this
fixed in exim 4?
TIA
mh
--
--
Content-Description: This is a digitally signed message part
[ signature.asc of type application/pgp-signature deleted ]
--
--
## List details at http://www.exim.org/mailman/listinfo/exim-users Exim
details at http://www.exim.org/ ##
--

## List details at http://www.exim.org/mailman/listinfo/exim-users Exim details at http://www.exim.org/ ##
Thomas Fini Hansen
2003-11-11 07:39:13 UTC
Permalink
Post by Willie Viljoen
I'm sure this can be done in Exim 3, but with great difficulty. I don't have
access to a sample Exim 3 installation to try a possible set of
configurations, so I can't get into that. I recommend upgrading to Exim 4
anyway.
Eh? Grat difficulty? I used a SSH tunnel to get mail from my server to
my laptop, using Exim 3. My guess at a configuration would be (all
I've changed is the port and the laptops hostname to * in route_list):

# Transport:
ssh_tunnel:
driver = smtp
port = 9025

# Router:
ssh_router:
driver = domainlist
transport = ssh_tunnel
self = send
route_list = * localhost byname

--
Thomas
***@system-tnt.dk

--

## List details at http://www.exim.org/mailman/listinfo/exim-users Exim details at http://www.exim.org/ ##
Martin Hicks
2003-11-11 03:36:36 UTC
Permalink
--
Post by Willie Viljoen
I think it's time to upgrade to Exim 4. There's no easy (and efficient) way
to do this in Exim 3. In Exim 4, it can be done very easily.
Place a normal Exim 4 style router in your configuration file at a point
where routing this makes sence (after virus scanning, etc). The router
driver = manualroute
transport = remote_smtp_over_ssh
route_list = !+local_domains 127.0.0.1
Note the difference in the transport line from the normal Exim 4 smarthost.
Here we use remote_smtp_over_ssh as opposed to remote_smtp normally used
here. Now, add this anywhere in the transports section of your configuration
driver = smtp
port = 9025
allow_localhost
This transport operates exactly like the remote_smtp transport that would
normally be used, except that it allows you to deliver to localhost, and
changes the SMTP port to 9025.
I'm sure this can be done in Exim 3, but with great difficulty. I don't have
access to a sample Exim 3 installation to try a possible set of
configurations, so I can't get into that. I recommend upgrading to Exim 4
anyway.
Hope this helps.
Will
This helped at lot. I'm still not getting it going though. Exim is
complaining about the smarthost being localhost.

(I'm using debian-sid, so the file references are based on their exim4
installation)

I have the following in
/etc/exim4/conf.d/transport/30_exim4-config_remote_smtp:

remote_smtp_over_ssh:
driver = smtp
port = 9025
allow_localhost

and in /etc/exim4/conf.d/router/200_exim4-config_primary
I have:

smarthost:
driver = manualroute
transport = remote_smtp_over_ssh
route_list = * localhost
allow_localhost


In the logs I'm still getting the following:

2003-11-10 22:30:37 Start queue run: pid=5634 -qff
2003-11-10 22:30:37 1AJP3A-0001Ef-OA Unfrozen by forced delivery
2003-11-10 22:30:37 1AJP3A-0001Ef-OA remote host address is the local
host: bork.org
2003-11-10 22:30:37 1AJP3A-0001Ef-OA == ***@bork.org R=smarthost
defer (-1): remote host address is the local host


I don't want a local delivery, I want bork.org to be sent to the
smarthost.

Suggestions?

mh


--
Martin Hicks || ***@bork.org || PGP/GnuPG: 0x4C7F2BEE
--
Content-Description: This is a digitally signed message part

[ signature.asc of type application/pgp-signature deleted ]
--


--

## List details at http://www.exim.org/mailman/listinfo/exim-users Exim details at http://www.exim.org/ ##
Willie Viljoen
2003-11-11 09:55:06 UTC
Permalink
----- Original Message -----
From: "Martin Hicks" <***@bork.org>
To: "Willie Viljoen" <***@unfoldings.net>
Cc: <exim-***@exim.org>
Sent: Tuesday, November 11, 2003 5:36 AM
Subject: Re: [Exim] Smarthost with an alternate port
Post by Martin Hicks
I have the following in
driver = smtp
port = 9025
allow_localhost
and in /etc/exim4/conf.d/router/200_exim4-config_primary
driver = manualroute
transport = remote_smtp_over_ssh
route_list = * localhost
allow_localhost
This all looks right, so the problem is probably elsewhere, except for one
thing. Check if localhost in the line is being resolved properly. Some auto
configuration scripts can cause problems here, the debian install might for
instance have done something strange in /etc/hosts. Check that file to make
sure localhost.yourdomain.net points to 127.0.0.1. I've seen some strange
cases where it points to, for instance, a private IP address on the
machine's ethernet interface. This is unlikely to be the cause though, read
further down for more possibilities...
Post by Martin Hicks
2003-11-10 22:30:37 Start queue run: pid=5634 -qff
2003-11-10 22:30:37 1AJP3A-0001Ef-OA Unfrozen by forced delivery
2003-11-10 22:30:37 1AJP3A-0001Ef-OA remote host address is the local
host: bork.org
defer (-1): remote host address is the local host
All I can think of is that your machine is configured to think it is
bork.org (ie, in the primary_hostname configuration line, or if it appears
in local_domains). Exim will have a fit if the smarthost also thinks it is
bork.org. It will believe the domain to be misconfigured. If the smarthost
accepts for bork.org, and your local machine accepts for bork.org, you have
a conflict.

Best way to fix this is to name your machine something else, for instance,
make it accept for home.bork.org or firewalled.bork.org instead. If you have
a situation where you have some addresses to be delivered locally, and some
at the remote host, you can use rewrite lines in the configuration file,
like this:

***@bork.org ***@home.bork.org T
***@bork.org ***@home.bork.org T

This way, e-mail sent via this machine to the john or joan users will be
rewritten (envelope TO: address only, no visible change) to be delivered
within this domain. Any other bork.org e-mail will be sent via the
smarthost. You'll probably want to also have these settings:

primary_hostname = home.bork.org
local_domains = @

Hope it helps again :)
Will


--

## List details at http://www.exim.org/mailman/listinfo/exim-users Exim details at http://www.exim.org/ ##
Loading...