diff --git a/README.md b/README.md index e898d3e..5a2d6cc 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,4 @@ # squidclamav +SquidClamAv is a dedicated ClamAV antivirus redirector for Squid. It can run antivirus checks based on filename regex, content-type regex, and more. It is easy to install and works even with heavy Squid access. + diff --git a/squidclamav-6.10-config.patch b/squidclamav-6.10-config.patch new file mode 100644 index 0000000..5374e2f --- /dev/null +++ b/squidclamav-6.10-config.patch @@ -0,0 +1,23 @@ +diff -Nru squidclamav-6.10.orig/etc/squidclamav.conf squidclamav-6.10/etc/squidclamav.conf +--- squidclamav-6.10.orig/etc/squidclamav.conf 2012-10-27 17:35:50.000000000 +0200 ++++ squidclamav-6.10/etc/squidclamav.conf 2013-03-27 19:49:41.902943626 +0100 +@@ -14,16 +14,16 @@ + maxsize 5000000 + + # When a virus is found then redirect the user to this URL +-redirect http://proxy.domain.dom/cgi-bin/clwarn.cgi ++redirect http://localhost/cgi-bin/squidclamav/clwarn.cgi + + # Path to the squiGuard binary if you want URL filtering, note that you'd better + # use the squid configuration directive 'url_rewrite_program' instead. +-#squidguard /usr/local/squidGuard/bin/squidGuard ++#squidguard /usr/bin/squidGuard + + # Path to the clamd socket, use clamd_local if you use Unix socket or if clamd + # is listening on an Inet socket, comment clamd_local and set the clamd_ip and + # clamd_port to the corresponding value. +-clamd_local /var/run/clamav/clamd.ctl ++clamd_local /var/run/clamav/clamd.socket + #clamd_ip 192.168.1.5,127.0.0.1 + #clamd_port 3310 + diff --git a/squidclamav-6.2-cgi-it_IT.patch b/squidclamav-6.2-cgi-it_IT.patch new file mode 100644 index 0000000..f4f7795 --- /dev/null +++ b/squidclamav-6.2-cgi-it_IT.patch @@ -0,0 +1,52 @@ +diff -Nru squidclamav-6.2.orig//cgi-bin/clwarn.cgi.it_IT squidclamav-6.2/cgi-bin/clwarn.cgi.it_IT +--- squidclamav-6.2.orig//cgi-bin/clwarn.cgi.it_IT 1970-01-01 01:00:00.000000000 +0100 ++++ squidclamav-6.2/cgi-bin/clwarn.cgi.it_IT 2011-04-27 17:14:05.743456514 +0200 +@@ -0,0 +1,48 @@ ++#!/usr/bin/perl ++use strict; ++ ++use CGI; ++ ++my $VERSION = '6.2'; ++my $TITLE_VIRUS = "SquidClamAv $VERSION : Virus rilevato"; ++ ++my $cgi = new CGI; ++ ++my $url = $cgi->param('url') || ''; ++my $virus = $cgi->param('virus') || ''; ++my $source = $cgi->param('source') || ''; ++$source =~ s/\/-//; ++my $user = $cgi->param('user') || ''; ++ ++ ++# Remove clamd infos ++$virus =~ s/stream: //; ++$virus =~ s/ FOUND//; ++ ++ ++print $cgi->header(); ++ ++print $cgi->start_html(-title => $TITLE_VIRUS); ++print qq{ ++

$TITLE_VIRUS

++
++

++}; ++print qq{ ++L\'indirizzo URL richiesto $url
++contiene il virus : $virus ++}; ++ ++print qq{ ++

++Il file non può essere scaricato. ++

++Origine: $source / $user ++

++


++Powered by SquidClamAv $VERSION. ++}; ++ ++print $cgi->end_html(); ++ ++exit 0; diff --git a/squidclamav.spec b/squidclamav.spec new file mode 100644 index 0000000..cdba504 --- /dev/null +++ b/squidclamav.spec @@ -0,0 +1,114 @@ +Name: squidclamav +Version: 6.11 +Release: 1mamba +Summary: A dedicated ClamAV antivirus redirector for Squid +Group: Network/Security +Vendor: openmamba +Distribution: openmamba +Packager: Silvan Calarco +URL: http://sourceforge.net/projects/squidclamav/ +Source: http://downloads.sourceforge.net/project/squidclamav/squidclamav/%{version}/squidclamav-%{version}.tar.gz +Patch0: %{name}-6.2-cgi-it_IT.patch +Patch1: %{name}-6.10-config.patch +License: GPL +## AUTOBUILDREQ-BEGIN +BuildRequires: c-icap-devel +BuildRequires: glibc-devel +BuildRequires: perl-devel +## AUTOBUILDREQ-END +Requires(pre): squid +Requires: clamd +Requires: clamav +Requires(pre): c-icap +BuildRoot: %{_tmppath}/%{name}-%{version}-root + +%description +SquidClamAv is a dedicated ClamAV antivirus redirector for Squid. It can run antivirus checks based on filename regex, content-type regex, and more. It is easy to install and works even with heavy Squid access. + +%prep +%setup -q +%patch0 -p1 +%patch1 -p1 + +%build +%configure \ + --libexecdir=/var/www/cgi-bin/ +# --sysconfdir=%{_sysconfdir}/squid + +%make + +%install +[ "%{buildroot}" != / ] && rm -rf "%{buildroot}" +%makeinstall + +rm -f %{buildroot}%{_datadir}/squidclamav/README + +%post +if [ $1 -ge 1 ]; then +# new install or upgrade +[ "`grep 1344/squidclamav %{_sysconfdir}/squid/squid.conf`" ] || { + cat >> %{_sysconfdir}/squid/squid.conf << _EOF +icap_enable on +icap_send_client_ip on +icap_send_client_username on +icap_client_username_encode off +icap_client_username_header X-Authenticated-User +icap_preview_enable on +icap_preview_size 1024 +icap_service service_req reqmod_precache bypass=1 icap://127.0.0.1:1344/squidclamav +adaptation_access service_req allow all +icap_service service_resp respmod_precache bypass=1 icap://127.0.0.1:1344/squidclamav +adaptation_access service_resp allow all +_EOF + service squid reload +} + +[ "`grep squidclamav.so %{_sysconfdir}/c-icap.conf`" ] || { + cat >> %{_sysconfdir}/c-icap.conf << _EOF +Service squidclamav squidclamav.so +_EOF + service c-icap reload +} +fi +: + +%clean +[ "%{buildroot}" != / ] && rm -rf "%{buildroot}" + +%files +%defattr(-,root,root) +%config(noreplace) %{_sysconfdir}/squidclamav.conf +%{_sysconfdir}/squidclamav.conf.default +%{_libdir}/c_icap/squidclamav.la +%{_libdir}/c_icap/squidclamav.so +%{_datadir}/c_icap/templates/squidclamav/en/MALWARE_FOUND +%attr(0755,root,root) /var/www/cgi-bin/squidclamav/clwarn.cgi* +%{_mandir}/man1/squidclamav.1* +%doc AUTHORS COPYING ChangeLog README + +%changelog +* Sun Mar 23 2014 Automatic Build System 6.11-1mamba +- automatic update by autodist + +* Thu Mar 28 2013 Automatic Build System 6.10-1mamba +- automatic version update by autodist + +* Mon Jul 25 2011 Automatic Build System 6.3-1mamba +- automatic version update by autodist + +* Thu Apr 28 2011 Silvan Calarco 6.2-5mamba +- fixed user of cgi files + +* Thu Apr 28 2011 Silvan Calarco 6.2-4mamba +- fixed italian cgi typo and permissions + +* Wed Apr 27 2011 Silvan Calarco 6.2-3mamba +- added italian language cgi +- install cgi in default server directory +- fix default configuration for cgi and squidGuard paths + +* Wed Apr 27 2011 Silvan Calarco 6.2-2mamba +- added post script configuration for squid and c-icap + +* Wed Apr 13 2011 Silvan Calarco 6.2-1mamba +- package created by autospec