From eliezer at ngtech.co.il Tue Sep 15 20:32:12 2015 From: eliezer at ngtech.co.il (Eliezer Croitoru) Date: Tue, 15 Sep 2015 23:32:12 +0300 Subject: Samples build failure on CentOS7 Message-ID: <55F8804C.4050003@ngtech.co.il> Hey, I have tried to build the libecap examples modules from: http://www.measurement-factory.com/tmp/ecap/ecap_adapter_sample-1.0.0.tar.gz I have compiled the next version as a RPM: http://www.measurement-factory.com/tmp/ecap/libecap-1.0.0.tar.gz Based on fedora RPM and build squid based on the packages. Squid build fine but When I try to build the example files I am getting a compilation build. The configure log: http://paste.ngtech.co.il/pv4ylzu5s The make error log: http://paste.ngtech.co.il/ptg3tsgus I Want to first try and build the samples and then build a simple url_rewrite module or something similar to use with for url filtering. I have not seen such an example so I would like to to try and write one. Thanks, Eliezer From rousskov at measurement-factory.com Tue Sep 15 20:47:19 2015 From: rousskov at measurement-factory.com (Alex Rousskov) Date: Tue, 15 Sep 2015 14:47:19 -0600 Subject: Samples build failure on CentOS7 In-Reply-To: <55F8804C.4050003@ngtech.co.il> References: <55F8804C.4050003@ngtech.co.il> Message-ID: <55F883D7.40808@measurement-factory.com> On 09/15/2015 02:32 PM, Eliezer Croitoru wrote: > Squid build fine but When I try to build the example files I am getting > a compilation build. > The configure log: > http://paste.ngtech.co.il/pv4ylzu5s > > The make error log: > http://paste.ngtech.co.il/ptg3tsgus The sample async adapter does not include a unistd.h header that is required on some platforms. Please use the attached patch to fix this compilation bug. Thank you, Alex. -------------- next part -------------- A non-text attachment was scrubbed... Name: sleep-requires-unistd.patch Type: text/x-diff Size: 564 bytes Desc: not available URL: From eliezer at ngtech.co.il Wed Sep 16 19:19:56 2015 From: eliezer at ngtech.co.il (Eliezer Croitoru) Date: Wed, 16 Sep 2015 22:19:56 +0300 Subject: Example for a working(but not really perfect) ECAP module. Message-ID: <55F9C0DC.7070006@ngtech.co.il> Hey, With Alex help I was able to track my way and write an ECAP module that is based on the sample adapters. The code is at: http://paste.ngtech.co.il/p0nsaq6lb I will describe the functionality: I have an ACL server which works per url. So each request that is being tested by the module is being tested using HTTP based on curl library against the ACL server. The module then defaults to allow the request unless the ACL server response with an "ERR" at the beginning of the response. I must admit that on my tests the ECAP module based on the libcurl is performing slower then an external_acl I wrote in golang. The reasons for the slow operations are unknown and needs better testing. Settings that are being used with the helper in squid: ##ECAP TESTS SETTINGS loadable_modules /usr/local/lib/ecap_adapter_minimal.so ecap_enable on ecap_service ecapModifier reqmod_precache uri=ecap://e-cap.org/ecap/services/sample/minimal adaptation_access ecapModifier allow all ##END From unknown reason I was unable to use the squid debugging and have used syslog for that. TODO: - add a debug variable - add reconfiguring methods - test what is slowing down the service - Test and try with memcached - Test and try with TokyoCabinet - Test and try with Mysql - Test and try to work with Redis - Test and try work with LDAP This module is an equivalent of external_acl helper which uses only the url to test couple things. I am missing the understanding of how to get the request IP or any other details which are out of the scope of the request itself. This module structure might be good for something like: - Session helper - url filtering - ACL module - Authorization helpers(radius, mysql, ldap etc) The code comes from me which is not a c++ expert and there for I missed lots of things. To build the module you need to put the code in the examples src/adapter_minimal.cc file and then compile it with a special lib for curl which means that the steps to build are: $ LIBS="-lcurl" ./configure $ make $ make install Notice that an ecap module unlike external_acl helper, doesn't implements cache by default and there for works slower in some cases. In some cases is not recommended unless some caching is implemented inside the module. Eliezer