Commit Graph

4283 Commits

Author SHA1 Message Date
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
Nick Mathewson 2c4a176e66 Add functionality to listen for SIGHUPs. 2022-08-26 15:33:56 -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
Ian Jackson d06e295a3a Merge branch 'safelog_note' into 'main'
First draft of "what is sensitive" document

See merge request tpo/core/arti!687
2022-08-26 13:10:53 +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
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
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 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
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
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
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