[squid-users] Define and use a variable in squid.conf (Was: What happens when duplicate external_acl_type are mentioned)

Amish anon.amish at gmail.com
Sun Dec 2 04:31:28 UTC 2018


On 02/12/18 9:33 am, Alex Rousskov wrote:
>
> To reduce long-term headaches, I think we should be strict and deprecate
> (and then prohibit) ignoring duplicated external_acl_type declarations.
>
> I do not see any good reasons for ignoring this configuration error
> forever. FWIW, the use case discussed in this thread is not a good
> reason IMO because Squid configuration in question can and should be
> easily generated (probably from a stable template) to correctly
> accommodate the needs of the current authentication method.
>

Thank you for your clarification.

Now I am looking for alternate ways I can resolve my issue.

Does squid allow defining a variable and using it as argument or macro?

For example:

File: pre.conf
----------------
define proxyauth 0
#auth_param basic program /usr/lib/squid/basic_db_auth <arguments>


File: main.conf:
------------------
include pre.conf
external_acl_type ipuser queue-size=40 ttl=120 children-max=1 
children-startup=1 concurrency=20 %>a %variable{proxyauth} 
/usr/lib/squid/ip_to_user
# OR alternate form
# external_acl_type ipuser queue-size=40 ttl=120 children-max=1 
children-startup=1 concurrency=20 %>a /usr/lib/squid/ip_to_user 
--proxyauth %variable{proxyauth}


So if I want to use proxyauth I can uncomment auth_param line and change 
proxyauth to 1. ip_to_user will be smart enough to then act accordingly.

The reason I cant change main.conf directly is because its a 
standardized packaged file and gets overwritten every time package is 
updated.

This "define" feature can also have several other use in future.

Thank you,

Amish.


More information about the squid-users mailing list