Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I have setup this Squid config file and it seems to be doing the exact opposite of what I want. It is blocking traffic from 65.134.25.35 and 122.45.36.27. And allowing all other clients to connect on 80. Is that normal? My first time working with Squid. Note: real IPs have been slightly altered.

acl manager proto cache_object
acl localhost src 127.0.0.1/32 ::1
acl to_localhost dst 127.0.0.0/8 0.0.0.0/32 ::1

# Example rule allowing access from your local networks.
# Adapt to list your (internal) IP networks from where browsing
# should be allowed
#acl localnet src 10.0.0.0/8            # RFC1918 possible internal network
#acl localnet src 172.16.0.0/12         # RFC1918 possible internal network
#acl localnet src 192.168.0.0/16        # RFC1918 possible internal network
acl localhet src 197.202.60.0/24        # My Organization
acl localnet src 197.202.61.0/24        # My Organization
acl localnet src 197.202.62.0/24        # My Organization
acl localnet src 197.202.63.0/24        # My Organization
#acl localnet src fc00::/7               # RFC 4193 local private network range
#acl localnet src fe80::/10              # RFC 4291 link-local (directly plugged) machines

acl safe_ports port 80                  # http

acl CONNECT method CONNECT
acl allow dstdomain  .somecompany.com .anothercompany.com
acl all_others dst all
acl myclients src 65.134.25.35 122.45.36.27

# Recommended minimum Access Permission configuration:
# Only allow cachemgr access from localhost
http_access allow manager localhost
http_access deny manager

# Deny requests to certain unsafe ports
#http_access deny !safe_ports

# We strongly recommend the following be uncommented to protect innocent
# web applications running on the proxy server who think the only
# one who can access services on "localhost" is a local user
http_access deny to_localhost

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

# Disable Caching
cache deny all
#pass accelerated domains to the peer
# Example rule allowing access from your local networks.
# Adapt localnet in the ACL section to list your (internal) IP networks
# from where browsing should be allowed
http_access allow localnet
http_access allow localhost
# And finally deny all other access to this proxy
http_access allowed
http_access deny all_others
#http_access allow whitelist
http_access allow myclients
# Squid normally listens to port 3128
http_port 80
# We recommend you to use at least the following line.
hierarchy_stoplist cgi-bin ?
# Leave coredumps in the first cache dir
coredump_dir /var/spool/squid
# Add any of your own refresh_pattern entries above these.
refresh_pattern ^ftp:           1440    20%     10080
refresh_pattern ^gopher:        1440    0%      1440
refresh_pattern -i (/cgi-bin/|\?) 0     0%      0
refresh_pattern .               0       20%     4320
share|improve this question
add comment

2 Answers

up vote 1 down vote accepted

The order of the http_access lines in the squid.conf matters. You have the deny all_others applied before your allow myclients which is the ACL for 65.134.25.35. The http_access settings are processed in order. As soon as an ACL matches, the request will be allowed or denied, and rule processing will stop. The myclients ACL will never be do anything useful since everything is already denied. So you should move any ACLs you create above the comment # And finally deny....

# from where browsing should be allowed
http_access allow localnet
http_access allow localhost
#http_access allow whitelist
http_access allow myclients
# And finally deny all other access to this proxy
#http_access allowed
http_access deny all_others
share|improve this answer
    
Awesome. Thanks. Any thoughts on getting standard SSL to work? I want SSL to also work over 443. –  Tyndall Feb 22 '12 at 18:53
    
Sorry, but I don't what is your problem? Are you trying to connect to the squid box over SSL, or are you trying to access SSL web site t hrough the proxy, or what? Anyway, if you have another question, then you should ask another question. –  Zoredache Feb 22 '12 at 19:18
    
ok will do. It was to access those same 2 DNS name patterns over SSL on 443. But still only connect to the proxy via 80. –  Tyndall Feb 22 '12 at 20:10
    
Ah, in that case, then your issue is related to the safe_ports ACL. Right now it only allows port 80. If you want to allow connecting to other ports, then you'll want to include them as additional entries. –  Zoredache Feb 22 '12 at 21:17
    
If you allow port 443 does Squid know that this means https? or do you have to add another line to say that it is SSL traffic? +1 –  Tyndall Feb 23 '12 at 13:33
add comment

Those http_access lines are confused.

You're allowing access by localnet. then denying access to everybody, and then allowing individual clients again.

See this link on how to troubleshoot ACLs: http://wiki.squid-cache.org/SquidFaq/SquidAcl#I_set_up_my_access_controls.2C_but_they_don.27t_work.21__why.3F

share|improve this answer
    
also must be missing something else too - even with the fix I can get to other sites other than *.somecompany.com and *.anothercompany.com –  Tyndall Feb 22 '12 at 20:20
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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