Commit Graph

7023 Commits

Author SHA1 Message Date
Nick Mathewson 3d4181bcd4 tor-error: typo fix in a comment. 2023-06-22 13:15:50 -04:00
Nick Mathewson 33bfa7c7a8 Remove onion service descriptor-related errorkinds.
These have been subsumed by other errorkinds, mostly
OnionServiceProtocolViolation and TorProtocolViolation.

In particular please review the change in tor-hsclient closely;
I am not sure about the new errorkinds for the error there.
2023-06-22 13:11:06 -04:00
Nick Mathewson dbd2552178 netdoc: Introduce HsDescError
For higher-level HsDesc-related functions, this type indicates where
exactly an error occurred.  It lets us distinguish decryption errors
from parsing errors, and attribute responsibility to the hsdir, the
onion service, or the user's lack of encryption.

This lets us remove some just-introduced complexity in
tor-hsclient.
2023-06-22 12:43:30 -04:00
Nick Mathewson 610ed2d457 Merge branch 'socks_errorkinds' into 'main'
Generate correct-ish socks5 errors for onion service errors.

Closes #736

See merge request tpo/core/arti!1279
2023-06-22 16:15:55 +00:00
gabi-250 4b7060a492 Merge branch 'notes' into 'main'
tor-hsclient: Delete/rewrite out-of-date commentary

See merge request tpo/core/arti!1288
2023-06-22 16:00:34 +00:00
Alexander Færøy 25e5a77475 Merge branch 'downgrade-todo' into 'main'
keymgr: Remove/downgrade TODOs

See merge request tpo/core/arti!1285
2023-06-22 15:35:02 +00:00
Nick Mathewson 57b1e36667 arti: Resolve TODO HS items related to extended SOCKS5 errors
This takes an approach discussed in #736: Instead of trying to
distinguish INTRO/REND failures perfectly, we instead map our
existing ErrorKinds as best we can, in respect to the fact that
this distinction is not super important in practice.

Closes #736
2023-06-22 11:05:57 -04:00
Nick Mathewson 967cae6ced New ErrorKind for invalid onion addresses
Use this to emit HS_BAD_ADDRESS as appropriate.
2023-06-22 10:57:08 -04:00
Nick Mathewson 42f16fc2ce socksproto: Add unspecified but documented socks5 extension codes 2023-06-22 10:56:24 -04:00
Nick Mathewson 1a9e5b8463 Remove ErrorKind::OnionService{Intro,Rend}Failed
These errors are orthogonal to our actual error kinds.  See
discussion on #736.
2023-06-22 10:56:23 -04:00
Ian Jackson 6cd56972e4 tor-hsclient: Delete/rewrite out-of-date commentary 2023-06-22 15:48:41 +01:00
Gabriela Moldovan e5aafa129b keymgr: Downgrade 2 "TODO hs" to "TODO HSS". 2023-06-22 11:28:24 +01:00
Gabriela Moldovan 84b2cc98d5 keymgr: Remove outdated TODO.
This TODO talks about a change we've decided not to implement.
2023-06-22 11:25:27 +01:00
Alexander Færøy d1658a120e Merge branch 'stderr' into 'main'
lints: Promote clippy::print_stderr and clippy::print_stdout

See merge request tpo/core/arti!1271
2023-06-21 16:41:10 +00:00
Ian Jackson 7a364cfc4d Merge branch 'keymgr-refactor-fs-ops-2' into 'main'
keymgr: Make ArtiNativeKeyStore::key_path() return a relative path.

Closes #908

See merge request tpo/core/arti!1267
2023-06-21 16:40:53 +00:00
Gabriela Moldovan b8279c3421 keymgr: Fix clippy lints. 2023-06-21 17:04:03 +01:00
Gabriela Moldovan d8743771e8 keymgr: Remove outdated TODO.
This TODO was addressed in #899
2023-06-21 17:03:41 +01:00
Gabriela Moldovan 1e1cb05d27 keymgr: Make ArtiNativeKeyStore::key_path() return a relative path.
This also updates `ArtiNativeKeyStore`'s  `KeyStore::remove`
implementation to build the absolute path of the file being removed, by
joining `self.keystore_dir` and the relpath returned by
`ArtiNativeKeyStore::key_path()`.

This addresses #908
2023-06-21 17:03:40 +01:00
Gabriela Moldovan 91abe17da1 keymgr: Derive Into for ArtiPath.
Sometimes we need the underlying String (for example to create a
PathBuf).
2023-06-21 17:01:02 +01:00
Ian Jackson f7a93d6de9 Merge branch 'keymgr-api-consistency' into 'main'
keymgr: Remove Error::NotFound, update KeyMgr, KeyStore APIs.

See merge request tpo/core/arti!1280
2023-06-21 15:54:02 +00:00
Ian Jackson 8f7e86c87e lints: Run maint/add_warning to actually apply new lints (again)
I prepared 161b9844d against an earlier version of main without the
geoip crate.  Run maint/add_warning again.
2023-06-21 16:44:49 +01:00
Ian Jackson ffa94d8f30 Merge branch 'keymgr-rm-cond' into 'main'
keymgr: Remove unnecessary condition.

See merge request tpo/core/arti!1277
2023-06-21 15:28:07 +00:00
Ian Jackson 5ca0cbdefc Merge branch 'keymgr-remove-todo' into 'main'
keymgr: Remove outdated TODO.

See merge request tpo/core/arti!1278
2023-06-21 15:27:26 +00:00
Ian Jackson 8948d611bd Merge branch 'defer-hsservice-todos' into 'main'
Downgrade every "TODO HS" in tor-hsservice

See merge request tpo/core/arti!1265
2023-06-21 15:13:46 +00:00
Ian Jackson 1e5004eba7 Merge branch 'hsdesc-accessors' into 'main'
netdoc: Use derive amplify::Getters for HsDesc accessors.

Closes #909

See merge request tpo/core/arti!1266
2023-06-21 15:11:05 +00:00
Alexander Færøy ddb81d7efd Merge branch 'doc_link_fix' into 'main'
Fix a rustdoc link.

See merge request tpo/core/arti!1274
2023-06-21 15:04:54 +00:00
Gabriela Moldovan f633e41380 keymgr: Remove Error::NotFound, update KeyMgr, KeyStore APIs.
This removes the `NotFound` `tor_keymgr::Error` variant. Since `KeyMgr`
and `KeyStore` users will need to be able to distinguish between "not
found" errors and other I/O errors, this also changes the return types
of the `get()` and `remove()` functions of `KeyStore` and `KeyMgr`,
which now return `Ok(None)` instead of `Error::NotFound`.

This makes the `KeyStore` API consistent with `KeyMgr::get`, which
already has a return type of `Result<Option<K>>` (rather than
`Result<K>`).

This also prepares us for #901, which will make key store errors
opaque. Without this change:
  * we'd have to create a `struct NotFoundError;` error type. Its
    `HasKind` impl would need to return a new
    `ErrorKind::KeyStoreErrorNotFound` `ErrorKind` variant
  * callers would have to match the `error_kind()` of the error to
    figure out whether  the key simply can't be found
    (`ErrorKind::KeyStoreErrorNotFound`), or if something went wrong
    (any other `ErrorKind`).

Given the above, I think `Result<Option<()>>` makes for a more ergonomic
API.

Part of #901
2023-06-21 16:00:30 +01:00
gabi-250 53a05c1e7b Merge branch 'upgrade_21June2023' into 'main'
Upgrade a couple of dependencies

See merge request tpo/core/arti!1276
2023-06-21 14:23:50 +00:00
Nick Mathewson dd944bc787 Generate correct ErrorKinds for hsdesc decryption failures.
Part of #736
2023-06-21 10:22:42 -04:00
Gabriela Moldovan 523eb7e5f0 keymgr: Remove outdated TODO.
This TODO describes something we're not planning to implement, so let's
just remove it.
2023-06-21 14:55:13 +01:00
Gabriela Moldovan 521ba309cc keymgr: Remove unnecessary condition.
We don't need to special-case `NotFound` errors because
`ssh_key::PrivateKey::from_openssh` doesn't read from disk (so it
shouldn't be returning `NotFound` errors in the first place).

Previously, this condition made sense because we were using
`ssh_key::PrivateKey::read_openssh_file` instead of
`ssh_key::PrivateKey::from_openssh`, which _does_ read from disk. This
condition should have been removed in !1263 (the refactoring where we
switched to `from_openssh`).

(Also, after #901 is implemented, we probably won't have an
`Error::NotFound` error anymore).
2023-06-21 14:42:42 +01:00
Nick Mathewson a7627341ec Merge branch 'onionsocks' into 'main'
arti: return prop304 extended socks5 reply codes for onion services

See merge request tpo/core/arti!1248
2023-06-21 13:38:42 +00:00
Nick Mathewson 4ab95a4d26 Merge branch 'chanmgr-method' into 'main'
Create chanmgr() method in TorClient

See merge request tpo/core/arti!1275
2023-06-21 13:38:21 +00:00
Nick Mathewson 16a07a8f63 Upgrade to memmap2 0.7 2023-06-21 09:13:55 -04:00
Nick Mathewson 0505579497 Upgrade to strum 0.25. 2023-06-21 09:12:36 -04:00
Saksham Mittal 056ca5c438
Remove extra 'this' in some methods 2023-06-21 18:40:18 +05:30
Saksham Mittal 341cf5c690
Create chanmgr() method in TorClient 2023-06-21 18:34:24 +05:30
Nick Mathewson 2d7756956e Add and use ErrorKinds for remaining onion service errors 2023-06-21 09:01:02 -04:00
Nick Mathewson 36c4112600 arti: return prop304 extended socks5 reply codes for onion services
We don't yet return all of them; this commit adds some todo notes
about changes we may need to our ErrorKinds.

Part of #736
2023-06-21 09:01:01 -04:00
Nick Mathewson fbb3d98fb3 arti: Abbreviate SocksStatus and ErrorKind imports and refactor. 2023-06-21 09:00:03 -04:00
Nick Mathewson f14a87e4c8 Merge branch 'todos' into 'main'
tor-hsclient: Dispose of easy todos and remove many allows

See merge request tpo/core/arti!1272
2023-06-21 12:53:16 +00:00
Nick Mathewson 372a72e185 Fix a rustdoc link. 2023-06-21 08:45:25 -04:00
Nick Mathewson 21ff8e8060 Merge branch 'chanmgr-doc-fix' into 'main'
Remove message 'For now, only direct channels are supported' in tor-chanmgr docs

See merge request tpo/core/arti!1273
2023-06-21 12:35:46 +00:00
Nick Mathewson 107fbb05de Merge branch 'geoip-nullity-fromstr' into 'main'
Followups wrt country-code robustness

See merge request tpo/core/arti!1268
2023-06-21 12:32:23 +00:00
Saksham Mittal c3384df00f
Remove message 'For now, only direct channels are supported' in tor-chanmgr docs 2023-06-21 17:29:11 +05:30
Ian Jackson 9a05fbb10d tor-hsclient: Apply deferred clippy churn needed by fmt churn
rustfmt *introduced* this clippy warning.
2023-06-21 12:54:57 +01:00
gabi-250 692049ed51 Merge branch 'openssl' into 'main'
Bump openssl because RUSTSEC-2023-0044

See merge request tpo/core/arti!1270
2023-06-21 11:24:58 +00:00
Ian Jackson fe41d2059e tor-hsclient: Apply deferred rustfmt churn 2023-06-21 12:19:04 +01:00
Ian Jackson 60fc4ef98a tor-hsclient: Drop most allows that are marked for removal 2023-06-21 12:19:04 +01:00
Ian Jackson a57d3067a5 tor-hsclient: Drop a large number of unneeded imports 2023-06-21 12:19:04 +01:00