commit
a022705316
10 changed files with 142 additions and 0 deletions
@ -0,0 +1,8 @@ |
|||||||
|
#!/usr/bin/perl -w |
||||||
|
|
||||||
|
use esmith::Build::CreateLinks qw(:all); |
||||||
|
|
||||||
|
foreach my $event (qw/bootstrap-console-save share-modify ibay-modify/){ |
||||||
|
templates2events("/etc/clamrt.list", $event); |
||||||
|
safe_symlink("restart", "root/etc/e-smith/events/$event/services2adjust/clamrt"); |
||||||
|
} |
@ -0,0 +1 @@ |
|||||||
|
enabled |
@ -0,0 +1 @@ |
|||||||
|
service |
@ -0,0 +1,9 @@ |
|||||||
|
{ |
||||||
|
|
||||||
|
use esmith::AccountsDB; |
||||||
|
my $a = esmith::AccountsDB->open_ro || die "Couldn't open AccountsDB\n"; |
||||||
|
|
||||||
|
my @ibays = $a->ibays(); |
||||||
|
my @shares = $a->get_all_by_prop(type=>'share'); |
||||||
|
|
||||||
|
} |
@ -0,0 +1,10 @@ |
|||||||
|
{ |
||||||
|
|
||||||
|
foreach my $share (@shares){ |
||||||
|
my $name = $share->key; |
||||||
|
my $av = $share->prop('ClamRT') || 'disabled'; |
||||||
|
next unless ($av eq 'enabled'); |
||||||
|
$OUT .= "/home/e-smith/files/shares/$name/files\n"; |
||||||
|
} |
||||||
|
|
||||||
|
} |
@ -0,0 +1,10 @@ |
|||||||
|
{ |
||||||
|
|
||||||
|
foreach my $ibay (@ibays){ |
||||||
|
my $name = $ibay->key; |
||||||
|
my $av = $ibay->prop('ClamRT') || 'disabled'; |
||||||
|
next unless ($av eq 'enabled'); |
||||||
|
$OUT .= "/home/e-smith/files/ibays/$name\n"; |
||||||
|
} |
||||||
|
|
||||||
|
} |
@ -0,0 +1,4 @@ |
|||||||
|
{ |
||||||
|
# Just a dummy rep so there's always a rep to watch |
||||||
|
} |
||||||
|
/tmp |
@ -0,0 +1,6 @@ |
|||||||
|
#!/bin/sh |
||||||
|
|
||||||
|
exec \ |
||||||
|
/usr/local/bin/setuidgid smelog \ |
||||||
|
/usr/local/bin/multilog t s5000000 \ |
||||||
|
/var/log/clamrt |
@ -0,0 +1,41 @@ |
|||||||
|
#!/bin/bash |
||||||
|
|
||||||
|
# Daniel Berteaud <daniel@firewall-services.com> |
||||||
|
# Inspired by Clam Temps Reel from Hackurx |
||||||
|
# http://hackurx.wordpress.com |
||||||
|
# Licence: GPL v3 |
||||||
|
|
||||||
|
exec 2>&1 |
||||||
|
|
||||||
|
CLAMD=$(/sbin/e-smith/db configuration getprop clamd status || \ |
||||||
|
echo 'disabled') |
||||||
|
if [ "$CLAMD" = "disabled" ]; then |
||||||
|
sv d . |
||||||
|
exit |
||||||
|
fi |
||||||
|
|
||||||
|
MAIL=$(/sbin/e-smith/db configuration getprop clamrt SendEmail || \ |
||||||
|
echo 'enabled') |
||||||
|
MAIL_MSG=$(/sbin/e-smith/db configuration getprop clamrt EmailMessage || \ |
||||||
|
echo 'A virus was found in ${!FILE}. This file has been moved to quarantine') |
||||||
|
MAIL_SUBJ=$(/sbin/e-smith/db configuration getprop clamrt EmailSubject || \ |
||||||
|
echo 'A virus was found') |
||||||
|
MAIL_DEST=$(/sbin/e-smith/db configuration getprop clamrt EmailDest || \ |
||||||
|
echo 'admin') |
||||||
|
QUARANTINE=$(/sbin/e-smith/db configuration getprop clamav QuarantineDirectory || \ |
||||||
|
echo '/var/spool/clamav/quarantine') |
||||||
|
|
||||||
|
/usr/bin/inotifywait -q -m -r -e create,modify,access --fromfile=/etc/clamrt.list \ |
||||||
|
--timefmt %M --format '%w%f|%T|%e' | \ |
||||||
|
perl -laF: -ne '$| = 1; print unless $_{$F[0]}++' | \ |
||||||
|
sed --unbuffered 's/|.*//g' | |
||||||
|
|
||||||
|
while read FILE; do |
||||||
|
echo "Scanning: $FILE" |
||||||
|
[ -e "$FILE" ] && clamdscan --fdpass --quiet -m --move=$QUARANTINE "$FILE" |
||||||
|
if [ "$?" == "1" ]; then |
||||||
|
echo "Malware found: $FILE quarantined ($QUARANTINE/$(basename $FILE))" |
||||||
|
[ "$MAIL" = "enabled" ] && echo $MAIL_MSG | mail -s "$MAIL_SUBJ" $MAIL_DEST |
||||||
|
fi |
||||||
|
done |
||||||
|
|
@ -0,0 +1,52 @@ |
|||||||
|
# Authority: VIP-ire |
||||||
|
# Name: Daniel B. |
||||||
|
|
||||||
|
Summary: On access AV scanner |
||||||
|
%define name smeserver-clamrt |
||||||
|
Name: %{name} |
||||||
|
%define version 0.0.1 |
||||||
|
%define release 1.beta0 |
||||||
|
Version: %{version} |
||||||
|
Release: %{release}%{?dist} |
||||||
|
License: GPL |
||||||
|
Group: SMEServer/addon |
||||||
|
|
||||||
|
Source: %{name}-%{version}.tar.gz |
||||||
|
|
||||||
|
URL: http://www.firewall-services.com/ |
||||||
|
BuildRoot: /var/tmp/%{name}-%{version}-%{release}-buildroot |
||||||
|
BuildArchitectures: noarch |
||||||
|
Requires: e-smith-base |
||||||
|
Requires: smeserver-clamav |
||||||
|
Requires: inotify-tools |
||||||
|
BuildRequires: e-smith-devtools |
||||||
|
|
||||||
|
%description |
||||||
|
Provides on access AV scan for shares and ibays |
||||||
|
|
||||||
|
%changelog |
||||||
|
|
||||||
|
%prep |
||||||
|
%setup |
||||||
|
|
||||||
|
%build |
||||||
|
perl createlinks |
||||||
|
%{__mkdir_p} root/var/log/clamrt |
||||||
|
|
||||||
|
%install |
||||||
|
/bin/rm -rf $RPM_BUILD_ROOT |
||||||
|
(cd root ; /usr/bin/find . -depth -print | /bin/cpio -dump $RPM_BUILD_ROOT) |
||||||
|
/bin/rm -f %{name}-%{version}-filelist |
||||||
|
/sbin/e-smith/genfilelist $RPM_BUILD_ROOT \ |
||||||
|
--file /var/service/clamrt/run 'attr(0755,root,root)' \ |
||||||
|
--file /var/service/clamrt/log/run 'attr(0755,root,root)' \ |
||||||
|
--dir /var/log/clamrt 'attr(0750,smelog,smelog)' \ |
||||||
|
> %{name}-%{version}-filelist |
||||||
|
echo "%doc CHANGELOG.git" >> %{name}-%{version}-filelist |
||||||
|
|
||||||
|
%files -f %{name}-%{version}-filelist |
||||||
|
%defattr(-,root,root) |
||||||
|
|
||||||
|
%clean |
||||||
|
rm -rf $RPM_BUILD_ROOT |
||||||
|
|
Loading…
Reference in new issue