SF.net SVN: logwatch:[300] trunk/scripts/services/openvpn
[email protected] Mon, 23 Nov 2015 17:26:20 +0000
| Newsgroups | gmane.comp.log.logwatch.devel |
|---|---|
| Message-ID | <[email protected]> |
Revision: 300
http://sourceforge.net/p/logwatch/code/300
Author: opoplawski
Date: 2015-11-23 17:26:20 +0000 (Mon, 23 Nov 2015)
Log Message:
-----------
[openvpn] Several fixes
- use strict - fix variable name issue caught
- Report incorrect LDAP passwords
- Handle multihome connection messages
- Collapse duplicate connection ports
Modified Paths:
--------------
trunk/scripts/services/openvpn
Modified: trunk/scripts/services/openvpn
===================================================================
--- trunk/scripts/services/openvpn 2015-11-06 23:34:02 UTC (rev 299)
+++ trunk/scripts/services/openvpn 2015-11-23 17:26:20 UTC (rev 300)
@@ -23,14 +23,29 @@
## copyright please contact [email protected]
#########################################################
+use strict;
my $Debug = $ENV{'LOGWATCH_DEBUG'};
my $Detail = $ENV{'LOGWATCH_DETAIL_LEVEL'};
+my %Auth;
+my %ConnErrors;
+my %ConnectCauseDrop;
+my %Connections;
+my %Crypt;
+my %Error;
+my %IncorrectPassword;
+my $MaxClients;
+my $MaxConn;
+my %OtherList;
+my %PluginCallFailure;
+my %PluginCallOK;
+my %VerifyList;
+my %VersionInfo;
if ( $Debug >= 5 ) {
print STDERR "\n\nDEBUG \n\n";
}
-while (defined($ThisLine = <STDIN>)) {
+while (defined(my $ThisLine = <STDIN>)) {
chomp($ThisLine);
# normalise - this could possibly be used for more detailed per host statistics
@@ -105,48 +120,51 @@
($ThisLine =~ /^UID set to/) or
($ThisLine =~ /^VERIFY OK: nsCertType=\w+/) or
($ThisLine =~ /^chroot to /) or
+ ($ThisLine =~ /^LDAP bind failed: Invalid credentials$/) or
($ThisLine =~ /Authenticate\/Decrypt packet error: bad packet ID \(may be a replay\): \[ #.* \] -- see the man page entry for --no-replay and --replay-window for more info or silence this warning with --mute-replay-warnings/)
) {
# Don't care about these...
- } elsif (($status, $depth, $dn) = ( $ThisLine =~ /^VERIFY (.*): depth=(.*), (.*)/ )) {
+ } elsif (my ($status, $depth, $dn) = ( $ThisLine =~ /^VERIFY (.*): depth=(.*), (.*)/ )) {
#VERIFY OK: depth=0, /C=US/ST=TX/O=Aidant.Enterprises/OU=IT/CN=delta.aidant.net/Email=keymaster-g3L/[email protected]: 23 Time(s)
$VerifyList{"status: $status depth: $depth DN: $dn"}++;
- } elsif (($status, $dn) = ( $ThisLine =~ /^VERIFY X509NAME (.*): (.*)/ )) {
+ } elsif (my ($status, $dn) = ( $ThisLine =~ /^VERIFY X509NAME (.*): (.*)/ )) {
#VERIFY X509NAME OK: /C=US/ST=TX/O=Aidant.Enterprises/OU=IT/CN=delta.aidant.net/Email=keymaster-g3L/[email protected]: 23 Time(s)
$VerifyList{"status: $status X509Name DN: $dn"}++;
- } elsif (($status, $dn) = ( $ThisLine =~ /^CRL CHECK (.*): (.*)/ )) {
+ } elsif (my ($status, $dn) = ( $ThisLine =~ /^CRL CHECK (.*): (.*)/ )) {
#CRL CHECK OK: C=US, ST=CO, L=Boulder, O=NWRA, OU=Boulder, CN=user, name=root, emailAddress=xxxx-HT/[email protected]
$VerifyList{"CRL check status: $status DN: $dn"}++;
} elsif ($ThisLine =~ /^TLS: Username\/Password authentication/) {
$VerifyList{$ThisLine}++;
+ } elsif ($ThisLine =~ /^Incorrect password supplied for .* "(.*)"/) {
+ $IncorrectPassword{$1}++;
} elsif ($ThisLine =~ m/^MULTI: new incoming connection would exceed maximum number of clients/) {
$MaxClients++;
} elsif ($ThisLine =~ m/^OpenVPN [\d.]+ [\w-]+ [\[\]\w ]+ built on [\w]+ +[\d]+ [\d]+$/) {
$VersionInfo{$ThisLine} = 1;
- } elsif (($config, $peer, $port) = ($ThisLine =~ m/^\[([\S]+)\] Peer Connection Initiated with [^\d]*([\d]+\.[\d]+\.[\d]+\.[\d]+)\:([\d]+)$/)) {
- push (@{$Connections{$config}{$peer}}, $port);
- } elsif (($peer, $port) = ($ThisLine =~ m/^Peer Connection Initiated with [^\d]*([\d]+\.[\d]+\.[\d]+\.[\d]+)\:([\d]+)$/)) {
- push (@{$Connections{"client"}{$peer}}, $port);
- } elsif (($dir, $channel, $bits, $algo) = ($ThisLine =~ /^(Incoming|Outgoing) (Control Channel) Authentication: Using ([\d]+ bit) message hash '(\S+)' for HMAC authentication/)) {
+ } elsif (my ($config, $peer, $port) = ($ThisLine =~ m/^\[([\S]+)\] Peer Connection Initiated with [^\d]*([\d]+\.[\d]+\.[\d]+\.[\d]+)\:([\d]+)/)) {
+ push (@{$Connections{$config}{$peer}}, $port) unless grep(/^$port$/,@{$Connections{$config}{$peer}});
+ } elsif (my ($peer, $port) = ($ThisLine =~ m/^Peer Connection Initiated with [^\d]*([\d]+\.[\d]+\.[\d]+\.[\d]+)\:([\d]+)/)) {
+ push (@{$Connections{"client"}{$peer}}, $port) unless grep(/^$port$/,@{$Connections{"client"}{$peer}});
+ } elsif (my ($dir, $channel, $bits, $algo) = ($ThisLine =~ /^(Incoming|Outgoing) (Control Channel) Authentication: Using ([\d]+ bit) message hash '(\S+)' for HMAC authentication/)) {
$Auth{$channel}{$dir}{"$bits $algo"}++;
- } elsif (($channel, $dir, $bits, $algo) = ($ThisLine =~ /^(Data Channel) (Encrypt|Decrypt): Using ([\d]+ bit) message hash '(\S+)' for HMAC authentication/)) {
+ } elsif (my ($channel, $dir, $bits, $algo) = ($ThisLine =~ /^(Data Channel) (Encrypt|Decrypt): Using ([\d]+ bit) message hash '(\S+)' for HMAC authentication/)) {
$Auth{$channel}{$dir}{"$bits $algo"}++;
- } elsif (($channel, $proto, $cipher) = ($ThisLine =~ /^(Control Channel): (\w+), cipher (.+)/)) {
+ } elsif (my ($channel, $proto, $cipher) = ($ThisLine =~ /^(Control Channel): (\w+), cipher (.+)/)) {
$Crypt{$channel}{$proto}{$cipher}++;
- } elsif (($channel, $dir, $algo, $bits) = ($ThisLine =~ /^(Data Channel) (Encrypt|Decrypt): Cipher '(\S+)' initialized with ([\d]+ bit) key/)) {
+ } elsif (my ($channel, $dir, $algo, $bits) = ($ThisLine =~ /^(Data Channel) (Encrypt|Decrypt): Cipher '(\S+)' initialized with ([\d]+ bit) key/)) {
$Crypt{$channel}{$dir}{"$bits $algo"}++;
- } elsif (($proto, $host, $port, $error) = ($ThisLine =~ /^(TCP|UDP): connect to ([\d.]+):(\d+) failed, will try again in \d+ seconds: (.*)/)) {
+ } elsif (my ($proto, $host, $port, $error) = ($ThisLine =~ /^(TCP|UDP): connect to ([\d.]+):(\d+) failed, will try again in \d+ seconds: (.*)/)) {
$ConnErrors{$error}{"$proto $host:$port"}++;
- } elsif (($proto, $error) = ($ThisLine =~ /^read (\w+)_SERVER \[\]: (.*)/)) {
+ } elsif (my ($proto, $error) = ($ThisLine =~ /^read (\w+)_SERVER \[\]: (.*)/)) {
$ConnErrors{$error}{"$proto"}++;
- } elsif (($name) = ($ThisLine =~ /MULTI: new connection by client '(.*)' will cause previous active sessions by this client to be dropped. Remember to use the --duplicate-cn option if you want multiple clients using the same certificate or username to concurrently connect./)) {
+ } elsif (my ($name) = ($ThisLine =~ /MULTI: new connection by client '(.*)' will cause previous active sessions by this client to be dropped. Remember to use the --duplicate-cn option if you want multiple clients using the same certificate or username to concurrently connect./)) {
$ConnectCauseDrop{$name}++;
- } elsif ((($Err) = ($ThisLine =~ /(read UDPv4 \[ECONNREFUSED\]: Connection refused \(code=111\))/)) or
- (($Err) = ($ThisLine =~ /(read UDPv4 \[EHOSTUNREACH\]: No route to host \(code=113\))/))) {
+ } elsif ((my ($Err) = ($ThisLine =~ /(read UDPv4 \[ECONNREFUSED\]: Connection refused \(code=111\))/)) or
+ (my ($Err) = ($ThisLine =~ /(read UDPv4 \[EHOSTUNREACH\]: No route to host \(code=113\))/))) {
$Error{$Err}++;
- } elsif (($plugin,$call,$status) = ($ThisLine =~ /^PLUGIN_CALL: POST (.*)\/(PLUGIN_.*) status=(.*)/)) {
+ } elsif (my ($plugin,$call,$status) = ($ThisLine =~ /^PLUGIN_CALL: POST (.*)\/(PLUGIN_.*) status=(.*)/)) {
if ($status == 0) {
$PluginCallOK{$plugin}{$call}++;
} else {
@@ -166,17 +184,24 @@
if(keys %ConnErrors) {
print "Connection Errors:\n";
- foreach $error (sort keys %ConnErrors) {
+ foreach my $error (sort keys %ConnErrors) {
print " $error:\n";
- foreach $host (sort keys %{$ConnErrors{$error}}) {
+ foreach my $host (sort keys %{$ConnErrors{$error}}) {
print " $host: ".$ConnErrors{$error}{$host}." Time(s)\n";
}
}
}
+if (keys %IncorrectPassword) {
+ print "\nIncorrect Password\n";
+ foreach my $DN (sort {$a cmp $b} keys %IncorrectPassword) {
+ print " $DN: $IncorrectPassword{$DN} Time(s)\n";
+ }
+}
+
if (keys %VerifyList) {
print "\nVerify\n";
- foreach $line (sort {$a cmp $b} keys %VerifyList) {
+ foreach my $line (sort {$a cmp $b} keys %VerifyList) {
print " $line: $VerifyList{$line} Time(s)\n";
}
}
@@ -187,12 +212,12 @@
if (keys %Connections) {
print "\nConnections:";
- foreach $config (sort keys %Connections) {
+ foreach my $config (sort keys %Connections) {
print "\n Configuration $config:";
- foreach $peer (sort keys %{$Connections{$config}}) {
- $ports = $Connections{$config}{$peer};
+ foreach my $peer (sort keys %{$Connections{$config}}) {
+ my $ports = $Connections{$config}{$peer};
print "\n $peer connected " . ($#{$ports} + 1) . " Time(s), Ports:";
- for ($i = 0; $i <= $#{$ports}; $i++) {
+ for (my $i = 0; $i <= $#{$ports}; $i++) {
print "\n " if (($i + 16) % 20 == 0);
print " $$ports[$i]";
}
@@ -203,11 +228,11 @@
if (keys %Auth and $Detail >= 10) {
print "\nCiphers used for Authentication:";
- foreach $channel (sort keys %Auth) {
+ foreach my $channel (sort keys %Auth) {
print "\n $channel:";
- foreach $dir (sort keys %{$Auth{$channel}}) {
+ foreach my $dir (sort keys %{$Auth{$channel}}) {
print "\n $dir:";
- foreach $algo (sort keys %{$Auth{$channel}{$dir}}) {
+ foreach my $algo (sort keys %{$Auth{$channel}{$dir}}) {
print "\n $algo used $Auth{$channel}{$dir}{$algo} Time(s)";
}
}
@@ -217,11 +242,11 @@
if (keys %Crypt and $Detail >= 10) {
print "\nCiphers used for Encryption:";
- foreach $channel (sort keys %Crypt) {
+ foreach my $channel (sort keys %Crypt) {
print "\n $channel:";
- foreach $dir (sort keys %{$Crypt{$channel}}) {
+ foreach my $dir (sort keys %{$Crypt{$channel}}) {
print "\n $dir:";
- foreach $algo (sort keys %{$Crypt{$channel}{$dir}}) {
+ foreach my $algo (sort keys %{$Crypt{$channel}{$dir}}) {
print "\n $algo used $Crypt{$channel}{$dir}{$algo} Time(s)";
}
}
@@ -231,32 +256,32 @@
if (keys %VersionInfo) {
print "\nVersion Information:\n";
- foreach $vers (sort keys %VersionInfo) {
+ foreach my $vers (sort keys %VersionInfo) {
print " $vers\n"
}
}
if (keys %ConnectCauseDrop) {
print "\n Previous active sessions of the same client dropped upon new connection:\n";
- foreach $name (sort keys %ConnectCauseDrop) {
+ foreach my $name (sort keys %ConnectCauseDrop) {
print " client $name: $ConnectCauseDrop{$name} Time(s)\n"
}
}
if (keys %Error) {
print "\n UDPv4 errors:\n";
- foreach $Err (sort keys %Error) {
+ foreach my $Err (sort keys %Error) {
print " " . $Err . ": " .$Error{$Err}. " Time(s)\n";
}
}
-if (keys %PluginCallFailures) {
+if (keys %PluginCallFailure) {
print "\nPlugin Call Failures:";
- foreach $plugin (sort keys %PluginCallFailures) {
+ foreach my $plugin (sort keys %PluginCallFailure) {
print "\n Plugin $plugin:";
- foreach $call (sort keys %{$PluginCallFailures{$plugin}}) {
- $times = $PluginCallFailures{$plugin}{$call};
- print "\n $call failed $PluginCallFailures{$plugin}{$call} Time(s)";
+ foreach my $call (sort keys %{$PluginCallFailure{$plugin}}) {
+ my $times = $PluginCallFailure{$plugin}{$call};
+ print "\n $call failed $PluginCallFailure{$plugin}{$call} Time(s)";
}
print "\n";
}
@@ -264,10 +289,10 @@
if (keys %PluginCallOK and $Detail >= 5) {
print "\nPlugin Call OK:";
- foreach $plugin (sort keys %PluginCallOK) {
+ foreach my $plugin (sort keys %PluginCallOK) {
print "\n Plugin $plugin:";
- foreach $call (sort keys %{$PluginCallOK{$plugin}}) {
- $times = $PluginCallOK{$plugin}{$call};
+ foreach my $call (sort keys %{$PluginCallOK{$plugin}}) {
+ my $times = $PluginCallOK{$plugin}{$call};
print "\n $call succeeded $PluginCallOK{$plugin}{$call} Time(s)";
}
print "\n";
@@ -276,7 +301,7 @@
if (keys %OtherList) {
print "\n**Unmatched Entries**\n";
- foreach $line (sort {$a cmp $b} keys %OtherList) {
+ foreach my $line (sort {$a cmp $b} keys %OtherList) {
print " $line: $OtherList{$line} Time(s)\n";
}
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
------------------------------------------------------------------------------
Go from Idea to Many App Stores Faster with Intel(R) XDK
Give your users amazing mobile app experiences with Intel(R) XDK.
Use one codebase in this all-in-one HTML5 development environment.
Design, debug & build mobile apps & 2D/3D high-impact games for multiple OSs.
http://pubads.g.doubleclick.net/gampad/clk?id=254741551&iu=/4140