]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/telemetry: obscure entity_name with a salt 29330/head
authorSage Weil <sage@redhat.com>
Thu, 25 Jul 2019 17:20:52 +0000 (12:20 -0500)
committerSage Weil <sage@redhat.com>
Thu, 25 Jul 2019 17:20:52 +0000 (12:20 -0500)
Signed-off-by: Sage Weil <sage@redhat.com>
src/pybind/mgr/telemetry/module.py

index 495fd5d8c55fd53dd6a0fd45c5d925b69d7b3d5f..4078f32bba2d069a5e59d8bb76d29e91240dd1c7 100644 (file)
@@ -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