Participate in install check and logs export

This commit is contained in:
Jamie Cameron
2014-05-13 23:35:10 -07:00
parent 89211f2db0
commit c6ef902618
5 changed files with 49 additions and 1 deletions

View File

@ -1,6 +1,5 @@
# Functions for configuring the fail2ban log analyser
#
# XXX other .pl files
# XXX include in makedist.pl
# XXX main help page
# XXX help page for filters with description of <HOST> / etc

18
fail2ban/install_check.pl Executable file
View File

@ -0,0 +1,18 @@
# install_check.pl
use strict;
use warnings;
our (%text, %in, %access, %config);
do 'fail2ban-lib.pl';
# is_installed(mode)
# For mode 1, returns 2 if the server is installed and configured for use by
# Webmin, 1 if installed but not configured, or 0 otherwise.
# For mode 0, returns 1 if installed, 0 if not
sub is_installed
{
my ($mode) = @_;
my $err = &check_fail2ban();
return $err ? 0 : $mode ? 2 : 1;
}

View File

@ -142,3 +142,8 @@ config_logtarget=Write logs to
config_syslog=Syslog service
config_file=Log file
config_default=Default destination
syslog_logtarget=Fail2Ban action log
__norefs=1

View File

@ -6,3 +6,4 @@ desc_de=Fail2Ban Intrusionsdetektor
longdesc_de=Fail2ban sch&#252;tzt Ihr System vor Brute-Force-Angriffen, indem Quell-IPs blockiert werden.
desc_ms_MY=Fail2Ban Pengesan Pencerobohan
longdesc_ms_MY=Fail2ban melindungi sistem anda dari serangan kekerasan dengan mengesan mereka dan menyekat IP sumber mereka.
syslog=1

25
fail2ban/syslog_logs.pl Executable file
View File

@ -0,0 +1,25 @@
# Contains a function to supply the syslog module with extra logs
use strict;
use warnings;
our (%text, %in, %access, %config);
do 'fail2ban-lib.pl';
# syslog_getlogs()
# Returns the Fail2Ban log
sub syslog_getlogs
{
my @rv;
my $conf = &get_config();
my ($def) = grep { $_->{'name'} eq 'Definition' } @$conf;
if ($def) {
my $logtarget = &find_value("logtarget", $def);
if ($logtarget =~ /^\//) {
push(@rv, { 'file' => $logtarget,
'desc' => $text{'syslog_logtarget'},
'active' => 1 });
}
}
return @rv;
}