Squid mit ClamAV

Aus xinux.net
Zur Navigation springen Zur Suche springen

Sachen installieren

apt-get install squid3 clamav libclamav-dev make gcc

icap herunterladen und installieren

http://sourceforge.net/project/showfiles.php?group_id=123427
tar -xzf ...
./configure --enable-static --with-clamav --prefix=/usr/local/icap
make
make install

Gruppe nobody für icap erstellen, falls diese nicht existiert

groupadd nobody

Konfiguration von c_icap /usr/local/icap/etc/c-icap.conf man ändert “User wwwrun” zu “User proxy” und fügt am Ende der Config folgende Zeilen ein:

acl localsquid_respmod src 127.0.0.1 type respmod
acl localsquid src 127.0.0.1
acl externalnet src 0.0.0.0/0.0.0.0
icap_access allow localsquid_respmod
icap_access allow localsquid
icap_access deny externalnet

Squid-Konfiguration:

icap_enable on
icap_preview_enable on
icap_preview_size 128
icap_send_client_ip on
#icap_send_auth_user on
icap_send_auth_username on
#icap_auth_scheme Local://%u
icap_service service_avi_req reqmod_precache 0 icap://localhost:1344/srv_clamav
icap_service service_avi respmod_precache 1 icap://localhost:1344/srv_clamav
#icap_class class_antivirus service_avi service_avi_req
#icap_access class_antivirus allow all 
icap_class class_antivirus service_avi
icap_access class_antivirus allow all !lan
icap_class class_antivirus_req service_avi_req
icap_access class_antivirus_req allow all

noch die acl lan mit dem Lokalen Netzwerk konfigurieren

acl lan  dst 192.168.240.0/20

damit lokale Sachen und vor allem die heruntergeladenen Dateien vom Proxy nicht über icap laufen

Download-Verzeichnis von heruntergeladenen Dateien in (/usr/local/icap/etc/c-icap.conf) gegebenenfalls erstellen und am besten Rechte 777 vergeben. :

srv_clamav.VirSaveDir /var/www/downloads

Die Datei get_file.pl aus dem Sourcenverzeichnis in contrib nach /usr/lib/cgi-bin kopieren

cp /usr/src/c_icap-060708rc1/contrib/get_file.pl /usr/lib/cgi-bin/

nicht vergessen die Datei ausführbar zu machen

chmod +x /usr/lib/cgi-bin/get_file.pl

und in der Datei die Filevariable umbenennen

vi /usr/lib/cgi-bin/get_file.pl
$filename="/var/www/downloads/"


Fehlermeldungen

beim configure von c_icap

configure: error: no acceptable C compiler found in $PATH

Es muss ein C Compiler inkl. Abhängigkeiten installiert werden:

apt-get install gcc
inklusiv Abhängigkeiten

checking for C compiler default output file name… configure: error: C compiler cannot create executables G++ inkl. Abhängigkeiten installieren

apt-get install g++
-bash: make: command not found

make inkl. Abhängigkeiten installieren

apt-get install make

bei make von c_icap

srv_clamav.c:27:20: error: clamav.h: No such file or directory
srv_clamav.c:121: error: invalid use of undefined type ’struct cl_limits’

clam Antivirus library development files müssen installiert werden

apt-get install libclamav-dev

bei make install von c_icap

chgrp nobody /usr/local/icap/var/log/
chgrp: ungültige Gruppe nobody

Gruppe nobody anlegen und make install erneut ausführen

groupadd nobody
make install

Vorlage:HOWTO