<div dir="ltr"><div><div><div><div><div><div><div><div>Hi,<br><br></div><div>First of all my setup information<br></div><div>Distribution: CentOS Linux release 7.0.1406 (Core)<br></div><div>Kernel Version: Linux 3.10.0-123.8.1.el7.x86_64 x86_64<br>RPM Package Version: squid-3.3.8-12.el7_0.x86_64<br></div><div>Squid Cache: Version 3.3.8<br>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'<br></div><div><br></div><div><br></div>I'm currently working in a external acl (python based) to get the Source IP and the HTTP Reply Content-Type header<br></div><div>in order to make a mime based filter based on the source ip (client ip) with a database backend.<br></div><div>As the documentation for external_acl_type[1] says, i just need to use the format %<{Header}, for my specific<br>need it should be%<h{Content-Type} (added the "h" because after running squid -k parse it states that i should use<br>this form instead of the one described in the documentation).<br></div><div>But after some testing it doesn't work...<br></div><br></div>So m defining it in squid.conf like (Lower TTL's only for testing purposes):<br>------ relevant lines /etc/squid/squid.conf ------<br>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<br>acl test_filter external testfilter<br>http_reply_access deny test_filter<br>------ relevant lines /etc/squid/squid.conf ------<br><br></div>Considering that testfilter is simple a python script to log everything to %ea:<br>------ /external_acl/test.py ------<br>#!/usr/bin/python -u<br>import sys<br>from urllib import quote<br><br>EOF = False<br>while not EOF:<br> line = sys.stdin.readline()<br> if not line:<br> EOF = True<br> continue<br> <br> sys.stdout.write('{0} log={1}\n'.format('ERR', quote(line)))<br><br>------ /external_acl/test.py ------<br><br></div>After configuring the logs everything is working fine except that the Content-Type is never presented to the external ACL<br>it always show "-" instead of text/html as you can see in this example log line (squid format + %ea):<br>1416507449.579 814 10.0.0.100 TCP_MISS/200 8823 GET <a href="http://www.squid-cache.org/" target="_blank">http://www.squid-cache.org/</a> - HIER_DIRECT/<a href="http://77.93.254.178" target="_blank">77.93.254.178</a> text/html 10.0.0.100%20-%0A<br><br></div>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 "-"<br>to the external_acl.<br><br></div>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?<br><br></div>Kindest Regards<br><div><div><div><div><div><div><div><div><div><div><div><br>[1] <a href="http://www.squid-cache.org/Versions/v3/3.3/cfgman/external_acl_type.html" target="_blank">http://www.squid-cache.org/Versions/v3/3.3/cfgman/external_acl_type.html</a><br>-- <br><div><div dir="ltr">Jorge Iván Burgos Aguilar<br></div></div>
</div></div></div></div></div></div></div></div></div></div></div></div>