diff options
| author | Josef Gustafsson <josef.gson@gmail.com> | 2015-09-30 12:59:46 +0200 |
|---|---|---|
| committer | Josef Gustafsson <josef.gson@gmail.com> | 2015-09-30 12:59:46 +0200 |
| commit | beaf6e3b91ebfc3a7134398c1607a679434859f7 (patch) | |
| tree | 483ad49931867e9763579ec38434b29cb3f5bc78 | |
| parent | 8e7f6d4953c149c1a71445e1f62f60108c788a6a (diff) | |
bugfix in consistency validation
| -rw-r--r-- | monitor/josef_lib.py | 22 | ||||
| -rwxr-xr-x | monitor/josef_monitor.py | 27 |
2 files changed, 26 insertions, 23 deletions
diff --git a/monitor/josef_lib.py b/monitor/josef_lib.py index e5c7d14..d78de48 100644 --- a/monitor/josef_lib.py +++ b/monitor/josef_lib.py @@ -47,16 +47,6 @@ def get_all_roots(base_url): root_cert = base64.decodestring(accepted_cert) return certs -def check_domain(raw_entry, log=None): - orig_entry = extract_original_entry(raw_entry) - try: - cert_info = my_get_cert_info(orig_entry[0][0]) - if log: - cert_info["log"] = log[8:-1] # strip generic URL stuff - return cert_info - except IndexError: - return None - def check_domain_all(raw_entry, log=None): orig_entry = extract_original_entry(raw_entry) try: @@ -927,15 +917,3 @@ def reduce_subtree_to_root(layers): return next_merkle_layer(layers[0]) return layers[0] -def verify_subtree(sth, subtree, base_url): - try: - tmp = deepcopy(subtree) - root = base64.b64encode(reduce_subtree_to_root(tmp)[0]) - - if root == sth["sha256_root_hash"]: - return True - else: - return False - except: - return False - diff --git a/monitor/josef_monitor.py b/monitor/josef_monitor.py index 1866a63..d5e4254 100755 --- a/monitor/josef_monitor.py +++ b/monitor/josef_monitor.py @@ -81,7 +81,9 @@ class ctlog: + str(self.entries -1 ) + " of " + str(self.sth["tree_size"]-1)) if self.entries != start_size: - if not verify_subtree(self.sth, self.subtree, self.url): + if verify_subtree(self.sth, self.subtree, self.url): + pass + else: self.log(ERROR_STR + "Failed to verify newly built subtree!") def fetch_and_increment_subtree(self, first, last, url, subtree =[[]]): @@ -263,6 +265,29 @@ class ctlog: print ERROR_STR + "Could not verify consistency for " + self.url +def verify_subtree(sth, subtree, base_url): + try: + tmp = deepcopy(subtree) + root = base64.b64encode(reduce_subtree_to_root(tmp)[0]) + + if root == sth["sha256_root_hash"]: + return True + else: + return False + except: + return False + +def check_domain(raw_entry, log=None): + orig_entry = extract_original_entry(raw_entry) + try: + cert_info = my_get_cert_info(orig_entry[0][0]) + if log: + cert_info["log"] = log[8:-1] # strip generic URL stuff + return cert_info + except IndexError: + return None + + # def verify_inclusion_all(old, new): # for url in old: # try: |
