Commit Graph

623 Commits

Author SHA1 Message Date
Nick Mathewson 023d288ba2 event_report: assert correctness of format ending
(Also, document that this static assertion is the reason why you are
seeing a confusing error message.)
2023-07-07 09:00:31 -04:00
Nick Mathewson 7168feefdd tor-error: Add optional tracing support
The main contribution here is a set of convenience macros for
logging error `Report`s.  Notably, this macros always logs
`Internal` and `BadAspiUsage` errors at `WARN`, unless they
are already at `ERROR` or more.

This is a little tricky because `tracing::event!()` requires
its Level argument to be a constant.
2023-07-07 09:00:31 -04:00
Ian Jackson 1ec339daf4 Merge branch 'task4' into 'main'
Introduce a MockExecutor for fully-isolated test cases

See merge request tpo/core/arti!1375
2023-07-06 14:41:04 +00:00
Nick Mathewson 36a92e44d9 Merge branch 'log_precision' into 'main'
arti: Add a `logging.time_granularity` option with 1s default.

Closes #551

See merge request tpo/core/arti!1376
2023-07-06 14:37:49 +00:00
Ian Jackson a4bb2a8b57 tor-dirmgr: bridge descriptor tests: Use MockRuntime (drop Tokio dep)
This isn't used any more.
2023-07-06 15:14:40 +01:00
Ian Jackson dc28b320f4 tor-rtmock: MockRuntime: provide test_with_various
In both fallible and infallible variants, for convenience.
2023-07-06 15:14:40 +01:00
Ian Jackson e23b1e00b5 tor-rtmock: MockExecutor: Configurable scheduling policy 2023-07-06 15:14:40 +01:00
Ian Jackson be632ba0f9 tor-rtmock: Provide MockRuntime 2023-07-06 15:14:40 +01:00
Ian Jackson 67941488ab tor-rtmock: Unit tests for MockExecutor 2023-07-06 15:14:40 +01:00
Ian Jackson d82ed8d793 tor-rtmock: Provide MockExecutor 2023-07-06 15:14:40 +01:00
Nick Mathewson 512064cc19 arti: Add a `logging.time_granularity` option with 1s default.
This lets us provide less information in our logs: in particular, it
lets us avoid logging with microsecond precision.

Closes #551.
2023-07-06 09:44:09 -04:00
Nick Mathewson 9c4de185e9 arti: Install a panic hook that sends messages to `tracing`
(Also leaves installed the default handler that sends messages to
stderr.)

Closes #921.
2023-07-05 16:37:10 -04:00
trinity-1686a 7c797d822e fix audit 2023-07-04 20:57:25 +02:00
Nick Mathewson de13a7319b Bump patchlevel versions on crates with smaller changes
Done with the commands below.

The following crates have had various changes, and should get a
patchlevel bump. Since they are pre-1.0, we do not need to
distinguish new APIs from other changes.

```
cargo set-version --bump patch -p arti-client
cargo set-version --bump patch -p safelog
cargo set-version --bump patch -p tor-bytes
cargo set-version --bump patch -p tor-cert
cargo set-version --bump patch -p tor-circmgr
cargo set-version --bump patch -p tor-config
cargo set-version --bump patch -p tor-consdiff
cargo set-version --bump patch -p tor-dirclient
cargo set-version --bump patch -p tor-dirmgr
cargo set-version --bump patch -p tor-error
cargo set-version --bump patch -p tor-hsservice
cargo set-version --bump patch -p tor-linkspec
cargo set-version --bump patch -p tor-llcrypto
cargo set-version --bump patch -p tor-netdir
cargo set-version --bump patch -p tor-netdoc
cargo set-version --bump patch -p tor-proto
cargo set-version --bump patch -p tor-rpcbase
cargo set-version --bump patch -p tor-socksproto
```

This crate has new features, but no new non-experimental Rust APIs.
So even though it is post-1.0, it gets a patchlevel bump.

```
cargo set-version --bump patch -p arti
```
2023-06-30 08:42:21 -04:00
Nick Mathewson 65e81bf0ca Bump minor versions on crates with breaking changes
Done with:
```
cargo set-version --bump minor -p tor-hsclient
cargo set-version --bump minor -p arti-rpcserver
cargo set-version --bump minor -p tor-hscrypto
cargo set-version --bump minor -p tor-cell
```
2023-06-30 08:38:16 -04:00
Nick Mathewson 40768a9f61 Bump versions on crates with nonfunctional changes
These crates have had nonfunctional changes only, mostly due to !1271,
or ac90cb7500, or documentation changes: crates that depend on
them do not require a version bump.

```
arti-bench
arti-config
arti-hyper
arti-testing
caret
fs-mistrust
retry-error
tor-async-utils
tor-basic-utils
tor-chanmgr
tor-checkable
tor-congestion
tor-consdiff
tor-events
tor-guardmgr
tor-persist
tor-protover
tor-ptmgr
tor-rtcompat
tor-rtmock
tor-units
```
2023-06-30 08:30:55 -04:00
Gabriela Moldovan b5e190d05d keymgr: Remove ArtiPath normalization, introduce additional restrictions. 2023-06-29 19:28:22 +01:00
Ian Jackson 9ad64792da Merge branch 'update' into 'main'
Run "cargo update" in preparation for Friday release.

See merge request tpo/core/arti!1338
2023-06-29 16:33:00 +00:00
Nick Mathewson b9530d0762 Merge branch 'netdir_by_rsa_experimental_apis' into 'main'
netdir: Conditionally expose APIs for working with unusable relays; document what "usable" means.

See merge request tpo/core/arti!1325
2023-06-29 16:08:51 +00:00
Nick Mathewson 7ac362eba7 netdir: Conditionally expose some by_rsa APIs as experimental.
Network-health wants these to see whether a given relay is listed in
the consensus.

cc @juga
2023-06-29 08:53:59 -04:00
Nick Mathewson 207a1d834c Run "cargo update" in preparation for Friday release. 2023-06-29 08:30:51 -04:00
Gabriela Moldovan bc447524c2 keymgr: Add tests for ArtiNativeKeyStore::key_path. 2023-06-29 11:54:54 +01:00
Ian Jackson cdad2db082 HS configuration: Add retry parameters to configuration
I think these should go in `[circuit_timing]`.  That section already
has some retry parameters, so is not strictly *timing*.

This is not honoured yet.
2023-06-28 13:32:54 +01:00
Ian Jackson c0c0beb8e1 arti cfg tests: Overhaul exception handling
This was super confusing and fragile.  Amongst the problems:

 * Information about exceptional config keys was spread across a
   number of places, manipulated in ad-hoc ways (conditional Vec
   appends, etc).

 * As a consequence, each exceptional table has confusing and unclear
   semantics.

 * It doesn't deal well with the way that cargo sometimes enables
   features for dependency crates even if arti itself wouldn't demand
   them; this can lead to sub-crates supporting config keys when the
   tests in arti don't expect them to, causing spurious test failures.

Fix this:

 * Introduce a new, systematic, way of writing information about
   configuration keys that need some kind of special handling.

 * Use this new approach in *both* sets of "thorough" config tests.

 * Be more relaxed about deprecated keys.  We don't want to tightly
   couple this to absence in the supported file, I think.

 * Understand more clearly the concept of keys of which we don't know,
   in the current build config, whether the code is expected to
   accept them.

I have tested this locally with:

   for p in '-p arti' '--workspace'; do for f in '--no-default-features --features=tokio,native-tls' '--all-features' ''; do nailing-cargo test $p $f; done; done
2023-06-28 12:56:09 +01:00
pinkforest 4be2e3ce0f Back down x25519-dalek to 2.0.0-pre.1 from 2.0.0-rc.2
=========================
Notes from nickm:

(This differs from pinkforest's original MR: It removes the
Cargo.lock changes and the version bump on tor-llcrypto.)

Minimal Cargo.lock changes from downgrade.

(These are exactly those changes generated by running "build" and
"test".)

There are several reasons to do this:

  * It's best to bump all of our dalek dependencies at once to rc.3
    or later, rather than the piecemeal approach we've been stuck
    with so far.

  * We don't want to do this bump right now, since there are some
    tricky questions about clamping we need to figure out (see
    #808), and we need to make sure we get them right, and we're in
    a distracted this week.

  * We _do_ need to move away from 2.0.0-rc.2 right now, since
    it was causing a failure in `cargo install arti`, and then it
    got yanked.

Thanks to pinkforest for helping us out here and explaining all of
this!

Fixes #926.

Commit-edited-by: Nick Mathewson <nickm@torproject.org>
2023-06-27 13:55:24 -04:00
gabi-250 dece1bec6c Merge branch 'upgrade-itertools' into 'main'
Upgrade to itertools 0.11.0

See merge request tpo/core/arti!1306
2023-06-26 14:42:02 +00:00
Nick Mathewson 0bffdf23a4 Upgrade to itertools 0.11.0
The breaking changes here do not seem to affect us.
2023-06-26 09:30:54 -04:00
Gabriela Moldovan 7c023f2ec2 keymgr: Create a KeyStoreError trait for keystore errors.
The new `BoxedError` type will replace `tor_keymgr::Error`.

Part of #901
2023-06-26 13:13:15 +01:00
Nick Mathewson 90f653f582 netdoc: Use a dev-dependency on anyhow to fix a doc example 2023-06-22 13:42:40 -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
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
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
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
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
Ian Jackson 0c18de656f Bump openssl because RUSTSEC-2023-0044 2023-06-21 11:57:34 +01:00
Nick Mathewson cf9d902320 geoip: Make ?? a little more bullet-proof
We want to make sure that ?? is always None, never a CountryCode.
2023-06-20 16:22:21 -04:00
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 17fab6e913 netdoc: Use derive amplify::Getters for HsDesc accessors.
Closes #909.
2023-06-20 14:00:41 -04: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 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 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
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 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 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
Ian Jackson 18291cb001 arti-client: Provide ErrorDetailDiscriminants for convenient testing
ErrorDetail isn't PartialEq so we can't assert_eq! it.
But the discriminants will be.
2023-06-16 16:18:02 +01:00
Gabriela Moldovan eda974cd34 keymgr: Move the HS client and service key specifiers out of tor-keymgr.
The HS `HsClientSpecifier` and `HsClientSecretKeySpecifier` are moved to
`tor-hsclient`. The HS service secret key specifier stubs are moved to
`tor-hsservice`.
2023-06-15 18:16:33 +01:00
Gabriela Moldovan 61f37b1b5c keymgr: Add key manager implementation stub. 2023-06-15 18:15:30 +01:00
Gabriela Moldovan a2d0ee63cc keymgr: Add ArtiNativeKeyStore implementation skeleton.
This adds implementation stubs for `ArtiNativeKeyStore`, and introduces
the traits needed to make the `KeyStore` APIs work.
2023-06-15 18:15:30 +01:00