diff options
author | Louis Bouchard <louis.bouchard@canonical.com> | 2013-04-03 17:50:55 +0200 |
---|---|---|
committer | Louis Bouchard <louis.bouchard@canonical.com> | 2013-04-05 12:20:40 +0200 |
commit | f4084bab912b41065270301c7305e65df9ddb73c (patch) | |
tree | 15936089f5510081017ee1b607ed8de7ba48968e /sos/plugins/ldap.py | |
parent | 1a989a63de99e2f9e2985d16ffa609a13555cfe5 (diff) | |
download | sos-f4084bab912b41065270301c7305e65df9ddb73c.tar.gz |
Enabled new Debian plugins & adapted to new format
Diffstat (limited to 'sos/plugins/ldap.py')
-rw-r--r-- | sos/plugins/ldap.py | 44 |
1 files changed, 42 insertions, 2 deletions
diff --git a/sos/plugins/ldap.py b/sos/plugins/ldap.py index dff5d625..42f2db3a 100644 --- a/sos/plugins/ldap.py +++ b/sos/plugins/ldap.py @@ -12,16 +12,28 @@ ## along with this program; if not, write to the Free Software ## Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -from sos.plugins import Plugin, RedHatPlugin +from sos.plugins import Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin import os -class ldap(Plugin, RedHatPlugin): +class Ldap(Plugin): """LDAP related information """ + plugin_name = "ldap" + + def setup(self): + super(ldap, self).setup() + +class RedHatLdap(Ldap, RedHatPlugin): + """LDAP related information for RedHat based distribution + """ + files = ('/etc/openldap/ldap.conf',) packages = ('openldap', 'nss-pam-ldapd') + def setup(self): + super(RedHatLdap, self).setup() + def get_ldap_opts(self): # capture /etc/openldap/ldap.conf options in dict # FIXME: possibly not hardcode these options in? @@ -40,3 +52,31 @@ class ldap(Plugin, RedHatPlugin): def postproc(self): self.do_file_sub("/etc/ldap.conf", r"(\s*bindpw\s*)\S+", r"\1***") self.do_file_sub("/etc/nslcd.conf", r"(\s*bindpw\s*)\S+", r"\1***") + +class DebianLdap(Ldap, DebianPlugin, UbuntuPlugin): + """LDAP related information for Debian based distribution + """ + + def setup(self): + super(DebianLdap, self).setup() + + files = ('/etc/ldap/ldap.conf',) + packages = ('slapd', 'ldap-utils') + + def get_ldap_opts(self): + # capture /etc/ldap/ldap.conf options in dict + # FIXME: possibly not hardcode these options in? + ldapopts=["URI","BASE","TLS_CACERTDIR"] + results={} + tmplist=[] + for i in ldapopts: + t=self.do_regex_find_all(r"^(%s)\s+(.*)" % i,"/etc/ldap/ldap.conf") + for x in t: + results[x[0]]=x[1].rstrip("\n") + return results + + def setup(self): + self.add_copy_specs(["/etc/ldap/ldap.conf", "/etc/ldap/slapd.d"]) + + def postproc(self): + self.do_file_sub("/etc/ldap/ldap.conf", r"(\s*bindpw\s*)\S+", r"\1***") |