All of lore.kernel.org
 help / color / mirror / Atom feed
* Redirect outgoing traffic
@ 2007-09-22  0:50 Dean Montgomery
  2007-09-22  1:59 ` Amos Jeffries
  2007-09-25  0:01 ` Martijn Lievaart
  0 siblings, 2 replies; 6+ messages in thread
From: Dean Montgomery @ 2007-09-22  0:50 UTC (permalink / raw)
  To: netfilter

We have a program for that allows teachers to turn off the Internet their
school classrooms.  Thea script shells into each workstations and blocks
outgoing traffic to any computer port 80, 8080, etc.

This works great.  However we would like something more end-user friendly.

I would like to change this so that the outgoing web traffic gets redirected
to a small web daemon that displays a message "The teacher has turned off the
internet".

Setting up the web daemon was easy.

However I do not know how to write an iptables firewall rule to redirect all
outgoing web traffic from the local workstation to a different ip and port.

e.g.
redirect any outgoing traffic to any ip on port 80,443,3128,8080 -to-
192.168.0.1 port 55580

Any ideas?


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Redirect outgoing traffic
  2007-09-22  0:50 Redirect outgoing traffic Dean Montgomery
@ 2007-09-22  1:59 ` Amos Jeffries
  2007-09-24 22:32   ` Dean Montgomery
  2007-09-25  0:01 ` Martijn Lievaart
  1 sibling, 1 reply; 6+ messages in thread
From: Amos Jeffries @ 2007-09-22  1:59 UTC (permalink / raw)
  To: netfilter

Dean Montgomery wrote:
> We have a program for that allows teachers to turn off the Internet their
> school classrooms.  Thea script shells into each workstations and blocks
> outgoing traffic to any computer port 80, 8080, etc.
> 
> This works great.  However we would like something more end-user friendly.
> 
> I would like to change this so that the outgoing web traffic gets redirected
> to a small web daemon that displays a message "The teacher has turned off the
> internet".
> 
> Setting up the web daemon was easy.
> 
> However I do not know how to write an iptables firewall rule to redirect all
> outgoing web traffic from the local workstation to a different ip and port.
> 
> e.g.
> redirect any outgoing traffic to any ip on port 80,443,3128,8080 -to-
> 192.168.0.1 port 55580
> 
> Any ideas?
> 

I think you will find it much easier to pass at least each classrooms 
traffic through a control point where all the 'fancy' configuration happens.

I'll admit to some bias being a Squid proxy developer. But take a good 
look at proxy software in general. They can do so much more for web 
traffic control based on many criteria than simple allow/deny at the 
firewall.


Amos Jeffries

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Redirect outgoing traffic
  2007-09-22  1:59 ` Amos Jeffries
@ 2007-09-24 22:32   ` Dean Montgomery
  0 siblings, 0 replies; 6+ messages in thread
From: Dean Montgomery @ 2007-09-24 22:32 UTC (permalink / raw)
  To: netfilter; +Cc: Amos Jeffries

Amos Jeffries wrote:
>
> I think you will find it much easier to pass at least each classrooms
> traffic through a control point where all the 'fancy' configuration
> happens.

We already have a proxy server running that captures all http traffic and 
filters it through dansguardian.

I would prefer to have an iptables rule on the client workstation to redirect 
http traffic to a different server.


e.g.
redirect any outgoing traffic to any ip on port 80,443,3128,8080 -to-
192.168.0.1 port 55580

I'm just looking for the right iptables syntax.

Thanks.




-- 
Dean Montgomery
Network Support Tech./Programmer
School District #73

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Redirect outgoing traffic
  2007-09-22  0:50 Redirect outgoing traffic Dean Montgomery
  2007-09-22  1:59 ` Amos Jeffries
@ 2007-09-25  0:01 ` Martijn Lievaart
  2007-09-26 23:46   ` Dean Montgomery
  1 sibling, 1 reply; 6+ messages in thread
From: Martijn Lievaart @ 2007-09-25  0:01 UTC (permalink / raw)
  To: Dean Montgomery; +Cc: netfilter

Dean Montgomery wrote:
> We have a program for that allows teachers to turn off the Internet their
> school classrooms.  Thea script shells into each workstations and blocks
> outgoing traffic to any computer port 80, 8080, etc.
>
> This works great.  However we would like something more end-user friendly.
>
> I would like to change this so that the outgoing web traffic gets redirected
> to a small web daemon that displays a message "The teacher has turned off the
> internet".
>
> Setting up the web daemon was easy.
>
> However I do not know how to write an iptables firewall rule to redirect all
> outgoing web traffic from the local workstation to a different ip and port.
>
> e.g.
> redirect any outgoing traffic to any ip on port 80,443,3128,8080 -to-
> 192.168.0.1 port 55580
>
> Any ideas?
>   

This can be done with a DNAT rule, if, and only if, the return traffic 
from the proxy goes back through the firewall. The syntax is trivial, 
use 'iptables -j DNAT -h' to get help on the syntax.

As the webdeamon is trivial, you can also set it up on the firewall 
itself. That way you don't have the issue with the return traffic.

For https do note that the client will always get an ugly certificate 
warning (certificate does not match requested name and probably a second 
one that the root certificate is not trusted). This cannot be helped 
(easily).

HTH,
M4


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Redirect outgoing traffic
  2007-09-25  0:01 ` Martijn Lievaart
@ 2007-09-26 23:46   ` Dean Montgomery
  2007-09-27  7:40     ` Gáspár Lajos
  0 siblings, 1 reply; 6+ messages in thread
From: Dean Montgomery @ 2007-09-26 23:46 UTC (permalink / raw)
  To: Martijn Lievaart, netfilter




On September 24, 2007, you wrote:
> Dean Montgomery wrote:
> > We have a program for that allows teachers to turn off the Internet their
> > school classrooms.  Thea script shells into each workstations and blocks
> > outgoing traffic to any computer port 80, 8080, etc.
> >
> > This works great.  However we would like something more end-user
> > friendly.
> >
> > I would like to change this so that the outgoing web traffic gets
> > redirected to a small web daemon that displays a message "The teacher has
> > turned off the internet".
> >
> > Setting up the web daemon was easy.
> >
> > However I do not know how to write an iptables firewall rule to redirect
> > all outgoing web traffic from the local workstation to a different ip and
> > port.
> >
> > e.g.
> > redirect any outgoing traffic to any ip on port 80,443,3128,8080 -to-
> > 192.168.0.1 port 55580
> >
> > Any ideas?
>
> This can be done with a DNAT rule, if, and only if, the return traffic
> from the proxy goes back through the firewall. The syntax is trivial,
> use 'iptables -j DNAT -h' to get help on the syntax.

Only problem with this is that I want the rule on the local workstation and 
not on the nat box.  DNAT table is not picked up by local traffic leaving the 
workstation.

So this does not work...
iptables -t nat -A PREROUTING -p tcp -m tcp --dport 80 -j 
DNAT --to-destination :48888



-- 
Dean Montgomery
Network Support Tech./Programmer
School District #73

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Re: Redirect outgoing traffic
  2007-09-26 23:46   ` Dean Montgomery
@ 2007-09-27  7:40     ` Gáspár Lajos
  0 siblings, 0 replies; 6+ messages in thread
From: Gáspár Lajos @ 2007-09-27  7:40 UTC (permalink / raw)
  To: Dean Montgomery, Netfilter list

Dean Montgomery írta:
> Only problem with this is that I want the rule on the local workstation and 
> not on the nat box.  DNAT table is not picked up by local traffic leaving the 
> workstation.
>
> So this does not work...
> iptables -t nat -A PREROUTING -p tcp -m tcp --dport 80 -j 
> DNAT --to-destination :48888
>
>   
But int the OUTPUT chain....
iptables -t nat -A OUTPUT -p tcp -m tcp --dport 80 -j DNAT ....

Swifty



^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2007-09-27  7:40 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-09-22  0:50 Redirect outgoing traffic Dean Montgomery
2007-09-22  1:59 ` Amos Jeffries
2007-09-24 22:32   ` Dean Montgomery
2007-09-25  0:01 ` Martijn Lievaart
2007-09-26 23:46   ` Dean Montgomery
2007-09-27  7:40     ` Gáspár Lajos

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.