View previous topic :: View next topic |
Author |
Message |
0day n00b
Joined: 20 Apr 2005 Posts: 22
|
Posted: Thu Apr 28, 2005 8:34 pm Post subject: Iptables Port Forwarding |
|
|
Hola,
I'm trying to setup a rule in iptables that will forward all mail being sent to us to an external spam filtering appliance IF the mail being sent is not from the spam appliance. Does anyone know how to do this? Thanks. Jake _________________ Jake H.
jakeh_at_0dayinc.com
0day Inc. Network Security Consulting for the Future...
www.0dayinc.com |
|
Back to top |
|
|
the_sphynx Apprentice
Joined: 19 May 2004 Posts: 156 Location: Thornton, CO
|
Posted: Thu Apr 28, 2005 9:26 pm Post subject: |
|
|
You will have to forward all port 25 traffic to the appliance:
Code: | iptables -A PREROUTING -t nat -p tcp -d <your_external_address> --dport 25 -j DNAT --to <destination_address_of_appliance>:25 |
Something like that should do the trick! _________________ Folding@Home User 285941 |
|
Back to top |
|
|
0day n00b
Joined: 20 Apr 2005 Posts: 22
|
Posted: Thu Apr 28, 2005 9:59 pm Post subject: |
|
|
Let me explain in better detail
I meant to say something more like this:
[pseudo code]
If traffic coming in on port 25 is not coming from the IP address of the SpamAppliance's IP on port 25 then redirect the email to the SpamAppliance
on port 25 otherwise allow the email through.
[/pseudocode]
Basically it needs to meet two conditions. Thanks.
Jake _________________ Jake H.
jakeh_at_0dayinc.com
0day Inc. Network Security Consulting for the Future...
www.0dayinc.com |
|
Back to top |
|
|
0day n00b
Joined: 20 Apr 2005 Posts: 22
|
Posted: Fri Apr 29, 2005 3:37 pm Post subject: |
|
|
My other thought would be something like this although I can't think of how to grab $SOURCEIP
Code: |
if [[ $SOURCEIP != $SPAMAPPLIANCE ]]; then
$IPTABLES -t nat -A PREROUTING -i $OUTSIDE -p tcp -m tcp --dport 25 -j DNAT --to-destination $SPAMAPPLIANCE:25
$IPTABLES -t nat -A PREROUTING -i $INSIDE -p tcp -m tcp --dport 25 -j DNAT --to-destination $SPAMAPPLIANCE:25
else
$IPTABLES -A INPUT -i $OUTSIDE -d $SPAMAPPLIANCE -p tcp --dport 25 -j ACCEPT
$IPTABLES -A INPUT -i $INSIDE -s $LAN -p tcp --dport 25 -j ACCEPT
fi
|
_________________ Jake H.
jakeh_at_0dayinc.com
0day Inc. Network Security Consulting for the Future...
www.0dayinc.com |
|
Back to top |
|
|
|