Commit Graph

4242 Commits

Author SHA1 Message Date
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 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
Nick Mathewson 187c6b48df Merge branch 'no_root' into 'main'
arti: Do not allow running as root.

See merge request tpo/core/arti!688
2022-08-24 15:21:57 +00:00
Nick Mathewson 8332e613f4 test/chutney/setup: Set allow_running_as_root as needed. 2022-08-24 10:57:03 -04:00
Nick Mathewson 25c287636b arti: Do not allow running as root.
This can be overridden with `application.allow_running_as_root`.

Part of #523.
2022-08-24 10:57:03 -04:00
Nick Mathewson 51eb0e6ca2 Merge branch 'test-old-config' into 'main'
Test oldest example configuration file

See merge request tpo/core/arti!684
2022-08-23 14:43:30 +00:00
Nick Mathewson 9dbf504ffe Merge branch 'resolve-option-general' into 'main'
tor-config: Provide resolve_option_general, for T: !Default etc.

See merge request tpo/core/arti!685
2022-08-23 14:43:18 +00:00
Ian Jackson ee2580face tor-config: resolve_option_general: Add semver note 2022-08-23 14:21:13 +01:00
Ian Jackson 0c747b8069 tor-config: resolve_option_general: Add TODO about example 2022-08-23 14:20:49 +01:00
Nick Mathewson 32c14d37bf Fix syntax in doc comment. 2022-08-23 12:59:41 +00:00
Ian Jackson 298f6f508c arti cfg: Write down future plans
Mostly cribbed from
  https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/684#note_2829937
2022-08-23 13:55:48 +01:00
Ian Jackson 457c17adb0 tor-config: Provide resolve_option_general, for T: !Default etc.
At one point in this MR I thought I was going to want this for
arti::cfg::ListenConfig (which we don't want to be Default).

In fact ListenConfig is being handled specially, but having written
this function it seemed sensible to keep it.  Since resolve_option
becomes a wrapper for it, the existing tests exercise it.
2022-08-22 16:26:38 +01:00
Ian Jackson 086cf3701a arti cfg: Test parsing of the oldest config file we still support 2022-08-22 16:26:22 +01:00
Ian Jackson a1cc2578b3 arti cfg: Fix docs about ARTI_EXAMPLE_CONFIG
The defaults are now
2022-08-22 16:26:22 +01:00
eta bca7250524 Merge branch 'ansi-term' into 'main'
Tolerate RUSTSEC-2021-0139 (ansi_term unmaintained)

See merge request tpo/core/arti!683
2022-08-22 15:18:22 +00:00
Ian Jackson eb93e05552 maint/cargo_audit: Tolerate RUSTSEC-2021-0139 (ansi_term unmaintained) 2022-08-22 10:37:00 +01:00
Ian Jackson ff962e5109 maint/cargo_audit: Honour $CARGO
This makes it easier to for me to test this script.  (I would like to
do this to all of them but it's easier on a case-by-case basis.)
2022-08-22 10:36:53 +01:00
Nick Mathewson 83eefe1e21 Merge branch 'format-python-script' into 'main'
Format python script in maint

See merge request tpo/core/arti!678
2022-08-17 12:45:02 +00:00
Ian Jackson 46d9dadd02 Merge branch 'channel' into 'main'
Channel padding

See merge request tpo/core/arti!657
2022-08-17 10:26:25 +00:00