Koozali.org: home of the SME Server

redirect port 25 boot up

alan

redirect port 25 boot up
« on: May 29, 2003, 08:03:35 PM »
How do i get the esmith server to load a redirect program on bootup

Trevor B

Re: redirect port 25 boot up
« Reply #1 on: May 30, 2003, 12:16:59 PM »
Put your script in /etc/e-smith/events/local

My smtpredir script looks like
#!/bin/sh

#------------------------------------------------------------
# Hacked script to try to redirect smtp traffic from external
# port 2525 to internal port 25
#------------------------------------------------------------

# description: Configures IP redirection from an external port to an alternate internal port.

    OUTERNET=$(/sbin/e-smith/db configuration get ExternalIP)
    /usr/local/bin/redir --lport=2525 --laddr=$OUTERNET --cport=25 --caddr=127.0.0.1

exit 0

Sorry about the test wrapping, but the caddr=127.0.0.1 should all be on the previous line.

Thanks Terry Brummel & Michiel

Trevor B

alan wrote:
>
> How do i get the esmith server to load a redirect program on
> bootup

guestHH

Re: redirect port 25 boot up
« Reply #2 on: May 30, 2003, 12:52:18 PM »
Don't 'you need 'redir' for this Terry?

http://www.star-support.com/downloads/mitel/contrib/redir/

Michiel

Re: redirect port 25 boot up
« Reply #3 on: May 30, 2003, 12:55:16 PM »
I believe your solution will not work with dynamic IP-addresses since you use the external IP address to identify the listening interface. As soon as your ISP changes your IP, redir will be clueless.

However, if you just run:

/usr/local/bin/redir --lport=2525 --cport=25 &

it should work, even after an IP change. This in effect means that redir listens to _all_ interfaces, including the internal one, but that shouldn't be a problem.

However, I haven't yet been able to test this conclusively since my ISP takes weeks before changing my IP address :-) I would therefore be interested in your feed-back.

Michiel

Trevor B

Re: redirect port 25 boot up
« Reply #4 on: May 30, 2003, 01:08:19 PM »
My ISP also rarely changes my IP address, so wont have an opportunity to test.

I guess that it shouldn't worry the internals as port 25 is still being listened for by smtp..... hmmmm

I was looking at including it in my custom dynamic dns script or looking a bit harder for the appropriate place when I get the time, but might not need to.

Thanks
Trevor B

Michiel wrote:
>
> I believe your solution will not work with dynamic
> IP-addresses since you use the external IP address to
> identify the listening interface. As soon as your ISP changes
> your IP, redir will be clueless.
>
> However, if you just run:
>
> /usr/local/bin/redir --lport=2525 --cport=25 &
>
> it should work, even after an IP change. This in effect means
> that redir listens to _all_ interfaces, including the
> internal one, but that shouldn't be a problem.
>
> However, I haven't yet been able to test this conclusively
> since my ISP takes weeks before changing my IP address :-) I
> would therefore be interested in your feed-back.
>
> Michiel

Trevor B

Re: redirect port 25 boot up
« Reply #5 on: May 30, 2003, 01:09:36 PM »
Was assuming that they must already have a redir program from the question.. Yes it does.

Trevor B

guestHH wrote:
>
> Don't 'you need 'redir' for this Terry?
>
> http://www.star-support.com/downloads/mitel/contrib/redir/

Michiel

Re: redirect port 25 boot up
« Reply #6 on: May 30, 2003, 01:19:44 PM »
> I was looking at including it in my custom dynamic dns script

Would you know by any chance what the best way is to launch a script upon IP change? I could run a cron-job testing for a new IP, but I guess there is a smarter way.

Michiel

Trevor B

Re: redirect port 25 boot up
« Reply #7 on: May 31, 2003, 02:40:22 PM »
That's why I was thinking of the custom dynamic dns script (I have one for zonedit.com).

That is triggered on every IP change (as I am sure others are - I just don't know which ones we can utilise).

If you have selected Custom Dynamic DNS service in your setup it will run the
/sbin/e-smith/dynamic-dns/custom
script, which can contain anything you want.

I guess you could also create a script (or a link to a script) in the
/etc/e-smith/events/ip-change directory, but I'm sure that that wouldn't survive an upgrade.

Any other suggestions welcome.

Trevor B

Michiel wrote:
>
> > I was looking at including it in my custom dynamic dns script
>
> Would you know by any chance what the best way is to launch a
> script upon IP change? I could run a cron-job testing for a
> new IP, but I guess there is a smarter way.
>
> Michiel

Michiel

Re: redirect port 25 boot up
« Reply #8 on: May 31, 2003, 03:59:49 PM »
> I guess you could also create a script (or a link to a
> script) in the
> /etc/e-smith/events/ip-change directory, but I'm sure that
> that wouldn't survive an upgrade.

That's exactly what the people at Mitel recommended. As long as you give it a unique name, it will survive any upgrade.

Trevor B

Re: redirect port 25 boot up
« Reply #9 on: May 31, 2003, 04:16:05 PM »
That's good, because that's exactly what I did.

I stored my scripts in /etc/e-smith/events/actions and created a link in
/etc/e-smith/events/ip-change to them (I redirect 2525 to 25 & 8080 to 80). Made sure that they were named so that they ran after the set-external-ip script had run.

I also use the update revision script of yours in /etc/e-smith/events/local

Thanks
Trevor B

Michiel wrote:
>
> > I guess you could also create a script (or a link to a
> > script) in the
> > /etc/e-smith/events/ip-change directory, but I'm sure that
> > that wouldn't survive an upgrade.
>
> That's exactly what the people at Mitel recommended. As long
> as you give it a unique name, it will survive any upgrade.

Craig F.

Re: redirect port 25 boot up
« Reply #10 on: July 02, 2003, 04:51:58 AM »
Just use the normal port-forwarding rpm
e-smith-portforwarding-0.1.0-31 and e-smith-packetfilter-1.13.0-07 to forward port 2525 to $OUTERNET port 25. It will even refresh the next time you get an IP change.

And it's not adding a non-standard operation to the events directory