Commit Graph

37144 Commits

Author SHA1 Message Date
Nick Mathewson
0d63b19afa Merge branch 'maint-0.4.5' 2021-04-13 09:41:13 -04:00
David Goulet
ba2ee8ae3b scripts: Add default include path to ccls generated file
Signed-off-by: David Goulet <dgoulet@torproject.org>
2021-04-12 12:55:52 -04:00
David Goulet
218f9f90fb guard: Don't check bridge transport name when selecting eligible guards
This is related to ticket #40360 which found this problem when a Bridge entry
with a transport name (let say obfs4) is set without a fingerprint:

  Bridge obfs4 <IP>:<PORT> cert=<...> iat-mode=0

(Notice, no fingerprint between PORT and "cert=")

Problem: commit 09c6d03246 added a check in
get_sampled_guard_for_bridge() that would return NULL if the selected bridge
did not have a valid transport name (that is the Bridge transport name that
corresponds to a ClientTransportPlugin).

Unfortuantely, this function is also used when selecting our eligible guards
which is done *before* the transport list is populated and so the added check
for the bridge<->transport name is querying an empty list of transports
resulting in always returning NULL.

For completion, the logic is: Pick eligible guards (use bridge(s) if need be)
then for those, initiate a connection to the pluggable transport proxy and
then populate the transport list once we've connected.

Back to get_sampled_guard_for_bridge(). As said earlier, it is used when
selecting our eligible guards in a way that prevents us from selecting
duplicates. In other words, if that function returns non-NULL, the selection
continues considering the bridge was sampled before. But if it returns NULL,
the relay is added to the eligible list.

This bug made it that our eligible guard list was populated with the *same*
bridge 3 times like so (remember no fingerprint):

  [info] entry_guards_update_primary(): Primary entry guards have changed. New primary guard list is:
  [info] entry_guards_update_primary():   1/3: [bridge] ($0000000000000000000000000000000000000000)
  [info] entry_guards_update_primary():   2/3: [bridge] ($0000000000000000000000000000000000000000)
  [info] entry_guards_update_primary():   3/3: [bridge] ($0000000000000000000000000000000000000000)

When tor starts, it will find the bridge fingerprint by connecting to it and
will then update the primary guard list by calling
entry_guard_learned_bridge_identity() which then goes and update only 1 single
entry resulting in this list:

  [debug] sampled_guards_update_consensus_presence(): Sampled guard [bridge] ($<FINGERPRINT>) is still listed.
  [debug] sampled_guards_update_consensus_presence(): Sampled guard [bridge] ($0000000000000000000000000000000000000000) is still listed.
  [debug] sampled_guards_update_consensus_presence(): Sampled guard [bridge] ($0000000000000000000000000000000000000000) is still listed.

And here lies the problem, now tor is stuck attempting to wait for a valid
descriptor for at least 2 guards where the second one is a bunch of zeroes and
thus tor will never fully bootstraps:

  [info] I learned some more directory information, but not enough to build a
  circuit: We're missing descriptors for 1/2 of our primary entry guards
  (total microdescriptors: 6671/6703). That's ok. We will try to fetch missing
  descriptors soon.

Now, why passing the fingerprint then works? This is because the list of
guards contains 3 times the same bridge but they all have a fingerprint and so
the descriptor can be found and tor can bootstraps.

The solution here is to entirely remove the transport name check in
get_sampled_guard_for_bridge() since the transport_list is empty at that
point. That way, the eligible guard list only gets 1 entry, the bridge, and
can then go on to bootstrap properly.

It is OK to do so since when launching a bridge descriptor fetch, we validate
that the bridge transport name is OK and thus avoid connecting to a bridge
without a ClientTransportPlugin. If we wanted to keep the check in place, we
would need to populate the transport_list much earlier and this would require
a much bigger refactoring.

Fixes #40360

Signed-off-by: David Goulet <dgoulet@torproject.org>
2021-04-08 14:08:28 -04:00
George Kadianakis
62614f0b3f Merge remote-tracking branch 'tor-gitlab/mr/354' 2021-04-08 14:37:30 +03:00
George Kadianakis
e0b8a79b2e Merge branch 'maint-0.4.5' 2021-04-08 14:29:08 +03:00
George Kadianakis
b07ed22cbb Merge remote-tracking branch 'tor-gitlab/mr/273' 2021-04-08 14:20:53 +03:00
George Kadianakis
5ebf2b81a1 Merge remote-tracking branch 'tor-gitlab/mr/345' 2021-04-05 17:07:05 +03:00
Nick Mathewson
e9c950af82 src/config/README: add documentation for geoip format. 2021-04-02 12:37:13 -04:00
George Kadianakis
769d54c5d7 Add two new test vectors for ed25519 key blinding.
- Also fix the vector producing script to work with python3.
2021-03-30 00:03:27 +03:00
Daniel Pinto
ce60454afd Add long format name --torrc-file for command line option -f. #40324 2021-03-28 03:56:31 +01:00
Daniel Pinto
36768b5756 Fix glob processing on BSD systems. #40318
On Linux systems, glob automatically ignores the errors ENOENT and
ENOTDIR because they are expected during glob expansion. But BSD
systems do not ignore these, resulting in glob failing when globs
expand to invalid paths. This is fixed by adding a custom error
handler that ignores only these two errors and removing the
GLOB_ERR flag as it makes glob fail even if the error handler
ignores the error and is unnecessary as the error handler will
make glob fail on all other errors anyway.
2021-03-26 01:56:07 +00:00
Daniel Pinto
272cb803df Avoid unused function warnings on libc's without GLOB_ALTDIRFUNC #40354 2021-03-24 22:26:39 +00:00
Roger Dingledine
6c14f9076f fix up the keypinning comments 2021-03-24 18:17:13 -04:00
Roger Dingledine
962b15aa6f fix some tiny typos 2021-03-24 18:13:46 -04:00
Nick Mathewson
c359c3056b Merge branch 'maint-0.4.4' into maint-0.4.5 2021-03-24 12:25:05 -04:00
Nick Mathewson
f6af8e2021 Merge branch 'maint-0.4.5' 2021-03-24 12:25:05 -04:00
Nick Mathewson
37b16d7e19 Merge remote-tracking branch 'tor-gitlab/mr/339' 2021-03-24 12:23:30 -04:00
Nick Mathewson
c9db3c1bdf Retroactively add a missing changelog entry for v2 hs removal
Closes #40348.
2021-03-24 09:52:05 -04:00
George Kadianakis
f1c673fa54 Merge remote-tracking branch 'tor-gitlab/mr/343' 2021-03-24 13:17:27 +02:00
David Goulet
0cf3ab54f6 Merge branch 'tor-gitlab/mr/337' 2021-03-23 09:42:21 -04:00
Nick Mathewson
08a1b4d6b1 Add a DormantTimeoutEnabled to disable dormant mode entirely
(If you need to do this in an older version you can just set
DormantClientTimeout to something huge.)

Closes #40228.
2021-03-23 09:40:58 -04:00
David Goulet
9ca2394d6b channel: Fix use after free in channel_do_open_actions()
Fortunately, our tor_free() is setting the variable to NULL after so we were
in a situation where NULL was always used instead of the transport name.

This first appeared in 894ff2dc84 and results in
basically no bridge with a transport being able to use DoS defenses.

Fixes #40345

Signed-off-by: David Goulet <dgoulet@torproject.org>
2021-03-23 09:19:41 -04:00
David Goulet
3a2593710b man: HiddenServiceStatistics applies for bridges
Closes #40346

Signed-off-by: David Goulet <dgoulet@torproject.org>
2021-03-23 08:32:26 -04:00
David Goulet
35b601a8b5 Merge branch 'tor-gitlab/mr/342' 2021-03-23 08:19:02 -04:00
Nick Mathewson
5c7f9844e4 manpage:Move BridgeRecordUsageByCountry to statistics section
patch from cypherpunks; closes #40323
2021-03-22 14:09:22 -04:00
George Kadianakis
ed7081ae2e Improve the man page entry for Address.
Fixes bug #40296 .
2021-03-22 16:38:34 +02:00
Nick Mathewson
0229d5f818 Add "Heartbeat" to the start of several heartbeat messages.
Closes #40322.
2021-03-19 13:33:56 -04:00
Nick Mathewson
2dfa19a871 Move ServerTransport* options to 'Server Options' section.
Patch from 'cypherpunks'. Closes #40331.
2021-03-19 13:23:29 -04:00
Nick Mathewson
40294c8ab1 Link to bridges.torproject.org/info in BridgeDistribution entry.
This incorporates a suggestion from cypherpunks on #40321

Closes #40321.
2021-03-19 13:10:41 -04:00
Nick Mathewson
3f7824ff68 bump to 0.4.6.1-alpha-dev 2021-03-18 13:48:19 -04:00
Nick Mathewson
cd0e5a942e Terminate rep_hist_get_overload_stats_lines() with an NL.
We use it in router.c, where chunks are joined with "", not with
NL... so leaving off the terminating NL will lead to an unparseable
extrainfo.

Found by toralf. Bug not in any released Tor.
2021-03-18 13:30:49 -04:00
Nick Mathewson
411db63fc3 Minor edits to changelog 2021-03-18 10:16:37 -04:00
Nick Mathewson
ded8f9b378 Fold new entries into 0.4.6.1-alpha ChangeLog 2021-03-18 09:51:37 -04:00
George Kadianakis
80da1761a6 Fix compiler warning about signed/unsigned conversion.
```
src/feature/stats/rephist.c: In function ‘overload_happened_recently’:
src/feature/stats/rephist.c:215:21: error: comparison between signed and unsigned integer expressions [-Werror=sign-compare]
   if (overload_time > approx_time() - 3600 * n_hours) {
```
from https://gitlab.torproject.org/tpo/core/tor/-/issues/40341#note_2729364
2021-03-17 20:03:39 +02:00
Roger Dingledine
6de09642f0 warn and reject reentering streams at client too
Clients now check whether their streams are attempting to re-enter
the Tor network (i.e. to send Tor traffic over Tor), and they close
them preemptively if they think exit relays will refuse them.

See bug 2667 for details. Resolves ticket 40271.
2021-03-17 13:04:23 -04:00
George Kadianakis
29f07a4e9d Merge branch 'mr/334' 2021-03-17 18:23:18 +02:00
George Kadianakis
7740a8b5d4 Rate-limit counter should increase once per minute. 2021-03-17 18:22:38 +02:00
George Kadianakis
e688580277 Implement rate limiting metrics. 2021-03-17 18:22:38 +02:00
George Kadianakis
faf1fe833e Implement port/file-descriptor exhaustion metric.
This uses a heuristic that came up after a discussion with David.

I'm leaving this as a separate commit so that it can be discussed further if
needed.
2021-03-17 18:22:38 +02:00
George Kadianakis
f493a12e89 Implement straightforward overload general metrics.
- OOM metric
- onionskin overload metric
- DNS timeout metric
2021-03-17 18:22:38 +02:00
George Kadianakis
0a5ecb3342 Implement backbone of overload statistics.
- Implement overload statistics structure.
- Implement function that keeps track of overload statistics.
- Implement function that writes overload statistics to descriptor.
- Unittest for the whole logic.
2021-03-17 18:22:38 +02:00
David Goulet
15a95df376 Merge branch 'tor-gitlab/mr/337' 2021-03-17 11:53:14 -04:00
Nick Mathewson
066748c9cd Add a DormantTimeoutEnabled to disable dormant mode entirely
(If you need to do this in an older version you can just set
DormantClientTimeout to something huge.)

Closes #40228.
2021-03-17 11:53:09 -04:00
George Kadianakis
0ac03390e4 Merge branch 'maint-0.4.5' 2021-03-17 13:43:48 +02:00
George Kadianakis
59bbf8cde9 Merge remote-tracking branch 'tor-gitlab/mr/333' into maint-0.4.5 2021-03-17 13:43:38 +02:00
Nick Mathewson
36b54fc6aa Merge branch 'maint-0.4.5'
"ours" to avoid version bump.
2021-03-16 09:18:40 -04:00
Nick Mathewson
d66178c7b7 Bump version to 0.4.5.7-dev 2021-03-16 09:18:27 -04:00
Nick Mathewson
e2dd8f1532 Merge branch 'maint-0.4.4' into maint-0.4.5
"ours" to avoid version bump.
2021-03-16 09:18:06 -04:00
Nick Mathewson
94fb308c5d Bump version to 0.4.4.8-dev 2021-03-16 09:17:56 -04:00
Nick Mathewson
5fac24053d Merge branch 'maint-0.3.5' into maint-0.4.4
"ours" to avoid version bump.
2021-03-16 09:17:40 -04:00