/usr/share/perl5/Lire/Firewall/WatchguardDlfConverter.pm is in lire 2:2.1.1-2.1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 | package Lire::Firewall::WatchguardDlfConverter;
use strict;
use Lire::DlfConverter;
use Lire::Firewall qw/firewall_number2names/;
use Lire::Syslog;
use Carp;
use base qw/Lire::DlfConverter/;
sub new {
my $proto = shift;
bless {}, (ref $proto || $proto);
}
sub name { 'watchguard' }
sub title { 'Watchguard firewall log' }
sub description { '<para>Watchguard firewall log</para>' }
sub schemas { qw/firewall/ }
sub handle_log_lines { 1 }
sub init_dlf_converter {
my ($self, $process) = @_;
$self->{'parser'} = new Lire::Syslog;
}
sub process_log_line {
my ($self, $process, $line) = @_;
#
# skip invalid log entries
#
return $process->ignore_log_line($line)
unless $line =~ /firewalld/;
eval {
my $log = $self->{'parser'}->parse($line);
local $_ = $log->{'content'};
#
# skip invalid log entries
#
return $process->ignore_log_line($line)
unless defined $log->{'process'} && $log->{'process'} eq 'firewalld';
my @v = split ' ', $log->{'content'};
return $process->error($line,
'invalid firewalld record at line '
.$process->line_count
.': should contain more than 9 fields')
if @v < 9;
#
# assign log values to hash
#
my %dlf = (
'time' => $log->{'timestamp'},
'count' => 1,
'length' => $v[3],
'protocol' => $v[4],
'from_ip' => $v[7],
'to_ip' => $v[8],
'from_port' => $v[9],
'to_port' => $v[10],
);
if($v[0] eq 'deny') {
$dlf{'action'} = 'denied'
} elsif($v[0] eq 'allow') {
$dlf{'action'} = 'permitted'
} else {
return $process->ignore_log_line($line)
}
$log->{'content'} =~ / \((.+)\)/;
$dlf{'rule'} = $1;
#
# convert numbers to names and create dlf-record
#
firewall_number2names(\%dlf);
$process->write_dlf('firewall', \%dlf);
};
if($@) {
$process->error($line, $@);
}
}
sub finish_conversion {
delete $_[0]->{'parser'};
}
1; # nag nag.
__END__
=pod
=head1 NAME
Lire::Firewall::WatchguardDlfConverter - convert Watchguard logs to firewall DLF
=head1 DESCRIPTION
B<Lire::Firewall::WatchguardDlfConverter> converts Watchguard logs into
firewall DLF format.
Input for this converter is the standard Watchguard syslog log file.
=head1 AUTHOR
Wessel Dankers <wsl@logreport.org>
Initial code by Joost Bekkers <joost@jodocus.org>, now maintained by the
LogReport team. Based upon the cisco_ios2dlf.in script.
=head1 SEE ALSO
The WatchGuard website at http://www.watchguard.com/ for some information on
the WatchGuard Firebox System. Unfortunately, only very little information is
freely available.
=head1 VERSION
$Id: WatchguardDlfConverter.pm,v 1.10 2006/07/23 13:16:35 vanbaal Exp $
=head1 COPYRIGHT
Copyright (C) 2001-2003 Stichting LogReport Foundation LogReport@LogReport.org
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 (see COPYING); if not, check with
http://www.gnu.org/copyleft/gpl.html.
=cut
# Local Variables:
# mode: cperl
# End:
|