Commit Graph

3553 Commits

Author SHA1 Message Date
Ian Jackson 3a8c36e9c6 Use ErrorReport for remaining errors in error! in tor-circmgr 2023-01-30 18:52:32 +00:00
Ian Jackson 8c1830090c Use ErrorReport for errors in error! in tor-chanmgr 2023-01-30 18:52:32 +00:00
Ian Jackson 22016f233b Use tor_error::Report for remaining errors in error! in arti 2023-01-30 18:52:32 +00:00
Ian Jackson 49f3697b19 Apply safelog to DNS response serialisation errors, but report them
With safe logging disabled, print the error too.

With safe logging enabled, do not print the message or the error.
2023-01-30 18:52:32 +00:00
Ian Jackson 5c0a7e0127 Use ErrorReport for errors in error! in arti-client 2023-01-30 18:52:32 +00:00
Ian Jackson 2954568fae Use ErrorReport for errors in warn! in tor-ptmgr 2023-01-30 18:52:32 +00:00
Ian Jackson 47e226293f Use ErrorReport for errors in warn! in tor-persist 2023-01-30 18:52:32 +00:00
Ian Jackson dc9352b515 Use ErrorReport for errors in warn! in tor-dirmgr 2023-01-30 18:52:32 +00:00
Ian Jackson 25c41977ac Use ErrorReport for errors in warn! in tor-circmgr 2023-01-30 18:52:32 +00:00
Ian Jackson 410fdc9f32 Use ErrorReport for errors in warn! in tor-chanmgr 2023-01-30 18:52:32 +00:00
Ian Jackson 36ebf7d23a Use ErrorReport/Report for errors in warn! in arti 2023-01-30 18:52:32 +00:00
Ian Jackson cc6cf7f973 Use ErrorReport for errors in info! in tor-dirmgr 2023-01-30 18:04:57 +00:00
Ian Jackson 0e6be61db6 tor-dirclient: De-genericise internal fn retire_circ
Requring `Display` is wrong here, because if this is actually an
Error, Display would be wrong because it doesn't display causes.

As it happens, the `error` parameter is only ever `&str`.
2023-01-30 18:00:53 +00:00
Ian Jackson f657ef5b6c Use ErrorReport for errors in info! in tor-circmgr 2023-01-30 17:59:09 +00:00
Ian Jackson c2e4b8b7f9 Errors: Mark the type of an error, for clarity
We want to call ErrorReport::report() on Errors, but this isn't an
Error but only a string.
2023-01-30 17:52:02 +00:00
Nick Mathewson f6cbd180a1 netdir: remove duplicate code in param calculation 2023-01-28 12:43:08 -05:00
Nick Mathewson 4e7a552171 netdir: remove the vestigial smallvec implementation I added
It's cute, but I don't think it will help performance, and I'm
undecided about whether the semantic implications are true.
2023-01-28 12:43:08 -05:00
Nick Mathewson 268a723e49 Turn compute_ring_params into a method. 2023-01-28 12:43:08 -05:00
Nick Mathewson 2490b3cdc6 Use derive_more on SharedRandVal
This may be temporary if we wind up converting to CtByteArray,
but for now it's good to be terse.
2023-01-28 12:43:08 -05:00
Ian Jackson a51c76178e Several suggestions on gitlab. 2023-01-28 12:43:08 -05:00
Nick Mathewson 5236c5cf88 netdir: Implement ring-param constructors and time period accessors
This logic is a bit tricky, so I've tried to document it and add
fairly good tests.  The silver lining is that the external API for
all of this logic will make it invisible and hidden.

There are some cases where I added functions that I think might
eventually get lowered into MdConsensus: But I don't want to lower
too much right now, since the convention for our netdoc accessors is
that they are fairly unsophisticated, and they show you the document
as it is.

Closes #686
2023-01-28 12:43:08 -05:00
Nick Mathewson 9f3e6783ca netdoc: Add Eq and a note to SharedRandVal. 2023-01-28 12:12:17 -05:00
Nick Mathewson 790b38eec8 netdoc: Add SRV accessors.
These are deliberately unsophisticated accessors, in that they return Option<>
rather than filling in missing values with the documented
fallbacks. It seems better to leave a way to distinguish the absent
case in the API.
2023-01-28 12:12:17 -05:00
Nick Mathewson c1ced84239 netdoc: Add a timestamp to SRVs per prop#342.
This breaks some experimental APIs, but since they are experimental
no semver note is needed.
2023-01-28 12:12:17 -05:00
Nick Mathewson 8ce447b7e2 netdoc: Add Iso8601 time _with_ a "T" as an argument type. 2023-01-28 12:12:17 -05:00
Dimitris Apostolou 3da36c5c8b
Fix typos 2023-01-28 01:31:10 +02:00
Nick Mathewson 856d3b0a8b ErrorHint: Report hints for arti_client errors. 2023-01-27 11:56:53 -05:00
Nick Mathewson b3c963e7fa ErrorHint: Add a note about lowering the permissions hint 2023-01-27 11:56:53 -05:00
Nick Mathewson ae963e3c6b ErrorHint: use anonymize_home 2023-01-27 11:56:53 -05:00
Nick Mathewson 39ad97fdc2 ErrorHint: Implement tryfrom_torpersist 2023-01-27 11:56:53 -05:00
Nick Mathewson 3c82f794c1 ErrorHint: refactor API (part 2)
Change ErrorHint so that, internally, it just holds an enum with a
lightweight reference to whatever parts of the error it needs to
generate a hint.  Then we can move the formatting logic into a
Display function for ErrorHint, and do away with ErrorDetail entirely.
2023-01-27 11:56:53 -05:00
Nick Mathewson b8058c5d02 ErrorHint: refactor API (part 1)
Move the "hint" function into Error, and use Option rather than Result.

(I'm using Option here because it's not really an error case not to have
a hint; we just either have a hint, or we don't.)
2023-01-27 11:56:53 -05:00
Shady Katy cc4c07678a add opaque ErrorHint API, impl ErrorHint from BadPermissions 2023-01-27 11:02:42 -05:00
Nick Mathewson b7c8646d7b circmgr: drop a receiver more explicitly.
Clippy now complains about `let _ = (expr_producing_a_future);`,
which is probably smart, since maybe you wanted to await that future
and ignore the result.  So it seems that the right way to get rid of
an unwanted Receiver is now to drop it explicitly.

Closes #749
2023-01-27 09:16:51 -05:00
Nick Mathewson 2127c6b088 "Fix" remaining unchecked-subtraction warnings.
In both cases I think it's fine to panic; but it's best to do so
explicitly.
2023-01-27 09:16:41 -05:00
Nick Mathewson a6dd92843e Allow clippy::unchecked_duration_subtraction in tests
This panics on error, and we're fine with a panic on misbehavior in
tests.
2023-01-27 08:28:02 -05:00
Nick Mathewson ed74c62931 Elide a bunch of lifetimes.
Clippy now warns about these; I'm not sure how these warnings snuck
up on us.
2023-01-27 08:28:02 -05:00
Nick Mathewson bf04641c68 Disable clippy::unlinlined-format-args
This warning kind of snuck up on us! (See #748)  For now, let's
disable it.  (I've cleaned it up in a couple of examples, since
those are meant to be more idiomatic and user-facing.)

Closes #748.
2023-01-27 08:27:47 -05:00
Ian Jackson f2e254e63d Merge branch 'toml_0.6' into 'main'
Upgrade toml to version 0.6.

See merge request tpo/core/arti!989
2023-01-26 17:34:52 +00:00
Nick Mathewson b2373e6d3f Merge branch 'hscrypto_impl' into 'main'
Implement tor-hscrypto

Closes #684 and #742

See merge request tpo/core/arti!980
2023-01-26 14:28:13 +00:00
eta 51741398b2 Merge branch 'netdoc-builder' into 'main'
tor-netdoc: Provide NetdocEncoder (internal)

See merge request tpo/core/arti!984
2023-01-26 11:40:50 +00:00
eta 02d15dc5c1 Merge branch 'env' into 'main'
shell: use /usr/bin/env instead of absolute paths

See merge request tpo/core/arti!988
2023-01-26 11:35:38 +00:00
eta cd7059f5c7 Merge branch 'sensitive' into 'main'
tor-proto: Mark stream ids in errors as sensitive

See merge request tpo/core/arti!986
2023-01-26 11:31:46 +00:00
Nick Mathewson f9903789d1 Upgrade toml to version 0.6.
This required rewriting some of our error handling code in
command-line processing, since the toml crate now displays and
reports errors differently.  (Admittedly, this code still is kind of
ugly, but at least it is nicely hidden.)
2023-01-25 16:29:53 -05:00
Nick Mathewson 790f21032a hscrypto: Remove Credential.
It turns out that the credential is only calculated as an
intermediate result in order to blind keys and produce the
subcredential. As such, it has no need to leave the hscrypto module.
2023-01-25 14:34:16 -05:00
Nick Mathewson b4c4a21297 hscrypto: add a note about maybe replacing epoch_offset with voting_interval 2023-01-25 14:15:53 -05:00
Nick Mathewson 9864fd9db8 hscrypto: Explain why vanity onions require expanded secret keys. 2023-01-25 14:14:32 -05:00
Nick Mathewson 4399722ada hscrypto: document why we have keys in un-expanded form 2023-01-25 14:07:04 -05:00
Nick Mathewson 360e84afab hscrypto: Note that maybe Duration is the wrong type to use. 2023-01-25 13:59:50 -05:00
Nick Mathewson 904688467c hscrypto: Note the need for a Result rather than an Option 2023-01-25 13:57:57 -05:00
Ian Jackson ab0edd55e0 Apply several clarifications (and fixes for missing refs) 2023-01-25 18:54:48 +00:00
Nick Mathewson 386de7587e hscrypto: Use derive_more, and derive Deref for public keys. 2023-01-25 13:48:40 -05:00
Emil Engler 79097484de
shell: use /usr/bin/env instead of absolute paths
This commit changes the shebang in all shell scripts from absolute
paths (such as `/bin/bash` or `/usr/bin/python3`) to the `/usr/bin/env`
binary with the accompanying interpreter as it's argument.

The reason for this are as follows:
- NixOS cannot work with absolute paths
- BSD systems install their packages in /usr/local/bin
2023-01-25 18:35:53 +01:00
Nick Mathewson fe6575ef98 hscrypto: Revise TimePeriod to account for variable offset.
Previously, the offset was set to 12 hours unconditionally (like the
spec says).  But based on a conversation on tor-dev, it seems that
the offset should actually be 12 times the voting interval.

I'm also opening an MR to change the spec.
2023-01-24 15:04:40 -05:00
Nick Mathewson 108bb72c5e hscrypto: Add documentation for ClientSecretKeys 2023-01-24 13:40:59 -05:00
Nick Mathewson 93cdb0a2c3 Add a note about why we use ExpandedSecretKey for OnionIdSecretKey 2023-01-24 13:40:59 -05:00
Nick Mathewson 00aaf79620 hscrypto: Add our standard clippy warnings
(I have squashed the fixes for these warnings into the earlier
commits in this branch, so it will look like I did everything right
the first time.)
2023-01-24 13:40:59 -05:00
Nick Mathewson f192429442 hscrypto: Implement key blinding.
This implementation was made based on the specification, and then
validated against itself, and against C Tor.
2023-01-24 13:40:59 -05:00
Nick Mathewson 3dfeb5b144 hscrypto: Add an implementation for TimePeriod
This required some API tweaks, which is probably to be expected;
these time periods are a wonky kind of thing.
2023-01-24 13:33:48 -05:00
Nick Mathewson 0a52d90af3 hscrypto: Implement hs_mac. 2023-01-24 13:33:48 -05:00
Nick Mathewson 44e9d31af9 hscrypto: Improve documentation for RendCookie 2023-01-24 13:33:48 -05:00
Nick Mathewson 49afcafadd hscrypto: use a macro to define our byte wrappers too. 2023-01-24 13:33:48 -05:00
Nick Mathewson 7e4ad381a8 hscrypto: Add and use a macro to define all PK types. 2023-01-24 13:33:46 -05:00
Nick Mathewson 36485218c3 hscrypto: A couple of spelling fixes. 2023-01-24 13:32:18 -05:00
Nick Mathewson 23bbf17d38 hscrypto: Associate each type with new name from rend-spec-v3.txt 2023-01-24 13:32:18 -05:00
Nick Mathewson 3b2848f904 Merge branch 'onion-api-highlevel' into 'main'
Onion-service APIs: circmgr, hsclient, hsservice

See merge request tpo/core/arti!972
2023-01-24 18:19:42 +00:00
Ian Jackson 590c139af9 tor-proto: Mark stream ids in errors as sensitive
Pursuant to #556
2023-01-24 18:08:40 +00:00
Nick Mathewson 5b4ffc5e48 Note a needed isolation API. 2023-01-24 12:32:21 -05:00
Nick Mathewson 606426bfc7 hsservice: Add a note about the contents of circ_info.
In order to store per-circuit information, it's a good idea if we
provide something that can be the key of a `PtrWeakKeyHashMap`.
2023-01-24 12:32:21 -05:00
Nick Mathewson a210686c80 Sketch an API for onion services. 2023-01-24 12:32:21 -05:00
Nick Mathewson 32ae6dfa09 Add a new stub hsclient module to connect to onion services. 2023-01-24 12:32:21 -05:00
Nick Mathewson 8ce05dc725 CircMgr: Draft API to construct targeted multihop circuits.
Onion services and onion clients need these to make connections to
HsDirs, Introduction points, and Rendezvous points.
2023-01-24 12:32:21 -05:00
Nick Mathewson 190f24e66d CircMgr: Draft APIs used to implement onion service clients. 2023-01-24 12:32:21 -05:00
Nick Mathewson 1834579460 Merge branch 'onion-proto-apis' into 'main'
Draft APIs for onion services in tor-proto

See merge request tpo/core/arti!970
2023-01-24 17:28:16 +00:00
Nick Mathewson ce293e4ce4 tor-proto: comment fixes and more TODO hs 2023-01-24 11:50:10 -05:00
Ian Jackson 92ba020534 Add missing docsrs attribute 2023-01-24 16:19:05 +00:00
Ian Jackson 15a543d738 netdoc builder: Add two TODOs, prompted by testing experience 2023-01-24 16:15:17 +00:00
Ian Jackson be1cd7789d netdoc builder test: Make a bigger dummy document and test reparsing 2023-01-24 16:15:17 +00:00
Ian Jackson eb3b261595 netdoc builder: Implement object() and add one test case 2023-01-24 16:15:17 +00:00
Ian Jackson 4f0d17d96d netdoc-builder: Initial test case (no object yet) 2023-01-24 16:15:17 +00:00
Ian Jackson 066eb12f50 netdoc-builder: Provide new() method 2023-01-24 16:15:17 +00:00
Ian Jackson e989871a7b netdoc-builder: Implement ItemArgument for more needed types 2023-01-24 16:15:17 +00:00
Ian Jackson 94fec1e12c netdoc-builder: Remove some obsolete comments 2023-01-24 16:15:17 +00:00
Ian Jackson 16c4fee4b8 netdoc-builder: Move example into implementation doc comment
Not actually tested yet
2023-01-24 16:15:17 +00:00
Ian Jackson 8f725a19f8 netdoc-builder: Implement most of the internal general doc builder 2023-01-24 16:15:17 +00:00
Ian Jackson 22cf060426 netdoc-builder api: Clarify docs for object() 2023-01-24 16:15:17 +00:00
Ian Jackson c7e816d263 netdoc-builder api: Introduce ItemArgument trait 2023-01-24 16:15:17 +00:00
Ian Jackson eac7befc87 netdoc-builder api: Have .item() return ItemBuilder
This was a slip in the design doc.
2023-01-24 16:15:17 +00:00
Ian Jackson 8c8ff4948f netdoc-builder api: Abolish `K` generic on ItemEncoder
We're going to eagerly encode the keyword, so this will be easy.
Removing the generic simplifies the API.
2023-01-24 16:15:17 +00:00
Ian Jackson 669a399c46 netdoc-builder api: Don't promise to check args_raw_string value 2023-01-24 16:15:17 +00:00
Ian Jackson 2bc7a371b4 netdoc-builder api: Make ItemEncoder methods consume and return self
This will actually make the pattern in the example work.

The mentioned `ItemArgument` trait will arrive soon.
2023-01-24 16:15:17 +00:00
Ian Jackson 5fccbce160 netdoc-builder api: Move internal API into actual code file (fmt) 2023-01-24 16:15:17 +00:00
Ian Jackson e971d1ad59 netdoc-builder api: Move internal API into actual code file
Motion, plus the bare minimum needed to make it compile.
2023-01-24 16:15:17 +00:00
Ian Jackson f735a128bb tor-netdoc: tokenize: Provide BASE64_PEM_MAX_LINE
We'll use this in the netdoc builder, but it naturally lives here.
2023-01-24 16:15:17 +00:00
Ian Jackson c8ac951cf5 tor-netdoc: tokenize: Rename to tag_keywords_ok, document, expose
Rename from _keyword_, since this actually checks the *multiple*
keywords that can appear in an object's BEGIN line.

Make this clear in the doc comment.

Expose it for use by the netdoc builder.
2023-01-24 16:15:17 +00:00
Ian Jackson a8ab0a5f46 tor-netdoc: tokenize: crate-Expose object::BEGIN_STR etc.
The document builder wants these too.
2023-01-24 16:15:17 +00:00
Ian Jackson 5bd54f3701 tor-netdoc: Make AuthCertKwd pub(crate)
For now, this will be useful in a test.
2023-01-24 16:15:17 +00:00
Ian Jackson 043581fe0e tor-bytes: impl Writeable for &impl Writeable 2023-01-24 16:15:17 +00:00
Ian Jackson a4a4b19f21 tor-bytes: Implement conversion from EncodeError to Bug 2023-01-24 16:15:17 +00:00
eta c31f451e0b Merge branch 'bug736' into 'main'
Prop304: Add extended SOCKS result codes for onion services

See merge request tpo/core/arti!978
2023-01-24 15:05:19 +00:00
Nick Mathewson fd8915155e Merge branch 'ignore' into 'main'
Do not .gitignore crates/*/fuzz/corpus

See merge request tpo/core/arti!982
2023-01-20 18:47:20 +00:00
Ian Jackson 5c76bca692 tor-llcrypto: Tolerate some warnings (fmt) 2023-01-20 17:29:45 +00:00
Ian Jackson 4e6f5b7ff3 Do not .gitignore crates/*/fuzz/corpus
These are symlinks which are actually checked in.  They should not be
ignored.  (This caused trouble for some of my privsep tooling...)
2023-01-20 17:29:00 +00:00
Ian Jackson bd21d23279 tor-llcrypto: Tolerate some warnings
Without this,
  cargo +stable clippy -p tor-netdoc --all-features
produces warnings.
2023-01-20 16:37:31 +00:00
Nick Mathewson 131775bf36 Upgrade to latest rsa crate. 2023-01-20 08:06:30 -05:00
Nick Mathewson 02a1f9a3e4 Upgrade to latest async-broadcast
(We don't yet use the code that uses it, but we might as well have
our unused code be up-to-date.)
2023-01-20 08:06:30 -05:00
Nick Mathewson 707efc944d upgrade to latest serial_test 2023-01-20 08:06:30 -05:00
Nick Mathewson 889206cde4 Complete our migration to base64ct.
This is in lieu of upgrading to the latest base64 crate, which has
a different API from the old one.  Since we have to migrate either
way, we might as well use base64ct everywhere.

I don't think that most of these cases _require_ constant-time
base64, but it won't hurt.
2023-01-20 08:06:30 -05:00
Nick Mathewson 6cb0528cc1 Upgrade to latest rlimit crate. 2023-01-19 14:10:54 -05:00
Neel Chauhan 66a649f5f8 Prop304: Add extended SOCKS result codes for onion services 2023-01-18 18:39:00 -08:00
Michael van Straten fa93f6674d made TorClient::set_stream_prefs public 2023-01-18 18:20:59 +01:00
Nick Mathewson 12845d6e1e tor-proto: Draft API to handle incoming BEGIN requests.
Onion services (and later, exits and caches) will need this.
2023-01-17 15:20:03 -05:00
Nick Mathewson e8ed46006e tor-proto: Expose support for doing onion service handshakes
This is a little tricky, but I think that we're not actually
exposing too much here.  I expect we'll need to tweak this stuff
between now and our final version.
2023-01-17 15:20:03 -05:00
Nick Mathewson 99fdaa7c2e tor-proto: Draft APIs for handling control messages
We will need these for onion services, to send and receive messages
of types not handled directly by the tor-proto crate.
2023-01-17 15:20:03 -05:00
Nick Mathewson 4fedd301cf tor-proto: Rename "hs" experimental feature to "onion-common"
(For consistency with other crates)
2023-01-17 15:20:03 -05:00
Nick Mathewson 56cb2d2a10 Make a top-level API for connecting to onion services.
Fortunately, it adds very little to the arti-client API surface.
2023-01-12 09:28:58 -05:00
Nick Mathewson 7030cbe460 Merge branch 'onion-netdir-apis' into 'main'
Add onion service APIs to tor-netdir

See merge request tpo/core/arti!966
2023-01-11 16:08:18 +00:00
Nick Mathewson de3f10f492 netdir: add network parameters related to onion services
These are available unconditionally, since they represent
comparatively little storage and processing effort.

See param-spec.txt section 8 for the original information here.
2023-01-11 09:10:08 -05:00
Nick Mathewson 136f70545d tor-units: Add an IntegerMinutes. 2023-01-11 09:10:08 -05:00
Nick Mathewson 5b74ef7af9 Adjust onion service ring APIs in light of prop#342
* It is the NetDir's responsibility to tell the caller what the time
  period is.
* There can be up to two secondary time periods.
* Each time period has a single SRV.
* Secondary time periods only apply for onion services, when they
  publish.
* When publishing, the correct input is a time period.
2023-01-11 09:04:13 -05:00
Nick Mathewson f24f8d295c Sketch APIs for the onion service directory ring.
These are a bit complex internally, but the API they present is
pretty simple.  I've left some discussion of points where the design
isn't totally fleshed out, and where we need to look harder at the
spec.

Part of #716.
2023-01-11 09:04:13 -05:00
Nick Mathewson 2c41321710 Netdoc: Refactor SharedRandVal.
SharedRandVal now holds only the 32-byte random value itself; the
"number of commits" field is in SharedRandStatus.

This commit also makes the SharedRandVal be exactly 32 bytes, since
we've set it to that value in the spec.
2023-01-11 09:04:12 -05:00
Nick Mathewson d7abced11f hscrypto: Add several derives
The important addition here is the Copy derives, which affect API
design. I'm applying them to the types that are 32 byte or smaller.
2023-01-11 09:04:12 -05:00
Ian Jackson d6800bae0c Merge branch 'blind_privkey' into 'main'
llcrypto: Implement secret-key blinding.

Closes #719

See merge request tpo/core/arti!964
2023-01-09 18:06:00 +00:00
eta cea6396513 Merge branch 'typos' into 'main'
Fix typos

See merge request tpo/core/arti!965
2023-01-09 14:44:00 +00:00
eta 371bcdc554 Merge branch 'arti-hyper-fixing-715' into 'main'
Temporary fix for #715 and #569

Closes #715

See merge request tpo/core/arti!958
2023-01-09 14:43:37 +00:00
Dimitris Apostolou 892c6eaadf
Fix typos 2023-01-07 20:35:54 +02:00
Michael van Straten 2e8c38d11d Removed unnecessary "all()" cfg constraint 2023-01-07 13:00:40 +01:00
Michael van Straten 90a25fa21a Added x86_64-apple-darwin to fallback to "tls-api-openssl" 2023-01-07 12:57:23 +01:00
Michael van Straten 0a04851636 fixed "broken_intra_doc_link" 2023-01-06 19:43:44 +01:00
Nick Mathewson 8472acf3ac Merge branch 'onion-api-v0.2' into 'main'
Onion service APIs, part 1.

See merge request tpo/core/arti!959
2023-01-06 18:32:36 +00:00
Ian Jackson 0c2f800ab0 Merge branch 'sensitive' into 'main'
tor-proto: Remove some sensitive info from errors

See merge request tpo/core/arti!934
2023-01-06 18:07:26 +00:00
Nick Mathewson 7f6e3e19a3 Sketch a solution for arti#525 2023-01-06 13:03:50 -05:00
Nick Mathewson 91d9ffe0b6 Sketch out new required APIs in tor-cell 2023-01-06 13:03:50 -05:00
Nick Mathewson 9a54e01dd0 tor-cert: add a few hs TODOs 2023-01-06 13:03:50 -05:00
Nick Mathewson eba937e54c netdoc: Outline some basic types for encoding HsDescs. 2023-01-06 13:03:50 -05:00
Nick Mathewson 0203634ec5 Create a new tor-hscrypto crate.
This module has types and operations needed in multiple places
for an onion service implementation.  There are a bunch of
TODO hs-crypto comments that we'll need to fill in.
2023-01-06 13:03:50 -05:00
Nick Mathewson e650e07cd4 netdoc: note some changes we will have to make to srv 2023-01-06 13:03:50 -05:00
Nick Mathewson 7d38bbd829 llcrypto: fix a comment.
This described the wrong type of key.
2023-01-06 13:03:50 -05:00
Nick Mathewson e7c87372e2 llcrypto: clarify meaning of "Identity".
The `Ed25519Identity` and `RsaIdentity` types are not precisely
always used as relay identifiers: they are more generally used as
_key_ identifiers.

This will become relevant as `RsaIdentity` is used for authority
keys (as in authorities' VoterInfo blocks), and as `Ed25519Identity`
is used as the identifier behind an onion service key.
2023-01-06 13:03:47 -05:00
Ian Jackson 98acafe9d1 tor-proto: rustfmt
Not sure why the tree didn't have this newline already.  "Whatever".
2023-01-06 17:26:54 +00:00
Ian Jackson 0639b105c5 tor-proto: CreateFastWrap::decode_chanmsg: Do not report handshake
The debug impl prints the handshake challenge, which we should
probably treat as sensitive.
2023-01-06 17:26:54 +00:00
Ian Jackson df2124e28f tor-proto: impl Display for CreateResponse
Don't print the handshake value, but do print the display reason.
2023-01-06 17:26:54 +00:00
Ian Jackson 8c925499f8 tor-proto: When relay IDs mismatch, the IDs are sensitive in errors 2023-01-06 17:26:54 +00:00
Nick Mathewson 1e25a962a7 chanmgr: trace-level logs when launching connections.
Based on more temporary debugging code. Yet another part of #677.
2023-01-06 17:19:00 +00:00
Nick Mathewson 71dfaa3125 ptmgr: Add more logs when looking/creating a PT.
These are also based on temporary logs that I added locally while I
was hunting bugs.

Also part of #677.
2023-01-06 17:19:00 +00:00
Nick Mathewson 3eebe33678 ptmgr: Add more logging to IPC code.
This is based on logs that I added locally while I was trying to
debug some startup issues.  Hopefully they'll make things easier the
next time there's something to debug.

Part of #677.
2023-01-06 17:19:00 +00:00
eta b525fccfb0 Merge branch 'ya-lint' into 'main'
tor-linkspec: Fix an unused lint

See merge request tpo/core/arti!935
2023-01-06 17:16:27 +00:00
eta 118050e54c Merge branch 'test-lints' into 'main'
Add test lint blocks to all "mod test"

See merge request tpo/core/arti!937
2023-01-06 17:16:09 +00:00
eta fbae20537c Merge branch 'bug589a' into 'main'
Remove allow(unreachable_pub) from tor-guardmgr/src/lib.rs

Closes #589

See merge request tpo/core/arti!944
2023-01-06 17:14:03 +00:00
eta d869676263 Merge branch 'socks-resolve-ip' into 'main'
resolve ip through socks by parsing them

Closes #714

See merge request tpo/core/arti!957
2023-01-06 17:08:25 +00:00
Nick Mathewson 306e72c566 llcrypto: Implement secret-key blinding.
Closes #719.

Due to a difference between ed25519-dalek and ed25519-donna,
converting these secret keys directly to public keys does not work.
I've documented this in a "Limitations" section.
2023-01-06 12:02:49 -05:00
eta 246a5f1e56 Merge branch 'ctbytes' into 'main'
Add a new "CtByteArray" type, and use it in Id types.

See merge request tpo/core/arti!962
2023-01-06 16:41:29 +00:00
Nick Mathewson 9d3f19fd38 Add a new "CtByteArray" type, and use it in Id types.
This type provides a common implementation for types that are
implemented as arrays of bytes that should only be compared
with constant-time comparisons.
2023-01-05 12:34:14 -05:00
Michael van Straten 0d05a61381 Temporary fix for #715 and #569 2023-01-05 00:00:47 +01:00
Ian Jackson a7035d08a1 Merge branch 'tor-rtmock-rfc3399' into 'main'
Use parse_rfc3339() in the tor-rtmock crate

See merge request tpo/core/arti!943
2023-01-04 14:32:13 +00:00
Ian Jackson 8f91bc5ef9 Merge branch 'tor-proto-use-rfc3339' into 'main'
Use parse_rfc3339() in the tor-proto crate

See merge request tpo/core/arti!942
2023-01-04 14:31:07 +00:00
Ian Jackson 0ac7dfbd9e Merge branch 'tor-netdoc-rfc3399' into 'main'
Use parse_rfc3339() in the tor-netdoc crate

See merge request tpo/core/arti!941
2023-01-04 14:30:08 +00:00
trinity-1686a 29f1d9012d resolve ip through socks by parsing them 2023-01-03 17:53:16 +01:00
Emil Engler 8579bc66a8
doc: consistent summary line for the READMEs
This commit introduces a consistency to the summary line of all
README.md files in each and every crate.
2022-12-20 14:31:47 +01:00
Neel Chauhan e39e39ea27 Add semver.md for (into_)handshake() 2022-12-19 08:25:15 -08:00
Neel Chauhan b649a1d86f msg::{CreateFast/CreatedFast}: Rename accessor to (into_)body() 2022-12-18 21:00:24 -08:00
Neel Chauhan 23db2944cc Remove allow(unreachable_pub) from tor-guardmgr/src/lib.rs
Closes #589
2022-12-16 13:23:57 -08:00
Neel Chauhan 11958c9241 Use parse_rfc3339() in the tor-rtmock crate 2022-12-16 13:07:49 -08:00
Neel Chauhan a180f911bd Use parse_rfc3339() in the tor-netdoc crate 2022-12-16 12:56:00 -08:00
Neel Chauhan c171c0f834 Use parse_rfc3339() in the tor-proto crate 2022-12-16 12:53:50 -08:00
Ian Jackson fa5a417fc9 Merge branch 'err-dyn-report' into 'main'
Error logging (ErrorReport, .report()) POC

See merge request tpo/core/arti!936
2022-12-15 15:02:17 +00:00
Ian Jackson 8a28cb2d14 tor-error: tests: Add a test case for Report and Bug wrapping 2022-12-15 14:37:08 +00:00
Ian Jackson 125a455bdc test lint blocks: Add many many automatically
This is precisely the result of running the rune in
maint/adhoc-add-lint-blocks.
2022-12-12 18:00:30 +00:00
Ian Jackson baf78361e8 test lint blocks: Do some semi-manually
This is the hunks from running the rune in maint/adhoc-add-lint-blocks
but which require some subsequent manual fixup: usually, deleting
now-superfluous outer allows, but in some cases manually putting back
lints that the adhoc script deleted.
2022-12-12 18:00:29 +00:00
Ian Jackson ec7720ae91 test lint blocks: Standardise one in tor-socksproto
The previous syntax was recognised by the real script, but not by the
ad-hoc script I'm about to use to add all the missing ones.
2022-12-12 17:50:39 +00:00
coral 25f113b8b3 Tackling issue #663 (Use humantime in tests) 2022-12-12 17:41:22 +00:00
Ian Jackson 4181ccb8cc tor-circmgr: Use ErrorReport on a logged error
To demonstrate what the use looks like.
2022-12-12 16:40:51 +00:00
Ian Jackson b132536b32 tor-error: Provide ErrorReport extension trait with .report() method 2022-12-12 16:40:51 +00:00
Ian Jackson bd46e2ae84 tor_error: Promote internal StdError alias to report
The std::error::Error repetition was getting rather repetitively
repetitious, and is about to get more so.
2022-12-12 16:40:51 +00:00
Ian Jackson 8fea4dd6d3 tor-proto: reactor tests: Use debug fmt on an error
In tests, debug fmt is usually appropriate.

Found while looking for a candidate for
  https://gitlab.torproject.org/tpo/core/arti/-/issues/680
2022-12-12 16:40:51 +00:00
Ian Jackson 05ca80950e tor-linkspec: Fix an unused lint
Otherwise:

  cargo +stable clippy -p tor-proto --all-features --all-targets

Produces:

  warning: unused import: `PtTargetAddr`
   --> crates/tor-linkspec/src/traits.rs:9:28
    |
  9 | use crate::{ChannelMethod, PtTargetAddr, RelayIdRef, RelayIdType, RelayIdTypeIter};
    |                            ^^^^^^^^^^^^
2022-12-12 15:08:31 +00:00
Ian Jackson 5611d5cb0c Rename Sensitive::into_inner() from ::unwrap()
By analogy with similar methods on Mutex, Cell, BufReader, etc. etc.

Discussed here
  https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/890#note_2856885

Make it a method, as per
  https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/928
2022-12-12 11:52:34 +00:00
Dimitris Apostolou 7c1beb6171
Fix typos 2022-12-09 11:57:36 +02:00
Nick Mathewson dc2c00e282 Merge branch 'doc-config-must' into 'main'
tor-config: Document how to reject compiled-out features

Closes #654

See merge request tpo/core/arti!929
2022-12-07 13:20:09 +00:00
Nick Mathewson 64ea12d4b9 Merge branch 'shewllexpand' into 'main'
tor-config: Update to shellexpand 3.x

See merge request tpo/core/arti!927
2022-12-07 13:19:39 +00:00
Ian Jackson 4e74104e70 Merge branch 'spelling-20221206' into 'main'
A few spelling fixes for bridgedescmgr code

See merge request tpo/core/arti!925
2022-12-06 18:25:43 +00:00
Ian Jackson d88e890583 Merge branch 'persist_err_test' into 'main'
Test a couple more error cases in tor-persist, and lightly refactor

See merge request tpo/core/arti!930
2022-12-06 16:38:28 +00:00
Ian Jackson fe5aeed41f Merge branch 'safelog_tests' into 'main'
More unit tests for safelog crate

See merge request tpo/core/arti!928
2022-12-06 16:17:44 +00:00
Ian Jackson 2321d0ba0b Merge branch 'faravahar-removal' into 'main'
dirauth: Remove Faravahar

See merge request tpo/core/arti!924
2022-12-06 16:02:22 +00:00
Nick Mathewson 764eecabab Test a couple more error cases in tor-persist. 2022-12-06 10:55:26 -05:00
Ian Jackson dc3c7651ca tor-config: Document how to reject compiled-out features
Fixes #654
2022-12-06 15:51:43 +00:00
Ian Jackson f3fa77be6f tor-config: Add "particular situations" sections and mention list_builder 2022-12-06 15:51:31 +00:00
Nick Mathewson 3ab548eb1c safelog: tests for accessors. 2022-12-06 10:31:40 -05:00
Nick Mathewson 417dda9547 safelog: tests for BoxSensitive. 2022-12-06 10:28:53 -05:00
Ian Jackson ba338bdf37 tor-config: Update to shellexpand 3.x
This is the new upstream version (published by me, recently).
It has the same MSRV and one breaking change:

The caller who specifies a home dir function for substituting into
strings, must now supply a string, not Path.  Previously shellexpand
would allow the caller to supply non-unicode data, and then simply not
substitute it.  That was an infelicity in the shellexpand API.

Now this infelicity is pushed into our code.  The overall behaviour of
Arti hasn't changed as a result.  And it seems reasonable to me.

shellexpand 3.x also has a module for expanding Paths instead, in
response to requests for this filed as upstream tickets.  We *could*
use that but I am not sanguine about that approach: the Pathness would
spread throughout much of our config and file handling code.

I think we should at the very least postpone trying to work with
invalid-unicode-paths as long as we can.
2022-12-06 15:15:22 +00:00
Ian Jackson 010ffd6ea6 tor-config: home dir handling: fmt pre-patch 2022-12-06 15:11:58 +00:00
Nick Mathewson 993b4202c7 safelog: more tests for Redacted. 2022-12-06 09:34:26 -05:00
Nick Mathewson f204eebf11 arti-client: spelling fix. 2022-12-06 09:08:26 -05:00
Nick Mathewson 02d340e4b2 dirmgr: Spelling fixes and normali[sz]ations 2022-12-06 09:02:48 -05:00
David Goulet 5ea8c8eed0 dirauth: Remove Faravahar
See https://gitlab.torproject.org/tpo/core/tor/-/issues/40688

Signed-off-by: David Goulet <dgoulet@torproject.org>
2022-12-06 09:01:34 -05:00
David Goulet 43aa24b231 dirauth: New v3 identity key for moria1
We are rotating moria1's key due to a break-in few weeks ago. See
https://gitlab.torproject.org/tpo/core/tor/-/issues/40722 for more
details.

The original MR for C-tor (tor.git) done by Roger Dingledine, moria1's
operator, is here:
https://gitlab.torproject.org/tpo/core/tor/-/merge_requests/662

Signed-off-by: David Goulet <dgoulet@torproject.org>
2022-12-06 08:42:09 -05:00
eta 16305a6415 Merge branch 'optional-deps-static' into 'main'
make use of 1.60 weak dependancy features

Closes #434

See merge request tpo/core/arti!920
2022-12-05 15:21:55 +00:00
Nick Mathewson e0aeda3071 Remove semver.md files now that 1.1.0 is released. 2022-11-30 17:10:29 -05:00
Nick Mathewson 40941c6079 Merge branch 'version_bump' into 'main'
Bump the minor version of every crate.

See merge request tpo/core/arti!918
2022-11-30 20:54:15 +00:00
trinity-1686a 39fffd8d03 make use of 1.60 opt dependancy features 2022-11-30 21:24:04 +01:00
Nick Mathewson 38bef96b99 Bump the minor version of every crate.
We made this job easy this time around: by incrementing our MSRV, we
have forced ourselves to do at least a minor bump everywhere.
2022-11-30 15:10:16 -05:00
Nick Mathewson 82f877ec79 Hang onto a PT object after it is launched
If we don't do this, then snowflake's stdin will get closed and
it will exit immediately.

Found while investigating #333.
2022-11-30 14:44:14 -05:00
Nick Mathewson 903571353b Merge branch 'renaming' into 'main'
Renaming a couple of items for arti 1.1.0

Closes #623

See merge request tpo/core/arti!916
2022-11-30 18:58:37 +00:00
Nick Mathewson 6bd0f92c15 Downgrade a "TODO pt-client" comment 2022-11-30 13:22:54 -05:00
Nick Mathewson ed08cce1b5 Rename for_circuit_usage => as_relay_with_desc 2022-11-30 13:16:51 -05:00
Nick Mathewson acc2de7b31 Rename TransportHelper => TransportImplHelper. 2022-11-30 13:05:46 -05:00
Ian Jackson 17ba4a1cc2 Merge branch 'redacted_test_serial' into 'main'
safelog: Apply #[serial] to test_redacted()

Closes #675

See merge request tpo/core/arti!914
2022-11-30 17:38:12 +00:00
eta e13f2cf7d9 Merge branch 'ptmgr-todos' into 'main'
Dispose of ptmgr TODOs (and remove a dead variable)

See merge request tpo/core/arti!912
2022-11-30 17:37:47 +00:00
Nick Mathewson a0e1b3d651 Merge branch 'bridge-addr-2' into 'main'
Separate BridgeAddr and PtTargetAddr

See merge request tpo/core/arti!904
2022-11-30 17:36:50 +00:00
eta 5c2847e1d0 Merge branch 'fix_pt_protocol' into 'main'
Resolve two bugs in our pt-socks implementation

Closes #676

See merge request tpo/core/arti!913
2022-11-30 17:25:31 +00:00
Ian Jackson 8157cf059e Merge branch 'abolish-set-default-transport' into 'main'
Abolish ChanMgr::set_default_transport

See merge request tpo/core/arti!910
2022-11-30 17:05:36 +00:00
Nick Mathewson 4688ee9165 safelog: Apply #[serial] to test_redacted()
Closes #675.
2022-11-30 12:00:17 -05:00
Nick Mathewson e835bd4c4c PT protocol: pt-spec conformance with password field
pt-spec says:
```
      If the encoded argument list is less than 255 bytes in
      length, the "PLEN" field must be set to "1" and the "PASSWD"
      field must contain a single NUL character.
```

This is a very silly thing to say, but some PTs enforce it.

Fixes #676.
2022-11-30 11:53:38 -05:00
Nick Mathewson 475d9af34a connect_via_proxy: Actually send initial handshake.
Our previous code would make a TCP connection to the proxy, then
wait forever for it to say something. Whoops!

Part of a fix for #676.
2022-11-30 11:53:27 -05:00
Ian Jackson fa676ce577 ptmgr todo: Remove dead code allow 2022-11-30 16:42:40 +00:00
Ian Jackson fe33112923 ptmgr: No need for state_dir in PtMgr
This is used exclusively by the reactor.
2022-11-30 16:42:18 +00:00
Ian Jackson 1521f63bf1 ptmgr todo: Tolerate exposing the Vec for now
We may want to change this later, but this API is in a low level
crate, so this isn't a blocker.
2022-11-30 16:40:45 +00:00
Ian Jackson 4afe128189 PT SOCKS tests: add a few more tests 2022-11-30 16:35:04 +00:00
Ian Jackson 596e67f588 PT SOCKS tests: test name that only fits in V4 2022-11-30 16:35:04 +00:00
Nick Mathewson a5cdf88fdc Merge branch 'pt-todo-highlevel' into 'main'
Dispose of all TODO pt-client in arti-*

See merge request tpo/core/arti!909
2022-11-30 16:22:46 +00:00
eta f122b4b1ee Merge branch 'no_empty_select' into 'main'
ptmgr: Do not construct an empty select_all future.

Closes #672 and #670

See merge request tpo/core/arti!907
2022-11-30 16:01:58 +00:00
Ian Jackson ab74506dc9 Abolish ChanMgr::set_default_transport
The comment says
  // TODO pt-client: It's not clear to me that we really need this method.
and empirically, deleting it, and its callee, is fine.
2022-11-30 16:00:31 +00:00
Ian Jackson e068c5c2bc Merge branch 'ptmgr-errs' into 'main'
ptmgr: error fixes

See merge request tpo/core/arti!906
2022-11-30 15:58:26 +00:00
Ian Jackson e6d721c497 arti: transports parsing: Record this as a ticket 2022-11-30 15:56:16 +00:00
Ian Jackson 598f4e2e28 arti: BridgesConfig is evidently not too high up
Since apparently it was possible to write all the other code without
moving it.
2022-11-30 15:51:10 +00:00
Ian Jackson e4ac39e638 bridge config: Add a TODO about a redundant clone 2022-11-30 15:49:34 +00:00
Ian Jackson 429d2c7cb7 bridge config: Rename accessors
As per
  https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/904#note_2858480
2022-11-30 15:49:34 +00:00
Ian Jackson 117bee5808 bridge config: Use unreachable, not None.expect
As per
  https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/904#note_2858479
2022-11-30 15:49:34 +00:00
Ian Jackson bb6c98bdc1 BridgeAddr tests: dedupe slightly 2022-11-30 15:49:34 +00:00
Ian Jackson 199a6e0754 Separate BridgeAddr and PtTargetAddr
As per
  https://gitlab.torproject.org/tpo/core/arti/-/issues/668#note_2858220

This commit is difficult to split up.

The innards of BridgeAddr and PtTargetAddr are still a bit entangled.
2022-11-30 15:49:34 +00:00
Ian Jackson a74ee097f5 arti: pt mgr spawns the task itself in new 2022-11-30 15:48:31 +00:00
Ian Jackson 455295457f Merge branch 'redaction_fix' into 'main'
Fix a logic error in Redacted.

Closes #671

See merge request tpo/core/arti!905
2022-11-30 15:39:41 +00:00
Nick Mathewson d853fdb5cb ptmgr: Do not construct an empty select_all future.
Closes #670.

Closes #672.
2022-11-30 10:22:09 -05:00
Ian Jackson 1e63a89ce8 ptmgr: change error UnconfiguredTransportDueToConcurrentReconfiguration
Rename it from UnconfiguredTransport.  Change descriptions, kind, and
retry.  Add a TODO.

As per
  https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/901#note_2858455
2022-11-30 15:21:49 +00:00
Ian Jackson d705454313 ptmgr: Clarify E::NotAFile
As per
  https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/901#note_2858454
2022-11-30 15:21:39 +00:00
Ian Jackson f19d8e0397 ptmgr: Fix kind for E::StatedirCreateFailed
As per
  https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/901#note_2858456
2022-11-30 15:21:39 +00:00
Nick Mathewson 80d9248b50 Merge branch 'merge_ptreactor' into 'main'
Merge PtReactor, resolve a few of my comments.

See merge request tpo/core/arti!903
2022-11-30 15:21:13 +00:00
Nick Mathewson f0084e3fd4 Fix a logic error in Redacted.
Previously it was redacting exactly when safelogging was _disabled_,
which obviously isn't correct.

Fixes #671. Regression test included.
2022-11-30 09:07:33 -05:00
Nick Mathewson dacb3eafda ptmgr: report an error if PT transports don't match requested.
(I think this may be impossible now, since we check in ipc.rs, but
IMO it's best to check.)
2022-11-29 20:01:19 -05:00
Nick Mathewson 5f0f5f81b1 arti-client: Try to take ownership of state earlier.
There's no harm in doing this, since we'll try to take ownership of
the state soon as soon as we use it: We just want to try early, so
that we'll get it before we decide that we're using bridges.

Fixes bug #669; bug introduced by !889.
2022-11-29 19:58:42 -05:00
Nick Mathewson fdc49b1fed Register transport in pt reactor even if it has no pending requests 2022-11-29 19:35:38 -05:00
Nick Mathewson 9765fdc2e6 ptmgr: Use anonymize_home when displaying paths in errors 2022-11-29 19:30:50 -05:00
Nick Mathewson f6311c83f7 ptmgr: Use PluggableTransport::identity in logs.
This lets us avoid logging the user's path.
2022-11-29 19:20:44 -05:00
Nick Mathewson bb0749cd42 Centralize the "find an identifier for the pt name" logic in one place. 2022-11-29 19:13:32 -05:00
Nick Mathewson 21e7e52ad5 Merge remote-tracking branch 'eta/ptreactor-v1' into merge_ptreactor
Resolved several conflicts while doing so; mostly with !893 and
!895.
2022-11-29 18:55:49 -05:00
eta 9b4fc50625 tor-ptmgr: add PtReactor
This fleshes out the PtReactor that was previously a stub, making it
actually do reactor-ey things. Note that this is entirely untested, and
might not work at all. Hopefully it does, though.
2022-11-29 20:13:32 +00:00
Nick Mathewson 7ef9dde99c Merge branch 'todos-chanmgr' into 'main'
chanmgr: resolve several remaining "TODO pt-client" issues

See merge request tpo/core/arti!897
2022-11-29 19:31:48 +00:00
Nick Mathewson dc5551114c Merge branch 'list-builder-lint' into 'main'
tor-basic-utils: list_builder: Use standard test lint block

See merge request tpo/core/arti!900
2022-11-29 19:25:07 +00:00
Ian Jackson f3c8b0433b tor-basic-utils: list_builder: Use standard test lint block
This gets rid of a spurious warning on nightly about the use of dbg!
2022-11-29 18:41:56 +00:00