212-using-old-consensus.txt 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. Filename: 212-using-old-consensus.txt
  2. Title: Increase Acceptable Consensus Age
  3. Author: Mike Perry
  4. Created: 01-10-2012
  5. Status: Needs-Revision
  6. Target: 0.2.4.x+
  7. Overview
  8. This proposal aims to extend the duration that clients will accept
  9. old consensus material under conditions where the directory authorities
  10. are either down or fail to produce a valid consensus for an extended
  11. period of time.
  12. Motivation
  13. Currently, if the directory authorities are down or fail to consense
  14. for 24 hours, the entire Tor network will cease to function. Worse,
  15. clients will enter into a state where they all need to re-bootstrap
  16. directly from the directory authorities, which will likely exacerbate
  17. any potential DoS condition that may have triggered the downtime in the
  18. first place.
  19. The Tor network has had such close calls before. In the past, we've
  20. been able to mobilize a majority of the directory authority operators
  21. within this 24 hour window, but that is only because we've been
  22. exceedingly lucky and the DoS conditions were accidental rather than
  23. deliberate.
  24. If a DoS attack was deliberately timed to coincide with a major US
  25. and European combined holiday such as Christmas Eve, New Years Eve, or
  26. Easter, it is very unlikely we would be able to muster the resources to
  27. diagnose and deploy a fix to the authorities in time to prevent network
  28. collapse.
  29. Description
  30. Based on the need to survive multi-day holidays and long weekends
  31. balanced with the need to ensure clients can't be captured on an old
  32. consensus forever, I propose that the consensus liveness constants be
  33. set at 3 days rather than 24 hours.
  34. This requires updating two consensus defines in the source, and one
  35. descriptor freshness variable. The descriptor freshness should be
  36. set to a function of the consensus freshness.
  37. See Implementation Notes for further details.
  38. Security Concerns: Using an Old Consensus
  39. Clients should not trust old consensus data without an attempt to
  40. download fresher data from a directory mirror.
  41. As far as I could tell, the code already does this. The minimum
  42. consensus age before we try to download new data is two hours.
  43. However, the ability to accept old consensus documents does introduce
  44. the ability of malicious directory mirrors to feed their favorite old
  45. consensus document to clients to alter their paths until they
  46. download a fresher consensus from elsewhere. Directory guards
  47. (Proposal 207) may exacerbate this ability.
  48. This proposal does not address such attacks, and seeks only a modest
  49. increase in the valid timespan as a compromise.
  50. Future consideration of these and other targeted-consensus attacks
  51. will be left to proposals related to ticket #7126[1]. Once those
  52. proposals are complete and implemented, raising the freshness limit
  53. beyond 3 days should be possible.
  54. Implementation Notes
  55. There appear to be at least three constants in the code involved with
  56. using potentially expired consensus data. Two of them
  57. (REASONABLY_LIVE_TIME and NS_EXPIRY_SLOP) involve the consensus itself,
  58. and two (OLD_ROUTER_DESC_MAX_AGE and TOLERATE_MICRODESC_AGE) deal with
  59. descriptor liveness.
  60. Two additional constants ROUTER_MAX_AGE and ROUTER_MAX_AGE_TO_PUBLISH
  61. are only used when submitting descriptors for consensus voting.
  62. FORCE_REGENERATE_DESCRIPTOR_INTERVAL is the maximum age a router
  63. descriptor will get before a relay will re-publish. It is set to 18
  64. hours.
  65. OLD_ROUTER_DESC_MAX_AGE is set at 5 days. TOLERATE_MICRODESC_AGE
  66. is set at 7 days.
  67. The consensus timestamps are used in
  68. networkstatus_get_reasonably_live_consensus() and
  69. networkstatus_set_current_consensus().
  70. OLD_ROUTER_DESC_MAX_AGE is checked in routerlist_remove_old_routers(),
  71. router_add_to_routerlist(), and client_would_use_router().
  72. It is my opinion that we should combine REASONABLY_LIVE_TIME and
  73. NS_EXPIRY_SLOP into a single define, and make OLD_ROUTER_DESC_MAX_AGE a
  74. function of REASONABLY_LIVE_TIME and FORCE_REGENERATE_DESCRIPTOR_INTERVAL:
  75. #define REASONABLY_LIVE_TIME (3*24*60*60)
  76. #define NS_EXPIRY_SLOP REASONABLY_LIVE_TIME
  77. #define OLD_ROUTER_DESC_MAX_AGE \
  78. (REASONABLY_LIVE_TIME+FORCE_REGENERATE_DESCRIPTOR_INTERVAL)
  79. Based on my review of the above code paths, these changes should be all
  80. we need to enable clients to use older consensuses for longer while
  81. still attempting to fetch new ones.
  82. 1. https://trac.torproject.org/projects/tor/ticket/7126