mirror of
https://github.com/webmin/webmin.git
synced 2026-02-03 06:03:28 +00:00
Work on filters page
This commit is contained in:
@@ -37,19 +37,42 @@ return $pid;
|
||||
}
|
||||
|
||||
# list_filters()
|
||||
# Returns a list of all defined filters, each of which is a hash ref of
|
||||
# options from the [Definition] block
|
||||
# Returns a list of all defined filter files, each of which contains multiple
|
||||
# sections like [Definition]
|
||||
sub list_filters
|
||||
{
|
||||
my $dir = "$config{'config_dir'}/filter.d";
|
||||
my @rv;
|
||||
foreach my $f (glob("$dir/*.conf")) {
|
||||
my $conf = &parse_config_file($f);
|
||||
if (@$conf) {
|
||||
push(@rv, $conf);
|
||||
}
|
||||
}
|
||||
return @rv;
|
||||
}
|
||||
|
||||
# list_actions()
|
||||
# Returns a list of all defined action files, each of which contains multiple
|
||||
# sections like [Definition] and [Init]
|
||||
sub list_actions
|
||||
{
|
||||
my $dir = "$config{'config_dir'}/action.d";
|
||||
my @rv;
|
||||
foreach my $f (glob("$dir/*.conf")) {
|
||||
my $conf = &parse_config_file($f);
|
||||
if (@$conf) {
|
||||
push(@rv, $conf);
|
||||
}
|
||||
}
|
||||
return @rv;
|
||||
}
|
||||
|
||||
# list_jails()
|
||||
# Returns a list of all sections from the jails file
|
||||
sub list_jails
|
||||
{
|
||||
return &parse_config_file("$config{'config_dir'}/jail.conf");
|
||||
}
|
||||
|
||||
# parse_config_file(file)
|
||||
@@ -101,6 +124,8 @@ close($fh);
|
||||
return @rv;
|
||||
}
|
||||
|
||||
# split_directive_values(&dir)
|
||||
# Populate the 'values' field by splitting up the 'value' field
|
||||
sub split_directive_values
|
||||
{
|
||||
my ($dir) = @_;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
index_title=Fail2Ban
|
||||
index_title=Fail2Ban Intrusion Detector
|
||||
index_echeck=An error occurred detecting Fail2Ban on this system : $1. Either it is not installed, or the <a href='$2'>module configuration</a> is incorrect.
|
||||
index_fail2ban=Fail2Ban
|
||||
index_atboot=Start at boot?
|
||||
@@ -12,5 +12,13 @@ index_restartdesc=Click this button to apply the current configuration by restar
|
||||
|
||||
check_edir=The configuration directory $1 does not exist
|
||||
check_econf=The configuration file $2 in $1 does not exist
|
||||
client_cmd=The client command $1 was not found
|
||||
server_cmd=The server command $1 was not found
|
||||
check_eclient=The client command $1 was not found
|
||||
check_eserver=The server command $1 was not found
|
||||
|
||||
filters_title=Log Filters
|
||||
|
||||
actions_title=Actions
|
||||
|
||||
jails_title=Jails
|
||||
|
||||
config_title=Global Configuration
|
||||
|
||||
27
fail2ban/list_filters.cgi
Normal file
27
fail2ban/list_filters.cgi
Normal file
@@ -0,0 +1,27 @@
|
||||
#!/usr/local/bin/perl
|
||||
# Show a list of all defined filters
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
require './fail2ban-lib.pl';
|
||||
our (%in, %text);
|
||||
|
||||
&ui_print_header(undef, $text{'filters_title'}, "");
|
||||
|
||||
my @filters = &list_filters();
|
||||
print &ui_columns_start([ $text{'filters_name'},
|
||||
$text{'filters_re'} ]);
|
||||
foreach my $f (@filters) {
|
||||
my ($def) = grep { $_->{'name'} eq 'Definition' } @$f;
|
||||
next if (!$f); # XXX what about default?
|
||||
my $fail = &find_value("failregex", $f);
|
||||
my $fname = "XXX";
|
||||
print &ui_columns_row([
|
||||
&ui_link("edit_filter.cgi?file=".&urlize($def->{'file'}),
|
||||
$fname),
|
||||
&html_escape($fail),
|
||||
]);
|
||||
}
|
||||
print &ui_columns_end();
|
||||
|
||||
&ui_print_footer("", $text{'index_return'});
|
||||
Reference in New Issue
Block a user