Commit Graph

25255 Commits

Author SHA1 Message Date
teor
92fb099067
Merge branch 'maint-0.3.5' into maint-0.4.0 2019-12-05 10:13:53 +10:00
teor
46057ec5ae
Merge remote-tracking branch 'tor-github/pr/1424' into maint-0.4.0 2019-12-05 10:13:15 +10:00
teor
aee966cb06
Merge remote-tracking branch 'tor-github/pr/1277' into maint-0.3.5 2019-12-05 10:11:18 +10:00
Nick Mathewson
fcb5656128 Merge branch 'ticket32609_squashed' 2019-12-04 12:15:28 -05:00
teor
9ad569c71d practracker: Add missing .may_include files
All of these files contain "*.h", except for:
* src/app/config/.may_include
* src/test/.may_include
which also contain "*.inc".

This change prevents includes of "*.c" files, and other
unusually named files.

Part of 32609.
2019-12-04 12:15:22 -05:00
George Kadianakis
2693bf47e8 control-port: Include HS address in ONION_CLIENT_AUTH_VIEW reply. 2019-12-04 13:33:07 +02:00
David Goulet
3b64c6b6fc hs-v3: Fix NULL deref. in hs_circ_service_get_established_intro_circ()
Found by Stem regression tests. Reported by atagar.

Fixes #32664

Signed-off-by: David Goulet <dgoulet@torproject.org>
2019-12-03 10:11:42 -05:00
David Goulet
65759f2901 Merge branch 'tor-github/pr/1563' 2019-12-03 09:22:21 -05:00
George Kadianakis
12305b6bb6 hsv3: ONION_CLIENT_AUTH_REMOVE now also removes the credential file. 2019-12-03 09:22:17 -05:00
George Kadianakis
8ed8707f0a hsv3: Abstract parts of hs_config_client_authorization() into func.
Now we have a function that reads a file and returns a credential. We need that
for the REMOVE control port command.
2019-12-03 09:22:17 -05:00
George Kadianakis
763f337290 hsv3: Start refactoring hs_config_client_authorization().
- Remove key_dir which is useless.
- Kill an indentation layer.

We want to make it cleaner and slimmer so that we can reuse parts of it in the
REMOVE command for removing the right client auth file.
2019-12-03 09:22:17 -05:00
George Kadianakis
9395a0c765 hsv3: Remove support for client auth nicknames.
Because the function that parses client auth credentials saved on
disk (parse_auth_file_content()) is not future compatible, there is no way to
add support for storing the nickname on the disk. Hence, nicknames cannot
persist after Tor restart making them pretty much useless.

In the future we can introduce nicknames by adding a new file format for client
auth credentials, but this was not deemed worth doing at this stage.
2019-12-03 09:22:17 -05:00
George Kadianakis
c7c9899bc4 hsv3: Add tests for permanently storing auth credentials.
Remove Permanent flag from old tests, and make a new test that does all the
permanent things.
2019-12-03 09:22:17 -05:00
George Kadianakis
70572b9abd hsv3: Implement permanent storage of auth credentials.
- See hs_client_register_auth_credentials() for the entry point.
- Also set the permanent flag for credentials we read from the filesystem.
- Also add some missing documentation.
2019-12-03 09:22:17 -05:00
teor
df6c5382ad
Merge branch 'pr-1569-squashed' 2019-12-03 12:57:06 +10:00
Nick Mathewson
92a6803e1d
Distribute checkSpaceTest.sh and run it when we have perl. 2019-12-03 12:56:53 +10:00
Nick Mathewson
f63cf2158b Merge branch 'ticket32207' 2019-12-02 11:41:40 -05:00
Nick Mathewson
af7416bfad Link to mainloop_pubsub.[ch] when describing delivery policies 2019-12-02 11:41:16 -05:00
George Kadianakis
53bdd21179 Merge branch 'tor-github/pr/1559' 2019-12-02 12:52:44 +02:00
teor
96e620caaf
Merge remote-tracking branch 'tor-github/pr/1574' 2019-12-01 17:53:06 +10:00
teor
41a3930129 control: Update an outdated function comment
Cleanup after 31531.
2019-11-29 10:55:27 +10:00
teor
f8f278f8c4 control: Remove an unused function return value
Cleanup after 31531.
2019-11-29 10:54:42 +10:00
teor
7a69b3aebc control: Rename a function variable
Cleanup after 31531.
2019-11-29 10:53:32 +10:00
teor
7572988ea9 control: Remove an unnecessary header in control_events.h
And replace it with a struct forward declaration.

Also, move all the headers in the file before the forward
declaration.

Cleanup after 31531.
2019-11-29 10:50:09 +10:00
George Kadianakis
68a00c4951 Merge branch 'tor-github/pr/1573' 2019-11-27 15:36:26 +02:00
David Goulet
c508513014 test: Add unit tests for closing intro circ on failure
Signed-off-by: David Goulet <dgoulet@torproject.org>
2019-11-27 14:52:09 +02:00
David Goulet
a423cec670 hs-v3: Remove unused hs_service_intro_circ_has_closed()
Since the removal of ip->circuit_established, this function does litterally
nothing so clean it up.

Part of #32020

Signed-off-by: David Goulet <dgoulet@torproject.org>
2019-11-27 14:52:09 +02:00
David Goulet
cbc495453c hs-v3: Give a cleanup type to hs_circ_cleanup()
By centralizing the circuit cleanup type that is: on close, free and
repurpose, some actions on the circuit can not happen for a certain cleanup
type or for all types.

This passes a cleanup type so the HS subsystem (v2 and v3) can take actions
based on the type of cleanup.

For instance, there is slow code that we do not run on a circuit close but
rather only on free.

Part of #32020

Signed-off-by: David Goulet <dgoulet@torproject.org>
2019-11-27 14:52:09 +02:00
David Goulet
7f83c43594 hs-v3: Note client intro circuit failure
Report back to the v3 subsystem any introduction point client circuit failure
so they can be noted down in the failure cache.

Fixes #32020

Signed-off-by: David Goulet <dgoulet@torproject.org>
2019-11-27 14:52:09 +02:00
David Goulet
1aafe3376e hs-v2: Modernize rend_client_circuit_cleanup() code
Old and messy code path. Structure it in a more pleasant and readable way. No
behavior change with this refactor.

Part of #32020

Signed-off-by: David Goulet <dgoulet@torproject.org>
2019-11-27 14:52:09 +02:00
Neel Chauhan
99cf3f99c0 Make control_event_conf_changed() take a config_line_t 2019-11-26 22:12:23 -05:00
Neel Chauhan
96a15bece7 If statements to getresuid() and getresgid() in setuid.c shouldn't have an extra space 2019-11-26 21:58:31 -05:00
teor
5ec4fb7558
crypt_ops: Fix some weird macro spacing 2019-11-26 11:03:22 +10:00
teor
e66fde45f1
Code Style: Remove double newlines in win32/orconfig.h
There's no reason for them to be in there.

Part of 32522.
2019-11-26 11:02:58 +10:00
teor
d7fdab49f7
test/controller: Stop including a ".c" source file
Part of 32522.
2019-11-26 11:02:05 +10:00
teor
2a71a58d4f
test: Fix a python double-space 2019-11-26 11:00:39 +10:00
Nick Mathewson
31f8b4fa65 Merge branch 'stream-socks-auth' into bug19859_merged 2019-11-25 07:58:02 -05:00
teor
26071aa3be
Merge branch 'maint-0.4.0' into maint-0.4.1 2019-11-25 12:37:07 +10:00
teor
055f5d4d1b
Merge branch 'maint-0.3.5' into maint-0.4.0 2019-11-25 12:36:59 +10:00
teor
c17ab20ac0
Merge remote-tracking branch 'tor-github/pr/1441' into maint-0.4.0 2019-11-25 12:36:41 +10:00
teor
ed6f2f61a2
Merge remote-tracking branch 'tor-github/pr/1396' into maint-0.4.0 2019-11-25 12:35:58 +10:00
teor
501b5174d8
Merge remote-tracking branch 'tor-github/pr/1464' into maint-0.3.5 2019-11-25 12:35:11 +10:00
teor
400cee261e
Merge remote-tracking branch 'tor-github/pr/1422' into maint-0.3.5 2019-11-25 12:34:29 +10:00
teor
54c01119ed
Merge remote-tracking branch 'tor-github/pr/1405' into maint-0.3.5 2019-11-25 12:33:55 +10:00
teor
83424cb62f
Merge remote-tracking branch 'tor-github/pr/1395' into maint-0.3.5 2019-11-25 12:33:14 +10:00
teor
f9812ee5f7
Merge remote-tracking branch 'tor-github/pr/1394' into maint-0.3.5 2019-11-25 12:29:43 +10:00
Nick Mathewson
1d117e826f process_descs.c: rename confusing identifiers
The FP_ identifiers referred to fingerprints, but they also applied
to address ranges.  The router_status_t name invited confusion with
routerstasus_t.  Fixes ticket 29826.

This is an automated commit, generated by this command:

./scripts/maint/rename_c_identifier.py \
        router_status_t rtr_flags_t \
        FP_INVALID RTR_INVALID \
        FP_BADEXIT RTR_BADEXIT \
        FP_REJECT RTR_REJECT
2019-11-23 15:33:13 -05:00
Nick Mathewson
ff7d0ebcfe Fix a low-impact memory leak in options_act_reversible()
Found by Coverity as CID 1455953

Fixes bug 32575; bug not in any released Tor.
2019-11-22 09:04:36 -05:00
Nick Mathewson
cf22841e3b ht.h: improve documentation for HT_NEXT_RMV. 2019-11-21 11:56:42 -05:00
Nick Mathewson
da15448eb8 Merge branch 'ticket32209' 2019-11-21 08:26:20 -05:00
Nick Mathewson
55fac8dafc config.md: suggestions from teor 2019-11-21 08:26:12 -05:00
Nick Mathewson
d8ff7d0236 Merge branch 'reversible_3' 2019-11-21 07:49:18 -05:00
George Kadianakis
f23d4df091 Merge branch 'tor-github/pr/1555' 2019-11-21 13:03:44 +02:00
David Goulet
709d7fba11 hs-v3: Return bad address SOCKS5 extended error
If ExtendedErrors is set for the SocksPort, an invalid .onion address now
returns the 0xF6 error code per prop304.

Closes #30022

Signed-off-by: David Goulet <dgoulet@torproject.org>
2019-11-21 13:02:29 +02:00
David Goulet
00136c9430 hs-v2: Move v2 circuit cleanup actions into hs_circ_cleanup()
Refactor to decomplexify circuit_about_to_free() and finally have one single
entry point into the HS subsystems (v2 and v3) for when a circuit is freed.

With this, hs_circ_cleanup() becomes the one and only entry point when a
circuit is freed which then routes to the right subsystem version for any
actions to be taken.

This moves a big chunk of code from circuituse.c to rendclient.c. No behavior
change. Next commit will refactor it to reduce our technical debt.

Part of #32020

Signed-off-by: David Goulet <dgoulet@torproject.org>
2019-11-20 10:25:52 -05:00
David Goulet
588794771f circ: Add hidden service helper functions
Functions to correctly identify HS circuit type and version.

Part of #32020

Signed-off-by: David Goulet <dgoulet@torproject.org>
2019-11-20 10:25:52 -05:00
Nick Mathewson
b33f3c960d options_act_reversible: add more comments to explain ordering 2019-11-20 09:49:25 -05:00
Nick Mathewson
a3d06179ce Typo/grammar fixes. 2019-11-20 09:28:12 -05:00
Nick Mathewson
acb97cfa68 log config: Set safelogging_changed even if we aren't running Tor. 2019-11-20 09:26:47 -05:00
Nick Mathewson
89c355b386 Some tests for log changes, commit, and rollback 2019-11-20 09:26:47 -05:00
Nick Mathewson
a30d143228 Make KeyDirectory's GroupReadable behave the same as CacheDirectory's.
In #26913 we solved a bug where CacheDirectoryGroupReadable would
override DataDirectoryGroupReadable when the two directories are the
same.  We never did the same for KeyDirectory, though, because
that's a rare setting.

Now that I'm testing this code, though, fixing this issue seems
fine.  Fixes bug #27992; bugfix on 0.3.3.1-alpha.
2019-11-20 09:26:47 -05:00
Nick Mathewson
3094651fa3 New unit tests for options_create_directories(). 2019-11-20 09:26:47 -05:00
Nick Mathewson
9951afe177 parseconf test: ControlSocketsGroupWriteable without ControlSocket. 2019-11-20 09:26:47 -05:00
Nick Mathewson
cd8c96ce02 Typo fix in warning message about ControlSocket 2019-11-20 09:26:47 -05:00
Nick Mathewson
cf7580ab06 Free options objects for which validation fails.
Also free options objects when we discard them due to
TestingTorOptions.

Fixes bug 32555; bug not in any released Tor.
2019-11-20 09:14:08 -05:00
Nick Mathewson
929b46f44a Split listener configuration out of options_act_reversible() 2019-11-19 16:05:07 -05:00
Nick Mathewson
5060007f4b Split log configuration out of options_act_reversible(). 2019-11-19 16:03:32 -05:00
Nick Mathewson
20c24e72d9 options_act_reversible(): Extract more startup-only pieces.
These have to happen after opening listeners and before opening logs :/
2019-11-19 16:03:10 -05:00
Nick Mathewson
006ce47ffa Extract a function for one-time-only pre-reversible options.
These changes _only_ happen at startup, and happen before _any_
reversible option change is set.
2019-11-19 16:03:10 -05:00
Nick Mathewson
effed7fb1c Move some ControlSocket checks to options_validate_cb()
There is no reason for them be in options_act_reversible().
2019-11-19 16:03:10 -05:00
George Kadianakis
21b3303657 Rename REGISTER_SUCCESS_ALSO_DECRYPTED to REGISTER_SUCCESS_AND_DECRYPTED. 2019-11-18 19:21:45 +02:00
George Kadianakis
97fd75169d Various minor improvements after David's review.
- Fix a wrong log message
- Introduce a cap for the nickname size
- Change some 'if' statements to 'switch'.
2019-11-18 19:21:41 +02:00
George Kadianakis
ce422a9d4a hs-v3: Decrypt pending descriptors when we get new client auth creds. 2019-11-18 19:21:34 +02:00
George Kadianakis
b996d55bcd control-port: Tests for ONION_CLIENT_AUTH_VIEW. 2019-11-18 19:19:10 +02:00
George Kadianakis
db6a48b6bf control-port: Implement ONION_CLIENT_AUTH_VIEW. 2019-11-18 19:19:00 +02:00
George Kadianakis
ee4b2287c6 control-port: Tests for ONION_CLIENT_AUTH_REMOVE. 2019-11-18 19:18:56 +02:00
George Kadianakis
8330b4dc2a control-port: Implement ONION_CLIENT_AUTH_REMOVE. 2019-11-18 19:18:49 +02:00
George Kadianakis
46f4415022 control-port: Tests for ONION_CLIENT_AUTH_ADD. 2019-11-18 19:18:45 +02:00
George Kadianakis
00fdaaee1e control-port: Implement ONION_CLIENT_AUTH_ADD. 2019-11-18 19:16:01 +02:00
George Kadianakis
d28b6792cb Merge branch 'tor-github/pr/1423' 2019-11-18 19:06:53 +02:00
David Goulet
3892ac7c71 test: Unit test for the hs cache decrypt on new auth
Part of #30382

Signed-off-by: David Goulet <dgoulet@torproject.org>
2019-11-18 19:06:43 +02:00
David Goulet
c0dd5324b3 test: Unit test for the SOCKS5 HS client auth errors
Part of #30382

Signed-off-by: David Goulet <dgoulet@torproject.org>
2019-11-18 19:06:43 +02:00
David Goulet
68a004d147 hs-v3: Improve documentation of hs_cache_client_descriptor_t
Signed-off-by: David Goulet <dgoulet@torproject.org>
2019-11-18 19:06:43 +02:00
David Goulet
48a9f8a63f hs-v3: Function to re-parse unencrypted descriptor
We now keep descriptor that we can't decode due to missing client
authorization in the cache.

This new function is used when new client authorization are added and to tell
the client cache to retry decoding.

Part of #30382

Signed-off-by: David Goulet <dgoulet@torproject.org>
2019-11-18 19:06:43 +02:00
David Goulet
fbc18c8989 hs-v3: Refactor descriptor dir fetch done code
This commit extract most of the code that dirclient.c had to handle the end of
a descriptor directory requests (fetch). It is moved into hs_client.c in order
to have one single point of entry and the rest is fully handled by the HS
subsystem.

As part of #30382, depending on how the descriptor ended up stored (decoded or
not), different SOCKS error code can be returned.

Signed-off-by: David Goulet <dgoulet@torproject.org>
2019-11-18 19:06:43 +02:00
David Goulet
80f241907c hs-v3: Set extended error if .onion is invalid
In order to achieve this, the parse_extended_hostname() had to be refactored
to return either success or failure and setting the hostname type in the given
parameter.

The reason for that is so it can detect invalid onion addresses that is having
a ".onion", the right length but just not passing validation.

That way, we can send back the prop304 ExtendedError "X'F1' Onion Service
Descriptor Is Invalid" to notify the SOCKS connection of the invalid onion
address.

Part of #30382

Signed-off-by: David Goulet <dgoulet@torproject.org>
2019-11-18 19:06:43 +02:00
David Goulet
542402cd60 hs-v3: Set extended error when missing/bad client auth
Part of #30382

Signed-off-by: David Goulet <dgoulet@torproject.org>
2019-11-18 19:06:43 +02:00
David Goulet
fb1d212021 hs-v3: Set extended error when descriptor is not found
Part of #30382

Signed-off-by: David Goulet <dgoulet@torproject.org>
2019-11-18 19:06:43 +02:00
David Goulet
7bba8bf72f hs-v3: Return descriptor decoding status when storing as client
This will allow us to callback into the HS subsytem depending on the decoding
status and return an extended SOCKS5 error code depending on the decoding
issue.

This is how we'll be able to tell the SocksPort connection if we are missing
or have bad client authorization for a service.

Part of #30382

Signed-off-by: David Goulet <dgoulet@torproject.org>
2019-11-18 19:06:43 +02:00
David Goulet
96a53221b0 hs-v3: Keep descriptor in cache if client auth is missing or bad
We now keep the descriptor in the cache, obviously not decoded, if it can't be
decrypted for which we believe client authorization is missing or unusable
(bad).

This way, it can be used later once the client authorization are added or
updated.

Part of #30382

Signed-off-by: David Goulet <dgoulet@torproject.org>
2019-11-18 19:06:43 +02:00
teor
c34fb3413d
Merge remote-tracking branch 'tor-github/pr/1517' 2019-11-18 11:21:37 +10:00
Nick Mathewson
183f89ccac Merge remote-tracking branch 'tor-github/pr/1545' 2019-11-16 15:30:00 -05:00
Nick Mathewson
b0c1634ce9 Merge remote-tracking branch 'tor-github/pr/1544' 2019-11-16 15:29:14 -05:00
Nick Mathewson
59ba61a690 Make structs declared by tor_queues.h macros also follow naming rules 2019-11-16 15:27:08 -05:00
Nick Mathewson
cc271afeda map.h: replace maptype with mapname_t
This change makes our macro bodies consistent with our naming
expectations for structs and types outside macro bodies.
2019-11-16 15:20:47 -05:00
Nick Mathewson
0c80c2e45f handles.h: replace structname with structname_t
This change makes our macro bodies consistent with our naming
expectations for structs and types outside macro bodies.
2019-11-16 15:20:32 -05:00
Nick Mathewson
5a1a60e65e Revise struct names in examples in comments to end with _t 2019-11-16 15:12:35 -05:00
Nick Mathewson
d700dc7801 Topic documentation on our publish-subscribe architecture. 2019-11-16 14:31:49 -05:00
Nick Mathewson
0e4e96b9bf High-level documentation of configuration in Tor.
Closes ticket 32209.
2019-11-15 16:25:00 -05:00
Neel Chauhan
c8859eb754 Remove the extra whitespace around the DARWIN #defines 2019-11-15 15:05:53 -05:00