]> git.ipfire.org Git - thirdparty/squid.git/commit - src/acl/ReplyMimeType.h
No-lookup DNS ACLs
authorChristos Tsantilas <chtsanti@users.sourceforge.net>
Sun, 27 Jan 2013 17:35:07 +0000 (19:35 +0200)
committerChristos Tsantilas <chtsanti@users.sourceforge.net>
Sun, 27 Jan 2013 17:35:07 +0000 (19:35 +0200)
commit33810b1da0e66536755dd31ad95a0aabf2167858
tree59fb85657dc9eafb3959c0c516e5d1768af37ce6
parent47a56efd5b5c8866e9fc88b7c55a3aa37b63eafb
No-lookup DNS ACLs

Currently, dst, dstdom, dstdom_regex (and other?) DNS-related ACLs do DNS
lookups if such a lookup is needed to convert an IP address into a domain name
or vice versa. This creates two kinds of problems:

 - It is difficult to identify requests that use raw IP addresses in Request-URI
   or Host headers. One would have to use something like url_regex and possibly
   req_header to identify those before using dst ACLs to match the request
   destination against a known IP subnet. IPv6 would only make this harder.

 - It is difficult to use dst* ACLs in options that support fast ACLs only.
   If an async lookup is required, the answer will be unpredictable (now)
   or DUNNO (when the ACL bugs are fixed), possibly with warnings and other
   complications.

This patch adds a -n option to dst, dstdom, dstdom_regex and other DNS-related
ACLs. The option disable lookups and address type conversions. If lookup or
conversion is required because the parameter type (IP or domain name) does not
match the message address type (domain name or IP), then the ACL with a -n
option would immediately declare a mismatch without any warnings or lookups.

The "--" option can be used to stop processing all options, in the case the
first acl value has '-' character as first character (for example the '-' is
a valid domain name)

For example:

    # Matches requests with full URI host set to localhost
    # but not requests with full URI host set to 127.0.0.1
    acl toLocalRawName dstdom -n localhost
    http_access allow toLocalRawName

    # Use -- option to stop processing flags
    acl AnACL dst_domain -n -- -cream-and-sugar.tumblr.com

    # Matches requests with full URI host set to 127.0.0.1
    # but not requests with full URI host set to localhost
    acl toLocalRawIp dst -n 127.0.0.1/32
    cache_peer_access peer1 allow toLocalRawIp

Please note that -n prohibits lookups in Squid's DNS caches as well.

This is a Measurement Factory project
59 files changed:
src/AclRegs.cc
src/ConfigParser.cc
src/ConfigParser.h
src/acl/Acl.cc
src/acl/Acl.h
src/acl/Asn.cc
src/acl/Certificate.cc
src/acl/Certificate.h
src/acl/DestinationAsn.h
src/acl/DestinationDomain.cc
src/acl/DestinationDomain.h
src/acl/DestinationIp.cc
src/acl/DestinationIp.h
src/acl/HierCode.cc
src/acl/HierCode.h
src/acl/HttpRepHeader.cc
src/acl/HttpRepHeader.h
src/acl/HttpReqHeader.cc
src/acl/HttpReqHeader.h
src/acl/Ip.cc
src/acl/Ip.h
src/acl/LocalPort.cc
src/acl/LocalPort.h
src/acl/Method.cc
src/acl/Method.h
src/acl/MyPortName.cc
src/acl/MyPortName.h
src/acl/PeerName.cc
src/acl/PeerName.h
src/acl/Protocol.cc
src/acl/Protocol.h
src/acl/ReplyHeaderStrategy.h
src/acl/ReplyMimeType.h
src/acl/RequestHeaderStrategy.h
src/acl/RequestMimeType.h
src/acl/ServerCertificate.cc
src/acl/ServerCertificate.h
src/acl/SourceAsn.h
src/acl/SourceDomain.cc
src/acl/SourceDomain.h
src/acl/SslError.cc
src/acl/SslError.h
src/acl/Strategised.h
src/acl/Strategy.h
src/acl/Tag.cc
src/acl/Tag.h
src/acl/Time.cc
src/acl/Time.h
src/acl/Url.cc
src/acl/Url.h
src/acl/UrlLogin.cc
src/acl/UrlLogin.h
src/acl/UrlPath.cc
src/acl/UrlPath.h
src/acl/UrlPort.cc
src/acl/UrlPort.h
src/cache_cf.cc
src/external_acl.cc
src/snmp_core.cc