From e82bd5136a7fbfcd305615aafb246ccc27f5bc69 Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Thu, 25 Jul 2019 12:20:52 -0500 Subject: [PATCH] mgr/telemetry: obscure entity_name with a salt Signed-off-by: Sage Weil --- src/pybind/mgr/telemetry/module.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/pybind/mgr/telemetry/module.py b/src/pybind/mgr/telemetry/module.py index 495fd5d8c55..4078f32bba2 100644 --- a/src/pybind/mgr/telemetry/module.py +++ b/src/pybind/mgr/telemetry/module.py @@ -5,6 +5,7 @@ Collect statistics from Ceph cluster and send this back to the Ceph project when user has opted-in """ import errno +import hashlib import json import re import requests @@ -140,6 +141,7 @@ class Module(MgrModule): self.last_upload = None self.last_report = dict() self.report_id = None + self.salt = None def config_notify(self): for opt in self.MODULE_OPTIONS: @@ -158,6 +160,11 @@ class Module(MgrModule): self.report_id = str(uuid.uuid4()) self.set_store('report_id', self.report_id) + self.salt = self.get_store('salt', None) + if not self.salt: + self.salt = str(uuid.uuid4()) + self.set_store('salt', self.salt) + def gather_osd_metadata(self, osd_map): keys = ["osd_objectstore", "rotational"] keys += self.metadata_keys @@ -204,6 +211,13 @@ class Module(MgrModule): continue c = json.loads(crashinfo) del c['utsname_hostname'] + (etype, eid) = c.get('entity_name', '').split('.') + if etype != 'osd': + m = hashlib.sha1() + m.update(self.salt.encode('utf-8')) + m.update(eid.encode('utf-8')) + m.update(self.salt.encode('utf-8')) + c['entity_name'] = etype + '.' + m.hexdigest() crashlist.append(c) return crashlist