[virt-tools-list] [virt-manager PATCH] cloudinit: Scrub password from logs

athina.plaskasoviti at gmail.com athina.plaskasoviti at gmail.com
Sun Jul 28 08:40:38 UTC 2019


From: Athina Plaskasoviti <athina.plaskasoviti at gmail.com>

Signed-off-by: Athina Plaskasoviti <athina.plaskasoviti at gmail.com>
---
 virtinst/install/cloudinit.py | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/virtinst/install/cloudinit.py b/virtinst/install/cloudinit.py
index 44b8ed60..b1a3b146 100644
--- a/virtinst/install/cloudinit.py
+++ b/virtinst/install/cloudinit.py
@@ -1,6 +1,7 @@
 import tempfile
 import random
 import string
+import re
 from ..logger import log
 
 
@@ -62,7 +63,9 @@ def create_userdata(scratchdir, cloudinit_data):
     if cloudinit_data.disable:
         content += "runcmd:\n"
         content += "- [ sudo, touch, /etc/cloud/cloud-init.disabled ]\n"
-    log.debug("Generated cloud-init userdata:\n%s", content)
+
+    log.debug("Generated cloud-init userdata: \n%s",
+            re.sub(r"root:(.*)", 'root:[SCRUBBLED]', content))
 
     fileobj = tempfile.NamedTemporaryFile(
             prefix="virtinst-", suffix="-userdata",
-- 
2.21.0




More information about the virt-tools-list mailing list