do not log sensitive site-to-site VPN PSK Logging before: 2015-08-12 16:30:07,126 Searching for 192.168.23.6 and replacing with 192.168.23.6 192.168.23.5: PSK "preSharedKey"
Logging after: 2015-08-12 16:30:07,126 Searching for 192.168.23.6 and replacing with 192.168.23.6 192.168.23.5: PSK "****" Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/4f8ab51f Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/4f8ab51f Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/4f8ab51f Branch: refs/heads/master Commit: 4f8ab51f7f2a1d8b78e754981d92c3904408fb30 Parents: 9b97719 Author: Remi Bergsma <[email protected]> Authored: Fri Aug 14 09:07:25 2015 +0200 Committer: Remi Bergsma <[email protected]> Committed: Fri Aug 14 09:07:25 2015 +0200 ---------------------------------------------------------------------- systemvm/patches/debian/config/opt/cloud/bin/cs/CsFile.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cloudstack/blob/4f8ab51f/systemvm/patches/debian/config/opt/cloud/bin/cs/CsFile.py ---------------------------------------------------------------------- diff --git a/systemvm/patches/debian/config/opt/cloud/bin/cs/CsFile.py b/systemvm/patches/debian/config/opt/cloud/bin/cs/CsFile.py index 28d4413..1cbf971 100755 --- a/systemvm/patches/debian/config/opt/cloud/bin/cs/CsFile.py +++ b/systemvm/patches/debian/config/opt/cloud/bin/cs/CsFile.py @@ -114,7 +114,10 @@ class CsFile: def search(self, search, replace): found = False - logging.debug("Searching for %s and replacing with %s" % (search, replace)) + replace_filtered = replace + if re.search("PSK \"", replace): + replace_filtered = re.sub(r'".*"', '"****"', replace) + logging.debug("Searching for %s and replacing with %s" % (search, replace_filtered)) for index, line in enumerate(self.new_config): if line.lstrip().startswith("#"): continue
