summaryrefslogtreecommitdiff
path: root/crates/tor-keymgr/src
Commit message (Collapse)AuthorAgeFilesLines
* Disable a lot of dead code warnings (fmt)Ian Jackson2024-10-171-1/+4
|
* Disable a lot of dead code warningsIan Jackson2024-10-171-0/+3
| | | | | | | Now cargo check --workspace --no-default-features --all-targets cargo build -p arti --no-default-features --features=memquota,tokio,native-tls are both clean.
* tor-keymgr: Reformat a long line for readability.Gabriela Moldovan2024-10-151-1/+3
| | | | This breaks up a long statement to improve readability.
* tor-keymgr: Add missing docs for keypair_specifier.Gabriela Moldovan2024-10-151-0/+12
| | | | | This is a follow-up to !2393, which added support for the `key_specifier` top-level attribute.
* tor-config: Fix indentation in doc comment.Gabriela Moldovan2024-10-091-1/+1
| | | | | | It looks like my previous attempt from !2516 didn't fix it. This adds an extra space to fix the `doc_lazy_continuation` lint.
* tor-keymgr: Fix indentation in doc comment.Gabriela Moldovan2024-10-091-1/+1
| | | | | Addresses the `doc_lazy_continuation` lint, fixing the `rust-latest` job that's currently failing on main.
* tor-keymgr: Move C Tor keystore configs under ctor key (fmt).Gabriela Moldovan2024-10-081-5/+10
|
* tor-keymgr: Move C Tor keystore configs under ctor key.Gabriela Moldovan2024-10-081-35/+46
| | | | | | | This way we have a more intuitive layout, where all C Tor keystore configuration is under the `ctor` key. Prompted by https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/2481#note_3090486
* tor-keymgr: Add tests for CTorServiceKeystore.Gabriela Moldovan2024-10-081-1/+148
|
* tor-keymgr: Add tests for CTorClientKeystore.Gabriela Moldovan2024-10-083-2/+179
|
* tor-keymgr: Move assert_found helper to test_utils.Gabriela Moldovan2024-10-082-14/+24
| | | | | This moves `assert_found` out of the `keystore::arti::test` so we can reuse it for testing other keystore implementations too.
* tor-keymgr: Add tests for the keystore config.Gabriela Moldovan2024-10-081-0/+164
|
* tor-keymgr: Validate keystore ID uniqueness in ArtiKeystoreConfigBuilder.Gabriela Moldovan2024-10-081-1/+23
|
* arti-client, tor-keymgr: Remove a couple of now-addressed TODOs.Gabriela Moldovan2024-10-081-5/+0
|
* arti-client: Use the configured C Tor client keystores.Gabriela Moldovan2024-10-082-2/+2
|
* tor-keymgr: Add configuration for C Tor client keystores.Gabriela Moldovan2024-10-081-0/+82
| | | | | This is intentionally partially mis-indented to make this more reviewable (in case the reviewer isn't using `ignore-all-space`).
* arti-client: Use the configured C Tor keystores, if any.Gabriela Moldovan2024-10-081-0/+4
|
* tor-keymgr: Derive Getters for CTorKeystoreConfig.Gabriela Moldovan2024-10-081-1/+1
|
* tor-keymgr: Derive Getters for the ArtiKeystoreConfig.Gabriela Moldovan2024-10-081-1/+2
|
* tor-keymgr: Add a keystore for C Tor client keys.Gabriela Moldovan2024-10-083-0/+330
|
* tor-keymgr: Add a keystore for C Tor service keys.Gabriela Moldovan2024-10-084-0/+478
|
* tor-keymgr: Rename Filesystem variant to Io for clarity (fmt).Gabriela Moldovan2024-10-082-44/+57
|
* tor-keymgr: Rename Filesystem variant to Io for clarity.Gabriela Moldovan2024-10-082-3/+3
| | | | | The `FilesystemError::Filesystem` variant was actually just for IO errors.
* tor-keymgr: Refactor common fs errors into a separate error enum.Gabriela Moldovan2024-10-083-76/+96
| | | | | | | | This will be reused by other on-disk key stores (such as the C Tor ones we're about to add). I recommend reviewing this commit using `git diff --color-moved=zebra --ignore-space-change`
* tor-keymgr: Add RelKeyPath::from_parts constructor.Gabriela Moldovan2024-10-081-0/+5
| | | | This will be used to create relative paths representing C Tor keys.
* tor-keymgr: Rename RelKeyPath::new to RelKeyPath::arti.Gabriela Moldovan2024-10-082-3/+3
| | | | We're about to add a separate constructor for CTor paths.
* tor-keymgr: Move the checked_op utils out of the arti module.Gabriela Moldovan2024-10-083-10/+16
| | | | We are about to use this for the ctor keystore implementation too.
* tor-keymgr: Rename KeyPathRange to ArtiPathRange (fmt).Gabriela Moldovan2024-10-082-5/+5
|
* tor-keymgr: Rename KeyPathRange to ArtiPathRange.Gabriela Moldovan2024-10-083-8/+8
| | | | | This is only used for representing portions of `ArtiPath`s, so let's rename it accordingly.
* tor-keymgr: Implement KeyPath::matches for CTorPaths.Gabriela Moldovan2024-10-082-14/+37
| | | | | | | `KeyPath::matches` now returns a boolean (because we can't return a matching "range" for `CTorPaths`, because unlike ArtiPaths, they're not represented as `String`s, and do not have variable parts that need to be captured).
* tor-keymgr: Reimagine CTorPath as an enum.Gabriela Moldovan2024-10-083-14/+80
| | | | | | | | | | | | | | | | | | | | | | C Tor's client restricted discovery keys don't have the service hsid encoded in the filename (the hsid of the service each key is associated with is encoded in contents of the key file). This means that given a key specifier like `HsClientDescEncKeypairSpecifier` (which is a wrapper over an HsId), we can't actually compute the relative path of the key in its `KeySpecifier::ctor_path()` implementation. To do so we would need to access the keystore to figure out which path contains the requested HsId, which we can't (and shouldn't!) do from within the `KeySpecifier` impl. This suggests the String newtype (representing a relative path) we previously had is not a good abstraction for `CTorPath`s. Moreover, `CTorPath` are static (they don't have dynamic components like `ArtiPath`), so it makes more sense to model `CTorPath` as an enum. The new `CTorPath::ClientHsDescEncKey(HsId)` variant will be used to instruct the C Tor client keystore to find the file that contains the specified `HsId`, while the `Service` variant will be used for hidden service keys.
* tor-keymgr: Add configuration for C Tor service keystores.Gabriela Moldovan2024-10-081-3/+201
|
* tor-keymgr: Return an error if the keystore IDs are not unique.Gabriela Moldovan2024-10-081-0/+8
| | | | | | | | The `KeyMgrBuilder` now returns an error if the configured keystores don't have pairwise unique IDs. This is needed because some keymgr operations take a `KeystoreSelector` specifying the ID of the keystore the operation should be performed on, and assume that the keystore ID uniquely identifies a single keystore.
* tor-keymgr: Move config/arti.rs to config.rsGabriela Moldovan2024-10-082-116/+113
| | | | | | | | The config will soon contain secondary C Tor keystore configuration too, so the `arti` namespacing is about to stop making sense. I recommend reviewing this commit using `git diff --color-moved=zebra --ignore-space-change`
* tor-hsservice: Move HsNickname to tor-persist.Gabriela Moldovan2024-10-081-0/+3
| | | | | | | We are about to need this in `tor-keymgr`, where we're about to add a config for C Tor service keystores (the C Tor keystore config will have an associated `HsNickname` that specifies which of the arti hidden services it's supposed to be used with).
* tor-keymgr: Linkify the ArtiKeystoreKind docs.Gabriela Moldovan2024-10-031-2/+2
|
* Upgrade to derive_more version 1.0.0Nick Mathewson2024-09-251-3/+5
| | | | | | The `derive_more` crate broke backward compatibility with this version, so this change involved quite a few manual fixups. With luck, they'll keep compatibility for some while in the future.
* tor-keymgr: Rename keystore.type to keystore.kind.Gabriela Moldovan2024-09-231-2/+2
| | | | | In !2394 we settled on `kind`. This updates the error messages to reference the new field name.
* tor-keymgr: Move keystore config under keystore.primary.Gabriela Moldovan2024-09-231-3/+16
| | | | | The keystore settings only configure the *primary* keystore, so they should be under `keystore.primary`.
* arti: Reinstate the keystore.enabled option.Gabriela Moldovan2024-09-231-51/+24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is a follow-up from !2394 I want to keep the `keystore.enabled` option, because I'm planning on extending `ArtiKeystoreConfig` to support configuring secondary keystores too (currently, the only supported setting is `keystore.kind`, which configures the primary keystore). `keystore.enabled` will disable keystore use altogether (i.e. both primary and secondary). Currently, we only support configuring the "primary" (previously known as "default") keystore, which can be either "native" (the on-disk Arti keystore), or "ephemeral" (an in-memory keystore). To implement #858, we will need to support configuring additional keystores too, so we will need to move to a config of the form ```toml [storage.keystore] # Whether the keystore is enabled. #enabled = "auto" # Configure the primary keystore. [storage.keystore.primary] # The type of primary keystore to use kind = "auto" | "native" | "ephemeral" # Optionally configure C Tor keystores for arti to use. # # Note: The keystores listed here are read-only (keys are only # ever written to the primary keystore, configured in # `storage.keystore.primary`). [[storage.keystore.ctor]] # If the `kind` is `service`, this should be set to the `HiddenServiceDirectory` # of your hidden service. Arti will read `HiddenServiceDirectory/hostname` # and `HiddenServiceDirectory/private_key`. (Note: if your service is running # in restricted discovery mode, you must set the # `[[onion_services."<the nickname of your svc>".restricted_discovery.key_dirs]]` # to `HiddenServiceDirectory/client_keys` # # If the `kind` is `client`, this should be set to `ClientOnionAuthDir` of # your client. If Arti is configured to run as a client (i.e. if it runs in SOCKS # proxy mode), it will read the client restricted discovery keys from this path. path = "/foo/bar" # The type of keystore `path` should be interpreted as kind = "client" | "service" ``` This moves the current keystore settings to `storage.keystore.primary` in preparation for that change.
* tor-keymgr: Add back ArtiKeystoreConfig::is_enabled().Gabriela Moldovan2024-09-231-0/+7
| | | | | I am adding `is_enabled()` back because I plan to un-deprecate the `enabled` setting.
* tor-keymgr: Rename the primary keystore for clarity.Gabriela Moldovan2024-09-233-26/+26
| | | | | | | | | | Previously, arti's primary keystore was referred to as its "default" keystore. However, "default" is inaccurate here: there is no way to meaningfully override this "default" (the "default" store acts as the main keystore). Throughout the codebase, we query all keystores for keys (including the secondary ones), but only ever write to the default/primary keystore. This is OK for now, because it enables us to have one mutable keystore, and multiple secondary, read-only stores.
* tor-keymgr: added dummy implementation of ArtiEphemeralKeyStoreMorgan2024-09-201-0/+14
|
* tor-keymgr: added support for specifying keystore kind to ArtiKeystoreConfigMorgan2024-09-201-16/+80
|
* tor-keymgr: renamed ArtiNativeKeystoreConfig to ArtiKeystoreConfigMorgan2024-09-201-5/+5
|
* tor-keymgr: Set KeySpecifier deftly exported struct non_exhaustiveDavid Goulet2024-09-181-0/+1
| | | | Signed-off-by: David Goulet <[email protected]>
* tor-keymgr: put ephemeral keystore behind experimental featureSteven Engler2024-09-172-1/+9
| | | | Feature is named "ephemeral-keystore".
* tor-keymgr: add disk-related docs to `ArtiEphemeralKeystore`Steven Engler2024-09-171-0/+6
|
* tor-keymgr: add an overwrite flag to KeyMgr::insert()Morgan2024-09-101-8/+47
|
* rename get_keypair_specifier() to keypair_specifier()Adam Joseph F0B74D717CDE8412A3E0D4D5F29AC8080DA8E1E02024-09-094-8/+8
| | | | https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/2393#note_3073480