Search squid archive

External ACL with an HTTP reply header format doesn't

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

First of all my setup information
Distribution: CentOS Linux release 7.0.1406 (Core)
Kernel Version: Linux 3.10.0-123.8.1.el7.x86_64 x86_64
RPM Package Version: squid-3.3.8-12.el7_0.x86_64
Squid Cache: Version 3.3.8
configure options:  '--build=x86_64-redhat-linux-gnu' '--host=x86_64-redhat-linux-gnu' '--program-prefix=' '--prefix=/usr' '--exec-prefix=/usr' '--bindir=/usr/bin' '--sbindir=/usr/sbin' '--sysconfdir=/etc' '--datadir=/usr/share' '--includedir=/usr/include' '--libdir=/usr/lib64' '--libexecdir=/usr/libexec' '--sharedstatedir=/var/lib' '--mandir=/usr/share/man' '--infodir=/usr/share/info' '--disable-strict-error-checking' '--exec_prefix=/usr' '--libexecdir=/usr/lib64/squid' '--localstatedir=/var' '--datadir=/usr/share/squid' '--sysconfdir=/etc/squid' '--with-logdir=$(localstatedir)/log/squid' '--with-pidfile=$(localstatedir)/run/squid.pid' '--disable-dependency-tracking' '--enable-eui' '--enable-follow-x-forwarded-for' '--enable-auth' '--enable-auth-basic=DB,LDAP,MSNT,MSNT-multi-domain,NCSA,NIS,PAM,POP3,RADIUS,SASL,SMB,getpwnam' '--enable-auth-ntlm=smb_lm,fake' '--enable-auth-digest=file,LDAP,eDirectory' '--enable-auth-negotiate=kerberos' '--enable-external-acl-helpers=file_userip,LDAP_group,time_quota,session,unix_group,wbinfo_group' '--enable-cache-digests' '--enable-cachemgr-hostname=localhost' '--enable-delay-pools' '--enable-epoll' '--enable-icap-client' '--enable-ident-lookups' '--enable-linux-netfilter' '--enable-removal-policies=heap,lru' '--enable-snmp' '--enable-ssl' '--enable-ssl-crtd' '--enable-storeio=aufs,diskd,ufs' '--enable-wccpv2' '--enable-esi' '--enable-ecap' '--with-aio' '--with-default-user=squid' '--with-filedescriptors=16384' '--with-dl' '--with-openssl' '--with-pthreads' 'build_alias=x86_64-redhat-linux-gnu' 'host_alias=x86_64-redhat-linux-gnu' 'CFLAGS=-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches   -m64 -mtune=generic -fpie' 'LDFLAGS=-Wl,-z,relro  -pie -Wl,-z,relro -Wl,-z,now' 'CXXFLAGS=-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches   -m64 -mtune=generic -fpie' 'PKG_CONFIG_PATH=%{_PKG_CONFIG_PATH}:/usr/lib64/pkgconfig:/usr/share/pkgconfig'


I'm currently working in a external acl (python based) to get the Source IP and the HTTP Reply Content-Type header
in order to make a mime based filter based on the source ip (client ip) with a database backend.
As the documentation for external_acl_type[1] says, i just need to use the format %<{Header}, for my specific
need it should be%<h{Content-Type} (added the "h" because after running squid -k parse it states that i should use
this form instead of the one described in the documentation).
But after some testing it doesn't work...

So m defining it in squid.conf like (Lower TTL's only for testing purposes):
------ relevant lines /etc/squid/squid.conf ------
external_acl_type testfilter ttl=120 negative_ttl=120 children-max=5 children-idle=1 ipv4 %SRC %<h{Content-Type} /usr/bin/python -u /external_acl/test.py
acl test_filter external testfilter
http_reply_access deny test_filter
------ relevant lines /etc/squid/squid.conf ------

Considering that testfilter is simple a python script to log everything to %ea:
------ /external_acl/test.py ------
#!/usr/bin/python -u
import sys
from urllib import quote

EOF = False
while not EOF:
    line = sys.stdin.readline()
    if not line:
        EOF = True
        continue
   
    sys.stdout.write('{0} log={1}\n'.format('ERR', quote(line)))

------ /external_acl/test.py ------

After configuring the logs everything is working fine except that the Content-Type is never presented to the external ACL
it always show "-" instead of text/html as you can see in this example log line (squid format + %ea):
1416507449.579    814 10.0.0.100 TCP_MISS/200 8823 GET http://www.squid-cache.org/ - HIER_DIRECT/77.93.254.178 text/html 10.0.0.100%20-%0A

After testing with other reply headers, not a single one is working (even the very common date or server reply header) all send the same "-"
to the external_acl.

So someone here managed to workout this? or have a different solution for the same problem? or is it bug in squid? or in the package provided by centos?

Kindest Regards
_______________________________________________
squid-users mailing list
squid-users@xxxxxxxxxxxxxxxxxxxxx
http://lists.squid-cache.org/listinfo/squid-users

[Index of Archives]     [Linux Audio Users]     [Samba]     [Big List of Linux Books]     [Linux USB]     [Yosemite News]

  Powered by Linux