Continued Squid Chinese authoritative guide-Linux Enterprise Application-Linux server application information. The following is a detailed description. Ess allow A B
This rule is never correct, because a source IP address cannot be equivalent to 1.2.3.4 and 5.6.7.8 at the same time. The true intention of this rule is:
Acl A src 1.2.3.4 5.6.7.8
Http_access allow
The matching algorithm for an ACL value is that the search ends when squid finds a matching rule in the access list. If no access rule causes a match, the default action is the inverse of the last rule in the list. For example, consider the following simple access configuration:
Acl Bob ident bob
Http_access allow Bob
If the user Mary initiates a request, she will be rejected. The last (unique) rule in the list is the allow rule, which does not match the user name mary. In this way, the default action is allow's inverse, so the request is rejected. Similarly, if the last rule is deny, the default action is to allow requests. It is a good practice to add one at the end of the access list to explicitly allow or reject all requests. For clarity, the previous example should be written as follows:
Acl All src 0/0
Acl Bob ident bob
Http_access allow Bob
Http_access deny All
Src 0/0 ACL indicates that each request matches any type.
6.2.3 access list Style
Squid's access control syntax is very powerful. In most cases, you can do the same in two or more ways. Generally, you should put more specific and restricted access lists first. For example, the following statement is not very good:
Acl All src 0/0
Acl Net1 src 1.2.3.0/24
Acl Net2 src 1.2.4.0/24
Acl Net3 src 1.2.5.0/24
Acl Net4 src 1.2.6.0/24
Acl WorkingHours time-
Http_access allow Net1 WorkingHours
Http_access allow Net2 WorkingHours
Http_access allow Net3 WorkingHours
Http_access allow Net4
Http_access deny All
If you write like this, the access control list will be easier to maintain and understand:
Http_access allow Net4
Http_access deny! WorkingHours
Http_access allow Net1
Http_access allow Net2
Http_access allow Net3
Http_access deny All
At any time, you write a rule with two or more ACL elements. We recommend that you keep up with the opposite and broader rule. For example, if the default squid configuration rejects cache Management requests from non-local IP addresses, you may try to write:
Acl CacheManager proto cache_object
Acl Localhost src 127.0.0.1
Http_access deny CacheManager! Localhost
However, the problem here is that you did not allow indeed local cache management requests. Subsequent rules may cause the request to be rejected. The following rules cause problems:
Acl CacheManager proto cache_object
Acl Localhost src 127.0.0.1
Acl MyNet 10.0.0.0/24
Acl All src 0/0
Http_access deny CacheManager! Localhost
Http_access allow MyNet
Http_access deny All
Since the request from the local machine does not match MyNet, it is rejected. A better way to write this rule is:
Http_access allow CacheManager localhost
Http_access deny CacheManager
Http_access allow MyNet
Http_access deny All
6.2.4 latency check
Some ACLs cannot be checked during a process because necessary information is unavailable. Ident, dst, srcdomain, and proxy_auth belong to this category. When squid encounters an ACL that cannot be checked, it delay determines and publishes a query (IP address, domain name, user name, etc.) for necessary information ). When information is available, squid checks the rules at the beginning of the list again. It does not continue from the rest of the previous check. If possible, you should place these most likely delayed ACLs at the top of the rule to avoid unnecessary and repeated checks.
Because the delay is too costly, squid will cache the information obtained by the query as much as possible. Ident queries occur in each connection, rather than in each request. This means that when you use ident to query, continuous HTTP connections will benefit you. The Host Name and IP address of the DNS response are also cached, unless you use an earlier external dnsserver process. Agent Verification
Certificate Information is cached. See section 6.1.2.12.
6.2.5 slow-down and acceleration Rule Check
Squid internally considers that some access rules are quickly checked, while others are slowed down. The difference is whether squid delays its decision to wait for additional information. In other words, when squid queries additional information, a slow check will be delayed. For example:
+ Reverse DNS query: Host Name of the customer IP Address
+ RFC 1413 ident query: User Name of the customer's TCP Connection
+ Validators: Verify user credit
+ DNS forwarding query: IP address of the original server
+ User-defined external ACL
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.
A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service