]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
qa: s3test task scans radosgw logs for leaked encryption keys 13597/head
authorCasey Bodley <cbodley@redhat.com>
Mon, 6 Mar 2017 20:13:22 +0000 (15:13 -0500)
committerCasey Bodley <cbodley@redhat.com>
Mon, 3 Apr 2017 14:44:58 +0000 (10:44 -0400)
Signed-off-by: Casey Bodley <cbodley@redhat.com>
qa/tasks/s3tests.py

index 20f328b17994fd95ed0cacc4bd542e0bccd2deaa..c71ef49e801347b62fddb11365b90878a10a1ed2 100644 (file)
@@ -352,6 +352,46 @@ def run_tests(ctx, config):
             )
     yield
 
+@contextlib.contextmanager
+def scan_for_leaked_encryption_keys(ctx, config):
+    """
+    Scan radosgw logs for the encryption keys used by s3tests to
+    verify that we're not leaking secrets.
+
+    :param ctx: Context passed to task
+    :param config: specific configuration information
+    """
+    assert isinstance(config, dict)
+
+    try:
+        yield
+    finally:
+        # x-amz-server-side-encryption-customer-key
+        s3test_customer_key = 'pO3upElrwuEXSoFwCfnZPdSsmt/xWeFa0N9KgDijwVs='
+
+        log.debug('Scanning radosgw logs for leaked encryption keys...')
+        procs = list()
+        for client, client_config in config.iteritems():
+            (remote,) = ctx.cluster.only(client).remotes.keys()
+            proc = remote.run(
+                args=[
+                    'grep',
+                    '--binary-files=text',
+                    s3test_customer_key,
+                    '/var/log/ceph/rgw.{client}.log'.format(client=client),
+                ],
+                wait=False,
+                check_status=False,
+            )
+            procs.append(proc)
+
+        for proc in procs:
+            proc.wait()
+            if proc.returncode == 1: # 1 means no matches
+                continue
+            log.error('radosgw log is leaking encryption keys!')
+            raise Exception('radosgw log is leaking encryption keys')
+
 @contextlib.contextmanager
 def task(ctx, config):
     """
@@ -444,6 +484,7 @@ def task(ctx, config):
                 s3tests_conf=s3tests_conf,
                 )),
         lambda: run_tests(ctx=ctx, config=config),
+        lambda: scan_for_leaked_encryption_keys(ctx=ctx, config=config),
         ):
         pass
     yield