Opened 9 years ago

Closed 3 years ago

#4187 closed defect (fixed)

A verified unverified-consensus should be renamed to cached-consensus

Reported by: anonym Owned by:
Priority: High Milestone: Tor: 0.3.4.x-final
Component: Core Tor/Tor Version: Tor:
Severity: Normal Keywords: tor-client, directory, rename, fs, easy, 032-unreached
Cc: anonym, intrigeri Actual Points:
Parent ID: Points: 1
Reviewer: Sponsor:


If Tor with a fresh $DATA_DIR gets a consensus and cannot verify, Tor writes it as $DATA_DIR/unverified-consensus. If Tor then is restarted and suddenly can verify unverified-consensus for whatever reason, Tor will start using it and never write a cached-consensus. While this doesn't cause Tor to misbehave AFAICT, the name of unverified-consensus is misleading since it in fact isn't unverified any longer.

Steps to reproduce:

  1. rm $DATA_DIR/*-consensus
  2. date --set="Jan 1 00:00:00 UTC 2013" # or whenever all current authority certs are expired
  3. start tor
  4. verify that Tor is *not* working and that you got $DATA_DIR/unverified-consensus
  5. stop tor
  6. set correct system time
  7. start tor
  8. verify that Tor *is* working and that there's no $DATA_DIR/cached-consensus, only $DATA_DIR/unverified-consensus

Child Tickets

Change History (22)

comment:1 Changed 9 years ago by nickm

Milestone: Tor: unspecified

comment:2 Changed 8 years ago by nickm

Keywords: tor-client added

comment:3 Changed 8 years ago by nickm

Component: Tor ClientTor

comment:4 Changed 6 years ago by intrigeri

Cc: anonym intrigeri added; tails@… removed

comment:5 Changed 3 years ago by nickm

Keywords: directory rename fs easy added
Points: 1
Severity: Normal

This is a minor annoyance, but not too hard to fix if anybody wants to make the attempt.

The way to do it is probably somewhere inside networkstatus_set_current_consensus() or one of its callers.

comment:6 Changed 3 years ago by Farigon

Owner: set to Farigon
Status: newassigned

comment:7 Changed 3 years ago by Farigon

Status: assignednew

comment:8 Changed 3 years ago by Farigon

Owner: Farigon deleted
Status: newassigned

comment:9 Changed 3 years ago by arma

In retrospect, this bug bit me in #22400, in that it confused me about what Tor was doing.

Also, I wonder if the bug is a bit more than a minor annoyance in that it puts a timestamp on disk about a time in the past that I tried to use Tor and it didn't bootstrap. Still not a terrible bug, but it introduces a minor violation of Tor Browser's disk avoidance policy.

comment:10 Changed 3 years ago by nickm

Milestone: Tor: unspecifiedTor: 0.3.2.x-final
Priority: LowHigh

comment:11 Changed 3 years ago by nickm

Keywords: 032-unreached added
Milestone: Tor: 0.3.2.x-finalTor: unspecified

Mark a large number of tickets that I do not think we will do for 0.3.2.

comment:12 Changed 3 years ago by teor

Status: assignednew

Mark all tickets that are assigned to nobody as "new".

comment:13 Changed 3 years ago by aruna1234

The code in networkstatus.c regarding networkstatus_set_current_consensus(), has an assignment, where it assigns a char buff whether it is 'cached consensus' or 'unverified consensus'. When Tor is suddenly started and it can verify the unverified consensus, maybe we can have a check placed checking whether 'buff' is unverified, if it is then we could change it to 'verified consensus'. Is the approach feasible?

comment:14 Changed 3 years ago by teor

This ticket is about changing the file name on disk.

comment:15 Changed 3 years ago by fristonio

Hey, if no one is assigned to this issue I would really love to work to resolve this.

comment:16 Changed 3 years ago by teor

It's not assigned to anyone. And even if it is, it's always ok to ask if you can help out.

comment:17 Changed 3 years ago by fristonio

OK Got it,

Working on the issue, will update here as soon as I fix it.

comment:18 Changed 3 years ago by nickm

Here's an easier way to see the bug:

  1. Start tor, and let it bootstrap.
  2. Stop tor.
  3. In the DataDirectory, rename cached-microdesc-consensus to unverified-microdesc-consensus.
  4. Start tor again.

Although Tor will use the unverified-microdesc-consensus file, it will not rename it to the proper name once it is verified.

comment:19 Changed 3 years ago by fristonio

Thanks for this nickm, it was a great help to reproduce the issue with your suggestion. Here is my patch for the ticket.

Please comment if any other changes are required.

comment:20 Changed 3 years ago by nickm

Milestone: Tor: unspecifiedTor: 0.3.4.x-final
Status: newneeds_review

Thanks! We'll have a look soon!

comment:21 Changed 3 years ago by nickm

Status: needs_reviewmerge_ready

This patch looks good to me! Let's take it once the 0.3.4.x merge window is open.

I think there could still be remaining cases where the file doesn't get renamed, but this one at least should get fixed.

comment:22 Changed 3 years ago by nickm

Resolution: fixed
Status: merge_readyclosed

Merging in master!

Note: See TracTickets for help on using tickets.