Commit Graph

2431 Commits

Author SHA1 Message Date
trinity-1686a 4c543b570a fix compilation error with async-std 2022-09-06 21:32:20 +02:00
trinity-1686a 5e41e7dad4 document TOR_SKIP_CONTROLPORTTEST=1 for no warning on Tor Browser 2022-09-03 11:29:26 +02:00
Ian Jackson f62e2f48d4 READMEs: Drop stability warning re config
The referenced ticket is closed and I think the top-level caveats
remaining after !717 are sufficient.
2022-09-02 17:29:11 +01:00
Ian Jackson 52d9b8103a READMEs: Run maint/readmes (to update READMEs from lib.rs) 2022-09-02 17:08:08 +01:00
Ian Jackson 1f78b781f1 docs: Move Tor Browser part to arti top-level (rustfmt etc.) 2022-09-02 17:07:42 +01:00
Ian Jackson 6ae54b4623 arti-client README: Say we intend to provide FFI 2022-09-02 17:07:37 +01:00
Ian Jackson bed312bdcf README: Remove caveats from Tor Browser instructions 2022-09-02 17:07:37 +01:00
Ian Jackson 7581a425b3 README: Fix links to Tor Browser 2022-09-02 17:07:34 +01:00
Ian Jackson fc5c7ce55e docs: Move Tor Browser part to arti top-level (syntax fixup) 2022-09-02 17:07:17 +01:00
Ian Jackson b19547e15a docs: Move Tor Browser part to arti top-level (code motion) 2022-09-02 16:58:15 +01:00
Ian Jackson 78d633b940 README: change an NB to Note
https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/717#note_2834307
2022-09-02 16:44:13 +01:00
Ian Jackson c0189e02b7 READMEs: arti-client: Remove caveats and add some xrefs 2022-09-02 14:51:31 +01:00
Ian Jackson d512036549 READMEs: arti (CLI): Remove several caveats, and tidying 2022-09-02 14:51:31 +01:00
Ian Jackson 905aa29a9f Merge branch 'update-notify' into 'main'
update to notify v5.0.0

Closes #454

See merge request tpo/core/arti!679
2022-09-01 16:18:20 +00:00
Nick Mathewson 96875ea208 Bump crate versions in preparation for Arti 1.0.0 release.
Because we want to work more on ensuring that our semver stability
story is solid, we are _not_ bumping arti-client to 1.0.0 right now.

Here are the bumps we _are_ doing.  Crates with "minor" bumps have
had API breaks; crates with "patch" bumps have had new APIs added.

Note that `tor-congestion` is not bumped here: it's a new crate, and
hasn't been published before.

```
tor-basic-utils         minor
fs-mistrust             minor
tor-config              minor
tor-rtcompat            minor
tor-rtmock              minor
tor-llcrypto            patch
tor-bytes               patch
tor-linkspec            minor
tor-cell                minor
tor-proto               minor
tor-netdoc              patch
tor-netdir              minor
tor-persist             patch
tor-chanmgr             minor
tor-guardmgr            minor
tor-circmgr             minor
tor-dirmgr              minor
arti-client             minor
arti-hyper              minor
arti                    major
arti-bench              minor
arti-testing            minor
```
2022-09-01 08:59:49 -04:00
Nick Mathewson b3f989d689 Update patch-versions on crates without API changes.
Since our last round of releases, these crates have had either
trivial changes, or changes that did not affect their APIs.
Therefore we are bumping their versions, but not changing which
versions of them other crates depend on.
2022-09-01 08:45:02 -04:00
Alexander Færøy 276d472739 Fix broken build and tests after arti!700.
This patch fixes a minor build error where we would call
`compact_home()` on Windows instead of `anonymize_home()` on our PathBuf
instance.

Additionally we change how the `arti_conf` path is constructed such that
we join the individual path components to ensure that no "/" ends up
being present on Windows where path's are separated by "\".

See: tpo/core/arti#555.
See: tpo/core/arti!700.
2022-08-31 20:36:01 +02:00
trinity-1686a e1e3f912b3 update to v5.0.0 2022-08-31 19:08:06 +02:00
Nick Mathewson 6406e4db74 Merge branch 'ahf/563-appveyor-test-fix' into 'main'
Shorten the duration needed in preemptive::test::does_not_predict_old_ports.

See merge request tpo/core/arti!708
2022-08-31 17:00:17 +00:00
Nick Mathewson 2b5070640c Merge branch 'rustdoc_fix_20220831' into 'main'
Fix a rustdoc link error.

See merge request tpo/core/arti!711
2022-08-31 16:59:16 +00:00
Nick Mathewson 874ba13501 Fix a rustdoc link error. 2022-08-31 12:24:39 -04:00
Nick Mathewson 2221b66b74 Add test warning exceptions to arti::cfg::test 2022-08-31 11:22:18 -04:00
Nick Mathewson 8b6f4cc69d Update README.md files with "readmes" tool. 2022-08-31 11:08:03 -04:00
Nick Mathewson 77cb5acceb Merge branch 'compact_home_2' into 'main'
Represent the home directory as ${HOME} or %UserProfile%

Closes #555

See merge request tpo/core/arti!700
2022-08-31 13:57:11 +00:00
Nick Mathewson a9f19b0045 Use anonymize_home() when displaying various messages.
Closes #555
2022-08-31 09:38:35 -04:00
Nick Mathewson 7888ca09d2 fs-mistrust: Add a `anonymize_home` extension fn for Path.
This function transforms `/home/nickm/.config` to
`${HOME}/.config/`, so that we can expose the username less in our
logs.
2022-08-31 09:38:09 -04:00
Nick Mathewson 210c8f883c Merge branch 'ahf/557-mistrust-fixes-3' into 'main'
Add AppVeyor config (but do not enable it) and disable a few tests for Windows

See merge request tpo/core/arti!705
2022-08-31 13:25:38 +00:00
Nick Mathewson 8d6a1ea6ec Merge branch 'refactor-anyhow-arti-crate' into 'main'
Remove `anyhow` from `tor-config` crate

See merge request tpo/core/arti!707
2022-08-31 13:14:46 +00:00
Nick Mathewson 60e1a5c400 Merge branch 'upgrade_2022_0830' into 'main'
Upgrade and update dependencies in preparation for release.

See merge request tpo/core/arti!703
2022-08-31 13:06:01 +00:00
Alexander Færøy 3e3a68683c Shorten the duration needed in preemptive::test::does_not_predict_old_ports.
This patch shortens the duration of the `does_not_predict_old_ports`
test in the preemptive module. AppVeyor spawns its VMs/containers per
build, so the `Instant::now()` call returns a value smaller than `60 *
60 + 1` which causes the subtraction to overflow and thus panic.

Thanks to @trinity-1686a for the help here.

See: tpo/core/arti#563.
2022-08-31 14:52:40 +02:00
Nick Mathewson db50d57880 Upgrade serial_test in preparation for release. 2022-08-30 20:09:19 -04:00
Nick Mathewson 79860041fe Upgrade statrs in preparation for release. 2022-08-30 20:09:19 -04:00
Nick Mathewson a07c4124b1 Mark a few APIs as experimental in docs.
For example, see
https://tpo.pages.torproject.net/core/doc/rust/arti/fn.run.html :
this isn't labeled as `experimental-api`, but it should be.

These APIs were found by poking around in the `arti` crate.
2022-08-30 17:48:50 -04:00
Alexander Færøy 5c3456ff88 Comment out docstring as it fails to compile on Windows.
This patch comments out a method call to `trust_group()` as this method
is not available on all platforms that Arti builds on right now and thus
fails to compile there.

I have added a comment that the given call is not available on non-Unix
like platforms.

See: tpo/core/arti#557.
2022-08-30 22:07:44 +02:00
Alexander Færøy a0bf6b1eeb Disable 3 tests in fs-mistrust.
This patch disables `readable_ok()`, `multiple_errors()`, and
`check_contents()` as they all rely on permission issues on groups being
detected properly which is not the case on Windows right now.

See: tpo/core/arti#557.
2022-08-30 22:06:47 +02:00
Ian Jackson e2104e4cce tor-config: DisfavouredKey: Linkify Display 2022-08-30 13:24:06 +01:00
Ian Jackson 71122a61b6 tor-config: DisfavouredKey: Widen applicability of .to_string()
And linkify it.
2022-08-30 13:24:06 +01:00
Alexander Færøy 4c2fd18d35 Add documentation note on `to_string()` usage for DisfavouredKey. 2022-08-30 13:24:06 +01:00
Alexander Færøy 2f6ae1d5a1 Fix Tests on Windows in Configuration Subsystem.
This patch changes our `default_config()` test in `arti/src/cfg.rs` such
that we can define a number of known unrecognized options on different
platforms.

We mark the two keys "storage.permissions.trust_group" and
"storage.permissions.trust_user" as unknown on the Windows platform as
such features is not available using the ordinary Unix UID concept.

This patch also publicly exposes the `tor_config::load::DisfavouredKey`
and `tor_config::load::PathEntry` types and marks them as
non-exhaustive.

See: tpo/core/arti#450.
2022-08-30 13:24:06 +01:00
Ian Jackson 652ada2a4a Merge branch 'sighup' into 'main'
Sighup

See merge request tpo/core/arti!702
2022-08-30 11:59:03 +00:00
Alexander Færøy 8668bd7bc9 Use `expect()` instead of `unwrap()` in `mistrust_build()`.
See: tpo/core/arti#557.
2022-08-29 16:40:00 +02:00
Alexander Færøy d208706280 Refactor the construction of the `Mistrust` type in tests.
This patch refactors how we construct the `Mistrust` type in the tests
found in the fs-mistrust crate such that it is possible to construct an
instance of the `Mistrust` type using a set of operations available via
the `MistrustBuilder`'s methods.

We handle some of the portability issues found while testing this code
on Windows in the convenience function `mistrust_build()` instead of
having duplicated code in multiple test cases.

See: tpo/core/arti#557.
2022-08-29 16:22:57 +02:00
Alexander Færøy 514aaf41b8 Document in link_rel() why we do not support symlinks on Windows.
This patch adds a comment to the `link_rel()` function in fs-mistrust to
explain why we ignore symlink creation on the Windows platform.

See: tpo/core/arti#557.
2022-08-29 15:29:25 +02:00
Arturo Marquez 7d3d24cddf
Remove `anyhow` from `tor-config` crate 2022-08-28 18:07:53 -05:00
trinity-1686a 8510ba534d small refactoring to reduce duplicaiton of config reloading 2022-08-27 14:12:02 +02:00
trinity-1686a 748d5aea48 connect SIGHUP to watch_cfg 2022-08-27 14:12:02 +02:00
Nick Mathewson 7a3fec6fec WIP: listen for sighups and reconfigure? 2022-08-26 15:44:04 -04:00
Alexander Færøy 7b5ee8423b Disable fs-mistrust's simple_cases() unit test on non-Unix.
This patch disables the simple_cases() test on non-Unix platforms and
hides the LinkType type import on non-Unix where we won't be testing
symbolic link features.

See: tpo/core/arti#557.
2022-08-26 21:34:49 +02:00
Nick Mathewson 2c4a176e66 Add functionality to listen for SIGHUPs. 2022-08-26 15:33:56 -04:00
Alexander Færøy c3928bfe6c Fix compilation of tests for Windows.
This patch allows us to compile the fs-mistrust tests on Windows where
the `trust_no_group_id()` method is unavailable.

See: tpo/core/arti#557.
2022-08-26 21:33:40 +02:00
Alexander Færøy fa1b77642f Mark fs-mistrust's link_rel() and link_abs() as Unix-only.
Since we are not going to test symlink creation on Windows we remove
this code from the testing module.

See: tpo/core/arti#557.
2022-08-26 21:32:12 +02:00
Alexander Færøy edec8f3ecd Mark the repeats and looping tests in fs-mistrust as Unix-only.
See: tpo/core/art#557.
2022-08-26 21:30:20 +02:00
Nick Mathewson c1f64144b3 fs-mistrust: Try to handle verbatim prefixes in test.
We have a test that tries to check that our outputs are the same as
those from `std::fs::canonicalize`.  But on Windows, they aren't:
There, `canonicalize` also puts path prefixes into a "Verbatim"
form.

This patch tries to replicate that behavior for the test only.  If
we find that it's unreliable, though, our best bet is probably to
revise or disable this check on Windows, rather than chasing
compatibility with `GetFinalPathNameByHandle`.

Should fix part of #557.
2022-08-26 10:56:32 -04:00
Ian Jackson 3ea05c981d Merge branch 'fs-mistrust-by-component' into 'main'
fs-mistrust: Handle windows prefixes specially.

See merge request tpo/core/arti!698
2022-08-26 14:50:51 +00:00
Ian Jackson ca4ca75ede fs-mistrust: Clarify comment on `stack` 2022-08-26 14:14:40 +00:00
Nick Mathewson 5e7a62dff2 fs-mistrust: Handle windows prefixes specially.
On Windows, paths can have a "prefix", like `C:` or
`\\server\share`.  Attempts to get metadata for these prefixes
appear to fail with `ERROR_INVALID_FUNCTION`, since they are not
files.

This patch teaches fs-mistrust about prefixes on Windows, and tells
it that attempts to find their metadata are allowed to fail.

Doing this may solve part of #557.
2022-08-26 09:43:08 -04:00
Ian Jackson 56fd5ac779 Merge branch 'safelog_more' into 'main'
Apply safelog to more of the things that we log

See merge request tpo/core/arti!693
2022-08-26 13:20:00 +00:00
Nick Mathewson 496a5be749 Merge branch 'clippy' into 'main'
tor-config: tests: Apply standard lint block in sources.rs

See merge request tpo/core/arti!694
2022-08-26 12:56:25 +00:00
Nick Mathewson 2e7028e8e2 Merge branch 'setuid-again' into 'main'
arti: running_as_setuid: fix MacOs build

See merge request tpo/core/arti!697
2022-08-26 11:26:39 +00:00
Ian Jackson 0045b70bc8 Merge branch 'establish-intro-followup' into 'main'
Clean up EstablishIntro cell

See merge request tpo/core/arti!648
2022-08-26 11:21:02 +00:00
Ian Jackson 72bc20c99b arti: running_as_setuid: fix MacOs build
libc::getuid and geteuid are marked unsafe, even though I think they
could be safe.  So the previous code didn't build.
2022-08-26 11:44:05 +01:00
Yuan Lyu 08e55bc9b1
Clean up EstablishIntro cell 2022-08-25 16:45:40 -04:00
Nick Mathewson 88fa24d029 Improve error from bad escapes in a toml config.
Whereas previously we would say:

```
target/debug/arti: error: invalid escape character in string: `Z` at line 9 column 14 in ../../.config/arti/arti.toml
```
we now say:
```
target/debug/arti: error: invalid escape character in string: `Z` at line 9 column 14 in ../../.config/arti/arti.toml   (If you wanted to include a literal \ character, you need to escape it by writing two in a row: \\)
```

The implementation is a bit of a hack, I'm afraid, but I don't think
it's all that bad.

Closes #549.
2022-08-25 15:04:52 -04:00
Ian Jackson 3faf4475cc Bump toml dependency
We need
  60b874308e6792a73cc00517a60bbef60a12e3cc
  Mixed type arrays (#358)
for a test case in tor-config.

While we're here, drop the dupe entry in tor-config.

(In principle we could make this increase only in tor-config's
dev-dependencies, but that seems unnecessarily fiddly.)
2022-08-25 18:41:28 +01:00
Ian Jackson 76066dac81 tor-config Listen: Rename localhost_port_legacy (from _deprecated)
As per
  https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/602#note_2830847
2022-08-25 18:41:28 +01:00
Ian Jackson a6d7e38f6d tor-config Listen: Add a note about EADDRINUSE
Prompted by
  https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/602#note_2830848
2022-08-25 18:41:28 +01:00
Ian Jackson 81bf8d5f4d tor-config; Listen: Return addresses in groups for error behaviour
Prompted by
  https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/602#note_2830766
2022-08-25 18:41:28 +01:00
Ian Jackson 370330cb57 arti cfg: Provide comprehensive tests for port listening 2022-08-25 18:41:28 +01:00
Ian Jackson 12476bf0d4 arti: cfg: Rename `*_port` to `*_listen` and change the type
This commit largely follows the example for resolve_alternative_specs.

The difference is that there are two fields, so we use a macro to
avoid recapitulating the field names.
2022-08-25 18:41:28 +01:00
Ian Jackson 846fe3d520 tor-config: Provide resolve_alternative_specs 2022-08-25 18:41:28 +01:00
Ian Jackson 3af1f3e712 tor-config: Support tracking deprecated config keys 2022-08-25 18:41:28 +01:00
Ian Jackson 33358379f4 tor-config: Introduce ResolutionResults
This will allow us to handle new kinds of warnigns etc.
2022-08-25 18:41:03 +01:00
Ian Jackson 29a24a9dcb tor-config: Rename UnrecognizedKey to DisfavouredKey
We're going to want the to use the same type for deprecated keys.
2022-08-25 18:40:14 +01:00
Ian Jackson f588268128 tor-config: Provide misc::Listen 2022-08-25 18:40:14 +01:00
Ian Jackson 00c51bf63f tor-config misc tests: Add standard lint suppression block 2022-08-25 18:40:14 +01:00
Nick Mathewson 4696174d68 Merge branch 'default_log_severity' into 'main'
arti: Raise the default console log severity to "info"

See merge request tpo/core/arti!692
2022-08-25 17:13:51 +00:00
Nick Mathewson f9a9921bed arti-client: Treat list of exit ports as sensitive. 2022-08-25 12:03:38 -04:00
Ian Jackson a931ec08bd tor-config: tests: Apply standard lint block in sources.rs
Fixes a spurious clippy warning on nightly, about a dbg!
2022-08-25 16:33:59 +01:00
Nick Mathewson 0452fa67f6 arti: Adjust severity on per-socks-request log.
Also, note why we aren't hiding the addrs that we're listening on
here.
2022-08-25 11:09:38 -04:00
Nick Mathewson e8fcf2b038 arti-client: Downgrade "got a circuit for" message.
This is not interesting to the user, and violates some of our
safe-logging rules (like "Don't log at info for each user request"
and "don't log ports").
2022-08-25 11:05:42 -04:00
Nick Mathewson 0f133de6b9 Downgrade "guard set loaded" messages
These aren't interesting to the user.
2022-08-25 11:03:19 -04:00
Nick Mathewson 0510224820 circmgr: treat usage as sensitive. 2022-08-25 11:02:06 -04:00
Ian Jackson ae5ca43779 tor-config: semver.md: Document change to ConfigurationSource enum 2022-08-25 15:58:29 +01:00
Ian Jackson 2662fd0d71 tor-config source: just ConfigurationSource, not FoundConfigFile
FoundConfigFile existed to hide something that ConfigurationSource now
exposes.
2022-08-25 15:58:29 +01:00
Ian Jackson 9c00ec7da4 tor-config: Replace dir detection with ConfigurationSource enum
As per
  https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/682#note_2830860

And subsequent IRC discussion.

Having done the work as per review comments, I don't much like the
result.  It's quite un-ergonomiuc.  If we can't have fs autodetection,
I think syntactic autodetection within sources.rs would be nearly as
nice.

However, I seem to be outvoted.  At least the externally visible
functionality (of an arti binary, say) is reasonably ergonomic.
2022-08-25 15:58:29 +01:00
Ian Jackson e98bdf6004 tor-config: Provide is_syntactically_directory helper function 2022-08-25 15:58:29 +01:00
Ian Jackson a3005d8c0a tor-config: MustRead: Make public
I think this ought to be exhaustive.
2022-08-25 15:58:29 +01:00
Ian Jackson 7c0637ad44 config watch: Fix and reduce debounce interval
The parameter to FileWatcher::new is not a polling time fallback; it
is a "debounce time".  Events are always delayed by at least this
much.

10s is much too long for this.  1s is more appropriate.
2022-08-25 15:58:29 +01:00
Ian Jackson 7d8b3e2f2f config sources: Read arti.d as well as arti.toml
Fixes #474 aka #271
2022-08-25 15:58:29 +01:00
Ian Jackson ba94c4a4fa config sources tests: Test results of directory scan 2022-08-25 15:58:29 +01:00
Ian Jackson b700816eef config sources tests: Break out sources_nodefaults 2022-08-25 15:58:29 +01:00
Ian Jackson e4fea3e1ea config sources tests: Introduce test of reading directory 2022-08-25 15:58:29 +01:00
Ian Jackson 08767f59d8 config sources: Supporting reading directories 2022-08-25 15:58:29 +01:00
Ian Jackson 7d088cf8df config sources: Introduce scan() and FoundConfigFiles
We're going to need to do config file reading in two phases.

Right now this isn't actually necessary, because the set of files
is fixed since we don't support dynamically scanning directories.
But the new API will be needed in a moment.

Code motion and API changes, but no overall functional change.
Review with `git show -b` may be helpful.

The new API also provides for dealing with directories, but right now
that doesn't happen.
2022-08-25 15:58:29 +01:00
Ian Jackson 2fa75be660 tor-basic-utils: Provide IoErrorExt is_not_a_directory()
We're going to want this functionality, which isn't in the stable
stdlib.
2022-08-25 15:58:29 +01:00
Ian Jackson 587fa5f418 config watch: Provide watch_dir
No call site just yet; that will come shortly.

This requires a bit of reorganisation first.
2022-08-25 15:58:29 +01:00
Ian Jackson 863c66159b config watch: Re-establish watcher on each iteration
This is going to be needed in a moment.
2022-08-25 15:58:29 +01:00
Ian Jackson a7bb3a73b4 config watch: Rescan once on startup
That way if the config changes after we read it initially, but before
we set up the watcher, we will still pick it up.

Fixes #544
2022-08-25 15:58:29 +01:00
Ian Jackson 0f9bf12a7f config watch: Break out prepare_watcher
This is going to become more complicated, and gain another call site.
2022-08-25 15:58:29 +01:00
Ian Jackson 8e86599df4 config watch: Make the mpsc channel part of FileWatcher
The previous approach (inherited from the API of notify) was kind of
odd.

Soon we are going to want to be able to drop the watcher and replace
it.  That really wants the same object to contain all the things that
ought to be dropped together.  (notify's watchers stop generating
events and give EOF on the channel, when dropped.)
2022-08-25 15:58:29 +01:00