aboutsummaryrefslogtreecommitdiff
path: root/crates/tor-netdoc
Commit message (Collapse)AuthorAgeFilesLines
...
* tor-netdoc: Fix feature buildsIan Jackson2023-04-054-5/+8
| | | | | | | | | | | | Fixes cargo +stable test --locked --offline F -p tor-netdoc cargo +stable clippy -p tor-netdoc F --all-targets for values of F including --all-features --features=hs-client --features=hs-common --features=hs-service (nothing)
* Generate a new KP_hss_desc_enc keypair for each new descriptor.Gabriela Moldovan2023-03-312-33/+51
| | | | | | | | | | | | | | | | 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 <[email protected]>
* Remove unnecessary test constant.Gabriela Moldovan2023-03-312-14/+8
| | | | | | It's not really needed, it can just be generated at (test) runtime. Signed-off-by: Gabriela Moldovan <[email protected]>
* Add an encode-decode test for descriptors with client auth.Gabriela Moldovan2023-03-311-23/+96
| | | | | | | This adds a test for an `encode -> decode -> encode` flow for a hidden service descriptor with client authorization enabled. Signed-off-by: Gabriela Moldovan <[email protected]>
* Use constants instead of magic numbers.Gabriela Moldovan2023-03-311-6/+10
| | | | Signed-off-by: Gabriela Moldovan <[email protected]>
* Stop requiring the caller to supply `AuthClient`s.Gabriela Moldovan2023-03-314-102/+151
| | | | | | | | | | | | | | | | | | `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 <[email protected]>
* Patchlevel bumps for crates whose dependencies just changed.Nick Mathewson2023-03-311-1/+1
| | | | | | | | | | | | | | | | 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 ```
* Bump crate versions that have breaking changesNick Mathewson2023-03-311-1/+1
| | | | | | | | | | These crates have had breaking changes. They are pre-1.0, so they get a minor bump. ``` tor-basic-utils tor-config ```
* Bump patchlevel on crates with non-breaking changesNick Mathewson2023-03-311-6/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 ```
* Merge branch 'fix-broken-doc-links' into 'main'Nick Mathewson2023-03-302-5/+5
|\ | | | | | | | | Fix broken doc link. See merge request tpo/core/arti!1082
| * Fix broken doc link.Gabriela Moldovan2023-03-272-5/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This fixes a broken doc link I introduced in !1070: ``` error: unresolved link to `crate::doc::hsdesc::build::inner::HsDescInnerBuilder` --> crates/tor-netdoc/src/doc/hsdesc/build/middle.rs:34:11 | 34 | /// [`crate::doc::hsdesc::build::inner::HsDescInnerBuilder`] as described in sections | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ no item named `HsDescInnerBuilder` in module `inner` | = note: `-D rustdoc::broken-intra-doc-links` implied by `-D warnings` error: could not document `tor-netdoc` ``` Signed-off-by: Gabriela Moldovan <[email protected]>
* | Remove hard-coded test certs.Gabriela Moldovan2023-03-274-98/+86
| | | | | | | | | | | | We can use a deterministic rng to generate predictable keypairs instead. Signed-off-by: Gabriela Moldovan <[email protected]>
* | Make the HS encoder randomness source injectable.Gabriela Moldovan2023-03-275-50/+46
| | | | | | | | | | | | | | This makes it possible to plug in a deterministic randomness source for testing. Signed-off-by: Gabriela Moldovan <[email protected]>
* | Use the type system to enforce use of blinded keys.Gabriela Moldovan2023-03-272-25/+37
|/ | | | | | | | | | | | | | | Hidden services use blinded singing keys derived from the identity key to sign descriptor signing keys. Before this patch, the hidden descriptor builder represented its blinded signing keys (`blinded_id`) as plain `ed25519::Keypair`s. This was not ideal, as there was nothing preventing the caller from accidentally initializing `blinded_id` with an unblinded keypair. This introduces a new `HsBlindKeypair` type to represent blinded keypairs. Signed-off-by: Gabriela Moldovan <[email protected]>
* Use transparent structs instead of builders.Gabriela Moldovan2023-03-244-100/+95
| | | | | | | | The consensus seems to be the builders don't add much value, see [this comment]. [this comment]: https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/1070#note_2889488 Signed-off-by: Gabriela Moldovan <[email protected]>
* Refactor the inner doc tests to be more DRY.Gabriela Moldovan2023-03-241-53/+55
| | | | Signed-off-by: Gabriela Moldovan <[email protected]>
* Remove `NetdocText` and replace its uses with `String`.Gabriela Moldovan2023-03-246-66/+21
| | | | | | | | `NetdocText` is a wrapper around a `String` and a type marker. The type annotation proved of limited use, and made the netdoc builder API somewhat awkward to use. Signed-off-by: Gabriela Moldovan <[email protected]>
* Remove some unnecessary visibility restrictions.Gabriela Moldovan2023-03-243-130/+74
| | | | Signed-off-by: Gabriela Moldovan <[email protected]>
* Create a new `IntroPointDesc` type.Gabriela Moldovan2023-03-242-21/+55
| | | | | | | | | | | | Unlike `hsdesc::IntroPointDesc`, `hsdesc::build::IntroPointDesc` represents link specifiers as `LinkSpec`s rather than `UnparsedLinkSpec`s. Since this is a general-purpose representation of an introduction point and not merely an intermediate representation for decoding/encoding, it will probably need to be factored out of `tor-netdoc` at some point. Signed-off-by: Gabriela Moldovan <[email protected]>
* Use the less ambiguous inner/middle/outer terminology.Gabriela Moldovan2023-03-243-17/+19
|
* Add builder for encoding hidden service descriptors.Gabi Moldovan2023-03-2412-42/+1266
| | | | | | | | | | | | | | This introduces the `NetdocBuilder` trait described in `netdoc-builder.md` and a new `tor-netdoc::doc::hsdesc::build` module, which exports the `HsDescBuilder`. Hidden services will use `HsDescBuilder` to build and encode hidden service descriptors. There are several TODOs in the code that I'm planning to address separately. Partially addresses #745. Signed-off-by: Gabriela Moldovan <[email protected]>
* Define constants for `AuthClient` field lengths.Gabriela Moldovan2023-03-242-7/+19
| | | | | | | These are used in multiple places (and will also be used by the HS descriptor encoder later on), so let's make them named constants. Signed-off-by: Gabriela Moldovan <[email protected]>
* Implement `ItemArgument` for `String`.Gabriela Moldovan2023-03-241-0/+6
| | | | | | | This makes some code a bit more concise, as it allows us to make `Strings` into `ItemArgument`s without calling `.as_str()`. Signed-off-by: Gabriela Moldovan <[email protected]>
* Turn two blocking TODOs in hsdesc into "TODO HS"Ian Jackson2023-03-212-2/+2
| | | | TODO HS is blocking for HS release, but not for CI.
* Upgrade to bitflags 2.0Nick Mathewson2023-03-132-1/+2
| | | | | This version of bitflags now requires us to explicitly list the traits that we want to derive for our bit-flags structs.
* Fix typosDimitris Apostolou2023-03-031-1/+1
|
* tor-netdoc: Clarify that we must indeed check cert expiration.Nick Mathewson2023-03-011-3/+1
|
* tor-netdoc: Validate inner certs in HsDescNick Mathewson2023-03-013-82/+199
| | | | | | | | | | | | This makes our implementation behave the same as the C tor implementation, by validating all of the expiration and signatures on the certificates in the inner document. (It is still not semantically necessary to check these certs: the document in which they appear is already signed by the key with which they are allegedly signed.) Closes #744
* Patchlevel bumps for remaining changed crates.Nick Mathewson2023-02-281-6/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | These crates have had small code changes, but no API additions: tor-config tor-socksproto tor-cert tor-chanmgr tor-ptmgr tor-guardmgr tor-circmgr tor-dirclient tor-dirmgr arti tor-hsservice tor-congestion These crates have had API extensions: fs-mistrust tor-llcrypto tor-bytes tor-checkable tor-linkspec tor-netdoc tor-persist arti-client
* Bump tor-units version for breaking change.Nick Mathewson2023-02-281-1/+1
| | | | | | | | (The breaking change was removing `as_days()` from IntegerMinutes.) We are _not_ calling this a downstream-api breaking change, per discussion at https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/1012?commit_id=bb2ab7c2a3e0994bb438188511688b5b039cae29#note_2876819
* Bump patch-versions for breaking changes in tor-hs{crypto,client}Nick Mathewson2023-02-281-1/+1
| | | | | | These are API breaks, but the crates themselves are currently 100% experimental, so there's no need to bump the minor versions according to our semver rules.
* Rename onion-* cargo features to hs-* in tor-* cratesIan Jackson2023-02-285-11/+11
| | | | Fixes #756
* Apply a missing cfg_attr(docsrs...) in netdocNick Mathewson2023-02-211-0/+1
|
* Merge branch 'unparsed_linkspec' into 'main'Ian Jackson2023-02-211-9/+2
|\ | | | | | | | | HsDesc: Use a new UnparsedLinkSpecifier to avoid leaking which linkspec types we know See merge request tpo/core/arti!1029
| * tor-netdoc: Use UnparsedLinkSpec in IntroPointDesc.Nick Mathewson2023-02-171-9/+2
| |
* | netdoc: Remove a TODO hs comment.Nick Mathewson2023-02-171-1/+0
|/ | | | | | | | | | | | | | | | It said to check whether C enforces an absence of extraneous bytes at the end of the link specifiers. It does, in `hs_desc.c:decode_link_specifiers()`, where it says: ``` if (link_specifier_list_parse(&specs, decoded, (size_t) decoded_len) < decoded_len) { goto err; } ``` The comparison with "decoded_len" checks whether all the bytes were decoded.
* Merge branch 'doc-iter' into 'main'Nick Mathewson2023-02-1712-233/+116
|\ | | | | | | | | | | | | tor-netdoc: Abolish PauseAt in favour of using itertools Closes #760 See merge request tpo/core/arti!1021
| * tor-netdoc: Fix doc comment following removal of PauseAtIan Jackson2023-02-161-3/+6
| |
| * tor-netdoc: Run rustfmt (separately from the refactoring)Ian Jackson2023-02-152-5/+3
| |
| * tor-netdoc: Abolish NetDocReader::iter and into_iterIan Jackson2023-02-151-13/+0
| | | | | | | | Nothing uses these now; the NetDocReader is simply an iterator, itself.
| * tor-netdoc: Remove many needless calls to .iter() and .into_iter()Ian Jackson2023-02-159-35/+32
| |
| * tor-netdoc: Use impl Iterator for NetdocReader in .pause_atIan Jackson2023-02-151-2/+2
| | | | | | | | This simplifies the return type!
| * tor-netdoc: impl Iterator etc. for NetdocReaderIan Jackson2023-02-151-0/+29
| | | | | | | | This will simplify things at many call sites.
| * tor-netdoc: move PeekableIterator to util.rsIan Jackson2023-02-152-24/+36
| | | | | | | | We're going to want this a bit more widely.
| * tor-netdoc: Delete now-unused PauseAt typeIan Jackson2023-02-151-149/+0
| |
| * tor-netdoc: Use itertools to implement NetDocReader::pause_atIan Jackson2023-02-151-7/+11
| | | | | | | | This is the last use of PauseAt.
| * tor-netdoc: Replace use of PauseAt::new_pred()Ian Jackson2023-02-152-9/+10
| | | | | | | | | | | | | | We can just make a new PauseAt, since it can take the inner peekable iterator by mutable reference. This seems to tidy the code up a bit too.
| * tor-netdoc: Have sectionrules.parse take I, not &mut IIan Jackson2023-02-151-2/+2
| | | | | | | | | | | | There's a blanket impl of Itertor for &mut impl Iterator, so this isn't necessary, and it prevents us passing iterators by value producing syntactic vinegar.
| * tor-netdoc: Import Peekable rather than referring to it by pathIan Jackson2023-02-151-3/+4
| | | | | | | | | | This makes things easier to read. We're about to add another site (albeit, temporarily).
* | Expire routerdescs as soon as any of their expiries expireIan Jackson2023-02-151-1/+1
|/ | | | Fixes #772