How to invoke ClamAV adapter?

Asked by William Metcalf

I'm using libecap-0.2.0 and trying to use the clamav_adapter. I'm just unsure of how to invoke it. Using the following in my squid.conf...

loadable_modules /usr/local/lib/ecap_clamav_adapter.so
ecap_service eReqmod reqmod_precache 0 ecap://e-cap.org/ecap/services/clamav?mode=REQMOD
ecap_service eRespmod respmod_precache 0 ecap://e-cap.org/ecap/services/clamav?mode=RESPMOD
adaptation_service_set reqFilter eReqmod
adaptation_service_set respFilter eRespmod
adaptation_access respFilter allow all
adaptation_access reqFilter allow all

I get the following error when trying to start squid.

 /usr/local/squid/sbin/squid -N -f /etc/squid3/squid.conf
2011/03/29 21:49:22| ServiceConfig.cc(139) grokUri: squid.conf:62: empty adaptation service URI
FATAL: squid.conf:62: malformed adaptation service configuration
Squid Cache (Version 3.2.0.5-20110329): Terminated abnormally.
CPU Usage: 0.028 seconds = 0.008 user + 0.020 sys
Maximum Resident Size: 20960 KB
Page faults with physical i/o: 0

Anybody have any ideas? Removing the ?mode= from the service URI gives me the following warning in the cache.log.

2011/03/29 20:43:40| Warning: loaded eCAP service has no matching ecap_service config option: ecap://e-cap.org/ecap/services/clamav?mode=REQMOD
2011/03/29 20:43:40| Warning: loaded eCAP service has no matching ecap_service config option: ecap://e-cap.org/ecap/services/clamav?mode=RESPMOD
2011/03/29 20:43:40| Adaptation support is on
2011/03/29 20:43:40| WARNING: configured ecap_service was not loaded: ecap://e-cap.org/ecap/services/clamav
2011/03/29 20:43:40| WARNING: configured ecap_service was not loaded: ecap://e-cap.org/ecap/services/clamav

Question information

Language:
English Edit question
Status:
Solved
For:
eCAP Edit question
Assignee:
No assignee Edit question
Solved by:
Alex Rousskov
Solved:
Last query:
Last reply:
Revision history for this message
Best Alex Rousskov (rousskov) said :
#1

Squid parser is easily confused by '=' inside service URIs. When specifying the service URI, use the explicit uri=value syntax instead of an anonymous value. For example,

ecap_service eRespmod respmod_precache bypass=0 uri=ecap://e-cap.org/ecap/services/clamav?mode=RESPMOD

Revision history for this message
William Metcalf (william-metcalf) said :
#2

Great, works, thanks!

Revision history for this message
William Metcalf (william-metcalf) said :
#3

Thanks Alex Rousskov, that solved my question.

Revision history for this message
bellpeace (zvonimir-pavlinovic) said :
#4

I am new to ecap and I am wondering what does this service url actually do? I made my own adapter and have problems with loading the module: dying from an unhandled exception: file not found terminate called after throwing an instance of 'TextException'. I thought maybe this has to do something with service_url since I put bogus one.

Revision history for this message
Alex Rousskov (rousskov) said :
#5

Please start a new Answers thread for every new question.

The service URI allows the host application to match your service configuration with the service object. For example, in Squid, one squid.conf may contain 5 ecap_service lines and one loadable module may create 5 eCAP service objects. There needs to be a way to match configuration to services, and URIs are used for that. Also, URIs may have service parameters, but passing parameters to adapters is not their primary purpose.

You can hard-code any URI for your eCAP service object but please do not use host or domain names that you do not control, to avoid clashes with other services and general confusion. Make sure your host application configuration and your code use the same service URI.

Revision history for this message
bellpeace (zvonimir-pavlinovic) said :
#6

Ok, I am not going to put it now in a new thread, but if you think it is necessary, please put it there. I am a bit confused with this configuration file. As far as I've searched, I encountered just squid's configuration file, like stated here: http://wiki.squid-cache.org/Features/eCAP.
Is there an example of how should ecap configuration file look like and what is the syntax generally? Key value pairs? Since "configure" and "reconfigure" are empty, can configuration file be empty? What kind of server should I have for this service, is http enough, because it doesn't seem so since you cannot get access to any of example service's uris.

Thanks for help and understanding!