Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Item14149: Add checkers to help with setting Socket
- Loading branch information
Showing
3 changed files
with
107 additions
and
10 deletions.
There are no files selected for viewing
49 changes: 49 additions & 0 deletions
49
lib/Foswiki/Configure/Checkers/ClamAVScanPlugin/Enabled.pm
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
# See bottom of file for license and copyright information | ||
package Foswiki::Configure::Checkers::Plugins::ClamAVScanPlugin::Enabled; | ||
|
||
use strict; | ||
use warnings; | ||
|
||
use Foswiki::Configure::Checker (); | ||
our @ISA = ('Foswiki::Configure::Checker'); | ||
|
||
sub check_current_value { | ||
my ( $this, $reporter ) = @_; | ||
|
||
my %mod = ( | ||
name => 'Socket::PassAccessRights', | ||
usage => 'Requried to pass file access rights to Clamd scanner.', | ||
minimumVersion => 0 | ||
); | ||
|
||
Foswiki::Configure::Dependency::checkPerlModules( \%mod ); | ||
if ( !$mod{ok} && $Foswiki::cfg{Plugins}{ClamAVScanPlugin}{Enabled} ) { | ||
$reporter->ERROR( $mod{check_result} ); | ||
} | ||
elsif ( !$mod{ok} ) { | ||
$reporter->WARN( $mod{check_result} ); | ||
} | ||
else { | ||
$reporter->NOTE( $mod{check_result} ); | ||
} | ||
} | ||
|
||
1; | ||
__END__ | ||
Foswiki - The Free and Open Source Wiki, http://foswiki.org/ | ||
Copyright (C) 2012-2016 Foswiki Contributors. Foswiki Contributors | ||
are listed in the AUTHORS file in the root of this distribution. | ||
NOTE: Please extend that file, not this notice. | ||
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. For | ||
more details read LICENSE in the root of this distribution. | ||
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. | ||
As per the GPL, removal of this notice is prohibited. |
45 changes: 45 additions & 0 deletions
45
lib/Foswiki/Configure/Checkers/ClamAVScanPlugin/clamdPort.pm
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
# See bottom of file for license and copyright information | ||
package Foswiki::Configure::Checkers::Plugins::ClamAVScanPlugin::clamdPort; | ||
|
||
use strict; | ||
use warnings; | ||
|
||
use Foswiki::Configure::Checker (); | ||
our @ISA = ('Foswiki::Configure::Checker'); | ||
|
||
sub check_current_value { | ||
my ( $this, $reporter ) = @_; | ||
|
||
unless ( -e $Foswiki::cfg{Plugins}{ClamAVScanPlugin}{clamdPort} ) { | ||
$reporter->ERROR( | ||
"=$Foswiki::cfg{Plugins}{ClamAVScanPlugin}{clamdPort}= does not appear to exist. Is clamd running?" | ||
); | ||
|
||
foreach my $socket ( | ||
qw(/tmp/camd /var/run/clamav/clamd.sock /var/run/clamav/clamd.ctl)) | ||
{ | ||
$reporter->NOTE(" Try =$socket= - it appears to exist.") | ||
if ( -e $socket ); | ||
} | ||
} | ||
} | ||
|
||
1; | ||
__END__ | ||
Foswiki - The Free and Open Source Wiki, http://foswiki.org/ | ||
Copyright (C) 2016 Foswiki Contributors. Foswiki Contributors | ||
are listed in the AUTHORS file in the root of this distribution. | ||
NOTE: Please extend that file, not this notice. | ||
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. For | ||
more details read LICENSE in the root of this distribution. | ||
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. | ||
As per the GPL, removal of this notice is prohibited. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,14 @@ | ||
!noci | ||
data/System/ClamAVScanPlugin.txt 0644 Documentation page | ||
data/System/VarCLAMAVSTATUS.txt 0644 Documentation page | ||
lib/Foswiki/Plugins/ClamAVScanPlugin.pm 0444 Perl module | ||
lib/Foswiki/Plugins/ClamAVScanPlugin/Config.spec 0444 Configuration | ||
lib/Foswiki/Plugins/ClamAVScanPlugin/ClamAV.pm 0444 Scan module | ||
pub/System/ClamAVScanPlugin/ClamAVScanLogo.png 644 ClamAV Logo | ||
templates/oopsclamavattach.tmpl 0444 Alert template for Attach | ||
templates/oopsclamavreload.tmpl 0444 Results template for reload | ||
templates/oopsclamavsave.tmpl 0444 Alert template for Save | ||
templates/oopsclamavscan.tmpl 0444 Results template for scan | ||
data/System/ClamAVScanPlugin.txt 0664 | ||
data/System/VarCLAMAVSTATUS.txt 0664 | ||
lib/Foswiki/Configure/Checkers/ClamAVScanPlugin/Enabled.pm 0664 | ||
lib/Foswiki/Configure/Checkers/ClamAVScanPlugin/clamdPort.pm 0664 | ||
lib/Foswiki/Plugins/ClamAVScanPlugin.pm 0664 | ||
lib/Foswiki/Plugins/ClamAVScanPlugin/ClamAV.pm 0664 | ||
lib/Foswiki/Plugins/ClamAVScanPlugin/Config.spec 0664 | ||
lib/Foswiki/Plugins/ClamAVScanPlugin/DEPENDENCIES 0664 | ||
pub/System/ClamAVScanPlugin/ClamAVScanLogo.png 0664 | ||
templates/oopsclamavattach.tmpl 0664 | ||
templates/oopsclamavreload.tmpl 0664 | ||
templates/oopsclamavsave.tmpl 0664 | ||
templates/oopsclamavscan.tmpl 0664 |