[Webinar] Streamline your web hosting managementRegister Today

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 832
  • Last Modified:

p3scan iptables rules

hello,

May you know the http://p3scan.sourceforge.net/ project. It is a transperent pop3 proxy which use iptables to redirect tcp packets to port 8110 and run virus scanning. This port is p3scan own. The readme say: in the default case we can use the next iptables rule: "iptables -t nat -A PREROUTING -p tcp -i eth0 --dport pop3 -j REDIRECT --to 8110" and it's works fine when a packet coming from some clients from our local network. But I want to set up an another iptables rule, which say the next: if our linux gw (the p3scan runing on this server too) want to download our mails so that will be redirect to the port 8110 too.

thanks your help!
0
Kosztik
Asked:
Kosztik
  • 2
2 Solutions
 
brabardCommented:
Well , the core of iptables rules that redirect some requests by ports/services is to catch the requests before leaving the gateway , so you can try -o eth1 in OUTPUT chain , assuming eth1 is the interface that connect you to the Internet .

Tommorow I will try it with my pop3vscan .
0
 
Alf666Commented:
You can not do that. This would create a loop.

You need your linux box to be able to connect to POP3 servers on the internet. If you add a rule on the OUTPUT, then your p3scan will connect to itself. BAD !

The only thing you can do is to configure your clients on the gateway to connect directly to port 8110.
0
 
brabardCommented:
Alf666 is absolutely right , the use of this rule will maka e loop , but the answer is in the bottom of README file of my pop3vscan distribution . Assuming p3scan is running as a special user , the rules have to be :
iptables -t nat -A OUTPUT -p tcp --dport pop3 -m owner --uid-owner UID -j ACCEPT
iptables -t nat -A OUTPUT -p tcp --dport pop3 -j REDIRECT --to 8110

0
 
KosztikAuthor Commented:
>  , but the answer is in the bottom of README file of my >pop3vscan distribution

oh really! Thank you !!!
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now