4.5 Access Controls

I'll have a lot to say about access controls in Chapter 6. For now, I'll cover a few controls so that more enthusiastic readers can quickly start using Squid.

Squid's default configuration file denies every client request. You must place additional access control rules in squid.conf before anyone can use the proxy. The simplest approach is to define an ACL that corresponds to your user's IP addresses and an access rule that tells Squid to allow HTTP requests from those addresses. Squid has many different ACL types. The src type matches client IP addresses, and the http_access rules are checked for client HTTP requests. Thus, you need to add only two lines:

acl MyNetwork src 192.168.0.0/16

http_access allow MyNetwork

The tricky part is putting these lines in the right place. The order of http_access lines is very important, but the order of acl lines doesn't matter. You should also be aware that the default configuration file contains some important access controls. You shouldn't change or disrupt these until you fully comprehend their significance. When you edit squid.conf for the first time, look for this comment:

#

# INSERT YOUR OWN RULE(S) HERE TO ALLOW ACCESS FROM YOUR CLIENTS

#

Insert your new rules below this comment, and before the http_access deny All line.

For the sake of completeness, here is a suitable initial access control configuration, including the recommended default controls and the example earlier:

acl All src 0/0

acl Manager proto cache_object

acl Localhost src 127.0.0.1/32

acl Safe_ports port 80 21 443 563 70 210 280 488 591 777 1025-65535

acl SSL_ports 443 563

acl CONNECT method CONNECT

acl MyNetwork src 192.168.0.0/16



http_access allow Manager Localhost

http_access deny Manager

http_access deny !Safe_ports

http_access deny CONNECT !SSL_ports

http_access allow MyNetwork

http_access deny All


    Appendix A. Config File Reference
     
    ASPTreeView.com
     
    Evaluation has ЅАґЖ»ХКexpired.
    Info...