diff options
-rw-r--r-- | sos/plugins/__init__.py | 4 | ||||
-rw-r--r-- | sos/plugins/anaconda.py | 2 | ||||
-rw-r--r-- | sos/plugins/as7.py | 6 | ||||
-rw-r--r-- | sos/plugins/cluster.py | 2 | ||||
-rw-r--r-- | sos/plugins/general.py | 2 | ||||
-rw-r--r-- | sos/plugins/ipa.py | 2 | ||||
-rw-r--r-- | sos/plugins/jboss.py | 6 | ||||
-rw-r--r-- | sos/plugins/ldap.py | 4 | ||||
-rw-r--r-- | sos/plugins/libvirt.py | 2 | ||||
-rw-r--r-- | sos/plugins/named.py | 2 | ||||
-rw-r--r-- | sos/plugins/radius.py | 2 | ||||
-rw-r--r-- | sos/plugins/rhevm.py | 2 | ||||
-rw-r--r-- | tests/plugin_tests.py | 6 |
13 files changed, 21 insertions, 21 deletions
diff --git a/sos/plugins/__init__.py b/sos/plugins/__init__.py index ad4e5839..4341ddaa 100644 --- a/sos/plugins/__init__.py +++ b/sos/plugins/__init__.py @@ -165,7 +165,7 @@ class Plugin(object): '''Is the package $package_name installed?''' return (self.policy().pkgByName(package_name) is not None) - def doRegexExtOutputSub(self, cmd, regexp, subst): + def doExtOutputSub(self, cmd, regexp, subst): '''Apply a regexp substitution to command output archived by sosreport. cmd is the command name from which output is collected (i.e. excluding parameters). The regexp can be a string or a compiled re object. The @@ -193,7 +193,7 @@ class Plugin(object): except Exception, e: return 0 - def doRegexSub(self, srcpath, regexp, subst): + def doFileSub(self, srcpath, regexp, subst): '''Apply a regexp substitution to a file archived by sosreport. srcpath is the path in the archive where the file can be found. regexp can be a regexp string or a compiled re object. subst is a string to diff --git a/sos/plugins/anaconda.py b/sos/plugins/anaconda.py index 72b75775..3c60f00e 100644 --- a/sos/plugins/anaconda.py +++ b/sos/plugins/anaconda.py @@ -30,6 +30,6 @@ class anaconda(Plugin, RedHatPlugin): "/var/log/anaconda.xlog"]) def postproc(self): - self.doRegexSub("/root/anaconda-ks.cfg", + self.doFileSub("/root/anaconda-ks.cfg", r"(\s*rootpw\s*).*", r"\1******") diff --git a/sos/plugins/as7.py b/sos/plugins/as7.py index a4af8243..5d427a7c 100644 --- a/sos/plugins/as7.py +++ b/sos/plugins/as7.py @@ -235,19 +235,19 @@ class AS7(Plugin, IndependentPlugin, AS7Mixin): for dir_ in self.__jbossServerConfigDirs: path = os.path.join(self.__jbossHome, dir_) - self.doRegexSub(os.path.join(path,"configuration","*.xml"), + self.doFileSub(os.path.join(path,"configuration","*.xml"), password_xml_regex, r'<password>********</password>') tmp = os.path.join(path,"configuration") for propFile in find("*-users.properties", tmp): - self.doRegexSub(propFile, + self.doFileSub(propFile, r"=(.*)", r'=********') # Remove PW from -ds.xml files tmp = os.path.join(path, "deployments") for dsFile in find("*-ds.xml", tmp): - self.doRegexSub(dsFile, + self.doFileSub(dsFile, password_xml_regex, r"<password>********</password>") diff --git a/sos/plugins/cluster.py b/sos/plugins/cluster.py index f9b4edf8..3eb19fb5 100644 --- a/sos/plugins/cluster.py +++ b/sos/plugins/cluster.py @@ -128,5 +128,5 @@ class cluster(Plugin, RedHatPlugin): def postproc(self): for cluster_conf in glob("/etc/cluster/cluster.conf*"): - self.doRegexSub(cluster_conf, r"(\s*\<fencedevice\s*.*\s*passwd\s*=\s*)\S+(\")", r"\1%s" %('"***"')) + self.doFileSub(cluster_conf, r"(\s*\<fencedevice\s*.*\s*passwd\s*=\s*)\S+(\")", r"\1%s" %('"***"')) return diff --git a/sos/plugins/general.py b/sos/plugins/general.py index d83ddd70..47bd2191 100644 --- a/sos/plugins/general.py +++ b/sos/plugins/general.py @@ -83,7 +83,7 @@ class RedHatGeneral(general, RedHatPlugin): def postproc(self): - self.doRegexSub("/etc/sysconfig/rhn/up2date", + self.doFileSub("/etc/sysconfig/rhn/up2date", r"(\s*proxyPassword\s*=\s*)\S+", r"\1***") diff --git a/sos/plugins/ipa.py b/sos/plugins/ipa.py index cc4b1b5c..64218b45 100644 --- a/sos/plugins/ipa.py +++ b/sos/plugins/ipa.py @@ -79,5 +79,5 @@ class ipa(Plugin, RedHatPlugin): def postproc(self): match = r"(\s*arg \"password )[^\"]*" subst = r"\1********" - self.doRegexSub("/etc/named.conf", match, subst) + self.doFileSub("/etc/named.conf", match, subst) diff --git a/sos/plugins/jboss.py b/sos/plugins/jboss.py index e92747a7..e5283a5c 100644 --- a/sos/plugins/jboss.py +++ b/sos/plugins/jboss.py @@ -694,20 +694,20 @@ Default=\'all default minimal production standard web\'.', '', False), path=os.path.join(self.__jbossHome, "server", dir) ## Really annoying that there appears to be no vehicle to ## say I want ignore case...argh! - self.doRegexSub(os.path.join(path,"conf","login-config.xml"), + self.doFileSub(os.path.join(path,"conf","login-config.xml"), r"\"[Pp][Aa][Ss][Ss][Ww][Oo][Rr][Dd]\".*>.*</[Mm][Oo][Dd][Uu][Ll][Ee]-[Oo][Pp][Tt][Ii][Oo][Nn].*>", r'"password">********</module-option>') tmp = os.path.join(path,"conf", "props") for propFile in find("*-users.properties", tmp): - self.doRegexSub(propFile, + self.doFileSub(propFile, r"=(.*)", r'=********') ## Remove PW from -ds.xml files tmp=os.path.join(path, "deploy") for dsFile in find("*-ds.xml", tmp): - self.doRegexSub(dsFile, + self.doFileSub(dsFile, r"<[Pp][Aa][Ss][Ss][Ww][Oo][Rr][Dd].*>.*</[Pp][Aa][Ss][Ss][Ww][Oo][Rr][Dd].*>", r"<password>********</password>") return diff --git a/sos/plugins/ldap.py b/sos/plugins/ldap.py index ddd74505..c4a07d26 100644 --- a/sos/plugins/ldap.py +++ b/sos/plugins/ldap.py @@ -44,5 +44,5 @@ class ldap(Plugin, RedHatPlugin): self.addCopySpecs(["/etc/ldap.conf", "/etc/openldap", "/etc/nslcd.conf"]) def postproc(self): - self.doRegexSub("/etc/ldap.conf", r"(\s*bindpw\s*)\S+", r"\1***") - self.doRegexSub("/etc/nslcd.conf", r"(\s*bindpw\s*)\S+", r"\1***") + self.doFileSub("/etc/ldap.conf", r"(\s*bindpw\s*)\S+", r"\1***") + self.doFileSub("/etc/nslcd.conf", r"(\s*bindpw\s*)\S+", r"\1***") diff --git a/sos/plugins/libvirt.py b/sos/plugins/libvirt.py index 3408615f..fa439d50 100644 --- a/sos/plugins/libvirt.py +++ b/sos/plugins/libvirt.py @@ -23,6 +23,6 @@ class libvirt(Plugin, RedHatPlugin, UbuntuPlugin, DebianPlugin): def postproc(self): for xmlfile in glob.glob("/etc/libvirt/qemu/*.xml"): - self.doRegexSub(xmlfile, + self.doFileSub(xmlfile, r"(\s*passwd=\s*')([^']*)('.*$)", r"\1******\3") diff --git a/sos/plugins/named.py b/sos/plugins/named.py index e50fabb1..36bff1ca 100644 --- a/sos/plugins/named.py +++ b/sos/plugins/named.py @@ -48,4 +48,4 @@ class named(Plugin, RedHatPlugin): def postproc(self): match = r"(\s*arg \"password )[^\"]*" subst = r"\1******" - self.doRegexSub("/etc/named.conf", match, subst) + self.doFileSub("/etc/named.conf", match, subst) diff --git a/sos/plugins/radius.py b/sos/plugins/radius.py index df1442b1..472c06b0 100644 --- a/sos/plugins/radius.py +++ b/sos/plugins/radius.py @@ -35,7 +35,7 @@ class RedHatRadius(radius, RedHatPlugin): self.addCopySpecs(["/etc/raddb", "/etc/pam.d/radiusd", "/var/log/radius"]) def postproc(self): - self.doRegexSub("/etc/raddb/sql.conf", r"(\s*password\s*=\s*)\S+", r"\1***") + self.doFileSub("/etc/raddb/sql.conf", r"(\s*password\s*=\s*)\S+", r"\1***") class DebianRadius(radius, DebianPlugin, UbuntuPlugin): """radius related information on Debian distributions diff --git a/sos/plugins/rhevm.py b/sos/plugins/rhevm.py index 236ead49..e1575465 100644 --- a/sos/plugins/rhevm.py +++ b/sos/plugins/rhevm.py @@ -18,6 +18,6 @@ class rhevm(Plugin, RedHatPlugin): Obfuscate passwords. """ - self.doRegexSub("/etc/rhevm/rhevm-config/rhevm-config.properties", + self.doFileSub("/etc/rhevm/rhevm-config/rhevm-config.properties", r"Password.type=(.*)", r'Password.type=********') diff --git a/tests/plugin_tests.py b/tests/plugin_tests.py index a3055543..f01a7a9c 100644 --- a/tests/plugin_tests.py +++ b/tests/plugin_tests.py @@ -300,18 +300,18 @@ class RegexSubTests(unittest.TestCase): self.mp.archive = MockArchive() def test_file_never_copied(self): - self.assertEquals(0, self.mp.doRegexSub("never_copied", r"^(.*)$", "foobar")) + self.assertEquals(0, self.mp.doFileSub("never_copied", r"^(.*)$", "foobar")) def test_no_replacements(self): self.mp.addCopySpec(j("tail_test.txt")) self.mp.copyStuff() - replacements = self.mp.doRegexSub(j("tail_test.txt"), r"wont_match", "foobar") + replacements = self.mp.doFileSub(j("tail_test.txt"), r"wont_match", "foobar") self.assertEquals(0, replacements) def test_replacements(self): self.mp.addCopySpec(j("tail_test.txt")) self.mp.copyStuff() - replacements = self.mp.doRegexSub(j("tail_test.txt"), r"(tail)", "foobar") + replacements = self.mp.doFileSub(j("tail_test.txt"), r"(tail)", "foobar") self.assertEquals(1, replacements) self.assertTrue("foobar" in self.mp.archive.m.get(j('tail_test.txt'))) |