Commit Graph

3819 Commits

Author SHA1 Message Date
Nick Mathewson 559aed002f Merge branch 'x25519' into 'main'
tor-llcrypto: Pin x25519-dalek version, bump our crate version

Closes #807

See merge request tpo/core/arti!1108
2023-04-04 12:51:39 +00:00
Ian Jackson ed594b5a6f tor-llcrypto: Pin x25519-dalek version, bump our crate version
Fixes #807
2023-04-04 11:59:54 +01:00
gabi-250 d1553e884b Merge branch 'timerange' into 'main'
Ergonomic improvements to TimerangeBound

See merge request tpo/core/arti!1105
2023-04-03 17:35:42 +00:00
Ian Jackson e85f974934 TimerangeBound: Provide .as_ref() and .as_deref() 2023-04-03 15:54:13 +01:00
Ian Jackson 456eb2f3df TimerangeBound: derive Debug and Clone, and Eq/PartialEq in tests 2023-04-03 15:50:32 +01:00
Nick Mathewson 289007ef96 Merge branch 'debug-hex' into 'main'
Debug two types as compact hex strings

See merge request tpo/core/arti!1104
2023-04-03 12:31:27 +00:00
Ian Jackson 14cc805929 Merge branch 'hserror' into 'main'
tor-error: Errors for hidden services

See merge request tpo/core/arti!1099
2023-03-31 18:16:45 +00:00
Ian Jackson aafdf755c0 Debug as hex strings for HsBlindId and HsDirIndex 2023-03-31 19:10:17 +01:00
Ian Jackson 9de3c1e307 tor-basic-utils: Provide impl_debug_hex 2023-03-31 19:10:06 +01:00
Ian Jackson c5f6b2e3a5 tor-error: Add missing footnote
I C&P this from tor-dirmgr, and missed this part.
2023-03-31 18:45:40 +01:00
gabi-250 11a70925fd Fix duplicated licence in Cargo.toml 2023-03-31 17:44:30 +00:00
Ian Jackson 8a045af479 Merge branch 'netdir' into 'main'
tor-netdir: API changes to support hsconn hsdir fetch

See merge request tpo/core/arti!1094
2023-03-31 17:12:42 +00:00
Ian Jackson 3e22e881f3 tor-error: Add OnionServiceNotRunning error
We'll want this later.  Define it now, though, since we've discussed
it here
  https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/1099#note_2892020
2023-03-31 18:01:36 +01:00
Ian Jackson 68e5711684 tor-error: Put OnionService errors behind a new experimental-api feature 2023-03-31 17:57:24 +01:00
Ian Jackson 307af3714f tor-error: Document cargo feature 2023-03-31 17:56:32 +01:00
Ian Jackson c6a10387e3 tor-error: Errors for hidden services
So far these are just the errors that occur during descriptor
fetch. There will be more later as we have more code in tor-hsconn.

This is very user-facing; use the "onion service" terminology.
2023-03-31 17:53:40 +01:00
Gabriela Moldovan 3d0bf0d6ab
Generate a new KP_hss_desc_enc keypair for each new descriptor.
Previously, to build descriptors for hidden services with client auth
enabled, in addition to the list of authorized clients, users of
`HsDescBuilder` were required to also provide a descriptor encryption
keypair and a descriptor cookie. This was potentially dangerous and/or
error-prone, because the ephemeral encryption key and the descriptor
cookie are expected to be randomly generated and unique for each
descriptor.

This change makes `ClientAuth` private to the `hsdesc::build` module and
updates `HsDescBuilder` to build `ClientAuth`s internally. Users now
only need to provide the list of authorized client public keys.

Signed-off-by: Gabriela Moldovan <gabi@torproject.org>
2023-03-31 15:04:30 +01:00
Gabriela Moldovan 94a4d2ea43
Remove unnecessary test constant.
It's not really needed, it can just be generated at (test) runtime.

Signed-off-by: Gabriela Moldovan <gabi@torproject.org>
2023-03-31 15:04:26 +01:00
Gabriela Moldovan cd66781577
Add an encode-decode test for descriptors with client auth.
This adds a test for an `encode -> decode -> encode` flow for a hidden
service descriptor with client authorization enabled.

Signed-off-by: Gabriela Moldovan <gabi@torproject.org>
2023-03-31 15:04:23 +01:00
Gabriela Moldovan 8aa930a645
Use constants instead of magic numbers.
Signed-off-by: Gabriela Moldovan <gabi@torproject.org>
2023-03-31 15:04:19 +01:00
Gabriela Moldovan 2d9d16aabc
Stop requiring the caller to supply `AuthClient`s.
`AuthClient`s were originally meant to represent parsed `auth-client`
lines. In !1070, this struct was repurposed for representing individual
authorized clients in the HS descriptor encoder. However, hidden
services will likely use a list of public keys to represent the
authorized clients rather than a list of `AuthClient`s, as the
information from an `AuthClient` (`client_id`, `iv`, `encrypted_cookie`)
likely won't be immediately available to the hidden service.

This change updates the HS descriptor encoder to represent authorized
clients as a list of `curve25519::PublicKey`s. As such, it is now the
responsibility of the encoder to create the `client_id`, `iv`, and
`encrypted_cookie` using the available keys, the unencrypted descriptor
cookie, and HS subcredential.

Signed-off-by: Gabriela Moldovan <gabi@torproject.org>
2023-03-31 15:04:15 +01:00
Nick Mathewson 2ab5348ab2 Remove semver.md files. 2023-03-31 09:24:41 -04:00
Nick Mathewson d3a727a5a1 Remove "publish = false" from tor-hsclient.
It is now a (conditional, experimental) dependency of arti-client.
2023-03-31 09:14:35 -04:00
Nick Mathewson 9ef115a7fb Patchlevel bumps for crates whose dependencies just changed.
These crates had no changes until just a moment ago. But since
we updated the versions on some of their dependents, they have now
changed themselves.  Thus they get patchlevel bumps.

```
tor-rtmock
tor-protover
tor-socksproto
tor-consdiff
tor-chanmgr
tor-dirclient
tor-hsservice
```
2023-03-31 08:30:14 -04:00
Nick Mathewson e208fb15ad Bump crate versions that have breaking changes
These crates have had breaking changes.  They are pre-1.0, so they get
a minor bump.

```
tor-basic-utils
tor-config
```
2023-03-31 08:28:06 -04:00
Nick Mathewson a81ab391ae Bump patchlevel on crates with non-breaking changes
For these crates, the changes are nontrivial, so we
_do_ bump the versions on which their dependent crates depend.

Fortunately, since they are all pre-1.0, we don't need to
distinguish semver-additions from other changes.  (Except for arti,
which _is_ post-1.0, but gets a patchlevel bump anyway.)

These are unstable crates with breaking changes:

```
tor-hscrypto
tor-hsclient
```

These have new or extended APIs:

```
safelog
tor-bytes
tor-cell
tor-linkspec
tor-llcrypto
tor-proto
tor-cert
arti-client
```

These have new unstable APIs or features:
```
tor-netdoc
tor-circmgr (also broke some unstable APIs)
arti (is post-1.0)
```

These have bugfixes only:
```
caret
tor-dirmgr
```
2023-03-31 08:24:39 -04:00
Nick Mathewson 622c79aaa6 Bump patchlevel on crates with semver-irrelevant changes.
Their dependents are _not_ updated to a more recent version.

These bumped the version of a dependency that they don't expose
```
tor-rtcompat
fs-mistrust
```

This one had internal refactoring:
```
tor-netdir
```

These had trivial changes only:
```
tor-checkable
tor-ptmgr
tor-guardmgr
arti-hyper
arti-bench
arti-testing
```
2023-03-31 08:20:58 -04:00
Nick Mathewson f245fc12bb tor-hsclient: Fix a doc link. 2023-03-30 15:12:57 -04:00
Nick Mathewson 626f47a5cc Merge branch 'fix-broken-doc-links' into 'main'
Fix broken doc link.

See merge request tpo/core/arti!1082
2023-03-30 19:12:01 +00:00
Alexander Færøy bcb051fea4 Merge branch 'plumb' into 'main'
More plumbing for hs connections

See merge request tpo/core/arti!1098
2023-03-30 16:20:54 +00:00
Ian Jackson 2eed641fb6 tor-netdir: iter_filter_secondary: Make it less of a mess
Prompted by
  https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/1094#note_2891857
2023-03-30 17:02:47 +01:00
gabi-250 c7f924ff35 tor-netdir: Expand on comment for HsRingRings::iter 2023-03-30 16:02:27 +00:00
Alexander Færøy c8a8aeae50 Merge branch 'send' into 'main'
tor-circmgr: Make take_or_launch_stub_circuit future Send

See merge request tpo/core/arti!1096
2023-03-30 15:58:32 +00:00
gabi-250 2cd36a4c44 Merge branch 'ring' into 'main'
tor-netdir: Implement `HsDirRing::find_pos`

See merge request tpo/core/arti!1095
2023-03-30 15:37:42 +00:00
gabi-250 e7e305f9cd tor-netdir: Minor docs fixes 2023-03-30 15:37:07 +00:00
Ian Jackson 23c7bd9174 Run rustfmt
Apply this churn, which I deferred for ease of review.
2023-03-30 15:58:47 +01:00
Ian Jackson a14d18d295 arti-client: Call HsCircPool::launch_background_tasks
I found that I had the bug where I forgot to call this function, and
reached
   bad_api_usage!("The circuit launcher wasn't initialized")

The possibility of such a bug is a hazard of this API pattern.
2023-03-30 15:58:09 +01:00
Ian Jackson 577940853f tor-netdir: Implmeent HsDirRing::find_pos 2023-03-30 15:53:51 +01:00
Ian Jackson 3ed9dca842 tor-hsconn: Rename ConnError (from HsClientConnError)
The old name was unwieldy and other crates can just as well name it by
the crate scope.
2023-03-30 15:49:07 +01:00
Ian Jackson 255b9cac96 arti-client: When making hs conn, wait for bootstrap
Not doing this was a bug.  The bug was possible because of some code
duplication between the exit and hs paths.  Add a comment about that.
2023-03-30 15:49:07 +01:00
Ian Jackson 926abf3ade tor-client: Pass a netdir for each request
This will be more convenient inside tor-hsclient.  In arti-client,
this mirrors the way TorClient::get_or_launch_exit_circ works.
2023-03-30 15:49:07 +01:00
Ian Jackson 9b831933ef tor-netdir: Provide accessor for params field of HsDirParams 2023-03-30 15:47:06 +01:00
Ian Jackson 544d0e6d18 tor-netdir: Implement hs_dirs accessor 2023-03-30 15:47:06 +01:00
Ian Jackson 3c39c2f544 tor-netdir: hs_dirs accessor: change semantics, type, and name
Don't have it take the TP, so that the caller must call it multiple
times.  Instead, have it return all the relevant relays.
2023-03-30 15:47:06 +01:00
Ian Jackson e15f3c5348 tor-netdir: Provide hs_all_time_periods instead of ..._secondary_...
I don't think the server-side support will want to explicitly call
current and then secondary.  Rather, it will want to iterate over all
the relevant ones.

And fix the name, and add another comment about whether we need this.
2023-03-30 15:47:06 +01:00
Ian Jackson 4cf3cd00ef tor-netdir: Rename hs_time_period
Change its name to hs_* like we do with things at this layer.

But, it turns out, that at least for hs client connections to fetch
the descriptor, I don't seem to need to call it yet ?  Maybe it's not
needed.
2023-03-30 15:47:06 +01:00
Ian Jackson db028a6d34 tor-netdir: Sort out HsDirOp
* Change its name to Hs* like we do with things at this layer
* Make the Upload variant cfg-conditional
2023-03-30 15:47:06 +01:00
Ian Jackson 4d3d79a511 tor-netdir: Reorganise iteration over hsdir rings
Provide iter_for_op, by changing iter into iter_filter_secondary and
having a new entrypoint iter.
2023-03-30 15:47:06 +01:00
Ian Jackson 7924e995f1 tor-netdir: Provide relay_by_rs_idx 2023-03-30 15:47:06 +01:00
Ian Jackson dd493307f9 tor-circmgr: Make take_or_launch_stub_circuit future Send
thread_rng() isn't Send.  We can fix this by not holding it over an
await point.
2023-03-30 15:46:15 +01:00