[squid-users] question in :src/cf.data.pre "

Amos Jeffries squid3 at treenet.co.nz
Tue Dec 12 15:06:34 UTC 2017


On 13/12/17 03:31, --Ahmad-- wrote:
> as an example i want directives to be added automatically without adding them to squid.conf
> 
> look below :
> 
> acl ip1 myip 1.2.3.4
> http_access allow ip1
> http_port 6532
> 
> so above i want them to be added to squid.conf without add them there
> 
> so i run squid in terminal it will contact default squid.conf which has no config
> 
> but it will have the config above added automatically
> 
> make sense ?
> 

Sort of. See should be able to see how to add fixed default values for 
those directives are already being defined for how to add fixed values.

Your problem will be that the default config is loaded *before* Squid 
starts receiving traffic. The myip value is very dynamic and changes or 
only identifiable *after* Squid is fully running. It can even change 
between TCP connections arriving if the machines NIC assignments change.


Since your values are fixed at compile time and cannot be changed 
dynamically you may do better to have a squid.conf with those settings 
that gets loaded always and uses the include directive to load any other 
user configurable content.

Have a look at the way I'm doing separation between Squid packages 
config and admin config for Debian Squid-4 packages:
 
<https://alioth.debian.org/plugins/scmgit/cgi-bin/gitweb.cgi?p=pkg-squid/pkg-squid.git;a=commitdiff;h=3a068f640abdc87df8a767e8625289534c81ea69>
 
<https://alioth.debian.org/plugins/scmgit/cgi-bin/gitweb.cgi?p=pkg-squid/pkg-squid.git;a=commitdiff;h=586d19bb0ad644c6599407696a7a137af1575f93>


Amos


More information about the squid-users mailing list