|
Packit |
57988d |
|
|
Packit |
57988d |
##########################################################################
|
|
Packit |
57988d |
# $Id$
|
|
Packit |
57988d |
##########################################################################
|
|
Packit |
57988d |
# $Log: oidentd,v $
|
|
Packit |
57988d |
# Revision 1.7 2008/06/30 23:07:51 kirk
|
|
Packit |
57988d |
# fixed copyright holders for files where I know who they should be
|
|
Packit |
57988d |
#
|
|
Packit |
57988d |
# Revision 1.6 2008/03/24 23:31:26 kirk
|
|
Packit |
57988d |
# added copyright/license notice to each script
|
|
Packit |
57988d |
#
|
|
Packit |
57988d |
# Revision 1.5 2005/02/24 17:08:05 kirk
|
|
Packit |
57988d |
# Applying consolidated patches from Mike Tremaine
|
|
Packit |
57988d |
#
|
|
Packit |
57988d |
# Revision 1.4 2005/02/16 00:43:28 mgt
|
|
Packit |
57988d |
# Added #vi tag to everything, updated ignore.conf with comments, added emerge and netopia to the tree from Laurent -mgt
|
|
Packit |
57988d |
#
|
|
Packit |
57988d |
# Revision 1.3 2004/07/29 19:33:29 mgt
|
|
Packit |
57988d |
# Chmod and removed perl call -mgt
|
|
Packit |
57988d |
#
|
|
Packit |
57988d |
# Revision 1.2 2004/07/10 01:54:35 mgt
|
|
Packit |
57988d |
# sync with kirk -mgt
|
|
Packit |
57988d |
#
|
|
Packit |
57988d |
# Revision 1.2 2004/06/21 14:59:05 kirk
|
|
Packit |
57988d |
# Added tons of patches from Pawe? Go?aszewski" <blues@ds.pg.gda.pl>
|
|
Packit |
57988d |
#
|
|
Packit |
57988d |
# Thanks, as always!
|
|
Packit |
57988d |
#
|
|
Packit |
57988d |
# Revision 1.1 2004/02/03 02:45:26 kirk
|
|
Packit |
57988d |
# Tons of patches, and new 'oidentd' and 'shaperd' filters from
|
|
Packit |
57988d |
# Pawe? Go?aszewski" <blues@ds.pg.gda.pl>
|
|
Packit |
57988d |
#
|
|
Packit |
57988d |
# Revision 1.2 2004/01/27 09:20:58 blues
|
|
Packit |
57988d |
# - updated some missing entries
|
|
Packit |
57988d |
#
|
|
Packit |
57988d |
# Revision 1.1 2004/01/23 20:47:20 blues
|
|
Packit |
57988d |
# - basic support for oidentd. It's full support for me, but I know that
|
|
Packit |
57988d |
# something is missing. If you have some unmatched entries - send to me.
|
|
Packit |
57988d |
#
|
|
Packit |
57988d |
##########################################################################
|
|
Packit |
57988d |
|
|
Packit |
57988d |
########################################################
|
|
Packit |
57988d |
# This was written and is maintained by:
|
|
Packit |
57988d |
# Pawe³ Go³aszewski <blues@pld-linux.org>
|
|
Packit |
57988d |
#
|
|
Packit |
57988d |
# Please send all comments, suggestions, bug reports,
|
|
Packit |
57988d |
# etc, to kirk@kaybee.org and blues@pld-linux.org
|
|
Packit |
57988d |
########################################################
|
|
Packit |
57988d |
|
|
Packit |
57988d |
#####################################################
|
|
Packit |
57988d |
## Copyright (c) 2008 Pawe³ Go³aszewski
|
|
Packit |
57988d |
## Covered under the included MIT/X-Consortium License:
|
|
Packit |
57988d |
## http://www.opensource.org/licenses/mit-license.php
|
|
Packit |
57988d |
## All modifications and contributions by other persons to
|
|
Packit |
57988d |
## this script are assumed to have been donated to the
|
|
Packit |
57988d |
## Logwatch project and thus assume the above copyright
|
|
Packit |
57988d |
## and licensing terms. If you want to make contributions
|
|
Packit |
57988d |
## under your own copyright or a different license this
|
|
Packit |
57988d |
## must be explicitly stated in the contribution an the
|
|
Packit |
57988d |
## Logwatch project reserves the right to not accept such
|
|
Packit |
57988d |
## contributions. If you have made significant
|
|
Packit |
57988d |
## contributions to this script and want to claim
|
|
Packit |
57988d |
## copyright please contact logwatch-devel@lists.sourceforge.net.
|
|
Packit |
57988d |
#########################################################
|
|
Packit |
57988d |
|
|
Packit |
57988d |
## Initial initialization:
|
|
Packit |
57988d |
$Startups = 0;
|
|
Packit |
57988d |
$Shutdowns = 0;
|
|
Packit |
57988d |
$LookupCount = 0;
|
|
Packit |
57988d |
$LookupErrorCount = 0;
|
|
Packit |
57988d |
$Connections = 0;
|
|
Packit |
57988d |
$MasqLookupCount = 0;
|
|
Packit |
57988d |
|
|
Packit |
57988d |
while (defined($ThisLine = <STDIN>)) {
|
|
Packit |
57988d |
chomp($ThisLine);
|
|
Packit |
57988d |
if (
|
|
Packit |
57988d |
($ThisLine =~ m/^Continuous traffic control enabled/) or
|
|
Packit |
57988d |
($ThisLine =~ m/^Timeout for request -- Closing connection/)
|
|
Packit |
57988d |
) {
|
|
Packit |
57988d |
#ignore these
|
|
Packit |
57988d |
} elsif ( ($Host,$Port,$User,$Identity) = ($ThisLine =~ /^\[([^ ]*)\] Successful lookup: \d+ , (\d+) : ([^ ]*) \(([^ ]*)\)$/)) {
|
|
Packit |
57988d |
$Temp = "$User announced as $Identity";
|
|
Packit |
57988d |
$Lookups{$Port}{$Temp}{$Host}++;
|
|
Packit |
57988d |
$LookupCount++;
|
|
Packit |
57988d |
} elsif ( ($Host,$Port,$User) = ($ThisLine =~ /^\[([^ ]*)\] \(Masqueraded\) Successful lookup: \d+ , (\d+) : ([^ ]*)$/)) {
|
|
Packit |
57988d |
$Temp = "Masqueraded as $User";
|
|
Packit |
57988d |
$Lookups{$Port}{$Temp}{$Host}++;
|
|
Packit |
57988d |
$LookupCount++;
|
|
Packit |
57988d |
$MasqLookupCount++;
|
|
Packit |
57988d |
} elsif (
|
|
Packit |
57988d |
(($Host) = ($ThisLine =~ /^Connection from ([^ ]* \([^ ]*\)):\d+$/)) or
|
|
Packit |
57988d |
(($Host) = ($ThisLine =~ /^Connection from ([^ ]*):\d+$/))
|
|
Packit |
57988d |
) {
|
|
Packit |
57988d |
$Connection{$Host}++;
|
|
Packit |
57988d |
$Connections++;
|
|
Packit |
57988d |
} elsif ( ($Host,$Port) = ($ThisLine =~ /^\[([^ ]*)\] \d+ , (\d+) : ERROR : [^ ]*$/)) {
|
|
Packit |
57988d |
$ErrorLookup{$Port}{$Host}++;
|
|
Packit |
57988d |
$LookupErrorCount++;
|
|
Packit |
57988d |
} elsif ( $ThisLine =~ /^oidentd startup\s+succeeded$/ ) {
|
|
Packit |
57988d |
$Startups++;
|
|
Packit |
57988d |
} elsif ( $ThisLine =~ /^oidentd shutdown\s+succeeded$/ ) {
|
|
Packit |
57988d |
$Shutdowns++;
|
|
Packit |
57988d |
} else {
|
|
Packit |
57988d |
$OtherList{$ThisLine}++;
|
|
Packit |
57988d |
}
|
|
Packit |
57988d |
}
|
|
Packit |
57988d |
|
|
Packit |
57988d |
###########################
|
|
Packit |
57988d |
# Print report:
|
|
Packit |
57988d |
|
|
Packit |
57988d |
if ($Startups > 0) {
|
|
Packit |
57988d |
print "\nStartups: $Startups\n";
|
|
Packit |
57988d |
}
|
|
Packit |
57988d |
|
|
Packit |
57988d |
if ($Shutdowns > 0) {
|
|
Packit |
57988d |
print "\nShutdowns: $Shutdowns\n";
|
|
Packit |
57988d |
}
|
|
Packit |
57988d |
|
|
Packit |
57988d |
if (keys %Connection) {
|
|
Packit |
57988d |
print "\nConnections to service: $Connections Time(s)\n";
|
|
Packit |
57988d |
foreach $Host (sort {$a cmp $b} keys %Connection) {
|
|
Packit |
57988d |
print " $Host: $Connection{$Host} Time(s)\n";
|
|
Packit |
57988d |
}
|
|
Packit |
57988d |
}
|
|
Packit |
57988d |
|
|
Packit |
57988d |
if (keys %Lookups) {
|
|
Packit |
57988d |
print "\nSuccessful ident lookups $LookupCount Time(s)\n";
|
|
Packit |
57988d |
if ($MasqLookupCount > 0) {
|
|
Packit |
57988d |
print "Masqueraded connections: $MasqLookupCount Time(s)\n";
|
|
Packit |
57988d |
}
|
|
Packit |
57988d |
foreach $Port (sort {$a cmp $b} keys %Lookups) {
|
|
Packit |
57988d |
print " Service on port $Port:\n";
|
|
Packit |
57988d |
foreach $User (sort {$a cmp $b} keys %{$Lookups{$Port}}) {
|
|
Packit |
57988d |
print " $User:\n";
|
|
Packit |
57988d |
foreach $Host (sort {$a cmp $b} keys %{$Lookups{$Port}{$User}}) {
|
|
Packit |
57988d |
print " $Host: $Lookups{$Port}{$User}{$Host} Time(s)\n";
|
|
Packit |
57988d |
}
|
|
Packit |
57988d |
}
|
|
Packit |
57988d |
}
|
|
Packit |
57988d |
}
|
|
Packit |
57988d |
|
|
Packit |
57988d |
if (keys %ErrorLookup) {
|
|
Packit |
57988d |
print "\nErrors when lookup ident $LookupErrorCount Time(s)\n";
|
|
Packit |
57988d |
foreach $Port (sort {$a cmp $b} keys %ErrorLookup) {
|
|
Packit |
57988d |
print " Service on port $Port:\n";
|
|
Packit |
57988d |
foreach $Host (sort {$a cmp $b} keys %{$ErrorLookup{$Port}}) {
|
|
Packit |
57988d |
print " $Host: $ErrorLookup{$Port}{$Host} Time(s)\n"
|
|
Packit |
57988d |
}
|
|
Packit |
57988d |
}
|
|
Packit |
57988d |
}
|
|
Packit |
57988d |
|
|
Packit |
57988d |
if (keys %OtherList) {
|
|
Packit |
57988d |
print "\n**Unmatched Entries**\n";
|
|
Packit |
57988d |
foreach $line (sort {$a cmp $b} keys %OtherList) {
|
|
Packit |
57988d |
print "$line: $OtherList{$line} Time(s)\n";
|
|
Packit |
57988d |
}
|
|
Packit |
57988d |
}
|
|
Packit |
57988d |
|
|
Packit |
57988d |
exit(0);
|
|
Packit |
57988d |
|
|
Packit |
57988d |
# vi: shiftwidth=3 tabstop=3 syntax=perl et
|
|
Packit |
57988d |
# Local Variables:
|
|
Packit |
57988d |
# mode: perl
|
|
Packit |
57988d |
# perl-indent-level: 3
|
|
Packit |
57988d |
# indent-tabs-mode: nil
|
|
Packit |
57988d |
# End:
|