andykimpe / rpms / 389-ds-base

Forked from rpms/389-ds-base 5 months ago
Clone
dc8c34
From 38c7f0d8e7348358cce317f671bf48d64c3d7442 Mon Sep 17 00:00:00 2001
dc8c34
From: Mark Reynolds <mreynolds@redhat.com>
dc8c34
Date: Thu, 21 Mar 2013 16:12:41 -0400
dc8c34
Subject: [PATCH 126/225] Ticket 611 - logconv.pl missing stats for StartTLS,
dc8c34
 LDAPI, and AUTOBIND
dc8c34
dc8c34
RFE Description:  Previously there were no stats for StartTLS, LDAPI,
dc8c34
                  and AUTOTBIND connections/binds.
dc8c34
dc8c34
https://fedorahosted.org/389/ticket/611
dc8c34
dc8c34
Reviewed by: richm(Thanks!)
dc8c34
(cherry picked from commit 59ae73c25c316c81c1c18ea702c8e793c922e1d8)
dc8c34
(cherry picked from commit 9f382458ee799e08f9ceddab73111011ea15e3a4)
dc8c34
(cherry picked from commit db28372404d1d5b9e350b88bc73dddfdef27971b)
dc8c34
---
dc8c34
 ldap/admin/src/logconv.pl | 50 +++++++++++++++++++++++++++++++++++------------
dc8c34
 1 file changed, 37 insertions(+), 13 deletions(-)
dc8c34
dc8c34
diff --git a/ldap/admin/src/logconv.pl b/ldap/admin/src/logconv.pl
dc8c34
index 7ea7f09..7e0bfd8 100755
dc8c34
--- a/ldap/admin/src/logconv.pl
dc8c34
+++ b/ldap/admin/src/logconv.pl
dc8c34
@@ -70,6 +70,7 @@ $endFlag = 0;
dc8c34
 $endTime = 0;
dc8c34
 $reportStats = "";
dc8c34
 $dataLocation = "/tmp";
dc8c34
+$startTLSoid = "1.3.6.1.4.1.1466.20037";
dc8c34
 $s_stats = new_stats_block( );
dc8c34
 $m_stats = new_stats_block( );
dc8c34
 
dc8c34
@@ -208,6 +209,9 @@ $maxsimConnection = 0;
dc8c34
 $firstFile = 1;
dc8c34
 $elapsedDays = 0;
dc8c34
 $logCount = 0;
dc8c34
+$startTLSCount = 0;
dc8c34
+$ldapiCount = 0;
dc8c34
+$autobindCount = 0;
dc8c34
 $limit = 25000; # number of lines processed to trigger output
dc8c34
 
dc8c34
 # hash files
dc8c34
@@ -588,7 +592,9 @@ if($reportBinds eq "yes"){
dc8c34
 
dc8c34
 print "Restarts:                     $serverRestartCount\n";
dc8c34
 print "Total Connections:            $connectionCount\n";
dc8c34
-print "SSL Connections:              $sslCount\n";
dc8c34
+print " - StartTLS Connections:      $startTLSCount\n";
dc8c34
+print " - LDAPS Connections:         $sslCount\n";
dc8c34
+print " - LDAPI Conections:          $ldapiCount\n";
dc8c34
 print "Peak Concurrent Connections:  $maxsimConnection\n";
dc8c34
 print "Total Operations:             $allOps\n";
dc8c34
 print "Total Results:                $allResults\n";
dc8c34
@@ -760,21 +766,22 @@ print "Max BER Size Exceeded:        $maxBerSizeCount\n";
dc8c34
 print "\n";
dc8c34
 print "Binds:                        $bindCount\n";
dc8c34
 print "Unbinds:                      $unbindCount\n";
dc8c34
-print "\n LDAP v2 Binds:               $v2BindCount\n";
dc8c34
-print " LDAP v3 Binds:               $v3BindCount\n";
dc8c34
-print " SSL Client Binds:            $sslClientBindCount\n";
dc8c34
-print " Failed SSL Client Binds:     $sslClientFailedCount\n";
dc8c34
-print " SASL Binds:                  $saslBindCount\n";
dc8c34
+print " - LDAP v2 Binds:             $v2BindCount\n";
dc8c34
+print " - LDAP v3 Binds:             $v3BindCount\n";
dc8c34
+print " - AUTOBINDs:                 $autobindCount\n";
dc8c34
+print " - SSL Client Binds:          $sslClientBindCount\n";
dc8c34
+print " - Failed SSL Client Binds:   $sslClientFailedCount\n";
dc8c34
+print " - SASL Binds:                $saslBindCount\n";
dc8c34
 if ($saslBindCount > 0){
dc8c34
  foreach $saslb ( sort {$saslmech{$b} <=> $saslmech{$a} } (keys %saslmech) ){
dc8c34
-	printf "  %-4s  %-12s\n",$saslmech{$saslb}, $saslb;   
dc8c34
+	printf "    %-4s  %-12s\n",$saslmech{$saslb}, $saslb;   
dc8c34
  }
dc8c34
 }
dc8c34
 
dc8c34
-print "\n Directory Manager Binds:     $rootDNBindCount\n";
dc8c34
-print " Anonymous Binds:             $anonymousBindCount\n";
dc8c34
+print " - Directory Manager Binds:   $rootDNBindCount\n";
dc8c34
+print " - Anonymous Binds:           $anonymousBindCount\n";
dc8c34
 $otherBindCount = $bindCount -($rootDNBindCount + $anonymousBindCount);
dc8c34
-print " Other Binds:                 $otherBindCount\n\n";
dc8c34
+print " - Other Binds:               $otherBindCount\n\n";
dc8c34
 
dc8c34
 ##########################################################################
dc8c34
 #                       Verbose Logging Section                          #
dc8c34
@@ -1674,6 +1681,24 @@ sub parseLineNormal
dc8c34
 	if (m/ version=3/){$v3BindCount++}
dc8c34
 	if (m/ conn=1 fd=/){$serverRestartCount++}
dc8c34
 	if (m/ SSL connection from/){$sslCount++;}
dc8c34
+	if (m/ connection from local to /){$ldapiCount++;}
dc8c34
+	if($_ =~ /AUTOBIND dn=\"(.*)\"/){
dc8c34
+		$autobindCount++;
dc8c34
+		$bindCount++;
dc8c34
+		if($reportStat){ inc_stats('bind',$s_stats,$m_stats); }
dc8c34
+		if ($1 ne ""){ 
dc8c34
+			$tmpp = $1;
dc8c34
+			$tmpp =~ tr/A-Z/a-z/;
dc8c34
+			writeFile($BINDLIST, $tmpp); 
dc8c34
+			if($1 eq $rootDN){ 
dc8c34
+				$rootDNBindCount++;
dc8c34
+			}
dc8c34
+		} else {
dc8c34
+			$anonymousBindCount++;
dc8c34
+			writeFile($BINDLIST, "Anonymous Binds");
dc8c34
+			inc_stats('anonbind',$s_stats,$m_stats);
dc8c34
+		}
dc8c34
+	}
dc8c34
 	if (m/ connection from/){
dc8c34
 		$exc = "no";
dc8c34
 		if ($_ =~ /connection from *([0-9A-Fa-f\.\:]+)/i ){ 
dc8c34
@@ -1718,6 +1743,7 @@ sub parseLineNormal
dc8c34
 		if($reportStat){ inc_stats('bind',$s_stats,$m_stats); }
dc8c34
 		$bindCount++;
dc8c34
 		if ($1 ne ""){ 
dc8c34
+			if($1 eq $rootDN){$rootDNBindCount++;}
dc8c34
 			$tmpp = $1;
dc8c34
 			$tmpp =~ tr/A-Z/a-z/;
dc8c34
 			writeFile($BINDLIST, $tmpp); 
dc8c34
@@ -1728,9 +1754,6 @@ sub parseLineNormal
dc8c34
 				# only need this for the failed bind report
dc8c34
 				writeFile($BINDINFO, "$bindVal ,, $bindConn ,, $bindOp");
dc8c34
 			}
dc8c34
-			if($1 eq $rootDN){ 
dc8c34
-				$rootDNBindCount++;
dc8c34
-			}
dc8c34
 		} else {
dc8c34
 			$anonymousBindCount++;
dc8c34
 			writeFile($BINDLIST, "Anonymous Binds");
dc8c34
@@ -2026,6 +2049,7 @@ sub parseLineNormal
dc8c34
 	if (m/ EXT oid=/){
dc8c34
 		$extopCount++;
dc8c34
 		if ($_ =~ /oid=\" *([0-9\.]+)/i ){ writeFile($OID,$1); }
dc8c34
+		if ($1 && $1 eq $startTLSoid){$startTLSCount++;}
dc8c34
 		if ($verb eq "yes"){
dc8c34
 		        if ($_ =~ /conn= *([0-9]+)/i){ writeFile($EXT_CONN, $1); }
dc8c34
 			if ($_ =~ /op= *([0-9]+)/i){ writeFile($EXT_OP, $1); }
dc8c34
-- 
dc8c34
1.8.1.4
dc8c34