Commit Graph

4425 Commits

Author SHA1 Message Date
gabi-250 db7f46265e Merge branch 'keymgr-refactor-fs-ops' into 'main'
keymgr: Move FS operations out of KeyType impl

See merge request tpo/core/arti!1263
2023-06-20 18:41:33 +00:00
Nick Mathewson 8d4ca94e19 Merge branch 'add-tor-geoip' into 'main'
tor-geoip: Add new crate with GeoIP database functionality

See merge request tpo/core/arti!1239
2023-06-20 17:59:15 +00:00
Gabriela Moldovan c40e064b42 keymgr: Fix clippy lints. 2023-06-20 18:54:35 +01:00
Gabriela Moldovan 97350cfe4b keymgr: Address clippy lints and run cargo fmt. 2023-06-20 18:54:35 +01:00
Gabriela Moldovan 2f10b08d41 keymgr: Enforce keystore_dir properties for every key read/written from the keystore. 2023-06-20 18:54:35 +01:00
Gabriela Moldovan 9bfd263f42 keymgr: Update function names and docs to reflect reality.
The functions that handle OpenSSH-formatted keys now no longer read or
write from disk. This commit updates their names and doc strings to stop
suggesting they do.
2023-06-20 18:54:35 +01:00
Gabriela Moldovan abdf854547 keymgr: Move FS operations out of ssh.rs
This moves the filesystem calls from the `ssh` module to
`ArtiNativeKeyStore`. While `ArtiNativeKeyStore` shouldn't be concerning
itself with filesystem operations either, that refactoring will be
tackled separately (see arti#899).
2023-06-20 18:54:35 +01:00
eta d5632eacb2 tor-geoip: Add new crate with GeoIP database functionality
- This adds a new crate, `tor-geoip`, which can parse and perform
  lookups in the GeoIP database C-tor already uses (generated by a
  maintenance utility in the C-tor codebase).
- We embed a copy of C-tor's databases with the crate and use
  `include_str!` to ship them with the binary, bloating its size
  somewhat.
  - This does, however, solve the problem of figuring out how to
    distribute these.
  - The plan is to gate this functionality behind a feature flag anyway,
    so the cost should be nil unless explicitly opted into.

Part of tpo/core/onionmasq#47.
2023-06-20 16:57:58 +01:00
Gabriela Moldovan 181638333f keymgr: Create a temporary error type for the key types we don't support yet. 2023-06-20 16:48:36 +01:00
Gabriela Moldovan 0c7e5d1924 keymgr: Create a separate error source for key corruption errors. 2023-06-20 16:48:36 +01:00
Alexander Færøy 2fa8a4e56c Merge branch 'update-keymgr-todo' into 'main'
keymgr: Change "TODO hs" to "TODO HSS".

See merge request tpo/core/arti!1264
2023-06-20 13:42:28 +00:00
Gabriela Moldovan c0762f76f1 keymgr: Fix broken docs. 2023-06-20 13:34:32 +01:00
Gabriela Moldovan 84e05591c7 arti-client: Remove unnecessary #[cfgs(...)].
The `keymgr` module selects one of the key manager implementations
(dummy or "real") and exposes all the APIs we need, so we can remove
all of the cfgs related to the `keymgr` feature from `client.rs`.

Part of #897
2023-06-20 13:33:51 +01:00
Gabriela Moldovan 733a559322 arti-client: Create module exposing one of the key manager APIs.
This moves the key manager API selection (dummy vs "real" impl) into the
`keymgr` module. The module exports the dummy API if the `keymgr`
feature is disabled, and the impl from `tor-keymgr` otherwise.

Part of #897
2023-06-20 13:33:51 +01:00
Gabriela Moldovan 8202be3cfe arti-client: Make some of the dummy KeyMgr impls return an error.
`insert` and `remove` should return an error rather than `Ok(())`, as
`Ok(())` implies the key was stored/removed, which is impossible in the
no-op implementation.
2023-06-20 13:33:51 +01:00
Gabriela Moldovan 02c36dabd7 arti-client: Add more dummy keymgr APIs.
This will help us reduce the number of `#[cfgs(...)]` from `client.rs`

Part of #897
2023-06-20 13:33:51 +01:00
Gabriela Moldovan c7d32dbf4c arti-client: Add a result type for the dummy keymgr impl.
Part of #897
2023-06-20 13:33:51 +01:00
Gabriela Moldovan b289c0fd15 arti-client: Add an Error type for the dummy key manager.
Part of #897
2023-06-20 13:33:51 +01:00
Gabriela Moldovan 95e4021ed8 arti-client, keymgr: Introduce Mistrust settings and enforce FS permissions. 2023-06-20 13:29:10 +01:00
Gabriela Moldovan be5c911ac8 arti-client: Temporarily ignore key store errors.
We currently initialize the `ArtiNativeKeyStore` with a dummy root dir,
so when `ArtiNativeKeyStore` starts validating directories, this code
will start to fail. Let's preemptively ignore any errors coming from
`ArtiNativeKeyStore::new`. This is temporary and will be removed when we
introduce the key store config (and a real default value for the
keystore root dir).
2023-06-20 13:29:10 +01:00
Gabriela Moldovan e8176ac8b5 keymgr: Add TODO about separation of concerns wrt FS operations. 2023-06-20 13:29:10 +01:00
Gabriela Moldovan 6837dbce58 keymgr: Add an error variant for fs_mistrust errors.
This will be useful later, when `KeyMgr` will start validating
permissions and paths.
2023-06-20 13:29:10 +01:00
Gabriela Moldovan 01b43f7f26 keymgr: Add a FsErrorSource to Error::Fs.
In the future, the potential causes of an `Error::Filesystem` error will
include permission errors as well as other errors (not just
`io::Error`s).
2023-06-20 13:29:10 +01:00
Nick Mathewson f24a7d48c0 Merge branch 'circmgr-todos' into 'main'
Resolve several "TODO HS" comments in circmgr.

See merge request tpo/core/arti!1258
2023-06-20 12:13:24 +00:00
Ian Jackson affa5b5e91 Merge branch 'rpcdoc' into 'main'
rpc: Minor docs improvements

See merge request tpo/core/arti!1260
2023-06-20 12:11:49 +00:00
gabi-250 602bcc3c47 Typo fixes 2023-06-20 11:47:02 +00:00
Nick Mathewson 3e704a080c rpc: Fix docs typo 2023-06-20 11:38:31 +00:00
Gabriela Moldovan fed726e4ff keymgr: Defer key bundle support until "Basic Service" milestone.
We don't really need "key bundles" for the client keys.
2023-06-20 11:36:04 +01:00
Gabriela Moldovan 0bb7c7f600 keymgr: Change "TODO hs" to "TODO HSS".
We probably don't need to support passphrases for the "Basic Client"
milestone, so let's update this TODO accordingly.
2023-06-20 11:24:03 +01:00
Alexander Færøy f55187e065 Merge branch 'arti-client' into 'main'
Sort out .onion handling in arti-client

See merge request tpo/core/arti!1257
2023-06-19 14:44:55 +00:00
Nick Mathewson c7fa6cb746 Merge branch 'rpc_session_mgt' into 'main'
More work on RPC sessions, connections, and managers

See merge request tpo/core/arti!1254
2023-06-16 18:08:58 +00:00
Nick Mathewson b9500c6f3d Merge branch 'netdoc-todos' into 'main'
Resolve many TODO HS items in tor-netdoc

See merge request tpo/core/arti!1251
2023-06-16 17:31:31 +00:00
Nick Mathewson a34af0323b Fix compilation afver last suggestion. 2023-06-16 13:24:41 -04:00
Ian Jackson 0e3dbdee8e Apply 1 suggestion(s) to 1 file(s) 2023-06-16 17:07:25 +00:00
Ian Jackson 85a046e266 rpc: Cross-reference up from tor-rpcbase re where DispatchTable lives 2023-06-16 17:48:59 +01:00
Ian Jackson ceaa70f41a rpc: Expand and clarify and cross-reference lock hierarchy 2023-06-16 17:48:59 +01:00
Ian Jackson 0460a4a4d8 rpc: Document relationship between `Connection` and `RpcSession` 2023-06-16 17:48:59 +01:00
Nick Mathewson 34fc77081c hsdesc.rs: finally remove "allows".
The last piece here is removing some needless keygen from the
tests.  This causes the test output (using the deterministic PRNG)
to change.
2023-06-16 12:24:05 -04:00
Nick Mathewson 1091918525 netdoc::doc::hsdesc changes to let us downgrade/remove allows 2023-06-16 12:24:05 -04:00
Nick Mathewson f1b90fdfee netdoc: unmark MAC_KEY_LEN as conjectural.
The value here is 32 bytes; I'm adding it to to the specification
as torspec!141
2023-06-16 12:24:05 -04:00
Nick Mathewson d8f7ce510c SharedRandVal: Note that it doesn't have to be Ct. 2023-06-16 12:24:05 -04:00
Nick Mathewson 984d97a38d netdoc: remove a TODO about moving a module to where it already is. 2023-06-16 12:24:05 -04:00
Nick Mathewson 6edcca7df3 netdoc: use ct_lookup for rend descriptor cookie lookup
(I doubt that there is a viable side channel here, but still we
might as well get in the habit of doing these things properly.)
2023-06-16 12:24:05 -04:00
Nick Mathewson 2eba3d213e llcrypto: add another warning to ct_lookup. 2023-06-16 12:24:05 -04:00
Nick Mathewson 25db56777c Lower tor-proto::util::ct::lookup to tor-llcrypto
This is mostly code movement; you may want to review it with
`--color-moved`.

I'm doing this so we can also use the function in netdoc for
looking up hsdesc authentication.
2023-06-16 12:24:05 -04:00
Nick Mathewson a20c3eda6e netdoc: Downgrade an HS todo wrt HS_DESC_AUTH_TYPE 2023-06-16 12:24:05 -04:00
Nick Mathewson 6fb19c00f5 netdoc: downgrade some TODO HS to TODO HSS.
I'm using HSS for hs-service features.
2023-06-16 12:24:05 -04:00
Nick Mathewson 3c824fe302 netdoc::build remove very broken example.
This could never be a full rustdoc test, since rustdoc never
runs tests for private items.   Even if it were a rustdoc test,
it uses a bunch of types that aren't exposed in the right places,
and it invokes nonexistent functions, and it assumes a `self`
that isn't there.

In lieu of writing a new untested test, I've added a note to refer
the developer to where they can find working example code.
2023-06-16 12:24:05 -04:00
Nick Mathewson 7a617a2dbd netdoc: Remove a TODO that we already solved. 2023-06-16 12:23:56 -04:00
Nick Mathewson 072ce9182b hsclient: note that we should check revctr. 2023-06-16 12:23:56 -04:00