Koozali.org: home of the SME Server

to block outgoing traffic (http + https) for specific IPs on local network

Offline mdo

  • *
  • 355
  • +0/-0
We would like to block outgoing traffic on port 80 (http) and 443 (https) for specific IPs on the local network.

I don't believe that there is neither a contrib to allow to do that nor a db configuration to achieve this easily (or am I wrong here?). I searched but it seems the discussions in the past were to block outgoing traffic on specific ports for the whole local network, not to select by IP.

Is there any know solution to this available? any pointers?

Thanks,
Michael
...

Offline byte

  • *
  • 2,183
  • +2/-0
Re: to block outgoing traffic (http + https) for specific IPs on local network
« Reply #1 on: February 19, 2008, 11:11:49 AM »
Is there any know solution to this available? any pointers?

I do this using squid ACL's very successfully, have a look here:

http://www.squid-cache.org/Versions/v2/2.6/cfgman/

Key thing to remember is to make sure you have your ACL's in the right order otherwise they won't work how you think they should.
--[byte]--

Have you filled in a Bug Report over @ http://bugs.contribs.org ? Please don't wait to be told this way you help us to help you/others - Thanks!

Offline mdo

  • *
  • 355
  • +0/-0
Re: to block outgoing traffic (http + https) for specific IPs on local network
« Reply #2 on: February 19, 2008, 06:47:03 PM »
Thank you for your answer.

We have tested with squid ACLs on SME 7.3 and there was no problem to achieve our blocking for specific IPs for http (port 80) but squid (version 2.5-stable14.xxx) on SME 7.3 does NOT take care about https traffic at all and that was the shortcoming.

Your link points to a squid version 2.6 configuration file which mentions an "https_port" and the requirement to "--enable-ssl". I searched for https_port on squid-2.5 and it looks like this would be possible to enable - and I am surprised.

I thought squid and https together (for whatever reasons) would not be possible and that would be the reason why SME in its standard configuration never uses to proxy https traffic. Maybe it is easier then I thought and I just have to look to enable https proxying and do my testing with ACLs then again?

Thanks again for the pointer. I will do some testing and report back here. If someone else knows the answer to my new question (why does SME in its standard configuration does NOT use squid for https tarffic proxying where it does it so nicely for http traffic?) I would be very curious.

Thanks,
Michael



...

Offline arne

  • *****
  • 1,116
  • +0/-4
Re: to block outgoing traffic (http + https) for specific IPs on local network
« Reply #3 on: February 19, 2008, 10:19:11 PM »
For Squid proxy off:

iptables -I FORWARD -i eth0 -s 192.168.10.10 -p tcp --dport 80 -j DROP
iptables -I FORWARD -i eth0 -s 192.168.10.10 -p tcp --dport 443 -j DROP

For Squid proxy on:

iptables -I INPUT -i eth0 -s 192.168.10.10 -p tcp --dport 80 -j DROP
iptables -I INPUT -i eth0 -s 192.168.10.10 -p tcp --dport 443 -j DROP

(Allmost. There could be some issues about the sqid proxy on and 443.)

......

Offline CharlieBrady

  • *
  • 6,918
  • +3/-0
Re: to block outgoing traffic (http + https) for specific IPs on local network
« Reply #4 on: February 19, 2008, 10:46:51 PM »
Thanks again for the pointer. I will do some testing and report back here. If someone else knows the answer to my new question (why does SME in its standard configuration does NOT use squid for https tarffic proxying where it does it so nicely for http traffic?)

SME doesn't do anything unless someone at some stage cared enough about the issue to "make it so". So that's the most general answer to your question.

AFAIK, squid in SME has always been able to proxy https connections via the CONNECT method. Just configure your browser, and it will use the proxy.

squid cannot, however, do transparent proxy for https traffic. If you think about it, I'm sure you'll see why that is the case.

Offline cactus

  • *
  • 4,880
  • +3/-0
    • http://www.snetram.nl
Re: to block outgoing traffic (http + https) for specific IPs on local network
« Reply #5 on: February 21, 2008, 04:33:17 PM »
squid cannot, however, do transparent proxy for https traffic. If you think about it, I'm sure you'll see why that is the case.
Otherwise here is a clue: http://www.faqs.org/docs/Linux-mini/TransparentProxy.html#ss2.3 :-)
Be careful whose advice you buy, but be patient with those who supply it. Advice is a form of nostalgia, dispensing it is a way of fishing the past from the disposal, wiping it off, painting over the ugly parts and recycling it for more than its worth ~ Baz Luhrmann - Everybody's Free (To Wear Sunscreen)

Offline mmccarn

  • *
  • 2,651
  • +10/-0
Re: to block outgoing traffic (http + https) for specific IPs on local network
« Reply #6 on: February 22, 2008, 04:12:22 PM »
Here's a bug entry with some code that can be used to block outgoing traffic: http://bugs.contribs.org/show_bug.cgi?id=2977

Offline raem

  • *
  • 3,972
  • +4/-0
Re: to block outgoing traffic (http + https) for specific IPs on local network
« Reply #7 on: February 23, 2008, 05:05:01 AM »
mmccarn

Quote
Here's a bug entry with some code that can be used to block outgoing traffic: http://bugs.contribs.org/show_bug.cgi?id=2977

Which is more neatly documented here
http://wiki.contribs.org/Firewall#Block_outgoing_ports
...

Offline mdo

  • *
  • 355
  • +0/-0
Re: to block outgoing traffic (http + https) for specific IPs on local network
« Reply #8 on: February 25, 2008, 07:07:01 PM »
Thank you for all the hints and suggestions which challenged me to try to understand better how squid as a proxy works in an SME server environment. I must have taken for 'granted' the transparent proxy feature without understanding this properly.

What I wanted to achieve (to block web access completely for specific IPs on the local network) I would like to do via squid ACLs.
For this to work flexible, I now want to "enforce" a proxy setup on each PC on the LAN rather then using the transparent proxy at all, I am even thinking of disabling the transparent proxy (on port 80) and to enforce web access through port 3128 only.

The 'wpad.dat' feature, built into DHCP looks promising for this (http://bugs.contribs.org/show_bug.cgi?id=3512) which I will try (and report back to the bug if I figure it out how it exactly should work).
...