Commit Graph

27646 Commits

Author SHA1 Message Date
David Goulet
ea48ddc955 dns: Do not trigger overload general on DNS timeout
This was missed in #40527 when the DNS timeout overload general signal
was removed.

Closes #40564

Signed-off-by: David Goulet <dgoulet@torproject.org>
2022-02-14 13:20:53 -05:00
David Goulet
52d1c1fd31 Merge branch 'tor-gitlab/mr/518' 2022-02-09 10:36:26 -05:00
David Goulet
763d72238d kist: Don't try to flush empty outbuf
It is possible that a scheduled channel ended up with 0 bytes in its
outbuf after the scheduling loop and having an outbuf table entry
indicating that we need to flush bytes on the wire after the loop.

This lead to attempt to write 0 bytes up to the TLS layer that would
prevent such action.

All in all, this fixes wasted CPU cycles on attempting to flush nothing.

Fixes #40548

Signed-off-by: David Goulet <dgoulet@torproject.org>
2022-02-08 09:31:17 -05:00
David Goulet
9bf4a9e18a nss: Don't write empty payload on the wire
Part of #40548

Signed-off-by: David Goulet <dgoulet@torproject.org>
2022-02-08 09:31:13 -05:00
Tor CI Release
5afdc851b2 version: Bump version to 0.4.6.10-dev 2022-02-04 12:36:31 -05:00
Tor CI Release
92b4e4d041 version: Bump version to 0.4.5.12-dev 2022-02-04 12:36:01 -05:00
Tor CI Release
81a4f92b64 version: Bump version to 0.4.6.10 2022-02-04 11:09:56 -05:00
Tor CI Release
774374ebf5 version: Bump version to 0.4.5.12 2022-02-04 11:09:12 -05:00
David Goulet
d0d45a97d8 Merge branch 'maint-0.4.6' 2022-02-04 11:07:34 -05:00
David Goulet
728191fc2e Merge branch 'maint-0.4.5' into maint-0.4.6 2022-02-04 11:07:34 -05:00
Tor CI Release
6a6332a683 fallbackdir: Update list generated on February 04, 2022 2022-02-04 11:05:21 -05:00
Tor CI Release
5ab4fa9fd8 Update geoip files to match ipfire location db, 2022/02/04. 2022-02-04 11:05:13 -05:00
Tor CI Release
cfe022d01d Update geoip files to match ipfire location db, 2021/12/15. 2022-02-04 10:56:29 -05:00
Tor CI Release
f03cab5dbb fallbackdir: Update list generated on December 15, 2021 2022-02-04 10:17:10 -05:00
David Goulet
6b06803e0d Merge branch 'maint-0.4.6' 2022-02-03 08:30:59 -05:00
David Goulet
a08b12568e Merge branch 'maint-0.4.5' into maint-0.4.6 2022-02-03 08:30:40 -05:00
David Goulet
3c73622f27 hs: Double quote the metrics label value
Fixes #40552

Signed-off-by: David Goulet <dgoulet@torproject.org>
2022-02-03 08:30:23 -05:00
Alexander Færøy
8771199e6b Merge remote-tracking branch 'tor-gitlab/mr/513' into main 2022-01-25 21:42:44 +00:00
David Goulet
421ce94395 version: Bump version to 0.3.5.18
Signed-off-by: David Goulet <dgoulet@torproject.org>
2022-01-24 10:48:15 -05:00
David Goulet
28881d0a92 fallbackdir: Update list generated on January 24, 2022
Signed-off-by: David Goulet <dgoulet@torproject.org>
2022-01-24 10:35:18 -05:00
David Goulet
324ded93be geoip: Update to match ipfire location db, 2022/01/24.
Signed-off-by: David Goulet <dgoulet@torproject.org>
2022-01-24 10:31:43 -05:00
pseudonymisaTor
f1387b398c conn: add ClientHello Padding TLS extension 2022-01-23 09:24:28 +00:00
Nick Mathewson
7a3d60d471 Use an alternative solution to the warning in trace_probes_cc.c 2022-01-20 14:46:38 -05:00
Nick Mathewson
935d7b5803 Resolve typedef conflict from congestion_control_t
Resumes being able to build on old / esoteric gcc versions.

Fixes bug 40550; bugfix on 0.4.7.1-alpha.
2022-01-20 14:22:00 -05:00
David Goulet
222fbba4ff relay: Fix memory leak on BUG() code path
Introduced in bf10206e9e which is not
released yet thus no changes file.

Found by Coverity with cid #1495786.

Fixes #40532

Signed-off-by: David Goulet <dgoulet@torproject.org>
2022-01-19 14:01:34 -05:00
David Goulet
0f9967c945 Merge branch 'maint-0.4.5' into maint-0.4.6 2022-01-19 13:56:43 -05:00
David Goulet
8e407e3329 Merge branch 'maint-0.4.6' 2022-01-19 13:56:43 -05:00
David Goulet
986730e82c test: Remove HSv2 protover specific test
HSv2 is not advertised as a supported protocol version anymore.

This was introduced with the merge-forward of commit 72041c6306
which didn't fix the unit test.

Fixes #40549

Signed-off-by: David Goulet <dgoulet@torproject.org>
2022-01-19 13:36:23 -05:00
David Goulet
4d60ab8fb7 Merge branch 'maint-0.4.5' into maint-0.4.6 2022-01-18 13:15:38 -05:00
David Goulet
162c9f1b81 Merge branch 'maint-0.4.6' 2022-01-18 13:15:38 -05:00
David Goulet
4ab4521c31 Merge branch 'maint-0.3.5' into maint-0.4.5 2022-01-18 13:15:38 -05:00
David Goulet
501d8bbd4c Merge branch 'tor-gitlab/mr/511' into maint-0.3.5 2022-01-18 13:15:33 -05:00
David Goulet
ec5611e876 Merge branch 'maint-0.4.5' into maint-0.4.6 2022-01-18 13:15:29 -05:00
David Goulet
e949586889 Merge branch 'maint-0.4.6' 2022-01-18 13:15:29 -05:00
David Goulet
49c758af47 Merge branch 'maint-0.3.5' into maint-0.4.5 2022-01-18 13:15:29 -05:00
David Goulet
e523480691 Merge branch 'tor-gitlab/mr/510' into maint-0.3.5 2022-01-18 13:15:23 -05:00
David Goulet
7d9d769123 Merge branch 'maint-0.4.5' into maint-0.4.6 2022-01-18 13:12:35 -05:00
David Goulet
a4510603f7 Merge branch 'maint-0.4.6' 2022-01-18 13:12:35 -05:00
David Goulet
aac5731f86 Merge branch 'maint-0.3.5' into maint-0.4.5 2022-01-18 13:12:13 -05:00
Jérôme Charaoui
d6c2da6630 Update new relay blogpost URL
This removes the '/blog/' URL component which relies on a 
redirection since the blog has been migrated to Lektor
2022-01-18 12:56:34 -05:00
David Goulet
b9c06718a8 main: Update a dead URL in a log notice
Change https://www.torproject.org/download/download#warning to
https://support.torproject.org/faq/staying-anonymous/

Closes #40544

Signed-off-by: David Goulet <dgoulet@torproject.org>
2022-01-18 12:51:52 -05:00
David Goulet
72041c6306 relay: Don't advertise HSv2 protocol version
We removed HSIntro=3 and HSDir=1 that are v2 specific. Since 0.3.5.17,
we do not support introducing or being a directory for onion service v2.

Closes #40509

Signed-off-by: David Goulet <dgoulet@torproject.org>
2022-01-18 12:39:06 -05:00
Alexander Færøy
66e7ddb551 Merge remote-tracking branch 'tor-gitlab/mr/503' into main 2021-12-17 16:53:47 +00:00
Nick Mathewson
5591a3bcd6 Merge remote-tracking branch 'tor-gitlab/mr/504' 2021-12-16 12:36:35 -05:00
Tor CI Release
00d7337002 version: Bump version to 0.4.6.9-dev 2021-12-16 12:00:07 -05:00
Tor CI Release
475d669f62 version: Bump version to 0.4.7.3-alpha-dev 2021-12-16 11:59:20 -05:00
David Goulet
7a8aa8e36d Merge branch 'maint-0.4.6' 2021-12-16 09:28:17 -05:00
Tor CI Release
9a4366b3e3 Update geoip files to match ipfire location db, 2021/12/15. 2021-12-16 09:27:46 -05:00
Tor CI Release
57e8a9b8cb fallbackdir: Update list generated on December 15, 2021 2021-12-16 09:27:39 -05:00
Tor CI Release
955aa02c0d version: Bump version to 0.4.7.3-alpha 2021-12-16 09:27:29 -05:00
Tor CI Release
faad5ded78 version: Bump version to 0.4.6.9 2021-12-16 09:23:30 -05:00
Hans-Christoph Steiner
a86918d524 fix syntax errors listed by cppcheck 2021-12-16 10:21:18 +01:00
David Goulet
bf10206e9e Fix compiler warnings from ubuntu/jammy
Signed-off-by: David Goulet <dgoulet@torproject.org>
2021-12-15 09:00:15 -05:00
Alexander Færøy
193781e6ef Merge remote-tracking branch 'tor-gitlab/mr/500' into main 2021-12-15 12:46:18 +00:00
Alexander Færøy
48d778bc32 Merge remote-tracking branch 'tor-gitlab/mr/491' into main 2021-12-15 12:41:00 +00:00
Alexander Færøy
95b82c4fee Merge remote-tracking branch 'tor-gitlab/mr/497' into main 2021-12-15 12:38:30 +00:00
David Goulet
eb06d52dae fixup! relay: Change DNS timeout label on MetricsPort
Signed-off-by: David Goulet <dgoulet@torproject.org>
2021-12-14 16:13:00 -05:00
David Goulet
b37674fec7 fixup! relay: Change DNS timeout label on MetricsPort
Signed-off-by: David Goulet <dgoulet@torproject.org>
2021-12-14 16:12:17 -05:00
David Goulet
bf1ed5c853 relay: Change DNS timeout label on MetricsPort
Change it from "timeout" to "tor_timeout" in order to indicate that the
DNS timeout is one from tor's DNS threshold and not the DNS server
itself.

Fixes #40527

Signed-off-by: David Goulet <dgoulet@torproject.org>
2021-12-13 10:49:00 -05:00
David Goulet
ad6a0ebb11 Merge branch 'ticket40527_046_01' into ticket40527_047_01 2021-12-13 10:48:54 -05:00
David Goulet
cda7acb35d relay: Don't make DNS timeout trigger an overload
Tor has configure libevent to attempt up to 3 times a DNS query for a
maximum of 5 seconds each. Once that 5 seconds has elapsed, it consider
the query "Timed Out" but tor only gets a timeout if all 3 attempts have
failed.

For example, using Unbound, it has a much higher threshold of timeout.
It is well defined in
https://www.nlnetlabs.nl/documentation/unbound/info-timeout/ and has
some complexity to it. But the gist is that if it times out, it will be
much more than 5 seconds.

And so the Tor DNS timeouts are more of a "UX issue" rather than a
"network issue". For this reason, we are removing this metric from the
overload general signal.

See https://gitlab.torproject.org/tpo/network-health/team/-/issues/139
for more information.

Fixes #40527

Signed-off-by: David Goulet <dgoulet@torproject.org>
2021-12-13 10:47:46 -05:00
Nick Mathewson
86819229af Limit the number of elements in a consdiff hash line.
This avoids performing and then freeing a lot of small mallocs() if
the hash line has too many elements.

Fixes one case of bug 40472; resolves OSS-Fuzz 38363.  Bugfix on
0.3.1.1-alpha when the consdiff parsing code was introduced.
2021-12-06 12:35:08 -05:00
Cecylia Bocovich
0d3894dbbc
Add documentation on {C,S}METHOD parsing behaviour 2021-11-23 11:18:04 -05:00
Cecylia Bocovich
809b636b6e
Don't kill managed proxy on method error
Some PT applications support more than one transport. For example,
obfs4proxy supports obfs4, obfs3, and meek. If one or more transports
specified in the torrc file are supported, we shouldn't kill the managed
proxy on a {C,S}METHOD-ERROR. Instead, we should log a warning.

We were already logging warnings on method errors. This change just
makes sure that the managed proxy isn't killed, and then if no
transports are configured for the managed proxy, bumps the log level up
from a notice to a warning.

Closes #7362
2021-11-19 14:50:36 -05:00
Nick Mathewson
dd085d42f9 Do not count controller-selected paths towards path bias.
As a side effect, this fixes a "Bug" warning.

Closes #40515.  Bugfix on 0.2.4.10-alpha.
2021-11-15 08:55:47 -05:00
Alexander Færøy
d1493f2f27 Merge remote-tracking branch 'tor-gitlab/mr/485' into main 2021-11-08 14:14:03 +00:00
Alexander Færøy
fe52c87652 Merge remote-tracking branch 'tor-gitlab/mr/480' into main 2021-11-08 14:12:22 +00:00
Roger Dingledine
5ee85c1fac fix an already-existing bug in the unit tests
where the or_conn for testing the failure cache would be initialized
with random stack data, so e.g. its potentially_used_for_bootstrapping
field would start out at some random value.
2021-11-08 05:37:02 -05:00
Roger Dingledine
5ad126a51b don't cache connect failures from our own circuits
The connect failure cache had a bad interaction with retrying connections
to our guards or bridges when we go offline and then come back online --
while offline we would fail to connect and cache this result, and then
when we return we would decline to even attempt to connect, because our
failure cache said it wouldn't work.

Now only cache connect failures for relays when we connected to them
because of somebody else's EXTEND request.

Fixes bug 40499; bugfix on 0.3.3.4-alpha.
2021-11-08 05:37:02 -05:00
Nick Mathewson
c93114ec9e Prefer use of __MINGW_PRINTF/SCANF_FORMAT if available.
Mingw headers sometimes like to define alternative scanf/printf
format attributes depending on whether they're using clang, UCRT,
MINGW_ANSI_STDIO, or the microsoft version of printf/scanf.  This
change attempts to use the right one on the given platform.

This is an attempt to fix part of #40355.
2021-11-05 12:36:34 -04:00
David Goulet
77b265f96e Merge branch 'maint-0.4.5' into maint-0.4.6 2021-11-05 10:44:10 -04:00
David Goulet
1c77deca4f Merge branch 'maint-0.4.6' 2021-11-05 10:44:10 -04:00
David Goulet
a7fe37f1fa protover: Fix merge forward from 035
Signed-off-by: David Goulet <dgoulet@torproject.org>
2021-11-05 10:42:54 -04:00
David Goulet
47adba879c Merge branch 'maint-0.3.5' into maint-0.4.5 2021-11-05 10:35:08 -04:00
Nick Mathewson
439e17180c Light edit to protover warnings. 2021-11-05 10:30:57 -04:00
Simon South
001d880d10 sandbox: Allow "statx" syscall on i386 for glibc 2.33
glibc versions 2.33 and newer use the modern "statx" system call in their
implementations of stat() and opendir() for Linux on i386.  Prevent failures in
the sandbox unit tests by modifying the sandbox to allow this system call
without restriction on i386 when it is available, and update the test suite to
skip the "sandbox/stat_filename" test in this case as it is certain to fail.
2021-11-05 10:30:51 -04:00
Simon South
d59f63f1c4 test: Skip sandbox/stat_filename where "stat64" syscall defined
On 32-bit architectures where Linux provides the "stat64" system call,
including i386, the sandbox is unable to filter calls to stat() as glibc uses
this system call itself internally and the sandbox must allow it without
restriction.

Update the sandbox unit tests to skip the "sandbox/stat_filename" test on
systems where the "stat64" system call is defined and the test is certain to
fail.  Also reorder the "#if" statement's clauses to correspond with the
comment preceding it, for clarity.
2021-11-05 10:30:51 -04:00
Simon South
f5980e60ed sandbox: Allow "clock_gettime64" syscall where defined
On 32-bit architectures where Linux provides the "clock_gettime64" system call,
including i386, glibc uses it in place of "clock_gettime".  Modify the sandbox
implementation to match, to prevent Tor's monotonic-time functions (in
src/lib/time/compat_time.c) failing when the sandbox is active.
2021-11-05 10:30:51 -04:00
Simon South
55571fc8d7 sandbox: Filter "chown32" syscall on i386
On i386 glibc uses the "chown32" system call instead of "chown".  Prevent
attempts to filter calls to chown() on this architecture from failing by
modifying the sandbox implementation to match.
2021-11-05 10:30:51 -04:00
David Goulet
f93cd5deb8 protover: Add a note on why LinkAuth is not recommended or required
Signed-off-by: David Goulet <dgoulet@torproject.org>
2021-11-05 10:16:08 -04:00
David Goulet
3d1a49908c protover: Move all hardcoded lists in one place
This also moves the warnings and add some theatrical effect around the
code so anyone modifying those list should notice the warnings signs and
read the comment accordingly.

Signed-off-by: David Goulet <dgoulet@torproject.org>
2021-11-05 10:13:47 -04:00
Nick Mathewson
7c085490f5 Add scary warnings about changing the protover list.
Doing this in the wrong way has potential to cause serious havoc on
the network, so let's make it harder for future programmers to mess
it up.
2021-11-05 09:20:05 -04:00
David Goulet
36e6ad6c7b Merge branch 'maint-0.4.6' 2021-11-03 09:53:35 -04:00
David Goulet
83f8fe05e8 Merge branch 'maint-0.4.5' into maint-0.4.6
Signed-off-by: David Goulet <dgoulet@torproject.org>
2021-11-03 09:53:31 -04:00
David Goulet
6e8e1a4e6f relay: Don't allow DirPort on non-IPv4
Our code doesn't allow it and so this prevents an assert() crash if the
DirPort is for instance IPv6 only.

Fixes #40494

Signed-off-by: David Goulet <dgoulet@torproject.org>
2021-11-03 09:51:46 -04:00
Alexander Færøy
f6600377b4 Merge remote-tracking branch 'tor-gitlab/mr/474' into main 2021-11-02 15:28:56 +00:00
Alexander Færøy
ee38ec02f3 Use TOR_PRIuSZ instead of %ld for CC logging.
This patch fixes the current build of main on Windows.
2021-10-29 19:08:20 +00:00
Alexander Færøy
5c8deef9b6 Fix Windows build.
While trying to resolve our CI issues, the Windows build broke with an
unused function error:

   src/test/test_switch_id.c:37:1: error: ‘unprivileged_port_range_start’
   defined but not used [-Werror=unused-function]

We solve this by moving the `#if !defined(_WIN32)` test above the
`unprivileged_port_range_start()` function defintion such that it is
included in its body.

This is an unreviewed commit.

See: tor#40275
2021-10-29 16:52:18 +00:00
Roger Dingledine
7084ec8710 don't retry entry guards if they're bridges without descriptors
When we don't yet have a descriptor for one of our bridges, disable
the entry guard retry schedule on that bridge. The entry guard retry
schedule and the bridge descriptor retry schedule can conflict,
e.g. where we mark a bridge as "maybe up" yet we don't try to fetch
its descriptor yet, leading Tor to wait (refusing to do anything)
until it becomes time to fetch the descriptor.

Fixes bug 40497; bugfix on 0.3.0.3-alpha.
2021-10-28 20:57:28 -04:00
Roger Dingledine
f9cb7e3398 do notice-level log when we resume having enough dir info
we do a notice-level log when we decide we *don't* have enough dir
info, but in 0.3.5.1-alpha (see commit eee62e13d9, #14950) we lost our
corresponding notice-level log when things come back.

bugfix on 0.3.5.1-alpha; fixes bug 40496.
2021-10-28 20:57:28 -04:00
Roger Dingledine
db34f6c9e8 handle other de-sync cases from #40396
Specifically, every time a guard moves into or out of state
GUARD_REACHABLE_MAYBE, it is an opportunity for the guard reachability
state to get out of sync with the have-minimum-dir-info state.

Fixes even more of #40396.
2021-10-28 20:57:28 -04:00
Roger Dingledine
3c8510e2c0 reassess minimum-dir-info when a bridge fails
When we try to fetch a bridge descriptor and we fail, we mark
the guard as failed, but we never scheduled a re-compute for
router_have_minimum_dir_info().

So if we had already decided we needed to wait for this new descriptor,
we would just wait forever -- even if, counterintuitively, *losing* the
bridge is just what we need to *resume* using the network, if we had it
in state GUARD_REACHABLE_MAYBE and we were stalling to learn this outcome.

See bug 40396 for more details.
2021-10-28 20:57:28 -04:00
Roger Dingledine
867c3c6f89 only log "new bridge descriptor" if really new
The bridge descriptor fetching codes ends up fetching a lot of duplicate
bridge descriptors, because this is how we learn when the descriptor
changes.

This commit only changes comments plus whether we log that one line.

It moves us back to the old behavior, before the previous commit for
30496, where we would only log that line when the bridge descriptor
we're talking about is better than the one we already had (if any).
2021-10-28 20:57:28 -04:00
Alexander Færøy
31fa3cc1a0 Fix compilation on systems with older compilers.
This patch fixes a build error with GCC 7.x which doesn't seem to accept
const int's as constants in macro initialization.

See: tpo/core/tor#40410
2021-10-28 10:37:45 -04:00
David Goulet
8c970963a9 version: Missing version update in couple files
Signed-off-by: David Goulet <dgoulet@torproject.org>
2021-10-28 09:42:08 -04:00
David Goulet
27caad6f5c version: Missing version update in couple files
Signed-off-by: David Goulet <dgoulet@torproject.org>
2021-10-28 09:41:56 -04:00
David Goulet
97c976778a version: Missing version update in couple files
Signed-off-by: David Goulet <dgoulet@torproject.org>
2021-10-28 09:41:13 -04:00
David Goulet
fa438b6cf0 version: Missing version update in couple files
Signed-off-by: David Goulet <dgoulet@torproject.org>
2021-10-28 09:40:50 -04:00
David Goulet
a647c26a6b version: Bump to 0.4.6.8
Signed-off-by: David Goulet <dgoulet@torproject.org>
2021-10-26 09:17:01 -04:00
David Goulet
446135aff0 version: Bump to 0.4.5.11
Signed-off-by: David Goulet <dgoulet@torproject.org>
2021-10-26 09:16:44 -04:00
David Goulet
9280f32fc0 version: Bump to 0.3.5.17
Signed-off-by: David Goulet <dgoulet@torproject.org>
2021-10-26 09:16:17 -04:00
Roger Dingledine
d66549c208 fetch missing bridge descriptors without delay
Without this change, if we have a working bridge, and we add a new bridge,
we will schedule the fetch attempt for that new bridge descriptor for
three hours(!) in the future.

This change is especially needed because of bug #40396, where if you have
one working bridge and one bridge whose descriptor you haven't fetched
yet, your Tor will stall until you have successfully fetched that new
descriptor -- in this case for hours.

In the old design, we would put off all further bridge descriptor fetches
once we had any working bridge descriptor. In this new design, we make the
decision per bridge based on whether we successfully got *its* descriptor.

To make this work, we need to also call learned_bridge_descriptor() every
time we get a bridge descriptor, not just when it's a novel descriptor.

Fixes bug 40396.

Also happens to fix bug 40495 (redundant descriptor fetches for every
bridge) since now we delay fetches once we succeed.

A side effect of this change is that if we have any configured bridges
that *aren't* working, we will keep trying to fetch their descriptors
on the modern directory retry schedule -- every couple of seconds for
the first half minute, then backing off after that -- which is a lot
faster than before.
2021-10-24 17:40:28 -04:00
David Goulet
2f171f30c8 Merge branch 'maint-0.4.6' 2021-10-21 10:01:39 -04:00
David Goulet
d496a75026 Merge branch 'maint-0.4.5' into maint-0.4.6 2021-10-21 10:01:38 -04:00
David Goulet
1dab1c8ad5 Merge branch 'maint-0.3.5' into maint-0.4.5 2021-10-21 10:01:38 -04:00
David Goulet
66e8e0f71b fallbackdir: Regenerate the list for October 2021
Closes #40493

Signed-off-by: David Goulet <dgoulet@torproject.org>
2021-10-21 09:13:40 -04:00
Alexander Færøy
ae05f06597 Merge branch 'tor-gitlab/mr/452_squashed' into main 2021-10-21 12:57:37 +00:00
Nick Mathewson
ab26475cab Add a new consensus method to handle MiddleOnly specially.
When this method is in place, then any relay which is assigned
MiddleOnly has Exit, V2Dir, Guard, and HSDir cleared
(and has BadExit set if appropriate).
2021-10-21 12:57:20 +00:00
Nick Mathewson
fc542167cb Implement a MiddleOnly flag for vote generation.
This proposal implements part of Prop335; it's based on a patch
from Neel Chauhan.

When configured to do so, authorities will assign a MiddleOnly flag
to certain relays.  Any relay which an authority gives this flag
will not get Exit, V2Dir, Guard, or HSDir, and might get BadExit if
the authority votes for that one.
2021-10-21 12:57:20 +00:00
Alexander Færøy
d320f4d2a2 Merge remote-tracking branch 'tor-gitlab/mr/442' into main 2021-10-21 12:50:28 +00:00
Alexander Færøy
bd1c14f015 Merge branch 'maint-0.4.5' into maint-0.4.6 2021-10-21 12:35:36 +00:00
Alexander Færøy
0135fb028c Merge remote-tracking branch 'tor-gitlab/mr/338' into maint-0.4.5 2021-10-21 12:35:26 +00:00
Alexander Færøy
5717b88bcb Merge branch 'maint-0.3.5' into maint-0.4.5 2021-10-20 21:47:17 +00:00
Alexander Færøy
7372739765 Announce URL to bridge status page when starting Tor as a bridge relay.
This patch makes Tor announce the relay specific bridge status page URL
when Tor is starting up before bootstrap occours.

See: tor#30477
2021-10-20 21:44:45 +00:00
David Goulet
7c2c749d89 relay: Comment out a unused variable for now
We keep it around until libevent is fixed, it should be used again. In
the meantime, avoid the compiler to complain of this unused variable.

https://gitlab.torproject.org/dgoulet/tor/-/jobs/43358#L1522

Signed-off-by: David Goulet <dgoulet@torproject.org>
2021-10-20 15:17:08 -04:00
Alexander Færøy
bae6780e70 Merge branch 'tor-gitlab/mr/464_squashed' into main 2021-10-20 18:39:07 +00:00
Nick Mathewson
bcc953307b Move "Didn't recognize cell, but circ stops here" into heartbeat.
When we looked, this was the third most frequent message at
PROTOCOL_WARN, and doesn't actually tell us what to do about it.
Now:
 * we just log it at info
 * we log it only once per circuit
 * we report, in the heartbeat, how many times it happens, how many
   cells it happens with per circuit, and how long these circuits
   have been alive (on average).

Fixes the final part of #40400.
2021-10-20 18:38:39 +00:00
David Goulet
903fb3dd62 relay: Avoid duplicate MetricsPort DNS error
We don't output per-type DNS errors anymore so avoid looping over the
DNS query type and output each errors for them. Before this commit, it
created 3x the same message because we had A, AAAA and PTR type records.

Fix on previous commit e7abab8782

Signed-off-by: David Goulet <dgoulet@torproject.org>
2021-10-20 13:49:44 -04:00
Alexander Færøy
16cbbf04c4 Merge branch 'maint-0.4.5' into maint-0.4.6 2021-10-20 17:36:07 +00:00
Alexander Færøy
fdc7549b61 Merge branch 'maint-0.3.5' into maint-0.4.5 2021-10-20 17:36:06 +00:00
Alexander Færøy
5a043825d0 Remove unused function: dns_randfn_() in dns.c.
This patch unbreaks the current build after tor!369 landed.

See: https://bugs.torproject.org/tpo/core/tor/40371
2021-10-20 17:35:52 +00:00
Alexander Færøy
db112329a0 Merge remote-tracking branch 'tor-gitlab/mr/369' into maint-0.3.5 2021-10-20 17:35:35 +00:00
David Goulet
e7abab8782 relay: For metrics, don't report DNS errors by query type
This is due to the libevent bug
https://github.com/libevent/libevent/issues/1219 that fails to return
back the DNS record type on error.

And so, the MetricsPort now only reports the errors as a global counter
and not a per record type.

Closes #40490

Signed-off-by: David Goulet <dgoulet@torproject.org>
2021-10-20 10:40:56 -04:00
David Goulet
7a8108ea87 relay: Overload state on DNS timeout is now X% over Y secs
With this commit, we will only report a general overload state if we've
seen more than X% of DNS timeout errors over Y seconds. Previous
behavior was to report when a single timeout occured which is really too
small of a threshold.

The value X is a consensus parameters called
"overload_dns_timeout_scale_percent" which is a scaled percentage
(factor of 1000) so we can represent decimal points for X like 0.5% for
instance. Its default is 1000 which ends up being 1%.

The value Y is a consensus parameters called
"overload_dns_timeout_period_secs" which is the time period for which
will gather DNS errors and once over, we assess if that X% has been
reached ultimately triggering a general overload signal.

Closes #40491

Signed-off-by: David Goulet <dgoulet@torproject.org>
2021-10-20 10:00:03 -04:00
David Goulet
996409c9c4 test: Add unit tests for DNS timeout overload state
Signed-off-by: David Goulet <dgoulet@torproject.org>
2021-10-20 09:09:25 -04:00
David Goulet
de907893be relay: Overload state on DNS timeout is now X% over Y secs
With this commit, we will only report a general overload state if we've
seen more than X% of DNS timeout errors over Y seconds. Previous
behavior was to report when a single timeout occured which is really too
small of a threshold.

The value X is a consensus parameters called
"overload_dns_timeout_scale_percent" which is a scaled percentage
(factor of 1000) so we can represent decimal points for X like 0.5% for
instance. Its default is 1000 which ends up being 1%.

The value Y is a consensus parameters called
"overload_dns_timeout_period_secs" which is the time period for which
will gather DNS errors and once over, we assess if that X% has been
reached ultimately triggering a general overload signal.

Closes #40491

Signed-off-by: David Goulet <dgoulet@torproject.org>
2021-10-20 09:09:25 -04:00
David Goulet
d455f9e18a hs: v2 address are now considered a bad hostname
This means that at this commit, tor will stop logging that v2 is
deprecated and treat a v2 address as a bad hostname that we can't use.

Part of #40476

Signed-off-by: David Goulet <dgoulet@torproject.org>
2021-10-19 10:59:19 -04:00
David Goulet
af48f5736a hs: Fix merge conflicts after merging forward 40476
Signed-off-by: David Goulet <dgoulet@torproject.org>
2021-10-19 10:57:10 -04:00
David Goulet
2a705e81a3 Merge branch 'maint-0.4.6' 2021-10-19 10:35:40 -04:00
David Goulet
44e105c27f hs: Improve warning for bad service version
Now that we don't have version 2, it gives us:

  [warn] HiddenServiceVersion must be between 3 and 3, not 2.

This commit changes it to:

  [warn] HiddenServiceVersion must be 3, not 2.

Part of #40476

Signed-off-by: David Goulet <dgoulet@torproject.org>
2021-10-19 09:51:24 -04:00
David Goulet
f9750249ac test: Don't run HSv2 Chutney test networks
Part of #40476

Signed-off-by: David Goulet <dgoulet@torproject.org>
2021-10-19 09:51:24 -04:00
David Goulet
9a6c6e8ec5 test: Fix unit tests after disabling version 2
Some tests were removed because they were testing something not usable
anymore.

Some tests remains to make sure that things are indeed disabled.

Part of #40476

Signed-off-by: David Goulet <dgoulet@torproject.org>
2021-10-19 09:51:24 -04:00
David Goulet
d0053fdfb5 hs: Improve warning for bad service version
Now that we don't have version 2, it gives us:

  [warn] HiddenServiceVersion must be between 3 and 3, not 2.

This commit changes it to:

  [warn] HiddenServiceVersion must be 3, not 2.

Part of #40476

Signed-off-by: David Goulet <dgoulet@torproject.org>
2021-10-19 09:50:23 -04:00
David Goulet
48e6e0843b test: Don't run HSv2 Chutney test networks
Part of #40476

Signed-off-by: David Goulet <dgoulet@torproject.org>
2021-10-19 09:50:23 -04:00
David Goulet
1589e6bf28 test: Fix unit tests after disabling version 2
Some tests were removed because they were testing something not usable
anymore.

Some tests remains to make sure that things are indeed disabled.

Part of #40476

Signed-off-by: David Goulet <dgoulet@torproject.org>
2021-10-19 09:50:22 -04:00
David Goulet
fb0c949df6 hs-v2: Disable version 2 HSPOST and HSFETCH command
Part of #40476

Signed-off-by: David Goulet <dgoulet@torproject.org>
2021-10-19 09:50:22 -04:00
David Goulet
7a15296c43 hs-v2: Disable version 2 directory
Relay do not accept both stores and lookups of version 2 descriptor.
This effectively disable version 2 HSDir supports for relays.

Part of #40476

Signed-off-by: David Goulet <dgoulet@torproject.org>
2021-10-19 09:50:22 -04:00
David Goulet
f748a497c7 Merge branch 'ticket40476_045_01' into ticket40476_046_01 2021-10-19 09:48:13 -04:00
David Goulet
db297a177e hs: Improve warning for bad service version
Now that we don't have version 2, it gives us:

  [warn] HiddenServiceVersion must be between 3 and 3, not 2.

This commit changes it to:

  [warn] HiddenServiceVersion must be 3, not 2.

Part of #40476

Signed-off-by: David Goulet <dgoulet@torproject.org>
2021-10-19 09:36:14 -04:00
David Goulet
ce1f1dcbe5 test: Don't run HSv2 Chutney test networks
Part of #40476

Signed-off-by: David Goulet <dgoulet@torproject.org>
2021-10-19 09:36:14 -04:00
David Goulet
df8ff6f1ac test: Fix unit tests after disabling version 2
Some tests were removed because they were testing something not usable
anymore.

Some tests remains to make sure that things are indeed disabled.

Part of #40476

Signed-off-by: David Goulet <dgoulet@torproject.org>
2021-10-19 09:36:14 -04:00
David Goulet
044eadae65 hs-v2: Disable version 2 HSPOST and HSFETCH command
Part of #40476

Signed-off-by: David Goulet <dgoulet@torproject.org>
2021-10-19 09:20:53 -04:00
David Goulet
a7d28da272 hs-v2: Disable version 2 directory
Relay do not accept both stores and lookups of version 2 descriptor.
This effectively disable version 2 HSDir supports for relays.

Part of #40476

Signed-off-by: David Goulet <dgoulet@torproject.org>
2021-10-19 09:16:13 -04:00
David Goulet
e284b9f779 hs-v2: Disable version 2 introduction point
Upon receiving a v2 introduction request, the relay will close the
circuit and send back a tor protocol error.

Part of #40476

Signed-off-by: David Goulet <dgoulet@torproject.org>
2021-10-19 09:13:08 -04:00
David Goulet
471149b651 hs-v2: Disable version 2 service
The minimum service version is raised from 2 to 3 which effectively
disable loading or creating an onion service v2.

As for ADD_ONION, for version 2, a 551 error is returned:

  "551 Failed to add Onion Service"

Part of #40476

Signed-off-by: David Goulet <dgoulet@torproject.org>
2021-10-19 09:11:12 -04:00
David Goulet
ed4d6a0030 hs-v2: Disable SOCKS connection for v2 addresses
This effectively turns off the ability of tor to use HSv2 as a client by
invalidating the v2 onion hostname passed through a SOCKS request.

Part of #40476

Signed-off-by: David Goulet <dgoulet@torproject.org>
2021-10-19 09:08:05 -04:00
Nick Mathewson
34f3529861 Merge branch 'hs_fuzzing' 2021-10-16 10:49:41 -04:00
Nick Mathewson
37c0542d0d Merge remote-tracking branch 'asn-private/hsfuz' into hs_fuzzing 2021-10-15 11:20:06 -04:00
Alexander Færøy
8c18e9a949 Merge remote-tracking branch 'tor-gitlab/mr/459' into main 2021-10-14 19:19:32 +00:00
Alexander Færøy
b93af906c4 Merge remote-tracking branch 'tor-gitlab/mr/456' into main 2021-10-14 19:18:22 +00:00