0

I'm trying to setup squid on my computer to control the outgoing traffic from the same computer only. If my understanding is correct, squid runs as user "squid" on on most Linux distributions (mine is Fedora if it matters?).

I have setup iptables to drop all outgoing packets except those from uid 0 and uid 23 (root & squid).

:INPUT DROP [0:0]
:FORWARD DROP [0:0]
:OUTPUT DROP [0:0]
-A INPUT -i lo -j ACCEPT
-A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
-A INPUT -j DROP
-A FORWARD -j DROP
-A OUTPUT -m owner --uid-owner 0 -j ACCEPT
-A OUTPUT -m owner --uid-owner 23 -j ACCEPT
-A OUTPUT -j DROP
COMMIT

I then want to have to manually enter the squid proxy information into the browser for each local user account (so I don't think I'm after a transparent setup). If possible I would like a user/pass required to be able to connect to squid, so to prevent users having any access to the internet except via the squid proxy?

My current squid.conf is as follows, but it doesn't work at all, and obviously doesn't incorporate a user/pass requirement:

acl ssl_ports port 443
acl safe_ports port 80      # http
acl safe_ports port 21      # ftp
acl safe_ports port 443     # https
acl safe_ports port 70      # gopher
acl safe_ports port 210     # wais
acl safe_ports port 1025-65535  # unregistered ports
acl safe_ports port 280     # http-mgmt
acl safe_ports port 488     # gss-http
acl safe_ports port 591     # filemaker
acl safe_ports port 777     # multiling http
acl CONNECT method CONNECT
http_access deny !safe_ports
http_access deny CONNECT !ssl_ports
http_access allow localhost manager
http_access deny manager
http_access allow localhost
http_access deny all
http_port 3128
coredump_dir /var/spool/squid
refresh_pattern ^ftp:       1440    20% 10080
refresh_pattern ^gopher:    1440    0%  1440
refresh_pattern -i (/cgi-bin/|\?) 0 0%  0
refresh_pattern .   

Is what I'm trying to do achievable, and am I going about it the right way?

Will what I've done with iptables work?

I realize this is not something I'm going to learn to setup correctly in 10 minutes so any help/pointers to guides or even alternate solutions as to how to achieve this are all welcome?

0

You will likely need to open access to at least DNS for other programs.

Squid does have an authentication module, but you shouldn't need it in your case. As only squid can access the web all users will be force to use it.

Check the environment variables used to set up proxies and configure them globally. You should set http_proxy at least.

There is a wpad.dat mechanism for configuring proxies, but I haven't used it as you are intending.

I think you will find a lot of services use ports not listed, and the browsing experience will not be very good.

As you don't seem to be blocking any sites, it may be simpler just to limit the ports using iptables.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.