Commit Graph

322 Commits

Author SHA1 Message Date
Ian Jackson b13aa66a16 tor-hsclient: err: Move doc comment to correct impl
See
  https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/1336#note_2917236
2023-06-29 13:59:33 +01:00
Ian Jackson 4f8c718c09 tor-hsclient: err: Mention RENDEZVOUS2 2023-06-29 13:57:38 +01:00
Ian Jackson bfad582d1e tor-hsclient: err: Reword comments about error 2023-06-29 13:56:12 +01:00
Ian Jackson 8f1a71850c tor-hsclient: Handle handshake completion error correctly 2023-06-28 17:14:45 +01:00
Ian Jackson 9216f628f1 tor-hsclient: Rename RendezvousCompletionCircuit from RendezvousCompletion
We need to handle errors during the handshake.  That also produces a
`tor_proto::Error` but we  want to print a different message for that,
so let's rename this before adding the new variant.
2023-06-28 17:14:26 +01:00
Ian Jackson 4eb3e3b6ec tor-hsclient: Move handling of Bug to new section
It was wrong where ti was.
2023-06-28 17:14:26 +01:00
Ian Jackson 18478b47a7 tor-hsclient: Make RendPtIdentityForError use RelayIds
Since arti!1233 this is trivial.
2023-06-28 16:49:49 +01:00
Ian Jackson 4d071d1c07 tor-hsclient: Use RendPtIdentityForError in more places
For some reason this wasn't used in the actual errors,
although it *was* used in the types of the functions etc.
2023-06-28 16:47:55 +01:00
Ian Jackson 0e2f804d8f tor-netdoc: Reject hsdescs with no intro points
None of the existing NetdocErrorKinds seemed right.
2023-06-28 16:27:05 +01:00
Ian Jackson cbb8eb4fdd Merge branch 'reuse' into 'main'
tor-hsclient: Discuss intro circuit extend-and-reuse

See merge request tpo/core/arti!1298
2023-06-28 13:48:12 +00:00
Ian Jackson cf5235a713 HS timeout parameters: Restore some TODOs
Conceptually this is a fixup to
  HS configuration: Add retry parameters to configuration
which erroneously removed these comments - they were intended to apply
to *all* these parameters, not just the max attempts.

Not marking it as fixup! because that would involve merge conflicts.
2023-06-28 13:32:54 +01:00
Ian Jackson 11bb7e8a90 HS configuration: Use configured maximum attempts - comment
Explain why this fallback to MAX is good.

Discussion
  https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/1305#note_2915927
2023-06-28 13:32:54 +01:00
Ian Jackson 2bfe12983a HS configuration: Use configured maximum attempts (fmt) 2023-06-28 13:32:54 +01:00
Ian Jackson be33f00b31 HS configuration: Use configured maximum attempts 2023-06-28 13:32:54 +01:00
Ian Jackson a0b6f34e42 HS configuration: Plumb configuration through (fmt)
Apply deferred rustfmt churn.
2023-06-28 13:32:54 +01:00
Ian Jackson 984652217a HS configuration: Plumb configuration through
Invent a trait a la circmgr config for the hs client connector config.
Plumb a suitable value all the way through to the code that will use it.
2023-06-28 13:32:54 +01:00
Ian Jackson cdad2db082 HS configuration: Add retry parameters to configuration
I think these should go in `[circuit_timing]`.  That section already
has some retry parameters, so is not strictly *timing*.

This is not honoured yet.
2023-06-28 13:32:54 +01:00
Ian Jackson 41737efced tor-hsclient: Completely hide hsdir identities in errors 2023-06-28 13:02:44 +01:00
Nick Mathewson 4692dba5e0 hsclient: Use HsDescDownloadRequest::set_max_len. 2023-06-27 16:21:29 -04:00
Ian Jackson 062b7e7ced tor-hsclient: Increase some timeouts
1. Fix a use of 10ms that should have been TIMEOUT_SLOP.
2. Increase BODGE_YIELD by a factor of 5.

Now this test should tolerate being hung up for 125ms.  I am hoping
that this will fix the CI failure
  https://gitlab.torproject.org/Diziet/arti/-/jobs/302457
which fails at the line comparing circuit1 with circuit2a.
(I can't repro that locally.)
2023-06-26 17:57:33 +01:00
Ian Jackson e5c4551993 tor-hsclient: test: Introduce some constants for timings 2023-06-26 17:57:33 +01:00
Ian Jackson c8d1cdded7 tor-hsclient: test: Add another sleep for expiry task *start*
Without this, the expiry task can end up choosing a 600s timeout
starting *after we advanced the clock*.

Fixes #923
2023-06-26 17:55:10 +01:00
Ian Jackson 355e65003c tor-hsclient: impl Debug by hand for MockCirc
The provided impl for Mutex is hopeless: it prints just some internal
flags and doesn't acquire the mutex for printing purposes.

At some point we might want to factor this out as a general function
on `Arc<Mutex<...>>` but not now.
2023-06-26 17:55:10 +01:00
gabi-250 dece1bec6c Merge branch 'upgrade-itertools' into 'main'
Upgrade to itertools 0.11.0

See merge request tpo/core/arti!1306
2023-06-26 14:42:02 +00:00
Ian Jackson b31a253931 Merge branch 'data' into 'main'
tor-hsclient: Expire old IPT and HS descriptor data eventually

See merge request tpo/core/arti!1290
2023-06-26 13:45:15 +00:00
Nick Mathewson 0bffdf23a4 Upgrade to itertools 0.11.0
The breaking changes here do not seem to affect us.
2023-06-26 09:30:54 -04:00
Ian Jackson 8a707bef85 tor-hsclient: Split out expire_old_data function
As per discussion in
  https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/1290#note_2915679
2023-06-26 13:45:57 +01:00
Ian Jackson cccf6309d8 tor-hsclient: Add a comment about what run_housekeeping does
Prompted by
  https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/1290#note_2915679
2023-06-26 13:23:41 +01:00
Ian Jackson e588f4be72 tor-hsclient: Add a debug message about task exit
As per
  https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/1290#note_2915678
2023-06-26 13:23:41 +01:00
Ian Jackson e5e4cf65f7 tor-hsclient: Comment explaining why no launch_background_tasks
As per
  https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/1290#note_2915676
2023-06-26 13:15:22 +01:00
Ian Jackson 09ae0aed4a tor-hsclient: Say we *mustn't* do housekeeping while dormant
This is a change to the API docs, but not to the actual code, since
our call site is in arti-client and tied to netdir fetch,
which *doesn't* happen when dormant.

As per
  https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/1290#note_2915677
2023-06-26 13:14:17 +01:00
Nick Mathewson 08d1155cb9 Merge branch 'stabilize-ll-crates' into 'main'
Remove final "experimental" status from tor-hscrypto and tor-error.

See merge request tpo/core/arti!1291
2023-06-23 21:09:11 +00:00
Nick Mathewson 9e3e683e1b arti, hsclent: remove dependencies on tor-error/experimental-api
The relevant ErrorKinds and macros are now stable.
2023-06-23 12:49:46 -04:00
Nick Mathewson 0fb70f646e Merge branch 'circuit-bis' into 'main'
Add TODO SPEC for issues dealt with in !1299

See merge request tpo/core/arti!1303
2023-06-23 14:11:33 +00:00
Nick Mathewson 56198928ee Merge branch 'expire' into 'main'
tor-hsclient: Add a TODO SPEC re circuit dirtiness

See merge request tpo/core/arti!1302
2023-06-23 13:31:24 +00:00
Alexander Færøy 7f965e465a Merge branch 'circuit' into 'main'
Drop intro circuit after ack, and deal with TODOs

See merge request tpo/core/arti!1299
2023-06-23 13:09:50 +00:00
Ian Jackson 73cce4b93c tor-hsclient: Add TODO SPEC for issues dealt with in !1299 2023-06-23 14:00:45 +01:00
Ian Jackson f0c9e482da tor-hsclient: Add a TODO SPEC re HS intro extend-and-reuse 2023-06-23 13:53:51 +01:00
Ian Jackson 21fb232a6c tor-hsclient: Add a TODO SPEC re data lifetime 2023-06-23 13:49:38 +01:00
Ian Jackson ee76d3b9ee tor-hsclient: state tests: Test housekeeping (data expiry) 2023-06-23 13:49:38 +01:00
Ian Jackson a54f33f77b tor-hsclient: state tests: Promote mk_hsconn call 2023-06-23 13:49:38 +01:00
Ian Jackson 3cd7cf25b2 tor-hsclient: state tests: Introduce connect_called
This will allow us to track when `Data` is discarded.
2023-06-23 13:49:38 +01:00
Ian Jackson f4057285ce tor-hsclient: Expire old data eventually
Otherwise we'll fill up our RAM with junk.
2023-06-23 13:49:38 +01:00
Ian Jackson 163ee44902 tor-hsclient: Add a TODO SPEC re circuit dirtiness 2023-06-23 13:46:40 +01:00
Nick Mathewson 48d839e1b5 Merge branch 'data2' into 'main'
tor-hsclient: Expire old IPT data

See merge request tpo/core/arti!1295
2023-06-23 12:06:09 +00:00
Ian Jackson a6ca13d056 tor-hsclient: Discuss HS descriptor expiry and revision counters
And delete the corresponding TODO.
2023-06-23 12:52:59 +01:00
Ian Jackson 9938491057 tor-hsclient: Downgrade multi-ipt TODO 2023-06-23 12:43:00 +01:00
Ian Jackson 6448e56942 tor-hsclient: Downgrade rend/ipt parallelism TODOs and add links 2023-06-23 12:43:00 +01:00
Ian Jackson 546d1159a6 tor-hsclient: Downgrade ipt parallelism to a note 2023-06-23 12:43:00 +01:00
Ian Jackson cf4659a981 tor-hsclient: Downgrade hsdir fetch parallelism to a note 2023-06-23 12:43:00 +01:00
Ian Jackson ef85b9290e tor-hsclient: Drop intro circuit after ack 2023-06-23 12:43:00 +01:00
Ian Jackson 6bbe1dd4ef tor-hsclient: Discuss intro circuit extend-and-reuse
This is a summary of a discussion I had on IRC.
2023-06-23 12:41:29 +01:00
Ian Jackson 9a2702b58b Merge branch 'expire' into 'main'
tor-hsclient: Expire circuits when they get too old

See merge request tpo/core/arti!1287
2023-06-23 10:40:19 +00:00
Ian Jackson e4ff44e760 tor-hsclient: Write a test plan for IPT state management
This won't be trivial.  Put it in as a TODO HS rather than as part of
this fix MR.
2023-06-23 10:34:28 +01:00
Ian Jackson 14b697bcff tor-hsclient: Expire old IPT data
If we don't use it for a whole, the whole of `Data` will be expired by
the new machinery in !1290.  However, we also need to expire
individual IPTs.

This bug doesn't seem to have had a relevant TODO.
2023-06-23 10:34:28 +01:00
Nick Mathewson 20940644ca Merge branch 'desc-error' into 'main'
Clean up HsDesc error types and stabilize onion-service ErrorKinds

See merge request tpo/core/arti!1289
2023-06-22 18:56:14 +00:00
Ian Jackson 26a8cfea6c tor-hsclient: Add a note about circuit expiry uncertainty, ticket 2023-06-22 18:41:27 +01:00
Gabriela Moldovan fbb1ad0b1e keymgr: Move dummy implementation to tor-keymgr. 2023-06-22 18:33:43 +01:00
Nick Mathewson 33bfa7c7a8 Remove onion service descriptor-related errorkinds.
These have been subsumed by other errorkinds, mostly
OnionServiceProtocolViolation and TorProtocolViolation.

In particular please review the change in tor-hsclient closely;
I am not sure about the new errorkinds for the error there.
2023-06-22 13:11:06 -04:00
Nick Mathewson dbd2552178 netdoc: Introduce HsDescError
For higher-level HsDesc-related functions, this type indicates where
exactly an error occurred.  It lets us distinguish decryption errors
from parsing errors, and attribute responsibility to the hsdir, the
onion service, or the user's lack of encryption.

This lets us remove some just-introduced complexity in
tor-hsclient.
2023-06-22 12:43:30 -04:00
Ian Jackson fb3112fb73 tor-hsclient: Expand explanation of `last_used` (for Open) 2023-06-22 17:21:06 +01:00
Nick Mathewson 7842ace4db tor-hsclient: Make comment about circuit expiry more accurate 2023-06-22 16:16:23 +00:00
Nick Mathewson 610ed2d457 Merge branch 'socks_errorkinds' into 'main'
Generate correct-ish socks5 errors for onion service errors.

Closes #736

See merge request tpo/core/arti!1279
2023-06-22 16:15:55 +00:00
Ian Jackson 6cd56972e4 tor-hsclient: Delete/rewrite out-of-date commentary 2023-06-22 15:48:41 +01:00
Ian Jackson 7001a38c0c tor-hsclient: linkify a URL in a doc comment 2023-06-22 15:45:13 +01:00
Ian Jackson fe76477342 tor-hsclient: Apply broken formatting as demanded by rustfmt 2023-06-22 14:54:48 +01:00
Ian Jackson 10b54065e8 tor-hsclient: Test circuit expiry 2023-06-22 14:54:48 +01:00
Ian Jackson 3badca02c9 tor-hsclient: Expire HS circuits that we don't want to reuse 2023-06-22 14:54:00 +01:00
Ian Jackson a35a1402ae tor-hsclient: Introduce helper function for locking services table 2023-06-22 13:32:14 +01:00
Ian Jackson dedda8a590 tor-hsclient: Abolish an obsolete comment
We don't now handle inability to store by panicking.  Like the
previous comment says, such situations end up with Err in stored,
and that's handled by logging, below.
2023-06-22 13:24:16 +01:00
Alexander Færøy d1658a120e Merge branch 'stderr' into 'main'
lints: Promote clippy::print_stderr and clippy::print_stdout

See merge request tpo/core/arti!1271
2023-06-21 16:41:10 +00:00
Nick Mathewson dd944bc787 Generate correct ErrorKinds for hsdesc decryption failures.
Part of #736
2023-06-21 10:22:42 -04:00
Nick Mathewson 0505579497 Upgrade to strum 0.25. 2023-06-21 09:12:36 -04:00
Ian Jackson 9a05fbb10d tor-hsclient: Apply deferred clippy churn needed by fmt churn
rustfmt *introduced* this clippy warning.
2023-06-21 12:54:57 +01:00
Ian Jackson fe41d2059e tor-hsclient: Apply deferred rustfmt churn 2023-06-21 12:19:04 +01:00
Ian Jackson 60fc4ef98a tor-hsclient: Drop most allows that are marked for removal 2023-06-21 12:19:04 +01:00
Ian Jackson a57d3067a5 tor-hsclient: Drop a large number of unneeded imports 2023-06-21 12:19:04 +01:00
Ian Jackson ae1f144829 tor-hsclient: Add HSID to some log messages
For the debug!, we can use the unredacted form.  For error!, we use
Sensitive.
2023-06-21 12:19:04 +01:00
Ian Jackson d4b7714926 tor-hsclient: Do Debug the descriptor as part of Data
Empirically, this does not cause the descriptor to be spat out in
normal operation.  And it seems right.
2023-06-21 12:19:04 +01:00
Ian Jackson c94a726664 tor-hsclient: Drop some temporary trace calls
These were added as part of a debugging #885, and are no longer
needed.
2023-06-21 12:19:04 +01:00
Ian Jackson 8267fb4535 tor-hsclient: Drop two eprintlns in production code 2023-06-21 12:19:04 +01:00
Ian Jackson 0845694021 tor-hsclinet: Promote dead code allows to cover all tests
We want to remove the crate-level dead code allows.  The tests are
incomplete and there are multiple todos for that.
2023-06-21 12:19:04 +01:00
Ian Jackson 63ab6fb01c tor-hsclient: Use a formulaic TODO mark for incompleteness of tests 2023-06-21 12:19:04 +01:00
Ian Jackson 5a7ea7067d tor-hsclinet: Add a narrow allow, pending answer to open question
I need to talk to HS expert(s) about when this circuit can be
torn down.
2023-06-21 12:19:04 +01:00
Ian Jackson 9a30c4afce tor-hsclient: Remove unused Context.hs_blind_id_key 2023-06-21 12:19:04 +01:00
Ian Jackson 8f90fe619e tor-hsclient: Add an allow for a deliberately-unused variable 2023-06-21 12:19:04 +01:00
Ian Jackson be3433891f tor-hsclient: Omit some unussed struct fields in patterns
For the arms that have a fixed retry time, or a fixed ErrorKind,
dont't bind the unused inner error.
2023-06-21 12:19:04 +01:00
Ian Jackson 161b9844da lints: Run maint/add_warning to actually apply new lints 2023-06-21 12:15:41 +01:00
Nick Mathewson b9500c6f3d Merge branch 'netdoc-todos' into 'main'
Resolve many TODO HS items in tor-netdoc

See merge request tpo/core/arti!1251
2023-06-16 17:31:31 +00:00
Nick Mathewson 072ce9182b hsclient: note that we should check revctr. 2023-06-16 12:23:56 -04:00
Gabriela Moldovan eda974cd34 keymgr: Move the HS client and service key specifiers out of tor-keymgr.
The HS `HsClientSpecifier` and `HsClientSecretKeySpecifier` are moved to
`tor-hsclient`. The HS service secret key specifier stubs are moved to
`tor-hsservice`.
2023-06-15 18:16:33 +01:00
Gabriela Moldovan d133c8b0a6 hsclient: Change builder error return type to ConfigBuildError.
It's not perfectly clear what this error type should be, so let's use
`ConfigBuildError` for now (it makes things easier in `arti-client`, as
we already have an `ErrorDetail` for it).
2023-06-15 18:15:30 +01:00
Ian Jackson a1934e7102 tor-hsclient: Make Untried a {}-less unit
Suggested here
  https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/1247#note_2912642

It's unlikely this will grow any content, so fine.
2023-06-15 16:43:45 +01:00
gabi-250 7e601fba01 tor-hsclient: Insert a blank line 2023-06-15 16:43:45 +01:00
gabi-250 d99434d06b tor-hsclient: Docs improvements. 2023-06-15 16:43:45 +01:00
Ian Jackson 856269f7a7 tor-hsclient: Remove two done TODOs 2023-06-15 16:43:45 +01:00
Ian Jackson 731cc9ed44 tor-hsclient: provide intro_index accessor for FailedAttemptError (xref)
Add a cross-reference to docs arising from MR comments in !1246.
2023-06-15 16:43:45 +01:00
Ian Jackson 2dfa00f379 tor-hsclient: Actually store our IPT experiences 2023-06-15 16:43:45 +01:00
Ian Jackson f5a895b33f tor-hsclient: intro_rend_connect: bind `outcome`
This will be used in a moment.
2023-06-15 16:43:45 +01:00
Ian Jackson 4f4f753b6a tor-hsclient: Actually choose which intro points to use
Right now this just always chooses randomly because nothing stores
anything in the HashMap.
2023-06-15 16:43:45 +01:00