Skip to content

Commit

Permalink
F-Secure 12 Support (#553)
Browse files Browse the repository at this point in the history
* F-Secure 12 Support
  • Loading branch information
shawniverson authored Sep 26, 2021
1 parent 0000644 commit 90288cc
Show file tree
Hide file tree
Showing 5 changed files with 100 additions and 5 deletions.
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
5.4.1-2
5.4.1-3
6 changes: 6 additions & 0 deletions changelog
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
09/19/2021 Changed in v5.4.1-3 (beta)
==================================

- Support for F-Secure version 12+
- Milter queue processing for child-owned queue files

08/08/2021 Changes in v5.4.1-2
==================================

Expand Down
7 changes: 4 additions & 3 deletions common/etc/MailScanner/virus.scanners.conf
Original file line number Diff line number Diff line change
Expand Up @@ -18,18 +18,19 @@

avg /usr/lib/MailScanner/wrapper/avg-wrapper /usr
avast /usr/lib/MailScanner/wrapper/avast-wrapper /bin
avastd /bin/false /
avastd /bin/false /
bitdefender /usr/lib/MailScanner/wrapper/bitdefender-wrapper /opt/BitDefender
clamav /usr/lib/MailScanner/wrapper/clamav-wrapper /usr
clamd /bin/false /usr
clamavmodule /bin/false /usr/share/perl5/ClamAV
esets /usr/lib/MailScanner/wrapper/esets-wrapper /opt/eset/esets/sbin
f-secure /usr/lib/MailScanner/wrapper/f-secure-wrapper /opt/f-secure/fsav
f-secured /bin/false /opt/f-secure/fsav
f-secured /bin/false /opt/f-secure/fsav
f-secure-12 /usr/lib/MailScanner/wrapper/f-secure-12-wrapper /opt/f-secure/linuxsecurity
generic /usr/lib/MailScanner/wrapper/generic-wrapper /dev/null
sophos /usr/lib/MailScanner/wrapper/sophos-wrapper /opt/sophos-av
sophossavi /bin/false /tmp
none /bin/false /dev/null
drweb /usr/lib/MailScanner/wrapper/drweb-wrapper /usr/bin
kaspersky /usr/lib/MailScanner/wrapper/kaspersky-wrapper /opt/kaspersky/klms
kse /bin/false /opt/kaspersky/ScanEngine
kse /bin/false /opt/kaspersky/ScanEngine
37 changes: 37 additions & 0 deletions common/usr/lib/MailScanner/wrapper/f-secure-12-wrapper
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
#!/bin/sh

# f-secure-12-wrapper -- invoke F-Secure AV for use with
# mailscanner
#
# MailScanner - SMTP Email Processor
# Copyright (C) 2021 MailScanner Team <https://mailscanner.info>
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
# https://www.mailscanner.info
#

Root=$1
shift

FS_SCAN=fsanalyze
PackageDir=$Root/bin
ScanOptions="--quiet --scan-archives=yes --detect-encrypted-archives=yes --malware=remove --pua=remove"

if [ "x$1" = "x-IsItInstalled" ]; then
[ -x ${PackageDir}/${FS_SCAN} ] && exit 0
exit 1
fi

exec ${PackageDir}/${FS_SCAN} $ScanOptions "$@"
53 changes: 52 additions & 1 deletion common/usr/share/MailScanner/perl/MailScanner/SweepViruses.pm
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,17 @@ my %Scanners = (
SupportScanning => $S_SUPPORTED,
SupportDisinfect => $S_SUPPORTED,
},
"f-secure-12" => {
name => "F-Secure-12",
Lock => 'f-secure12Busy.lock',
CommonOptions => '--quiet --scan-archives=yes',
DisinfectOptions => '--malware=remove --pua=remove',
ScanOptions => '--malware=remove --pua=remove --detect-encrypted-archives=yes',
InitParser => \&InitFSecure12Parser,
ProcessOutput => \&ProcessFSecure12Output,
SupportScanning => $S_SUPPORTED,
SupportDisinfect => $S_SUPPORTED,
},
"f-secure" => {
Name => 'F-Secure',
Lock => 'f-secureBusy.lock',
Expand Down Expand Up @@ -262,7 +273,7 @@ my %Scanners = (
SupportDisinfect => $S_NONE,
},
"drweb" => {
Name => 'DrWeb',
Name => 'DrWeb',
Lock => 'drwebBusy.lock',
CommonOptions => '',
DisinfectOptions => '-cu',
Expand Down Expand Up @@ -1227,6 +1238,11 @@ sub InitFSecureParser {
%fsecure_Seen = ();
}

# Initialise any state variables the F-Secure-12 output parser uses
sub InitFSecure12Parser {
;
}

# Initialise any state variables the F-Secured output parser uses
my (%FSDFiles);

Expand Down Expand Up @@ -1631,6 +1647,41 @@ sub ProcessSophosOutput {
return 1;
}

sub ProcessFSecure12Output {
my($line, $infections, $types, $BaseDir, $Name) = @_;

my($report, $infected, $dot, $id, $part, @rest);
my($logout, $virus, $BeenSeen);

chomp $line;

$report = $line;
$logout = $line;
$logout =~ s/%/%%/g;
$logout =~ s/\s{20,}/ /g;

return 0 unless $line =~ /\sresult=infected\s/;

$line =~ s/^(.*):\sresult=infected(\sinfection=.*)/$1$2/;

# Get to the meat or die trying...
$line =~ s/\sinfection=(\S+).*$//
or MailScanner::Log::DieLog("Dodgy things going on in F-Secure-12 output:\n$report\n");
$virus = $1;
MailScanner::Log::NoticeLog("Virus Scanning: F-Secure found virus %s",$virus);

($dot,$id,$part,@rest) = split(/\//, $line);
my $notype = substr($part,1);
$logout =~ s/\Q$part\E/$notype/;
$report =~ s/\Q$part\E/$notype/;

MailScanner::Log::InfoLog($logout);
$report = $Name . ': ' . $report if $Name;
$infections->{"$id"}{"$part"} .= $report . "\n";
$types->{"$id"}{"$part"} .= "v"; # so we know what to tell sender
return 1;
}

sub ProcessFSecureOutput {
my($line, $infections, $types, $BaseDir, $Name) = @_;

Expand Down

0 comments on commit 90288cc

Please sign in to comment.