diff options
author | Xavier Queralt <xqueralt@redhat.com> | 2013-09-09 10:40:15 +0200 |
---|---|---|
committer | Bryn M. Reeves <bmr@redhat.com> | 2013-10-22 16:23:42 +0100 |
commit | 75a0ef8a395fccfc1353812addc3d9c1c523e34e (patch) | |
tree | abc0004d7f0945e35375412d8005108a1a56b86d | |
parent | df4fd5e890481200577e2f1cfe1231097f4dacfd (diff) | |
download | sos-75a0ef8a395fccfc1353812addc3d9c1c523e34e.tar.gz |
Fix password protection for nova
Signed-off-by: Xavier Queralt <xqueralt@redhat.com>
-rw-r--r-- | sos/plugins/openstack_nova.py | 25 |
1 files changed, 11 insertions, 14 deletions
diff --git a/sos/plugins/openstack_nova.py b/sos/plugins/openstack_nova.py index e9932b48..3823c572 100644 --- a/sos/plugins/openstack_nova.py +++ b/sos/plugins/openstack_nova.py @@ -60,20 +60,17 @@ class OpenStackNova(Plugin): self.add_copy_spec("/etc/nova/") def postproc(self): - protect_passwords = { - "/etc/nova/nova.conf": [ - "ldap_dns_password", "neutron_admin_password", - "rabbit_password", "qpid_password", "powervm_mgr_passwd", - "xenapi_connection_password", "virtual_power_host_pass", - "password", "host_password", "vnc_password", "connection", - "sql_connection"], - "/etc/nova/api-paste.ini": ["admin_password"] - } - - for conf_file, keys in protect_passwords.items(): - for password_key in keys: - regexp = r"(?m)^(%s\s*=\s*)(.*)" % password_key - self.do_file_sub(conf_file, regexp, r"\1*********") + protect_keys = [ + "ldap_dns_password", "neutron_admin_password", "rabbit_password", + "qpid_password", "powervm_mgr_passwd", "virtual_power_host_pass", + "xenapi_connection_password", "password", "host_password", + "vnc_password", "connection", "sql_connection", "admin_password" + ] + + regexp = r"((?m)^\s*#*(%s)\s*=\s*)(.*)" % "|".join(protect_keys) + + for conf_file in ["/etc/nova/nova.conf", "/etc/nova/api-paste.ini"]: + self.do_file_sub(conf_file, regexp, r"\1*********") class DebianOpenStackNova(OpenStackNova, DebianPlugin, UbuntuPlugin): |