Changes of Revision 24
[-] | Changed | mod_security-ix.spec |
x 1
2 %endif 3 Source3: zzz_asl_custom_exclude.conf 4 Source4: zzz_asl_custom_local_exclude.conf 5 +Source5: modsec-clamscan.pl 6 Patch1: waf-label.patch 7 BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) 8 %if 0%{?rhel_version} || 0%{?centos_version} || 0%{?sl_version} || 0%{?redhat_version} 9
10 install -D -m644 %{SOURCE2} %{buildroot}/%{apache_sysconfdir}/modsecurity.d/modsecurity_crs_10_config.conf 11 install -D -m644 %{SOURCE3} %{buildroot}/%{apache_sysconfdir}/modsec/zzz_asl_custom_exclude.conf 12 install -D -m644 %{SOURCE4} %{buildroot}/%{apache_sysconfdir}/modsec/zzz_asl_custom_local_exclude.conf 13 -#install -D -m755 rules/util/modsec-clamscan.pl %{buildroot}%{_bindir}/modsec-clamscan.pl 14 +install -D -m755 %{SOURCE5} %{buildroot}%{_bindir}/modsec-clamscan.pl 15 mkdir -p %{buildroot}/var/log/mlogc/data 16 install -D -m755 mlogc/mlogc %{buildroot}%{_bindir}/mlogc 17 install -m755 mlogc/mlogc-batch-load.pl %{buildroot}%{_bindir}/mlogc-batch-load.pl 18
19 %defattr (-,root,root) 20 %doc CHANGES LICENSE README.* modsecurity* doc 21 %{apache_libexecdir}/mod_security2.so 22 -#%{_bindir}/modsec-clamscan.pl 23 +%{_bindir}/modsec-clamscan.pl 24 %{_bindir}/mlogc 25 %{_bindir}/mlogc-batch-load.pl 26 %config %{apache_sysconfdir}/conf.d/00_mod_security.conf 27 |
||
[+] | Added | modsec-clamscan.pl ^ |
@@ -0,0 +1,50 @@ +#!/usr/bin/perl +# +# modsec-clamscan.pl +# ModSecurity for Apache (http://www.modsecurity.org) +# Copyright (c) 2002-2007 Breach Security, Inc. (http://www.breach.com) +# +# This script is an interface between mod_security and its +# ability to intercept files being uploaded through the +# web server, and ClamAV + +# by default use the command-line version of ClamAV, +# which is slower but more likely to work out of the +# box +$CLAMSCAN = "/usr/bin/clamscan"; + +# using ClamAV in daemon mode is faster since the +# anti-virus engine is already running, but you also +# need to configure file permissions to allow ClamAV, +# usually running as a user other than the one Apache +# is running as, to access the files +# $CLAMSCAN = "/usr/bin/clamdscan"; + +if (@ARGV != 1) { + print "Usage: modsec-clamscan.pl <filename>\n"; + exit; +} + +my ($FILE) = @ARGV; + +$cmd = "$CLAMSCAN --stdout --disable-summary $FILE"; +$input = `$cmd`; +$input =~ m/^(.+)/; +$error_message = $1; + +$output = "0 Unable to parse clamscan output [$1]"; + +if ($error_message =~ m/: Empty file\.?$/) { + $output = "1 empty file"; +} +elsif ($error_message =~ m/: (.+) ERROR$/) { + $output = "0 clamscan: $1"; +} +elsif ($error_message =~ m/: (.+) FOUND$/) { + $output = "0 clamscan: $1"; +} +elsif ($error_message =~ m/: OK$/) { + $output = "1 clamscan: OK"; +} + +print "$output\n"; |