Blame SOURCES/sos-bz1030602-fix-ldap-postproc.patch

629484
From 2fd64785d330f6ff8090b9b01f15b7f75ab57e41 Mon Sep 17 00:00:00 2001
629484
From: "Bryn M. Reeves" <bmr@redhat.com>
629484
Date: Tue, 13 Aug 2013 14:54:20 +0100
629484
Subject: [PATCH 1/4] Improve readability of add_copy_specs() usage in ldap.py
629484
629484
Use multi-line style for add_copy_specs() invocations in the ldap
629484
plug-in per the recommendations in Issue #173.
629484
629484
Signed-off-by: Bryn M. Reeves <bmr@redhat.com>
629484
---
629484
 sos/plugins/ldap.py | 13 ++++++++++---
629484
 1 file changed, 10 insertions(+), 3 deletions(-)
629484
629484
diff --git a/sos/plugins/ldap.py b/sos/plugins/ldap.py
629484
index b16b7b3..4d33076 100644
629484
--- a/sos/plugins/ldap.py
629484
+++ b/sos/plugins/ldap.py
629484
@@ -1,4 +1,4 @@
629484
-### This program is free software; you can redistribute it and/or modify
629484
+## This program is free software; you can redistribute it and/or modify
629484
 ## it under the terms of the GNU General Public License as published by
629484
 ## the Free Software Foundation; either version 2 of the License, or
629484
 ## (at your option) any later version.
629484
@@ -49,7 +49,10 @@ class RedHatLdap(Ldap, RedHatPlugin):
629484
 
629484
     def setup(self):
629484
         super(RedHatLdap, self).setup()
629484
-        self.add_copy_specs(["/etc/openldap", "/etc/nslcd.conf"])
629484
+        self.add_copy_specs([
629484
+                "/etc/openldap",
629484
+                "/etc/nslcd.conf"
629484
+        ])
629484
 
629484
     def postproc(self):
629484
         self.do_file_sub("/etc/nslcd.conf", r"(\s*bindpw\s*)\S+", r"\1***")
629484
@@ -66,7 +69,11 @@ class DebianLdap(Ldap, DebianPlugin, UbuntuPlugin):
629484
 
629484
         ldap_search = "ldapsearch -Q -LLL -Y EXTERNAL -H ldapi:/// "
629484
 
629484
-        self.add_copy_specs(["/etc/ldap/ldap.conf", "/etc/slapd.conf", "/etc/ldap/slapd.d"])
629484
+        self.add_copy_specs([
629484
+            "/etc/ldap/ldap.conf",
629484
+            "/etc/slapd.conf",
629484
+            "/etc/ldap/slapd.d"
629484
+        ])
629484
 
629484
         self.add_cmd_output("ldapsearch -x -b '' -s base 'objectclass=*'")
629484
         self.add_cmd_output(ldap_search + "-b cn=config '(!(objectClass=olcSchemaConfig))'",
629484
-- 
629484
1.7.11.7
629484
629484
629484
From a4a686eb589f0d54bc3808ce57c792356aa36106 Mon Sep 17 00:00:00 2001
629484
From: "Bryn M. Reeves" <bmr@redhat.com>
629484
Date: Tue, 13 Aug 2013 15:19:02 +0100
629484
Subject: [PATCH 2/4] Add pam_ldap.conf collection to ldap plug-in
629484
629484
Add the pam_ldap.conf file to the data collected by the ldap
629484
plug-in and tidy up substitution strings for this plug-in.
629484
629484
Signed-off-by: Bryn M. Reeves <bmr@redhat.com>
629484
---
629484
 sos/plugins/ldap.py | 13 +++++++++----
629484
 1 file changed, 9 insertions(+), 4 deletions(-)
629484
629484
diff --git a/sos/plugins/ldap.py b/sos/plugins/ldap.py
629484
index 4d33076..361de73 100644
629484
--- a/sos/plugins/ldap.py
629484
+++ b/sos/plugins/ldap.py
629484
@@ -39,23 +39,28 @@ class Ldap(Plugin):
629484
         self.add_copy_spec("/etc/ldap.conf")
629484
 
629484
     def postproc(self):
629484
-        self.do_file_sub("/etc/ldap.conf", r"(\s*bindpw\s*)\S+", r"\1***")
629484
+        self.do_file_sub("/etc/ldap.conf", r"(\s*bindpw\s*)\S+", r"\1******")
629484
 
629484
 class RedHatLdap(Ldap, RedHatPlugin):
629484
     """LDAP related information for RedHat based distribution
629484
     """
629484
 
629484
     packages = ('openldap', 'nss-pam-ldapd')
629484
+    files = ('/etc/ldap.conf', '/etc/pam_ldap.conf')
629484
 
629484
     def setup(self):
629484
         super(RedHatLdap, self).setup()
629484
         self.add_copy_specs([
629484
                 "/etc/openldap",
629484
-                "/etc/nslcd.conf"
629484
+                "/etc/nslcd.conf",
629484
+                "/etc/pam_ldap.conf"
629484
         ])
629484
 
629484
     def postproc(self):
629484
-        self.do_file_sub("/etc/nslcd.conf", r"(\s*bindpw\s*)\S+", r"\1***")
629484
+        self.do_file_sub("/etc/nslcd.conf",
629484
+                        r"(\s*bindpw\s*)\S+", r"\1********")
629484
+        self.do_file_sub("/etc/pam_ldap.conf",
629484
+                        r"(\s*bindpw\s*)\S+", r"\1********")
629484
 
629484
 class DebianLdap(Ldap, DebianPlugin, UbuntuPlugin):
629484
     """LDAP related information for Debian based distribution
629484
@@ -86,4 +91,4 @@ class DebianLdap(Ldap, DebianPlugin, UbuntuPlugin):
629484
     def postproc(self):
629484
         self.do_cmd_output_sub(
629484
         "ldapsearch -Q -LLL -Y EXTERNAL -H ldapi:/// -b cn=config '(!(objectClass=olcSchemaConfig))'",
629484
-            r"(olcRootPW\: \s*)\S+", r"\1***")
629484
+            r"(olcRootPW\: \s*)\S+", r"\1********")
629484
-- 
629484
1.7.11.7
629484
629484
629484
From cfb53a07ba72a311d2962e0bd73cf74430a4cad8 Mon Sep 17 00:00:00 2001
629484
From: "Bryn M. Reeves" <bmr@redhat.com>
629484
Date: Fri, 31 Jan 2014 15:25:15 +0000
629484
Subject: [PATCH 3/4] Remove obsolete diagnostics code from ldap plugin
629484
629484
Signed-off-by: Bryn M. Reeves <bmr@redhat.com>
629484
---
629484
 sos/plugins/ldap.py | 12 ------------
629484
 1 file changed, 12 deletions(-)
629484
629484
diff --git a/sos/plugins/ldap.py b/sos/plugins/ldap.py
629484
index 361de73..f1032a9 100644
629484
--- a/sos/plugins/ldap.py
629484
+++ b/sos/plugins/ldap.py
629484
@@ -22,18 +22,6 @@ class Ldap(Plugin):
629484
     plugin_name = "ldap"
629484
     ldap_conf = "/etc/openldap/ldap.conf"
629484
 
629484
-    def get_ldap_opts(self):
629484
-        # capture /etc/openldap/ldap.conf options in dict
629484
-        # FIXME: possibly not hardcode these options in?
629484
-        ldapopts=["URI","BASE","TLS_CACERTDIR"]
629484
-        results={}
629484
-        tmplist=[]
629484
-        for i in ldapopts:
629484
-            t=self.do_regex_find_all(r"^(%s)\s+(.*)" % i,self.ldap_conf)
629484
-            for x in t:
629484
-                results[x[0]]=x[1].rstrip("\n")
629484
-        return results
629484
-
629484
     def setup(self):
629484
         super(Ldap, self).setup()
629484
         self.add_copy_spec("/etc/ldap.conf")
629484
-- 
629484
1.7.11.7
629484
629484
629484
From e1a30a6d63a376d892a10d9cec89b312356ba9c2 Mon Sep 17 00:00:00 2001
629484
From: "Bryn M. Reeves" <bmr@redhat.com>
629484
Date: Fri, 31 Jan 2014 15:43:44 +0000
629484
Subject: [PATCH 4/4] Ensure superclass postproc method is called in ldap
629484
 plugin
629484
629484
Since the ldap plugins add files and post-processing methods at
629484
multiple class levels (Ldap, RedHatLdap etc.) derived classes
629484
must explicitly call their parent class's postproc() method to
629484
apply all substitutions to collected data.
629484
629484
Signed-off-by: Bryn M. Reeves <bmr@redhat.com>
629484
---
629484
 sos/plugins/ldap.py | 2 ++
629484
 1 file changed, 2 insertions(+)
629484
629484
diff --git a/sos/plugins/ldap.py b/sos/plugins/ldap.py
629484
index f1032a9..79d8394 100644
629484
--- a/sos/plugins/ldap.py
629484
+++ b/sos/plugins/ldap.py
629484
@@ -45,6 +45,7 @@ class RedHatLdap(Ldap, RedHatPlugin):
629484
         ])
629484
 
629484
     def postproc(self):
629484
+        super(RedHatLdap, self).postproc()
629484
         self.do_file_sub("/etc/nslcd.conf",
629484
                         r"(\s*bindpw\s*)\S+", r"\1********")
629484
         self.do_file_sub("/etc/pam_ldap.conf",
629484
@@ -77,6 +78,7 @@ class DebianLdap(Ldap, DebianPlugin, UbuntuPlugin):
629484
             suggest_filename="access_control_lists")
629484
 
629484
     def postproc(self):
629484
+        super(RedHatLdap, self).postproc()
629484
         self.do_cmd_output_sub(
629484
         "ldapsearch -Q -LLL -Y EXTERNAL -H ldapi:/// -b cn=config '(!(objectClass=olcSchemaConfig))'",
629484
             r"(olcRootPW\: \s*)\S+", r"\1********")
629484
-- 
629484
1.7.11.7
629484