Commit Graph

241 Commits

Author SHA1 Message Date
Nick Mathewson b232365a75 Semantic version changes for Arti 0.4.0 release
I followed the following procedure to make these changes:

* I used maint/changed_crates to find out which crates had changed
  since 0.3.0.
* I used grep and maint/list_crates to sort those crates in
  topological (dependency) order.
* I looked through semver_status to find which crates were listed as
  having semver-relevant changes (new APIs and breaking changes).
* I scanned through the git logs of the crates with no
  semver-relevant changes listed to confirm that, indeed, they had
  no changes.  For those crates, I incremented their patch-level
  version _without_ changing the version that other crates depend on.
* I scanned through the git logs of the crates with no
  semver-relevant changes listed to confirm that, indeed, they had
  no obvious breaking changes.
* I treated all crates that depend on `arti` and/or `arti-client` as
  having breaking changes.
* I identified crates that depend on crates that have changed, even
  if they have not changed themselves, and identified them as having
  a non-breaking change.
* For all of the crates, I used `cargo set-version -p $CRATE --bump
  $STATUS` (where `STATUS` is `patch` or `minor`) to update the
  versions, and the depended-upon versions.
2022-05-27 09:01:20 -04:00
Nick Mathewson 45d21d2520 Bump versions of trivially-changed crates.
These crates had only clippy fixes that do not affect their
behavior:
        tor-bytes
        tor-cell
        tor-events
        tor-linkspec
        tor-netdir
        tor-socksproto

This crate only had the cargo-husky dependency removed, which
does not affect compatibility:
        tor-llcrypto

Since these changes have no compatibility effects, it is not
necessary to bump the versions of these crates which other crates
depend on.
2022-05-27 08:52:44 -04:00
Nick Mathewson f17c9083da Run "cargo update" in preparation for release 2022-05-27 08:30:27 -04:00
Ian Jackson 4bf87d61ca Merge branch 'config-split' into 'main'
Break TorClientConfig out of ArtiConfig and warn on unknown config keys

Closes #459 and #417

See merge request tpo/core/arti!529
2022-05-26 10:40:43 +00:00
Ian Jackson 9c88158740 tor-config: Example for load module 2022-05-24 20:14:57 +01:00
Ian Jackson 865ae13502 tor-config: Support functions for tracking ignored config keys
This turns out to need quite a complicated algorithm.
2022-05-24 20:14:57 +01:00
Nick Mathewson af54b99b40 Run "cargo update" in preparation for the next release. 2022-05-24 15:08:01 -04:00
Nick Mathewson 12f2a47fcb Write custom serde impls for Trusted{User,Group}
We support all of the following (in TOML notation):

```
user = "rose"  # by name
user = 413     # by ID
user = false   # no user
user = ":current"  # A 'special' user.

user = { name: "rose" }
user = { id: 413 }
user = { special: ":none" }
user = { special: ":current" }
```
2022-05-24 10:54:02 -04:00
Nick Mathewson 9dd7b99de1 Add serde derives for MistrustBuilder.
The Group and User (de)serialization is pretty ugly, and I can't
vouch for the correcness of MistrustBuilder.  I will seek feedback
before I proceed.
2022-05-24 10:54:02 -04:00
Nick Mathewson 330582a142 fs-mistrust: Add Group and User types.
This will help make the actual configuration more serializable,
I hope.
2022-05-24 10:54:02 -04:00
Nick Mathewson 95200383b5 fs-mistrust: make Mistrust have a corresponding Builder type.
This is an approximately minimal revision to get Builder in place;
subsequent commits will clean up the API.
2022-05-24 10:54:02 -04:00
Nick Mathewson c27b3cb701 Update to newer sanitize-filename and tinystr. 2022-05-23 16:02:50 -04:00
Ian Jackson 793782acc8 channel: Provide and use Sink::prepare_send_from
This is a general-purpose implementation of the ad-hoc approach
currently taken in (eg) crates/tor-proto/src/channel/reactor.rs,
with an API intended to defned against the more obvious mistakes.

This allows us to separate the two concerns: the channel reactor can
focus on handling channel cells and control messages and is over 2.5x
shorter.

The complexity of the manual sink implementation, and the machinery
needed to avoid having to suspend while holding an item, are dealt
with separately.  That separate implemenation now has proper
documentation.  (Tests are in the nest commit to avoid this one being
even more unwieldy.)

We use `extend` to define this as an extension trait.  A competitor is
`ext` but in my personal projects I have found `extend` slightly
better.
2022-05-23 11:28:05 +01:00
Jim Newsome d54faaf500
async-compression v0.3.12 -> v0.3.14
This is to pick up
https://github.com/Nemo157/async-compression/pull/148#issuecomment-1128862482

Fixes https://gitlab.torproject.org/tpo/core/arti/-/issues/473
2022-05-20 16:33:19 -05:00
Nick Mathewson f70ad60e65 DirMgr: Improve display for DocSource
(Also, implement Display for tor_dirclient::SourceInfo).
2022-05-16 12:42:25 -04:00
Ian Jackson 4e2bd6c798 Abolish arti-config, replacing with tombstone crate 2022-05-13 12:42:30 +01:00
Ian Jackson ef36882807 arti-config abolition: Change references to use tor_config
Generally, change the paths that mention the crate name to go via a
module-level "use".

This involves adding tor-config as a direct dependency for a few
crates.
2022-05-13 12:42:30 +01:00
Ian Jackson 9a3205aeba arti-config abolition: Add deps to tor-config
These are needed to support the code which is moving.
2022-05-13 12:41:27 +01:00
Ian Jackson 58c753429f arti-bench: Disable all fs permissions (fs-mistrust) checks
This is a benchmarking tool, and fs-mistrust doesn't like the
permissions in our CI.  The env var ARTI_FS_DISABLE_PERMISSION_CHECKS
is (of course) specific to arti.  Maybe it should be honoured here,
or this should be done via the config files.

But disabling this is fine for now.
2022-05-13 10:56:56 +01:00
Ian Jackson bb166c14da arti-example-config.toml: Re-un-comment the example settings in test 2022-05-12 14:55:39 +01:00
Ian Jackson ab3bd9d6d5 arti-config: Move cmdline to tor-config
This does not know anything about arti, only about TOML and Config.

Code motion, plus necessary import adjustments.
2022-05-11 18:23:05 +01:00
Ian Jackson c9fee15cbf ConfigurationSource: Move "usual" logic for construction 2022-05-11 15:53:03 +01:00
eta 0597c31a6f Merge branch 'dirmgr-purification-2' into 'main'
Refactor the tor-dirmgr bootstrapping code more gracefully

See merge request tpo/core/arti!488
2022-05-10 17:10:45 +00:00
eta 6fc7a864c7 Remove cargo-husky, and replace with manual instructions
A build script reaching into your .git/hooks/ and modifying them
nonconsensually was a bit of a horrifying concept, and also made it hard
to build arti with the feature disabled. Remove this crate, and replace
it with manual instructions on how to install the hooks in
CONTRIBUTING.md.
2022-05-10 13:36:49 +01:00
eta cad815e31d tor-dirmgr/state.rs: feed through additional parameters, use them
- The additional parameters passed to GetConsensusState are now passed
  through all the states, and used as well.
- WriteNetDir doesn't have a now() or config() method any more, since
  the states now get this from the runtime or the config parameters.
- This required modifying the tests to make a mocked runtime and custom
  config directly, instead of using DirRcv for this purpose.
- Additionally, because we don't have to upgrade a weak reference for
  DirState::dl_config(), that function no longer wraps its return value
  in Result.
- (A bunch of the FIXMEs from the previous commit that introduced the
  additional parameters have now been rectified as a result.)
2022-05-10 11:48:56 +01:00
Nick Mathewson 3b0336e841 netdoc: add a new type for Nicknames
Relay nicknames are always between 1 and 19 characters long, and
they're always ASCII: That means that storing them in a [u8;19] will
always be possible, and always use less resources than storing them
in a String.

Fortunately, the tinystr crate already helps us with this kind of
thing.
2022-05-09 15:59:38 -04:00
Nick Mathewson 4262e9d0ec Merge branch 'use-fs-mistrust' 2022-05-09 15:27:25 -04:00
Nick Mathewson b0f39abe32 arti: use fs-mistrust to validate configuration file locations. 2022-05-09 14:40:29 -04:00
Nick Mathewson 2938268f34 arti-client: Configure and use fs-mistrust.
This is derived from the environment, not the configuration file: We
might not want to trust the configuration file until we've decided
whether we like its permissions.
2022-05-09 14:40:29 -04:00
Nick Mathewson 7b93091f57 Bump the version of every* crate to 0.3.0
* Except for safelog and fs-mistrust, which are new.
2022-05-06 10:03:15 -04:00
Nick Mathewson 013bb26040 Merge branch 'derive-builder-fork' into 'main'
Switch to derive_builder_arti_fork

Closes #446

See merge request tpo/core/arti!490
2022-05-06 13:07:51 +00:00
Ian Jackson 030289481f Switch to derive_builder_arti_fork
For reference, the git source for this crate (and the others in its
workspace) currently lives in my personal github account (ijackson).
If this fork turns out to be long-lived and gains features and/or
users, it would be good to move it to a gitlab somewhere.

I have granted Nick crate ownership on the crates.io system.
2022-05-06 13:36:40 +01:00
Nick Mathewson 4679023c39 Apply `sensitive` in some info-level log messages.
This specifically applies the `sensitive` wrapper in the places
where we're logging target addresses at level "info" or higher.
2022-05-06 07:36:50 -04:00
Nick Mathewson 7aacc6e30c Implement a safe-logging facility.
This is a rough first-cut of an API that I think might help us with
keeping limited categories of sensitive information out of our logs.
I'll refine it based on experiences with using it.
2022-05-06 07:36:48 -04:00
Nick Mathewson 66ee39995d Run "cargo update" in preparation for a release... next week? 2022-05-04 14:17:11 -04:00
Ian Jackson 221fe63430 list_builder: Use Educe to derive Default
This allows us to use this with an item builder type which doesn't
impl Default.  (Obviously this only makes sense for items which aren't
actually builders.)
2022-05-04 17:18:05 +01:00
Ian Jackson 8ad4735d58 Add dependency on paste crate
The list accessor macro is going to want this.
2022-05-04 13:48:30 +01:00
Ian Jackson fbf5e8dcb5 Merge branch 'path' into 'main'
CfgPath overhaul

Closes #449

See merge request tpo/core/arti!478
2022-05-03 17:00:41 +00:00
Ian Jackson 2da84857a5 CfgPath: Test serialisation round-trip with a binary format
Use MessagePack.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
2022-05-03 17:42:54 +01:00
Ian Jackson ed970310e2 CfgPath: Overhaul API
Document that this can contain either a string for expansion, or a
literal PathBuf not for expansion.

Rename the `from_path` method to `new_literal`: a very important
difference is whether it gets expanded - less important than the Rust
type.  Also, now it takes `Into<PathBuf>`, which avoids a needless
clone.

(We don't change the API in `arti-client` because
`&tempfile::Tempdir()` doesn't implement `Into<PathBuf>`, so
`arti-client` has to have some new `as_ref` calls.)

Provide accessors `as_unexpanded_str` and `as_literal_path`.  The
deserialisation already makes this part of the stable API,l so not
pvoding accessors seems just obstructive.  They are useful for tests,
too.

Add tests for the new entrypoints, and for deserialisation of both
variants from TOML (via config, or directly) and JSON.
2022-05-03 17:42:14 +01:00
Nick Mathewson e46edc21fa Merge branch 'fs-mistrust-v2' into 'main'
Second cut at a fs-mistrust crate.

See merge request tpo/core/arti!468
2022-05-03 14:28:28 +00:00
Nick Mathewson 85d7084d95 fs-mistrust: Add code to make a self-named group "trusted".
This required a bit of poking through the `users` crate, to mess
with the user and group dbs.  The original goal was to "trust the
group with the same name as us", but it turned into a bit of a
production, since:

  * We want to take our own name from $USER, assuming that matches
    our uid.  (Otherwise we want to ask getpwuid_r().)
  * We only want to trust the group if we are actually a member of
    that group.
  * We want to cache this information.
  * We want to test this code.
2022-05-03 10:03:32 -04:00
Nick Mathewson 7254fc60eb fs-mistrust: more examples, documentation. 2022-05-03 10:03:32 -04:00
Nick Mathewson 75633109c2 Add functionality to inspect directory content permissions
Also, explain _why_ this is pretty important.
2022-05-03 10:03:32 -04:00
Nick Mathewson c4a5a49b55 Second cut at a fs-mistrust crate.
This crate is meant to solve #315 by giving a way to make sure that
a file or directory is only accessible by trusted users.  I've tried
to explain carefully (in comments and documentation) what this crate
is doing and why, under the assumption that it will someday be read
by another person like me who does _not_ live and breathe unix file
permissions.  The crate is still missing some key features, noted in
the TODO section.

It differs from the first version of the crate by taking a more
principled approach to directory checking: it emulates the path
lookup process (reading symlinks and all) one path change at a time,
thus ensuring that we check every directory which could enable
an untrusted user to get to our target file, _or_ which could
enable them to get to any symlink that would get them to the target
file.

The API is also slightly different: It separates the `Mistrust`
object (where you configure what you do or do not trust) from the
`Verifier` (where you set up a check that you want to perform on a
single object).  Verifiers are set up to be a bit ephemeral,
so that it is hard to accidentally declare that _every_ object
is meant to be readable when you only mean that _some_ objects
may be readable.
2022-05-03 10:03:32 -04:00
trinity-1686a d1bd9e209f update tls-api to 0.8.0
and remove corresponding RUSTSEC from ignored list
2022-04-28 17:43:32 +02:00
eta 6f787e1e77 Merge branch 'derive-builder-git-fixup' into 'main'
derive_builder: Use git dep everywhere, rather than cargo patch

See merge request tpo/core/arti!477
2022-04-27 14:31:08 +00:00
Ian Jackson a97ad69855 derive_builder: Use git dep everywhere, rather than cargo patch
The `[patch]` approach causes the tree not to build when used as a
dependency, unless the `[patch]` is replicated into the depending
project.

Instead, replace our `derive_builer =` dependencies with a reference
to a specific git commit:

  perl -i~ -pe 'next unless m/^derive_builder/; s#"(0\.11\.2)"#{ version = "$1", git = "https://github.com/ijackson/rust-derive-builder", rev = "ba0c1a5311bd9f93ddf5f5b8ec2a5f6f03b22fbe" }#' crates/*/Cargo.toml

Note that the commitid has changed.  This is because derive_builder is
in fact a workspace of 4 crates.  3 of them are of interest to arti
itself (the 4th exists only for testing).  So the same "add git
revision" treatment had to be done to the `derive_builder` and
`derive_builder_macro` crates.  Each dependency edge involves a new
commit in the derive_builder workspace, since we can't create a git
commit containing its own commitid.  (We want to use commits, rather
than a branch, so that what we are depending on is actually properly
defined, and not subject to the whims of my personal github
namespace.)

There are no actual code changes in derive_builder.
2022-04-27 14:57:59 +01:00
Nick Mathewson f8dbad941e Bump async_executors to 0.6 2022-04-26 12:16:22 -04:00
Nick Mathewson aaab6f3812 Upgrade to AES 0.8
Now that we require Rust 1.56, we can upgrade to AES 0.8.  This
forces us to have some slight API changes.

We require cipher 0.4.1, not cipher 0.4.0, since 0.4.0 has
compatibility issues with Rust 1.56.
2022-04-26 12:16:22 -04:00