From 3864bf024b3b36221063b4262283a116ed5fbc66 Mon Sep 17 00:00:00 2001 From: Ellie Date: Sat, 23 Nov 2019 21:42:03 -0500 Subject: [PATCH 1/2] fixes issuer key error --- sleuth_pkg/sleuth/enrich_tls.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/sleuth_pkg/sleuth/enrich_tls.py b/sleuth_pkg/sleuth/enrich_tls.py index 8ab1c51e..c6c5ad41 100644 --- a/sleuth_pkg/sleuth/enrich_tls.py +++ b/sleuth_pkg/sleuth/enrich_tls.py @@ -104,8 +104,8 @@ def check_compliance(compliance_policy, scs): return "yes" if scs_desc in compliance_data[compliance_policy] else "no" return "error loading file" - - + + def audit_certs_issuer(certs, trusted_ca_list): """ As implemented now, we will get the tls certs in order, the root cert is at the end. We check to see if the issuer @@ -306,13 +306,17 @@ def enrich_tls(flow, kwargs): except KeyError: scs = None + print(json.dumps(tls, indent=4)) + exit() + if 's_cert' in tls: certs = list() for x in tls['s_cert']: tmp = dict() tmp['cert_sig_alg'] = x['signature_algo'] tmp['sig_key_size'] = x['signature_key_size'] - tmp['issuer'] = x['issuer'] + if 'issuer' in x: + tmp['issuer'] = x['issuer'] certs.append(tmp) else: certs = None From d5aade056a324765faa331f3eda302dcd7e7cd69 Mon Sep 17 00:00:00 2001 From: Ellie Date: Mon, 2 Dec 2019 10:20:23 -0500 Subject: [PATCH 2/2] Remove debugging code --- sleuth_pkg/sleuth/enrich_tls.py | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/sleuth_pkg/sleuth/enrich_tls.py b/sleuth_pkg/sleuth/enrich_tls.py index c6c5ad41..4af835be 100644 --- a/sleuth_pkg/sleuth/enrich_tls.py +++ b/sleuth_pkg/sleuth/enrich_tls.py @@ -105,7 +105,7 @@ def check_compliance(compliance_policy, scs): return "error loading file" - + def audit_certs_issuer(certs, trusted_ca_list): """ As implemented now, we will get the tls certs in order, the root cert is at the end. We check to see if the issuer @@ -306,9 +306,6 @@ def enrich_tls(flow, kwargs): except KeyError: scs = None - print(json.dumps(tls, indent=4)) - exit() - if 's_cert' in tls: certs = list() for x in tls['s_cert']: