Commit Graph

4259 Commits

Author SHA1 Message Date
Ian Jackson 4360ea00a3 Merge branch 'help_msg_on_backslash' into 'main'
Improve error from bad escapes in a toml config.

Closes #549

See merge request tpo/core/arti!695
2022-08-26 09:42:32 +00: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 cbb30b5e75 Merge branch 'port-listen' into 'main'
Rename *_port to *_listen and provide ListenConfig type for API

See merge request tpo/core/arti!602
2022-08-25 18:08:46 +00: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
Ian Jackson 87b88a5d5c Merge branch 'config-dir' into 'main'
Support arti.d config directories, and fixes to config reloading

Closes #544 and #474

See merge request tpo/core/arti!682
2022-08-25 15:19:19 +00: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
Ian Jackson 25b5a53953 config: Do process hardening on reconfigure even if not watching
These blocks were in the wrong order.

Previously, if you tried to turn on process hardening in the config
and then reloaded rather than restarting, it wouldn't take effect.
2022-08-25 15:58:29 +01:00
Ian Jackson cd2432474c tor-config sources: Remove some unneeded .to_string() from tests 2022-08-25 15:58:29 +01:00
Nick Mathewson 8fa1568b02 arti: Raise the default console log severity to "info"
Previously we logged at "debug", but that's not meant to
user-facing.
2022-08-25 09:10:42 -04:00
Nick Mathewson 709543bb48 Merge branch 'setresuid' into 'main'
Fix setuid testing for MacOS

See merge request tpo/core/arti!691
2022-08-25 11:42:00 +00:00
Ian Jackson 504bba2191 Fix setuid testing for MacOS 2022-08-25 12:21:33 +01:00
Nick Mathewson 679c1c9b6a Merge branch 'no_setuid' into 'main'
arti_client: Refuse to build a client if we are setuid.

See merge request tpo/core/arti!689
2022-08-24 19:47:15 +00:00
Nick Mathewson a8b3e147fe arti_client: Refuse to build a client if we are setuid.
Arti is not designed to be a setuid-safe program.

Part of #523.
2022-08-24 15:23:24 -04:00
eta 072595773e Merge branch 'doc-feature-flags' into 'main'
add annotations for required features in doc

Closes #541

See merge request tpo/core/arti!681
2022-08-24 17:39:24 +00:00
trinity-1686a 075ec7557f fix nightly lints 2022-08-24 19:10:12 +02:00
trinity-1686a c7d2b5001c fix test failing due to missing allow_running_as_root 2022-08-24 18:34:02 +02:00
trinity-1686a ef162655af switch from awk to python 2022-08-24 18:22:41 +02:00
trinity-1686a 97bb2325df add check_doc_features to CI 2022-08-24 18:22:41 +02:00
trinity-1686a ca99e9f635 add feature annotation to fields made visible through visible::StructFields 2022-08-24 18:22:41 +02:00
trinity-1686a 426a59b2ba add feature annotation not added by doc_auto_cfg 2022-08-24 18:22:41 +02:00
trinity-1686a 7f939fa480 enable doc_auto_cfg feature on every crate when documenting for docs.rs 2022-08-24 18:22:41 +02:00