Commit Graph

7761 Commits

Author SHA1 Message Date
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
Ian Jackson 792371a688 fs-mistrust: users: Use OsStr and OsString a lot less
We don't use OsString now except where it appears in our public API,
or where we get it from std::env.

Moving the `use` statements into the use sites enabled me to see
that I had found all the places I wanted to change.
2023-07-14 16:02:45 +01:00
Ian Jackson 5f3571fdf3 fs-mistrust: Remove a now-unneeded suppression
This function is actually (properly) fallible now.
2023-07-14 16:02:45 +01:00
Ian Jackson 41543b06d6 fs-mistrust: forbid unsafe code 2023-07-14 16:02:45 +01:00
Ian Jackson c943f734d6 fs-mistrust: Replace a direct libc call in a test 2023-07-14 16:02:45 +01:00
Ian Jackson e4bb7c388a fs-mistruct: Abolish some now-unneeded muts
MockPwdGrpProvider has internal mutability and is Sync, so its add
functions take &self.
2023-07-14 16:02:45 +01:00
Ian Jackson fe79f423f7 fs-mistrust: Use pwd-grp's getgroups function
This gets rid of some unsafe code here, with doubtful error handling,
in favour of the unit-tested version in pwd-grp.
2023-07-14 16:02:45 +01:00
Ian Jackson 5f46bacbb2 fs-mistruct: switch from users to pwd-grp
users is unmaintained.  pwd-grp is the crate I have just written to
replace it. In this commit:

Change the cargo dependency and imports.

Replace the cacheing arrangements.  users has a built-in cache;
pwd-grp doesn't.  Now, instead of cashing individual lookups, we cache
the trusted user and trusted gid calculation results.
This saves on some syscalls, and is also more convenient to write.
(Mocking is still done via the dependency.)

Many systematic consequential changes of details:

 * The entrypoint names to the library are different:
   pwd-grp uses the names of the corresponding Unix functions.

 * pwd-grp's returned structs are transparent, so we don't
   call accessors for .uid(), .name(), etc.

 * pwd-grp's methods are much more often fallible
   (returning io::Result<Option<...>)

 * We're using the non-UTF-8 pwd-grp API, which means we must
   use turbofish syntax in some places.

 * The mocking API is a bit different.
2023-07-14 16:02:45 +01:00
Ian Jackson bf65b7763e fs-mistrust: Introduce tempoary PwdGrpProvider alias
This allows us to change a number of trait bounds in advance, reducing
noise in the next commit.
2023-07-14 16:02:45 +01:00
Ian Jackson a6108bb9b3 fs-mistrust: impl Hash for TrustedUser and TrustedGroup (config) 2023-07-14 16:02:45 +01:00
Ian Jackson a45eefec1a fs-mistrust: users: tests: Introduce mock_users etc.
Add some wrapper functions for convenience.

The pwd-grp crate has a richer and more faithful, but not so
convenient, way of creating dummy user/group entries.  Also the type
names are all going to change.

Doing this now reduces churn.
2023-07-14 16:02:45 +01:00
Ian Jackson cdafa2ce01 fs-mistrust: users: Make several functions fallible
The actual underlying operations here *are* fallible.
The `users` crate hides those errors in several cases.

(Failures are very rare (at least unless NIS is involved), so this is
not of much practical import, but it's going to be necessary when we
use the more careful pwd-grp crate.
2023-07-14 16:02:45 +01:00
Alexander Færøy ce64ade742 Merge branch 'unused_import' into 'main'
Move an import to resolve a warning.

See merge request tpo/core/arti!1407
2023-07-14 13:35:27 +00:00
Alexander Færøy 63a3bbc33c Merge branch 'bug638' into 'main'
Stop unconditionally marking bridges as having dir info.

Closes #638

See merge request tpo/core/arti!1408
2023-07-14 13:35:04 +00:00
Alexander Færøy ae30658118 Merge branch 'uniq_bridge_addr' into 'main'
Bridges: deduplicate addresses.

See merge request tpo/core/arti!1409
2023-07-14 13:34:18 +00:00
Nick Mathewson b8334292fb Bridges: deduplicate addresses.
Currently we list an address for a bridge twice if it is listed both
in the bridge line and the bridge descriptor. That can't be right.
2023-07-13 16:58:12 -04:00
Nick Mathewson 3f2d4f8cec Better report for any recurrence of bug #638. 2023-07-13 15:43:57 -04:00
Nick Mathewson 7a915f5454 Stop unconditionally marking bridges as having dir info.
When we implemented bridges, we added code in 08473872ab to
conditionally mark their directory info as present or not present.
But the we didn't remove the old code to mark them present
unconditionally!

Fixes #638.
2023-07-13 15:43:42 -04:00
eta 71c148868b Merge branch 'geoip-netdir' into 'main'
Add country codes to relays inside a NetDir

See merge request tpo/core/arti!1364
2023-07-13 17:23:12 +00:00
eta 41bb03c6cc Add country codes to relays inside a NetDir
- When the `geoip` feature flag of `tor-netdir` is enabled, perform
  GeoIP lookups for all relays added to the directory and add the
  resulting country code to the `Relay` struct.
  - The GeoIP database is provided in a new
    `PartialNetDir::new_with_geoip` constructor.
- A new trait was also added to `tor-linkspec`, `HasCountryCode`, to
  enable getting this data out from other crates.

Part of onionmasq#47.
2023-07-13 17:47:00 +01:00
Nick Mathewson ce8848f348 Move an import to resolve a warning. 2023-07-13 12:33:01 -04:00
gabi-250 34eb5783e4 Merge branch 'make_factory_usable_v2' into 'main'
Second attempt to make a way to use ChannelFactory.

See merge request tpo/core/arti!1406
2023-07-13 16:26:32 +00:00
gabi-250 b53d42f23e geoip: Use from_raw_parts instead of transmute. 2023-07-13 11:53:41 -04:00
Nick Mathewson 157d134a65 Explain better why you would use build_unmanaged_channel 2023-07-13 11:51:12 -04:00
gabi-250 56d96e4253 Resolve numerous typos in `ChanMgr::build_unmanaged_channel` code 2023-07-13 15:47:05 +00:00
Nick Mathewson 6b61eec987 chanmgr: Remove now-unused (and never usable) builder() method. 2023-07-13 09:33:06 -04:00
Nick Mathewson ed455023c2 chanmgr: Document makeup and timeout behavior of our factories
Basically, it's all ChanBuilder at some point, and ChanBuilder
has a timeout.
2023-07-13 09:33:06 -04:00
Nick Mathewson 7a38d68528 chanmgr: Add an experimental build_unmanaged_channel() method.
This method will let the user construct a channel that isn't
stored or monitored by the ChanMgr.
2023-07-13 09:31:57 -04:00
Gabriela Moldovan 99b73cb22a
arti-client: Log whether a keystore is in use. 2023-07-13 12:30:10 +01:00
Gabriela Moldovan 5b97b0b2ce
tor-config: Remove unused ItemOrBool helper.
`ItemOrBool` is currently not used anywhere (it was previously used by
the keymgr config).
2023-07-13 12:30:07 +01:00
Gabriela Moldovan d5339772f1
arti cfg tests: Add keystore to example config.
Closes #939
2023-07-13 12:30:04 +01:00
Gabriela Moldovan f609ae2661
arti config: Remove extraneous whitespace. 2023-07-13 12:30:01 +01:00
Gabriela Moldovan 0260405603
arti-client: Use the config struct from tor-keymgr. 2023-07-13 12:29:57 +01:00
Gabriela Moldovan d8299e8d2f
tor-keymgr: Add ArtiNativeKeystoreConfig.
Previously, the keystore config consisted of a single field in
`StorageConfig`, which encoded 2 bits of information: whether the
keystore is enabled, and its root directory:
```
[storage]
# use this path, fail if compiled out
# keystore = "/path/to/arti/keystore"
#
# use default path, fail if compiled out
# keystore = true
#
# disable
# keystore = false
```

This commit adds `ArtiNativeKeystoreConfig`, which will replace the
multi-purpose `keystore` field. The new config will look like this:
```
#[storage.keystore]
# Whether the keystore is enabled.
#
# If the `keymgr` feature is enabled and this option is:
#     * set to false, we will ignore the configured keystore path.
#     * set to "auto", the configured keystore, or the default keystore, if the
#     keystore path is not specified, will be used
#     * set to true, the configured keystore, or the default keystore, if the
#     keystore path is not specified, will be used
#
# If the `keymgr` feature is disabled and this option is:
#     * set to false, we will ignore the configured keystore path.
#     * set to "auto", we will ignore the configured keystore path.
#
# Setting this option to true when the `keymgr` feature is disabled is a
# configuration error.
#enabled = "auto"
# The root directory of the arti keystore
#path = "${ARTI_LOCAL_DATA}/keystore"
```

While `ArtiNativeKeystoreConfig` currently only has 2 fields, `enabled`
and `path`, future versions of the keystore might require additional
config options.
2023-07-13 12:13:59 +01:00
gabi-250 42115116e4 Merge branch 'keymgr-integration-test' into 'main'
CI: Add client auth integration test.

Closes #954

See merge request tpo/core/arti!1399
2023-07-12 16:35:43 +00:00
Gabriela Moldovan d684073a31
CI: Reduce the success threshold for the HS client integration tests.
Prompted by https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/1399#note_2921505
2023-07-12 17:11:56 +01:00
Gabriela Moldovan 24501fdf0e
CI: Add client auth integration test. 2023-07-12 16:36:11 +01:00
Alexander Færøy 89a3d43aa6 Merge branch 'feat' into 'main'
"Fix" CI complaints about "Conversation"

See merge request tpo/core/arti!1402
2023-07-12 15:34:45 +00:00
Gabriela Moldovan 00b7d86e52
CI: Remove extraneous whitespace. 2023-07-12 16:30:10 +01:00
Gabriela Moldovan c942f02dea
arti-client: Log whether the client auth keys were retrieved. 2023-07-12 16:30:06 +01:00
Nick Mathewson a3604e7e81 Merge branch 'channel-experimental-api' into 'main'
Gate builder() behind experimental-api feature

See merge request tpo/core/arti!1403
2023-07-12 15:09:34 +00:00