commit 482304916eedcde95f15c21e7041f28364bda6e9 Author: Damian Johnson atagar@torproject.org Date: Mon Jan 16 13:47:24 2017 -0800
Check for shared random partiioning issues
First of four shared random checks requested on...
https://trac.torproject.org/projects/tor/ticket/17434 --- consensus_health_checker.py | 20 ++++++++++++++++++++ data/consensus_health.cfg | 1 + 2 files changed, 21 insertions(+)
diff --git a/consensus_health_checker.py b/consensus_health_checker.py index bde08cb..620c2ef 100755 --- a/consensus_health_checker.py +++ b/consensus_health_checker.py @@ -325,6 +325,7 @@ def run_checks(consensuses, votes): bad_exits_in_sync, bandwidth_authorities_in_sync, is_orport_reachable, + shared_random_commitment_mismatch, )
all_issues = [] @@ -745,6 +746,25 @@ def is_orport_reachable(latest_consensus, consensuses, votes): return issues
+def shared_random_commitment_mismatch(latest_consensus, consensuses, votes): + """ + Check that each authority's commitment matches the votes from other + authorities. + """ + + issues = [] + self_commitments = {} + + for authority, vote in votes.items(): + our_v3ident = DIRECTORY_AUTHORITIES[authority].v3ident + our_commitment = [c.commit for c in vote.directory_authorities[0].shared_randomness_commitments if c.identity == our_v3ident][0] + self_commitments[our_v3ident] = our_commitment + + for authority, vote in votes.items(): + for commitment in vote.directory_authorities[0].shared_randomness_commitments: + if commitment.commit != self_commitments[commitment.identity]: + issues.append(Issue(Runlevel.WARNING, 'SHARED_RANDOM_COMMITMENT_MISMATCH', authority = authority.nickname, their_v3ident = commitment.identity, our_value = commitment.commit, their_value = self_commitments[commitment.identity], to = [authority])) + def get_consensuses(): """ Provides a mapping of directory authority nicknames to their present consensus. diff --git a/data/consensus_health.cfg b/data/consensus_health.cfg index 5630207..5eb5931 100644 --- a/data/consensus_health.cfg +++ b/data/consensus_health.cfg @@ -20,6 +20,7 @@ msg BADEXIT_OUT_OF_SYNC => Authorities disagree about the BadExit flag for {fing msg BANDWIDTH_AUTHORITIES_OUT_OF_SYNC => Bandwidth authorities have a substantially different number of measured entries: {authorities} msg AUTHORITY_UNAVAILABLE => Unable to retrieve the {fetch_type} from {authority} ({url}): {error} msg UNABLE_TO_REACH_ORPORT => Unable to reach the ORPort of {authority} ({address}, port {port}): {error} +msg SHARED_RANDOM_COMMITMENT_MISMATCH => Shared randomness commitment we report for {their_v3ident} doesn't match their actual value (ours: {our_value}, theirs: {their_value})
# hours that we'll suppress messages if it hasn't changed
tor-commits@lists.torproject.org