Commit Graph

8051 Commits

Author SHA1 Message Date
Gabriela Moldovan 0b20806213
keymgr: Require callers to specify which keystore to insert keys in.
The caller uses `KeystoreSelector` to specify which keystore to insert
the new key into (only `KeystoreSelector::Id` and
`KeystoreSelector::Default` are supported for `insert`).

The ability to insert keys in a particular keystore will come in handy
when we implement the key management CLI (the CLI will have an option
for specifying the keystore to access/modify).
2023-07-20 19:24:29 +01:00
Gabriela Moldovan 6ec1b55938
keymgr: Add a convenience function for boxing keystore errors. 2023-07-20 19:24:19 +01:00
Gabriela Moldovan a794d78894
keymgr: Add an error type for misuse errors.
This error will be returned by `KeyMgr` if the caller tries to access a
keystore that does not exist, or if the requested `KeystoreSelector`
cannot be applied.
2023-07-20 19:24:16 +01:00
Gabriela Moldovan cf038fb772
keymgr: Add type for specifying which keystore to access. 2023-07-20 19:24:12 +01:00
Gabriela Moldovan d6d67769c9
keymgr: Add a function for looking keystores up by ID.
This will be used by `KeyMgr::insert` after we add an additional
argument to `insert` for specifying the keystore it should be using.
2023-07-20 19:24:08 +01:00
Gabriela Moldovan 04379dcae6
keymgr: Add an `id` function to `Keystore`.
This will enable the `KeyMgr` to look up `Keystore`s by ID (which is
a requirement for disambiguating the semantics of `insert`, which
currently tries to "guess" which keystore it should be using).
2023-07-20 19:24:05 +01:00
Gabriela Moldovan 2f05920c4d
keymgr: Iterate over all the stores, not just the secondary ones. 2023-07-20 19:24:01 +01:00
Gabriela Moldovan 9f5974fb7f
keymgr: Explicitly specify the default keystore for `KeyMgr`. 2023-07-20 19:23:58 +01:00
Gabriela Moldovan 8e49d1dd11
keymgr: Add a type alias for `Box<dyn Keystore>`.
This makes the code slightly less verbose.
2023-07-20 19:23:51 +01:00
Gabriela Moldovan ac93b1aef6
keymgr-config: Make fields private, add function for checking if keystore is enabled.
Hiding the underlying value of `enabled` enables us to give it a
different `auto` value depending on whether the `keymgr` feature is
enabled or not (it defaults to `true` if `keymgr` is enabled, and
`false` otherwise).
2023-07-20 19:23:48 +01:00
Gabriela Moldovan f18e773332
arti-client: Use a default keystore config if `experimental-api` is disabled.
The `experimental-api` was only meant to apply to the use of the
unstable `ArtiNativeKeystoreConfig` in the Arti config.
`experimental-api` was _not_ supposed to be used for enabling/disabling
the keystore (that's what the `enabled` flag is for).
2023-07-20 19:23:45 +01:00
Gabriela Moldovan b4bf421c11
arti-client: Move variable closer to where it's used (fmt). 2023-07-20 19:23:41 +01:00
Gabriela Moldovan ea02824547
arti-client: Move variable closer to where it's used. 2023-07-20 19:23:33 +01:00
Gabriela Moldovan d7c1b2cf03
arti-client: Make the `KeyMgr` optional.
If the Arti keystore is disabled, we have nothing to initialize the
`KeyMgr` with, so we might as well make it optional.
2023-07-20 19:23:30 +01:00
Gabriela Moldovan a030c3dbda
keymgr-doc: Add columns with additional details about the keys. 2023-07-20 18:59:21 +01:00
Ian Jackson 1f7911f0d9 Update pwd-grp to 0.1.1 to fix MacOS build etc.
This also gets rid of a duplicate copy of derive-adhoc.
2023-07-20 18:58:02 +01:00
Gabriela Moldovan 58baa2af9e
keymgr-doc: Rename ambiguous `--onion` flag to `--service`. 2023-07-20 18:52:10 +01:00
Ian Jackson e3d5f25750 tor-linkspec: impl AsRef<str> for PtTransportName 2023-07-20 18:49:28 +01:00
Ian Jackson b5e6af9f5c tor-guardmgr: bridges: getter for ManagedTransportConfigBuilder.protocols
It's a bit of a wart that tor-ptmgr calls these "protocols" and
tor-guardmgr calls these "transport names".
2023-07-20 16:42:03 +01:00
Ian Jackson 3343e70c68 tor-guardmgr: bridges: getter for BridgeConfigBuilder.transport
BridgeConfigBuilder is Serialize so this isn't making any new API
promises.  Ideally we'd have getters like this everywhere.
2023-07-20 16:42:03 +01:00
Gabriela Moldovan bcea3967ac
keymgr-doc: Add note about the key names. 2023-07-20 15:38:32 +01:00
Nick Mathewson c498cc2512 Merge branch 'cc_niche' into 'main'
geoip: Enable the niche optimization for CountryCode.

See merge request tpo/core/arti!1384
2023-07-20 12:18:58 +00:00
Nick Mathewson 3b7400621c Bump requirement to rlimit 0.10.1
There was a bug in 0.10.0 that broke MacOS.

Part of #963.
2023-07-20 08:15:38 -04:00
Nick Mathewson 9330c70ebe Initial notes about onion service structs and APIs 2023-07-19 16:34:06 -04:00
gabi-250 b4cee45a95 Merge branch 'chanmgr_rustdoc_links' into 'main'
Fix a pair of rustdoc links in chanmgr.

See merge request tpo/core/arti!1419
2023-07-19 18:20:08 +00:00
Nick Mathewson 027b3472a8 Fix a pair of rustdoc links in chanmgr. 2023-07-19 11:57:55 -04:00
Nick Mathewson 43481d1797 Merge branch 'issue961_01' into 'main'
geoip: Allow ASNs as zeros when creating NetDefn

Closes #961

See merge request tpo/core/arti!1417
2023-07-19 15:55:27 +00:00
Ian Jackson c3930838a4 Merge branch 'error' into 'main'
Print sources for errors in RetryError

Closes #958

See merge request tpo/core/arti!1416
2023-07-19 13:40:08 +00:00
Ian Jackson ad48335b91 tor-hsclient: Document API break.
This would be a break in higher-layer crates which incorproate this
error but:

 1. That's just arti-client which hides it behind the detailed errors
    cargo feature
 2. I'm hoping cargo-semver-checks would spot it, anyway.
2023-07-19 14:16:13 +01:00
Ian Jackson 36b9d11ecb retry-error: Attempts must be AsRef<dyn Error>; print their sources
The effect is that everywhere a RetryError is used, the error sources
for the contained errors will be Display'd.

In tor-hsclient we no longer need to explicitly wrap things up in
tor_error::Report.
2023-07-19 14:16:13 +01:00
Ian Jackson ed29dbcbd4 retry-error: Introduce a Wrapper type in a test
We're going to require that a RetryError contains things that are
AsRef<dyn Error> and ParseIntError isn't so we need a newtype.
2023-07-19 14:16:13 +01:00
Ian Jackson 882ce8c8ce retry-error: Provide fmt_error_with_sources in retry-error
This code came from tor-error.  So now tor-error depends on
retry-error.
2023-07-19 14:16:13 +01:00
juga 92baa823b9 geoip: Add derive macros to GeoipDb
to be able to debug it, for instance.
2023-07-18 14:39:52 +00:00
juga c42f84bd1e geoip: Allow ASNs as zeros when creating NetDefn
so that GeoipDb can be created from files including ASNs generated with
tor/scripts/maint/geoip/geoip-db-tool.

Closes #961
2023-07-18 14:39:52 +00:00
Ian Jackson dd5ceed791 tor-circmgr: impl AsRef<dyn std::error::Error> for some error types
We're about to want this.
2023-07-18 13:10:03 +01:00
gabi-250 f64997e1e1 Merge branch 'lock' into 'main'
Update Cargo.lock for d-a versions

See merge request tpo/core/arti!1414
2023-07-18 11:12:21 +00:00
Gabriela Moldovan 8941d5772d
keymgr-doc: Document the list of keys the keymgr needs to generate. 2023-07-18 11:19:39 +01:00
Ian Jackson 46492d8af2 Update Cargo.lock for d-a versions
!1410 and !1412 had a semantic conflict *in the Cargo lockfile*!

!1410 added a new indirect dependency on derive-adhoc, which is used
in pwd-grp.  pwd-grp is still declaring a dependency on d-a 0.6.1.
(This ought to be updated there in due course, but isn't a bug.)

!1412 updated our direct dependency on derive-adhoc to require 0.7.x.
In fact, the breaking change 0.6.x to 0.7.x is minor and we could have
written a more relaxed dependency.But cargo's syntax for that is very
clumsy - here is an example from derive-adhoc iteself:
  itertools = ">=0.10.1, <0.12"

Fix this for now in our tree with a `cargo update`, to unbreak main.
2023-07-18 11:13:56 +01:00
Alexander Færøy bd21ea34c2 Merge branch 'upgrades_20230717' into 'main'
Mid-month dependency upgrades

See merge request tpo/core/arti!1412
2023-07-17 20:19:59 +00:00
Nick Mathewson a783a4f932 Upgrade to latest derive-adhoc. 2023-07-17 10:24:38 -04:00
Alexander Færøy 95efd45e48 Merge branch 'no_longer_want' into 'main'
WANT_FROM_OTHER_CRATES: Remove note about async-rustls

See merge request tpo/core/arti!1411
2023-07-17 14:24:19 +00:00
gabi-250 89436bbfec Merge branch 'pwd-grp' into 'main'
Replace use of unmaintained users crate with homegrown pwd-grp

Closes #877

See merge request tpo/core/arti!1410
2023-07-17 14:18:02 +00:00
Nick Mathewson 1b3206ca0b Upgrade to latest rlimit. 2023-07-17 10:12:08 -04:00
Nick Mathewson 119bb68cbc keymgr: Upgrade to latest itertools.
(Everything else is already on 0.11.0.)
2023-07-17 10:08:38 -04:00
Nick Mathewson a36a0ab45b WANT_FROM_OTHER_CRATES: Remove note about async-rustls 2023-07-17 10:01:18 -04:00
gabi-250 4338080799 Merge branch 'keymgr-config-tweaks' into 'main'
tor-keymgr config updates

Closes #939

See merge request tpo/core/arti!1404
2023-07-17 10:38:58 +00:00
Gabriela Moldovan caf2ce3f6b
arti-client: Add TODO about expanding the keystore_dir in build(). 2023-07-17 11:12:37 +01:00
Ian Jackson 1d644d2923 cargo audit: un-ignore RUSTSEC-2023-0040 ("`users` is unmaintained" 2023-07-14 16:02:45 +01:00
Ian Jackson 967a36ee42 fs-mistrust: Run rustfmt to apply deferred formatting churn 2023-07-14 16:02:45 +01:00
Ian Jackson f137cbbe7c fs-mistrust: In a test, simplify env var handling 2023-07-14 16:02:45 +01:00