From c1e37e41831c8a9ce8c9901d604421b8b19a20e1 Mon Sep 17 00:00:00 2001 From: "Bryn M. Reeves" Date: Mon, 12 Aug 2013 20:11:29 +0100 Subject: [PATCH 1/3] Add new plug-in to gather OpenHPI configuration New plug-in to collect OpenHPI configuration files. These files may contain passwords; a regex substitution rule has been added based on information from the reporter but this needs testing with a range of actual configuration files. Signed-off-by: Bryn M. Reeves --- sos/plugins/openhpi.py | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 sos/plugins/openhpi.py diff --git a/sos/plugins/openhpi.py b/sos/plugins/openhpi.py new file mode 100644 index 0000000..bb35206 --- /dev/null +++ b/sos/plugins/openhpi.py @@ -0,0 +1,34 @@ +### This program is free software; you can redistribute it and/or modify +## it under the terms of the GNU General Public License as published by +## the Free Software Foundation; either version 2 of the License, or +## (at your option) any later version. + +## This program is distributed in the hope that it will be useful, +## but WITHOUT ANY WARRANTY; without even the implied warranty of +## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +## GNU General Public License for more details. + +## You should have received a copy of the GNU General Public License +## 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 +import os + +class OpenHPI(Plugin, RedHatPlugin): + """OpenHPI related information + """ + + plugin_name = 'openhpi' + + def setup(self): + self.add_copy_specs([ + "/etc/openhpi/openhpi.conf", + "/etc/openhpi/openhpiclient.conf" + ]) + + def postproc(self): + self.do_file_sub("/etc/openhpi/openhpi.conf" + r'([Pp]assw(or)?d|[Pp]assphrase)[[:space:]]+\=[[:space:]]"(.*)"', + r"\1******") + -- 1.7.11.7 From a2be6462e40acc48c4271b2faddc4e9a03187712 Mon Sep 17 00:00:00 2001 From: "Bryn M. Reeves" Date: Mon, 12 Aug 2013 20:15:25 +0100 Subject: [PATCH 2/3] Add file substitution rule for openhpiclient.conf Signed-off-by: Bryn M. Reeves --- sos/plugins/openhpi.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/sos/plugins/openhpi.py b/sos/plugins/openhpi.py index bb35206..a75f016 100644 --- a/sos/plugins/openhpi.py +++ b/sos/plugins/openhpi.py @@ -31,4 +31,7 @@ class OpenHPI(Plugin, RedHatPlugin): self.do_file_sub("/etc/openhpi/openhpi.conf" r'([Pp]assw(or)?d|[Pp]assphrase)[[:space:]]+\=[[:space:]]"(.*)"', r"\1******") + self.do_file_sub("/etc/openhpi/openhpiclient.conf" + r'([Pp]assw(or)?d|[Pp]assphrase)[[:space:]]+\=[[:space:]]"(.*)"', + r"\1******") -- 1.7.11.7 From a70afd9562a3ba9ad193fa25c6079c45533b9887 Mon Sep 17 00:00:00 2001 From: "Bryn M. Reeves" Date: Thu, 7 Nov 2013 18:17:18 +0000 Subject: [PATCH 3/3] Fix regex substitution in openhpi plug-in Signed-off-by: Bryn M. Reeves --- sos/plugins/openhpi.py | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/sos/plugins/openhpi.py b/sos/plugins/openhpi.py index a75f016..dbe004d 100644 --- a/sos/plugins/openhpi.py +++ b/sos/plugins/openhpi.py @@ -28,10 +28,6 @@ class OpenHPI(Plugin, RedHatPlugin): ]) def postproc(self): - self.do_file_sub("/etc/openhpi/openhpi.conf" - r'([Pp]assw(or)?d|[Pp]assphrase)[[:space:]]+\=[[:space:]]"(.*)"', - r"\1******") - self.do_file_sub("/etc/openhpi/openhpiclient.conf" - r'([Pp]assw(or)?d|[Pp]assphrase)[[:space:]]+\=[[:space:]]"(.*)"', - r"\1******") + self.do_file_sub("/etc/openhpi/openhpi.conf", + r'(\s*[Pp]ass.*\s*=\s*).*', r'\1********') -- 1.7.11.7