aboutsummaryrefslogtreecommitdiff
path: root/crates/arti-relay/src/tasks
Commit message (Collapse)AuthorAgeFilesLines
...
* relay: Modify RelayNtorKeys to use a constructorDavid Goulet2026-04-211-10/+23
| | | | | | | | | | | | Because of the sorting requirement and the fact that a `KeyMgr` can have multiple Ntor keys, the caller now explicitly extract the two Ntor keys it wants from the `KeyMgr` and then creates a `RelayNtorKeys` object with them. Future changes (#2495) will move this into a view and warn if there are more than 2 keys. Signed-off-by: David Goulet <[email protected]>
* relay: Use the new RelayNtorKeys for the create handlerDavid Goulet2026-04-211-28/+27
| | | | Signed-off-by: David Goulet <[email protected]>
* relay: Sort Ntor keys by valid_untilDavid Goulet2026-04-211-1/+15
| | | | | | | | | This is when we get them from the keystore so we can have a concept of ordering in the SmallVec. Future commit will transform this into a struct handling both keys. Signed-off-by: David Goulet <[email protected]>
* arti-relay: Use a SmallVec for the ntor keysGabriela Moldovan2026-04-091-2/+4
| | | | Usually, there will only be two of these.
* proto: Add method for installing ntor keys in the create handlerGabriela Moldovan2026-04-091-1/+1
| | | | | This also updates the key rotation task to call the setter whenever the ntor keys get updated.
* arti-relays: Pass a CreateRequestHandler to the crypto taskGabriela Moldovan2026-04-091-0/+2
| | | | This will need to be updated each time the ntor keys change.
* arti-relay: Add tests for the ntor key rotationGabriela Moldovan2026-04-091-0/+53
|
* arti-relay: Test that 1 ntor key gets generated on first runGabriela Moldovan2026-04-091-0/+7
|
* arti-relay: Dedupe test helperGabriela Moldovan2026-04-091-16/+10
| | | | | I am about to add another one of these, so I tried to deduplicate the impls a bit.
* arti-relays: Extend existing tests to check ntor key rotation (fmt)Gabriela Moldovan2026-04-091-1/+4
|
* arti-relays: Extend existing tests to check ntor key rotationGabriela Moldovan2026-04-091-2/+6
|
* arti-relay: Generate and rotate ntor keysGabriela Moldovan2026-04-091-10/+162
| | | | | | | | There is still some outstanding work here to read the lifetime and grace period from the consensus, but that will require some bigger changes to the rotation task. Closes #2451
* arti-relay: Add callbacks for deciding whether to expire and generateGabriela Moldovan2026-04-091-11/+26
| | | | | The logic for removing and generating ntor keys is going to be slightly different here.
* arti-relay: Replace have_rotated bools with KeyChange (fmt)Gabriela Moldovan2026-04-091-8/+14
|
* arti-relay: Replace have_rotated bools with KeyChangeGabriela Moldovan2026-04-091-15/+23
| | | | This will enable us to plug in the ntor key rotation logic.
* arti-relay: Add a struct describing a key change eventGabriela Moldovan2026-04-091-0/+19
| | | | | | This is just a wrapper over `bool` right now. It will helps us distinguish changes to the channel auth material from changes affecting the ntor circuit extension keys.
* arti-relay: s/have_rotated/have_removed for clarityGabriela Moldovan2026-04-091-2/+2
|
* arti-relay: Fix test MockRuntime::advance_by() usageGabriela Moldovan2026-04-091-6/+2
| | | | | | | This was previously advancing time by more than intended (I think the intention here was to use something like `MockRuntime::jump_wallclock()`, but that function has no effect on sleeping futures, so I think we should continue using `advance_by()`).
* Merge branch 'create-fast' into 'main'opara2026-04-081-0/+142
|\ | | | | | | | | Add support for handling CREATE_FAST cells and launching a circuit reactor See merge request tpo/core/arti!3846
| * arti-relay: add support for a `CreateRequestHandler`Steven Engler2026-04-081-0/+142
| |
* | arti-relay: Retrieve the signing key cert from the keystoreGabriela Moldovan2026-04-081-8/+16
| | | | | | | | | | | | | | The API for retrieving certs exists now, so we don't need to regenerate the cert each time. This addresses a TODO.
* | arti-relay: Reuse cert_expiry calculationGabriela Moldovan2026-04-081-2/+3
| | | | | | | | For readability.
* | arti-relay: Move comment closer to the durations it refers toGabriela Moldovan2026-04-081-2/+2
| | | | | | | | | | We forgot to move this comment when we replaced the hard-coded durations with top-level constants.
* | arti-relay: Use more descriptive names for the key lifetimesGabriela Moldovan2026-04-081-20/+20
| |
* | arti-relay: Remove no-longer needed implsGabriela Moldovan2026-04-011-5/+5
| | | | | | | | | | The specifiers are local to the crate, so we don't need the `valid_until` accessors anymore.
* | arti-relay: Move all key specifiers to a new keys module (fmt)Gabriela Moldovan2026-04-011-15/+11
| |
* | arti-relay: Move all key specifiers to a new keys moduleGabriela Moldovan2026-04-011-8/+11
|/ | | | | | | | | | | This extracts the key specifier types out of `tor-relay-crypto`, which * makes the code layout consistent with the hidden service crates (the key specifiers are defined in a `keys` module in `tor-hsservice`, while the key wrapper types live in `tor-hscrypto::pk`) * helps reduce the API surface: the key specifiers are only used in `arti-relay`, so we can move them there and make them `pub(crate)` instead of `pub`
* proto: Rename RelayIdentities to RelayChannelAuthMaterialDavid Goulet2026-03-301-14/+17
| | | | | | | | | | | | This object contains a melting pot of public keys, private keys and certificates. Rename it to reflect that it is channel authentication material and not "identities. https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/3791#note_3374454 Signed-off-by: David Goulet <[email protected]>
* Fix typosTobias Stoeckmann2026-03-241-1/+1
| | | | Typos found with codespell
* relay: Pass now() instead of the runtime in the crypto taskDavid Goulet2026-03-171-37/+31
| | | | | | | | | This way we get the whole task job to be aligned on one single now value to avoid potential inconsistencies between expiry and key generation. Fixes #2404 Signed-off-by: David Goulet <[email protected]>
* relay: Add crypto tasks unit testDavid Goulet2026-03-171-1/+242
| | | | | | Tests the key rotation code. Signed-off-by: David Goulet <[email protected]>
* relay: Use same wallclock() time when generating keysDavid Goulet2026-03-171-8/+6
| | | | Signed-off-by: David Goulet <[email protected]>
* relay: Make the crypto tasks use the runtime wallclockDavid Goulet2026-03-171-24/+41
| | | | | | This way we can unit tests properly. Signed-off-by: David Goulet <[email protected]>
* relay: Rewrite the rotation key logic in the crypto taskDavid Goulet2026-03-171-163/+245
| | | | | | | | | | | | | | | | | | | | | | This is almost a full rewrite of the crypto task which was needed in order to support our relay signing certificate to be put in the keystore which will be needed for the offline key feature. Instead of having rotate_key() do all the things, we now instead do two pass: 1. Remove all expired keys and certs. 2. Generate any missing keys. This still results in using the minimum valid_until of all our keys for the task sleep time. We can know cleanup the local trait used for this gymnastic and trade it for some more KeyMgr gymnastic. Fixes #2404 Signed-off-by: David Goulet <[email protected]>
* relay: Don't log warn if key already exists when generating oneDavid Goulet2026-03-171-4/+1
| | | | Signed-off-by: David Goulet <[email protected]>
* relay: Remove leftover comment from previous code iterationDavid Goulet2026-03-171-4/+0
| | | | Signed-off-by: David Goulet <[email protected]>
* arti-relay: use `debug_report` for failed channelsSteven Engler2026-02-261-1/+8
|
* proto: The AUTHENTICATE cell requires the SHA256 RSA identity digestDavid Goulet2026-02-261-1/+1
| | | | | | | Before this commit, we would use the RsaIdentity which is a SHA1 digest. We do the same for the peer RSA key. Signed-off-by: David Goulet <[email protected]>
* relay: Sleep rotate key task with earliest valid_untilDavid Goulet2026-02-251-19/+54
| | | | Signed-off-by: David Goulet <[email protected]>
* chanmgr: Responder relay channel now use the builder my_addrsDavid Goulet2026-02-241-6/+1
| | | | | | No need to pass from the arti relay binary our addresses when handling an incoming channel, use the one in the channel builder that an initiator channel uses.
* relay: Update ChanMgr on key rotationDavid Goulet2026-02-241-8/+18
| | | | Signed-off-by: David Goulet <[email protected]>
* arti-relay: add more error contextSteven Engler2026-02-231-6/+12
|
* arti-relay: don't warn if key gen was successfulSteven Engler2026-02-231-1/+2
|
* relay: Setup const for hardcoded value in crypto taskDavid Goulet2026-02-231-8/+13
| | | | Signed-off-by: David Goulet <[email protected]>
* relay: Log when key generation yields an existing key errorDavid Goulet2026-02-231-1/+4
| | | | Signed-off-by: David Goulet <[email protected]>
* relay: Simplify the crypto rotation task rotate_key()David Goulet2026-02-231-17/+11
| | | | Signed-off-by: David Goulet <[email protected]>
* relay: Get rid of start_task() for readabilityDavid Goulet2026-02-231-17/+1
| | | | Signed-off-by: David Goulet <[email protected]>
* relay: Generate relay identities at initDavid Goulet2026-02-231-3/+5
| | | | Signed-off-by: David Goulet <[email protected]>
* relay: Implement a helper to build RelayIdentitiesDavid Goulet2026-02-231-6/+107
| | | | | | | This required to add a slight helper to our tor-key-forge RSA key d-d macro to access the inner keypair. This avoids a clone. Signed-off-by: David Goulet <[email protected]>
* relay: Move try_generate_keys() into crypto taskDavid Goulet2026-02-231-5/+27
| | | | | | | Move rotating keys into a function so we can use it in try_generate_keys() that is used at startup. Signed-off-by: David Goulet <[email protected]>