Specifying multiple acl conditions on one acl line of squid.conf

access-control-listsquid

In squid I need to combine acl conditions in one line:
e.g.
acl allowed_conn src 10.40.50.5 && dstdomain intranet.loc
acl allowed_conn src 10.40.50.6 && dstdomain anothersite.net

I know that I could instead define two like so:
acl allow_src src 10.40.50.5
acl allow_domain intranet.loc

And then I could do:
http_access allow allow_src allow_domain
but in this way I will need to create new http_access lines for different acl combinations. I would like to have one http_access line like so:
http_access allow allowed_conn

Best Answer

Unfortunately, the fixed AND/OR logic of Squid's ACL list means that you can only implement an AND condition on the access line, not on the ACL line:

You've probably noticed (and been frustrated by) the fact that you cannot combine access controls with terms like "and" or "or." These operations are already built in to the access control scheme in a fundamental way which you must understand.

All elements of an acl entry are OR'ed together.
All elements of an access entry are AND'ed together

Is there some real reason you can't do it this way?

Related Topic