From: Yaarit Hatuka Date: Fri, 31 Jan 2020 21:44:30 +0000 (-0500) Subject: mgr/telemetry: anonymizing smartctl report itself X-Git-Tag: v15.1.1~549^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=be1257f324684cd3034f89ac1421b366cac66822;p=ceph.git mgr/telemetry: anonymizing smartctl report itself smartctl JSON output contains the device's serial number in two different keys ('serial_number' & 'output'). Serial is now obfuscated in both. Fixes: https://tracker.ceph.com/issues/43939 Signed-off-by: Yaarit Hatuka --- diff --git a/src/pybind/mgr/telemetry/module.py b/src/pybind/mgr/telemetry/module.py index ce8dd71e51a..e782d01732e 100644 --- a/src/pybind/mgr/telemetry/module.py +++ b/src/pybind/mgr/telemetry/module.py @@ -395,9 +395,9 @@ class Module(MgrModule): host, anon_host)) # anonymize the smartctl report itself - for k in ['serial_number']: - if k in m: - m.pop(k) + serial = devid.rsplit('_', 1)[1] + m_str = json.dumps(m) + m = json.loads(m_str.replace(serial, 'deleted')) if anon_host not in res: res[anon_host] = {}