Commit Graph

70 Commits

Author SHA1 Message Date
Nick Mathewson afdcd69e03 Make first-level directory retry logic configurable. 2021-02-17 11:55:39 -05:00
Nick Mathewson d8d2c0f79c Make our initial bootstrap retry schedule configurarable 2021-02-17 11:25:57 -05:00
Nick Mathewson bd6625174e tor-dirmgr: simplify config.rs a bit. 2021-02-16 13:37:20 -05:00
Nick Mathewson ddf994acc5 Add support to override network parameters in the configuration. 2021-02-16 13:29:46 -05:00
Nick Mathewson 94901ec355 Apply "deny_unknown_fields" to configuration types. 2021-02-12 11:26:00 -05:00
Nick Mathewson 209d1df242 Remove fallback to .arti/cache for cache directory 2021-02-12 10:59:06 -05:00
Nick Mathewson aeb410b915 Make authorities and fallbacks configurable.
This commit adds configuration options for these values, with the
right defaults, and uses those options instead of built-in functions
to set them.

We also remove the function to extract information from chutney
directories: now that arti is configurable, it can be chutney's job
to make its own network configurations.
2021-02-11 13:08:46 -05:00
Nick Mathewson 243880473f bump serde and log 2021-02-01 16:39:07 -05:00
Nick Mathewson c5799e136f Check declared post-digest on consensus diffs. 2021-01-25 16:51:56 -05:00
Nick Mathewson e11bb47d5b Don't give up easily on initial bootstrap attempts. 2021-01-25 16:23:43 -05:00
Nick Mathewson 4ba7a89a3f Resolve a few more XXX-A1 comments in dirmgr. 2021-01-25 16:12:56 -05:00
Nick Mathewson ca8646bc0c Remove some not-necessary XXX-A1s in sqlite.rs 2021-01-25 14:23:33 -05:00
Nick Mathewson 88e9db7bc2 dirmgr: fix usage and meaning of `pending`.
The documentation and implementation diverged; the documentation was
correct.
2021-01-25 14:19:04 -05:00
Nick Mathewson c16412e372 Detect consensuses that are signed by the wrong authorities.
With this patch we don't consider a consensus to be even potentially
well-signed if the authorities that are listed as signing it don't
contain enough authorities we believe in.  Otherwise, we'd just try
fetching certs for them and failing forever.

(I found this by switching from a chutney network to the main
network without cleaning out my cache.)

Closes #44
2021-01-25 14:08:47 -05:00
Nick Mathewson 1a497b04db dirmgr: Extra explanatory comments.
Also replace some "disk" with "cache" in log messages
2021-01-25 10:32:25 -05:00
Nick Mathewson 3f455e6f30 require latest futures crate 2021-01-15 17:05:05 -05:00
Nick Mathewson fa57fb4995 Upgrade a few more dependencies. 2021-01-13 08:17:14 -05:00
Nick Mathewson 7e843de2c8 Upgrade a few dependencies. 2021-01-13 08:14:28 -05:00
Nick Mathewson f01d641ec8 cargo upgrade. 2020-12-30 15:59:33 -05:00
George Kadianakis 4962128b0e dirmgr: Handle another error in download_mds().
Co-authored-by: David Goulet <dgoulet@torproject.org>
2020-12-23 15:38:16 +02:00
George Kadianakis a02de2010e dirmgr: Handle some errors in download_mds().
Co-authored-by: David Goulet <dgoulet@torproject.org>
2020-12-23 15:37:44 +02:00
Nick Mathewson ccd6cbf627 upgrade to latest anyhow 2020-12-21 10:21:24 -05:00
Nick Mathewson f1eba83ebd Fix a few clippy warnings 2020-12-17 15:23:55 -05:00
Nick Mathewson 31aa73c022 Download and use consensus diffs.
Had to refactor a few methods for database access, and fix a bug
where we were storing valid_until times with the wrong information.
2020-12-17 15:08:53 -05:00
Nick Mathewson a8a35c9914 dirmgr: Refactor so it has no unusable state.
With this new API, if you have a DirMgr, it has a NetDir that was
bootstrapped, and was live at least once during your program's
execution.
2020-12-15 11:57:24 -05:00
Nick Mathewson 863f459389 Add a "RetryError" to capture the idea of multiple failed attempts.
When we try to do something a few times and it fails each time, it
can be a good idea to remember why the individual failures
happened.
2020-12-12 12:54:00 -05:00
Nick Mathewson cfdedb995f upgrade rusqlite 2020-12-08 17:26:49 -05:00
Nick Mathewson 17c84fd59e upgrade to require latest anyhow. 2020-12-08 17:26:19 -05:00
Nick Mathewson 0caee4718f Document a problem on network transition 2020-12-08 16:59:16 -05:00
Nick Mathewson 8d6087426e De-parameterize ChanMgr and everything that wraps it.
This makes a whole lot of our code simpler, and makes it so that
CircMgr and DirMgr no longer need to have anything parameterized
over transports, either.

Instead of boxing Transport inside of ChanMgr, I've made a new
Connection trait that goes from a ChanTarget* straight to a Channel.
This lets us avoid having to box the intermediate TLS object.

[*] Actually, a copy of the information from a ChanTarget. Ick, but
I had to make a copy to avoid parameterizing
Connecter::build_channel.
2020-12-08 16:29:18 -05:00
Nick Mathewson bdc7908c7f Fix a logic bug in the --chutney-dir option.
It was recording the dirport for each chutney authority as though it
were an orport.  That obviously won't work.

Closes arti#45.
2020-12-07 16:54:18 -05:00
Nick Mathewson a52585d9d6 Mark some XXXX issues as XXXX-A1. 2020-12-07 16:07:59 -05:00
Nick Mathewson 0f963774db Fix grammar in a log message 2020-12-07 10:21:01 -05:00
Nick Mathewson 6f1e05a1d3 Add a few log messages about download timing. 2020-12-07 09:24:51 -05:00
Nick Mathewson 57eea69f52 Teach updater to download microdescriptors for usable directory.
This follows a three-phase process: We are either fetching
microdescriptors, waiting for the time to download the next
consensus, or fetching the next consensus and making it usable.

We can stop fetching microdescriptors for two reasons: by having no
more mds that we need to download, or by running out of time in
which the current consensus is usable.
2020-12-07 08:29:35 -05:00
Nick Mathewson 915515442f Reuse microdescriptors from previous consensus
Previously, we'd re-parse them from the database every time we got a
new consensus.
2020-12-06 11:42:50 -05:00
Nick Mathewson 6ddf55f799 Enforce that the periods in a consensus lifetime are nonempty.
To be valid, a lifetime must have valid_after < fresh_until <
valid_until.
2020-12-04 15:00:06 -05:00
Nick Mathewson 402d501020 Update a few comments. 2020-12-04 14:03:05 -05:00
Nick Mathewson b56223f382 Dirmgr: Add a feature to keep the directory up-to-date.
This required me to move the sqlite connection from a rwlock into mutex,
since it isn't actually Sync.
2020-12-04 13:53:51 -05:00
Nick Mathewson a72437a1c7 Abandon directory circuits on most kinds of directory failure.
(There are more cases that this _doesn't_ handle, but it's a start
for now.)
2020-12-02 09:46:35 -05:00
Nick Mathewson db55c84c89 tor-dirmgr: retry up to 3 times on download failure. 2020-12-01 09:38:59 -05:00
Nick Mathewson 85cf6c09b3 Make mmap usage optional. 2020-12-01 07:56:36 -05:00
Nick Mathewson d7b79095c8 tor-dirmgr: tests for storage.rs 2020-12-01 07:44:47 -05:00
Nick Mathewson b0fc36c06a Add a decorrelated-jitter implementation.
This is the algorithm we use on download failure to back off before
we retry.
2020-11-30 16:43:36 -05:00
Nick Mathewson ffd4ed16a0 only expire dorectory info on a successful bootstrap. 2020-11-30 12:54:56 -05:00
Nick Mathewson a1d02d4154 Add tests for blob_fname failing cases 2020-11-30 12:35:33 -05:00
Nick Mathewson 39bc39ddd5 More tests for sqlite.rs 2020-11-30 12:26:11 -05:00
Nick Mathewson c3c3d24973 Initial tests for authcert storage 2020-11-30 11:59:41 -05:00
Nick Mathewson baba0773c3 tor-dirmgr: Refactor storage not to take AuthCert type.
Add a new AuthCertMeta type to make it easier to test.
2020-11-30 11:26:03 -05:00
Nick Mathewson e979bd5cb2 tor-dirmgr: Refactor storage not to take Microdesc type.
Since all it needs is an MDDigest, that's what it should take.  This
will make it easier to test.
2020-11-30 11:11:39 -05:00