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

Cole Robinson crobinso at redhat.com
Sun Jul 28 19:16:25 UTC 2019


On 7/28/19 4:40 AM, athina.plaskasoviti at gmail.com wrote:
> 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",
> 

Thanks, pushed to the cloudinit branch now

- Cole




More information about the virt-tools-list mailing list