aboutsummaryrefslogtreecommitdiff
path: root/crates
Commit message (Collapse)AuthorAgeFilesLines
...
| * | | arti: Downgrade CircuitClosed to debug level.Nick Mathewson2026-01-221-3/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | This isn't the long-term solution to error reporting and proxies, but it is a start that we can work from. Closes #2304.
| * | | arti: Extract function to find a ProtoError sourceNick Mathewson2026-01-222-11/+22
| | | |
| * | | tor-proto: Report CircuitClosed on unexpected stream rx closeNick Mathewson2026-01-221-6/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | As near as I can tell, there are only three ways that the sender corresponding to this rx can be dropped: - `StreamMap::terminate` because the stream object itself was dropped. (But see #2323.) - `StreamMap::close_stream` because an END message or similar has been received. (But see #2322.) - The `StreamMap` has been dropped. The first two cases are already handled, and AFAICT the third can only happen when the circuit hop closes. That makes `CircuitClosed` the appropriate error here, not `StreamProto`. Part of a fix for #2304.
* | | | tor-rtcompat: depend on rustls 0.23.21Steven Engler2026-01-261-0/+7
| | | |
* | | | tor-basic-utils: bump slab to 0.4.7Steven Engler2026-01-261-1/+1
| | | | | | | | | | | | | | | | | | | | This is needed since we rely on `Slab::new()` being a const fn, which was only added in 0.4.7.
* | | | Merge branch 'database-compression-bug' into 'main'Clara Engler2026-01-222-5/+6
|\ \ \ \ | | | | | | | | | | | | | | | | | | | | tor-dirserver: Make compression failures a bug See merge request tpo/core/arti!3605
| * | | | tor-dirserver: Add comment on compression bugClara Engler2026-01-221-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | This commit adds a comment explaining why we treat compression errors as a bug.
| * | | | tor-dirserver: Make compression failures a bugClara Engler2026-01-222-5/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This commit removes `DatabaseError::Compression` because it does not fit in. Right now, this single variant makes the error to be call-site oriented which is not nice for error handling. Instead, this error should indicate that something was truly wrong with the database in itself, such as an invalid schema, a low-level SQLite bug, etc. Instead, we now map a compression error to `DatabaseError::Bug` because there is no good reason on why it should fail, given that we compress memory data to memory data. Probably because it uses the `std::io::Writer` interface which itself demands use of `std::io::Result`.
* | | | | Merge branch 'rate-limit-2' into 'main'David Goulet2026-01-224-46/+63
|\ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | tor-log-ratelim: Avoid logging when there's no update Closes #2320 See merge request tpo/core/arti!3603
| * | | | | tor-log-ratelim: don't log "now working" repeatedlySteven Engler2026-01-202-22/+27
| | | | | |
| * | | | | tor-log-ratelim: added field name to tuple structSteven Engler2026-01-201-8/+13
| | | | | |
| * | | | | tor-log-ratelim: avoid logging when there's no updateSteven Engler2026-01-204-7/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Adds a new `AppearsResolved` status to indicate that there have been successes and no failures. The `Dormant` status now means that there has been no activity.
| * | | | | tor-log-ratelim: ran cargo fmtSteven Engler2026-01-201-16/+17
| | | | | |
| * | | | | tor-log-ratelim: change if statement to matchSteven Engler2026-01-201-3/+4
| | | | | |
* | | | | | Merge branch 'ticket1599_03' into 'main'David Goulet2026-01-2219-311/+991
|\ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | proto: Implement relay responder handshake and finalize it for both handshakes See merge request tpo/core/arti!3596
| * | | | | | proto: Improve some comments in relay moduleDavid Goulet2026-01-222-1/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Signed-off-by: David Goulet <[email protected]>
| * | | | | | proto: Enforce condition with type systemDavid Goulet2026-01-221-5/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This commits returns either Some(AUTH_CELL, CERTS) or None. We future proof ourselves against one Some and other None even if an error check is done before. Signed-off-by: David Goulet <[email protected]>
| * | | | | | proto: Fix the link auth handling from the AUTH_CHALLENGEDavid Goulet2026-01-221-2/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Signed-off-by: David Goulet <[email protected]>
| * | | | | | proto: Add missing use for testsDavid Goulet2026-01-221-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Signed-off-by: David Goulet <[email protected]>
| * | | | | | proto: Use the channel codec channel typeDavid Goulet2026-01-226-21/+68
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Remove the channel type from Unverified and Verified channels and instead use the channel type in the underlying channel codec. The codec requires such type in order to restrict messages sets. Instead of duplicating it, this commit simply makes it that there is now only a single channel type attached to a channel structure. The resulting `struct Channel` in the end gets it copied from the channel codec as the framed_tls gets split and given to the `Reactor`. Down the line, we need a channel type attached to the `Channel` in order to know if it is a client or not and authenticated or not. Signed-off-by: David Goulet <[email protected]>
| * | | | | | proto: Improve comments on build_auth_data() about clog/slogDavid Goulet2026-01-221-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Signed-off-by: David Goulet <[email protected]>
| * | | | | | proto: Remove Option<> around peer_ip for build_netinfo_cell()David Goulet2026-01-222-4/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Signed-off-by: David Goulet <[email protected]>
| * | | | | | proto: Improve comment for handle_incoming()David Goulet2026-01-221-5/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Signed-off-by: David Goulet <[email protected]>
| * | | | | | proto: Put rsa_id and rsa_cert_digest togetherDavid Goulet2026-01-222-14/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Avoid having one None and the other Some which would be a bug. Signed-off-by: David Goulet <[email protected]>
| * | | | | | proto: Avoid magic hardcoded value for LINK_AUTHDavid Goulet2026-01-222-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Instead, use the static AUTHTYPE_ED25519_SHA256_RFC5705 value which is for now the only version we support. Signed-off-by: David Goulet <[email protected]>
| * | | | | | proto: Enforce CERTS and AUTHENTICATE are always expected togetherDavid Goulet2026-01-221-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | A Responder receiving cells from the Initiator, if it gets a CERTS, an AUTHENTICATE must also be present (and vice-versa). Signed-off-by: David Goulet <[email protected]>
| * | | | | | proto: Remove async for VerifiableChannel::check()David Goulet2026-01-224-22/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Signed-off-by: David Goulet <[email protected]>
| * | | | | | proto: Move cell sending out of check() and into finish()David Goulet2026-01-222-37/+42
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is so check() only authenticate a channel. The finish() function now only sends back the missing cells and build the final Channel. To pull this off, the AUTHENTICATE cell and our IP addresses need to be copied into the VerifiedRelayChannel. This allows us to remove complexity into the check() function as well and future commit will remove the async. Signed-off-by: David Goulet <[email protected]>
| * | | | | | proto: Remove uneeded code in the unverified inner check()David Goulet2026-01-221-25/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We can't get into the UnverifiedChannel::check() without wanting to verify our identities and authenticate. This validation has moved before calling check() for the relay channel type. Signed-off-by: David Goulet <[email protected]>
| * | | | | | proto: Implement FinalizableChannel for an unverified relay channelDavid Goulet2026-01-222-33/+128
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Reason for this is so we can use the type system to enforce that a client/bridge<-> relay channel can never become verified and thus in the code path of authentication. In other words, when check() is called, without an authentication cell, we can't authenticate or even verify the identities so we immediately return "self" which in this case is the UnverifiedRelayChannel. That channel can be finish()-ed to yield a Channel that can never be considered authenticated. Signed-off-by: David Goulet <[email protected]>
| * | | | | | proto: Send relay channel NETINFO in check()David Goulet2026-01-223-34/+44
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Once channel is verified and authenticate if need be, send the NETINFO. We require our advertised IP addresses for this so pass them to launch() as well to the UnverifiedRelayChannel. A cargo fmt change slipped in here, sorry about that. Signed-off-by: David Goulet <[email protected]>
| * | | | | | proto: Authenticate a relay channelDavid Goulet2026-01-224-33/+77
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This commit is a bit loaded but it is coherent. First, we set Eq and PartialEq to the channel message Authenticate so we can compare it with the one we expected. Second, the AuthenticationCell enum is introduced to store either an AUTH_CHALLENGE or an AUTHENTICATE since one side of the handshake can only have one. This allows us to store one or the other in UnverifiedRelayChannel. Depending on what we have, the authentication process is different as it dictates which side we are on (initiator vs responder). Keep in mind that the handshake code enforces receiving a AUTH_CHALLENGE along side CERTS. And same goes for AUTHENTICATE which means that if we have an AUTH_CHALLENGE in the UnverifiedRelayChannel, it is certain that the other side wants to authenticate and we are the initiator. Finally, the sending of CERTS and AUTHENTICATE by the initiator is now in UnverifiedRelayChannel::check() done right after verifying the channel CERTS and holding a "VerifiedChannel" object. This means that the last piece, sending the `NETINFO` by the initiator will be done in the check() but in a future commit. This leaves the VerifiableChannel::finish() to send nothing and only finalize the channel with the NETINFO (canonicity). Signed-off-by: David Goulet <[email protected]>
| * | | | | | proto: Make VerifiableChannel::check() asyncDavid Goulet2026-01-224-4/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Relay initiator needs to send CERTS and AUTHENTICATE in that function after verifiying the channel. And thus require to be async. Signed-off-by: David Goulet <[email protected]>
| * | | | | | proto: Add CertifiedConn to relay handshakeDavid Goulet2026-01-222-17/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We need this trait for the underlying TLS stream in order to access data such as the certificates or keying material. Signed-off-by: David Goulet <[email protected]>
| * | | | | | proto: Add relay link signing kp to RelayIdentitiesDavid Goulet2026-01-221-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Signed-off-by: David Goulet <[email protected]>
| * | | | | | proto: Add UnverifiedRelayChannel::build_auth_data()David Goulet2026-01-221-37/+101
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Reason for this is because both initiator and responder build the authentication data in order to send it (initiator) and validate it (responder). The build_auth_data() function takes a VerifiedChannel as an argument in order to access the CLOG/SLOG data and authentication data MUST always be handled after a channel is verified as in its CERTS has been checked. Take the opportunity also to add the NETINFO and relay identities data into the verified channel which will be needed to finalize the channel. The check() function is now missing the actual validation of the AUTHENTICATE for a responder which will come in the next commit(s). Signed-off-by: David Goulet <[email protected]>
| * | | | | | proto: Implement RelayResponderHandshakeDavid Goulet2026-01-222-2/+264
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This commit introduces the RelayResponderHandshake object used when accepting an inbound connection to open a channel. There are still TODOs pepperred in the code but the base is implemented. The Unverified and Verified channel need to be adjusted for this new handshake. This will come in the next commits. Signed-off-by: David Goulet <[email protected]>
| * | | | | | proto: Add helper to build NETINFO cellDavid Goulet2026-01-221-13/+25
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Again, as the CERTS helper, this is used by both initiator and responder handshake. Signed-off-by: David Goulet <[email protected]>
| * | | | | | proto: Add a helper function to build CERTS cellDavid Goulet2026-01-221-1/+47
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Both initiator and responder send CERTS cell hence this helper. Signed-off-by: David Goulet <[email protected]>
| * | | | | | relay: Pass advertised addresses to the channel handlerDavid Goulet2026-01-2210-19/+56
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We need the advertised addresses for the NETINFO cell when opening a relay channel. Keep them in the TorRelay object so we can pass them to the ChanMgr channel handler. This will also help with config reload where only the local values in TorRelay will need to be updated. Signed-off-by: David Goulet <[email protected]>
| * | | | | | cert: Add cert_type() to RsaCrossertDavid Goulet2026-01-221-0/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | It is always the same type for this specific certificate. Signed-off-by: David Goulet <[email protected]>
| * | | | | | proto: Make CERTS cell optionnable for UnverifiedChannelDavid Goulet2026-01-225-21/+67
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This requires to make a series of cert and digest also optionnable in the VerifiedChannel. This change is needed because as a relay responder, you might get the CERTS or not depending on if the other side wants to authenticate. Client and bridges do not authenticate and thus it is expected to not have a CERTS cell. This leads to the UnverifiedChannel::check() function to return early with a VerifiedChannel without any identity attached to it. Signed-off-by: David Goulet <[email protected]>
| * | | | | | proto: Move relay channel related structs outside of handshake.rsDavid Goulet2026-01-222-269/+272
| | |_|/ / / | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | Code movement only. Signed-off-by: David Goulet <[email protected]>
* | | | | | Merge branch 'rate-limit' into 'main'David Goulet2026-01-221-9/+19
|\ \ \ \ \ \ | |_|_|/ / / |/| | | | | | | | | | | | | | | | | arti-relay: Change debug message to rate-limited warning See merge request tpo/core/arti!3602
| * | | | | arti-relay: change debug message to rate-limited warningSteven Engler2026-01-201-9/+19
| | |/ / / | |/| | |
* | | | | Merge branch 'database-refactoring' into 'main'Clara Engler2026-01-224-197/+245
|\ \ \ \ \ | |_|/ / / |/| | | | | | | | | | | | | | tor-dirserver: Refactorings in the database.rs module See merge request tpo/core/arti!3599
| * | | | tor-dirserver: Remove FromStr for DocumentIdClara Engler2026-01-223-39/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This commit removes FromStr for DocumentId because it was only used in testing anyways. Instead, it replaces it with a simple From<[u8; 32]> only enabled in test builds, which is sufficient for what we are trying to do. An alternative would be to make the inner field pub, but this seems to aggressive for a testing only thing.
| * | | | tor-dirserver: Add `sha2` to `router_descriptor`Clara Engler2026-01-191-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This comit adds a `sha2` column to `router_descriptor` alongside a `CHECK` to see whether it equals `docid`. The reason for this is simple: Microdescriptors are the only kind of documents that are queriable with a SHA2 hash. Previously, we would have simply used the `docid` column for this, but in order to abstract it better, a distinct column with this hash is better.
| * | | | tor-dirserver: Rename `doc_id` to `docid`Clara Engler2026-01-194-76/+75
| | | | | | | | | | | | | | | | | | | | | | | | | Because we went with `docid` in the database (due to `rowid`), it is only natural to call the code variables `docid` too.
| * | | | tor-dirserver: Rename sha256 to docid in schemaClara Engler2026-01-194-51/+51
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This commit renames the sha256 column to docid for the reason that we agreed upon making the schema visible to all modules, so if we were to encapsulate docid properly, this change is only natural.