Commit Graph

10014 Commits

Author SHA1 Message Date
Daniel Pinto
bbd558a6eb Make SAVECONF keep only one backup and add sandbox rules for it. #40317
When seccomp sandbox is active, SAVECONF failed because it was not
able to save the backup files for torrc. This commit simplifies
the implementation of SAVECONF and sandbox by making it keep only
one backup of the configuration file.
2021-04-07 23:53:06 +01:00
Nick Mathewson
02816d6059 Try making our configure.ac script build with AC 2.70.
In versions <=2.69, according to the autoconf docs, AC_PROG_CC_C99
is needed with some compilers, if they require extra arguments to
build C99 programs.  In versions >=2.70, AC_PROG_CC checks for these
compilers automatically, and so the AC_PROG_CC_C99 macro is
obsolete.

So, what can you do if you want your script to work right with both
autoconf versions?  IIUC, neither including AC_PROG_CC_C99 macro nor
leaving it out will give you the right behavior with both versions.
It looks like you need to look at the autoconf version explicitly.

(Now, the autoconf manual implies that it's "against autoconf
philosophy" to look at the autoconf version rather than trying the
behavior to see if it works, but they don't actually tell you how to
detect recoverably at autoconf-time whether a macro is obsolete or
not, and I can't find a way to do that.)

So, is it safe to use m4_version_prereq, like I do here?  It isn't
listed in the autoconf 2.63 manual (which is the oldest version we
support).  But a mailing list message [1] (which added the
documentation back in 2008) implies that m4_version_prereq has been
there since "at least back to autoconf 2.59".

https://lists.gnu.org/archive/html/autoconf-patches/2008-12/msg00025.html

So I think this will work.

I am basing this patch against Tor 0.3.5 since, if autoconf 2.70
becomes widespread before 0.3.5 is unsupported, we might need this
patch to continue 0.3.5 development.  But I don't think we should
backport farther than 0.4.5 until/unless that actually happens.

This is part of a fix for #40355.
2021-04-07 10:18:44 -04: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
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
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
Nick Mathewson
5c7f9844e4 manpage:Move BridgeRecordUsageByCountry to statistics section
patch from cypherpunks; closes #40323
2021-03-22 14:09:22 -04: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
ded8f9b378 Fold new entries into 0.4.6.1-alpha ChangeLog 2021-03-18 09:51:37 -04: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
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
2022d974af Fold ticket40314 into ChangeLog. 2021-03-15 09:35:56 -04:00
Nick Mathewson
fcd42982b2 Remove changes files that will appear in 0.4.5.7
(0.4.6.1-alpha will come out after the stable releases.)
2021-03-15 09:03:37 -04:00
Nick Mathewson
61731e3550 Merge branch 'maint-0.4.4' into maint-0.4.5 2021-03-15 09:01:59 -04:00
Nick Mathewson
5ec579610a Merge branch 'maint-0.3.5' into maint-0.4.4 2021-03-15 09:01:59 -04:00
Nick Mathewson
3268403ba1 Merge branch 'maint-0.4.5' 2021-03-15 09:01:59 -04:00
Nick Mathewson
f078aab71e Merge branch 'bug40316_035_v2' into maint-0.3.5 2021-03-15 08:58:54 -04:00
Nick Mathewson
890ae4fb1a Fix detection of point to insert signatures on a pending consensus.
We were looking for the first instance of "directory-signature "
when instead the correct behavior is to look for the first instance
of "directory-signature " at the start of a line.

Unfortunately, this can be exploited as to crash authorities while
they're voting.

Fixes #40316; bugfix on 0.2.2.4-alpha.  This is TROVE-2021-002,
also tracked as CVE-2021-28090.
2021-03-15 08:56:58 -04:00
Nick Mathewson
a6533af9e8 Merge branch 'maint-0.4.4' into maint-0.4.5 2021-03-15 08:54:00 -04:00
Nick Mathewson
2eb900f7e2 Merge branch 'maint-0.3.5' into maint-0.4.4 2021-03-15 08:54:00 -04:00
Nick Mathewson
cfeb063f24 Merge branch 'maint-0.4.5' 2021-03-15 08:54:00 -04:00
Nick Mathewson
efca9ce41c Clarify new intended strategy with TROVE-2021-001
We're going to disable this feature in all versions for now.
2021-03-15 08:53:36 -04:00
Nick Mathewson
efb174df24 Merge branch 'maint-0.4.5' 2021-03-15 08:52:53 -04:00
Nick Mathewson
7c5a67ccd9 Merge branch 'maint-0.4.4' into maint-0.4.5 2021-03-15 08:52:29 -04:00
Nick Mathewson
b9f6539008 Merge branch 'maint-0.3.5' into maint-0.4.4 2021-03-15 08:52:28 -04:00
Nick Mathewson
f46f4562cf Merge branch 'bug40286_disable_min_035' into maint-0.3.5 2021-03-15 08:41:03 -04:00
Nick Mathewson
433f526af6 Merge branch 'maint-0.4.4' into maint-0.4.5 2021-03-12 11:36:34 -05:00
Nick Mathewson
9f59b6f458 Merge branch 'maint-0.3.5' into maint-0.4.4 2021-03-12 11:36:34 -05:00
Nick Mathewson
6cc5613404 Merge branch 'maint-0.4.5' 2021-03-12 11:36:34 -05:00
Nick Mathewson
c1ce126c74 Use the right ticket number. 2021-03-12 11:31:36 -05:00
Nick Mathewson
b014866f6a Merge branch 'maint-0.4.4' into maint-0.4.5 2021-03-12 11:30:22 -05:00
Nick Mathewson
0b4a0c1a26 Merge branch 'maint-0.4.5' 2021-03-12 11:30:22 -05:00
Nick Mathewson
41796158e6 Merge branch 'maint-0.3.5' into maint-0.4.4 2021-03-12 11:30:21 -05:00
Nick Mathewson
aa6c7741e8 update geoip-2021-03-12 to mention provider transition. 2021-03-12 11:29:09 -05:00
Nick Mathewson
a7b3cb06f5 Update geoip files to match ipfire location db, 2021/03/12. 2021-03-12 11:26:07 -05:00
Nick Mathewson
9131fe7eb2 Remove changes files already merged in release-0.4.5 2021-03-12 09:56:23 -05:00
Nick Mathewson
7d9403b422 Merge remote-tracking branch 'tor-gitlab/mr/336' 2021-03-10 16:47:46 -05:00
Nick Mathewson
f98dbdb069 Merge branch 'maint-0.4.5' 2021-03-10 15:28:14 -05:00
Nick Mathewson
e8d224dfb1 Merge remote-tracking branch 'tor-gitlab/mr/335' into maint-0.4.5 2021-03-10 15:27:50 -05:00
David Goulet
d382f26914 Merge branch 'tor-gitlab/mr/331' into maint-0.4.5 2021-03-10 10:06:44 -05:00
David Goulet
6fce18916f Merge branch 'tor-gitlab/mr/331' 2021-03-10 10:06:20 -05:00
David Goulet
fc080b4113 Merge branch 'maint-0.4.5' 2021-03-10 10:04:26 -05:00
David Goulet
9f9fed3fd1 vote: Add "stats" line
Closes #40314

Signed-off-by: David Goulet <dgoulet@torproject.org>
2021-03-10 09:51:30 -05:00
David Goulet
f93ccb8d24 hs: Remove hamrless BUG() that can happen
When reloading a service, we can re-register a service and thus end up again
in the metrics store initialization code path which is fine. No need to BUG()
anymore.

Fixes #40334

Signed-off-by: David Goulet <dgoulet@torproject.org>
2021-03-10 09:12:29 -05:00
Nick Mathewson
05564a8521 Start a changelog for 0.4.6.1-alpha 2021-03-09 11:58:46 -05:00
Nick Mathewson
4f138f2ed2 Remove changes files that are already merged in 0.4.5.x 2021-03-09 11:44:54 -05:00
Nick Mathewson
9409c7f2f5 Don't warn about missing guard state if controller picked first hop
See comments about why this needs a new flag and we can't just use
CIRCUIT_PURPOSE_CONTROLLER.

Fixes #40285; bugfix on 0.3.2.1-alpha.
2021-03-08 13:42:43 -05:00
Nick Mathewson
b599f489ae Fix documentation formatting for VirtualAddrNetworkIPv6
Fixes bug #40256; bugfix on 0.2.9.4-alpha.
2021-03-08 11:17:24 -05:00
Nick Mathewson
690c7be253 Fix parsing bug in linux get_total_system_memory().
Use find_str_at_start_of_line(), not strstr() here: we don't want
to match "MemTotal: " if it appears in the middle of a line.

Fixes #40315; bugfix on 0.2.5.4-alpha.
2021-03-03 14:52:15 -05:00
Alexander Færøy
80b6054bb0 Merge remote-tracking branch 'tor-gitlab/mr/213' 2021-03-03 15:16:20 +00:00
David Goulet
f75baf5ea5 Merge branch 'maint-0.4.5' 2021-02-24 13:55:30 -05:00
David Goulet
6ea7eb58c6 Merge branch 'tor-gitlab/mr/321' into maint-0.4.5 2021-02-24 13:55:21 -05:00
George Kadianakis
830b0f8c62 Merge remote-tracking branch 'tor-gitlab/mr/306' 2021-02-24 12:35:55 +02:00
David Goulet
6edb648aa0 Merge branch 'maint-0.4.5' 2021-02-23 12:28:04 -05:00
David Goulet
97e51dd01b Merge branch 'tor-gitlab/mr/326' into maint-0.4.5 2021-02-23 12:27:59 -05:00
David Goulet
ad4f87ed3f Remove mallinfo() from codebase
Now deprecated in libc >= 2.33

Closes #40309

Signed-off-by: David Goulet <dgoulet@torproject.org>
2021-02-23 12:16:58 -05:00
David Goulet
296a557bfc Remove mallinfo() from codebase
Now deprecated in libc >= 2.33

Closes #40309

Signed-off-by: David Goulet <dgoulet@torproject.org>
2021-02-23 11:02:33 -05:00
David Goulet
39d0f69dfe relay: Avoid a directory early fetch
The directory_fetches_from_authorities() is used to know if a client or relay
should fetch data from an authority early in the boot process.

We had a condition in that function that made a relay trigger that fetch if it
didn't know its address (so we can learn it). However, when this is called,
the address discovery has not been done yet so it would always return true for
a relay.

Furthermore, it would always trigger a log notice that the IPv4 couldn't be
found which was inevitable because the address discovery process has not been
done yet (done when building our first descriptor).

It is also important to point out that starting in 0.4.5.1-alpha, asking an
authority for an address is done during address discovery time using a one-hop
circuit thus independent from the relay deciding to fetch or not documents
from an authority.

Small fix also is to reverse the "IPv(4|6)Only" flag in the notice so that if
we can't find IPv6 it would output to use IPv4Only.

Fixes #40300

Signed-off-by: David Goulet <dgoulet@torproject.org>
2021-02-23 09:49:45 -05:00
Nick Mathewson
bc799a1eaf Merge remote-tracking branch 'tor-gitlab/mr/320' 2021-02-23 09:29:49 -05:00
David Goulet
c96465259a dos: Change the DoS heartbeat line format
Fix a bug introduced in 94b56eaa75 which
overwrite the connection message line.

Furthermore, improve how we generate that line by using a smartlist and change
the format so it is clearer of what is being rejected/detected and, if
applicable, which option is disabled thus yielding no stats.

Closes #40308

Signed-off-by: David Goulet <dgoulet@torproject.org>
2021-02-23 08:54:45 -05:00
Nick Mathewson
100221baac Merge remote-tracking branch 'origin/master' 2021-02-23 08:43:19 -05:00
Nick Mathewson
09614e0c9d Tweak documentation on 40282 2021-02-23 08:42:31 -05:00
Nick Mathewson
4321755de7 Merge branch 'ticket40282_046_01_squashed' 2021-02-23 08:32:58 -05:00
David Goulet
1c45a3df7c changes: Add changes file for #40282
Closes #40282

Signed-off-by: David Goulet <dgoulet@torproject.org>
2021-02-23 08:29:32 -05:00
Alexander Færøy
83ab6adb10 Merge remote-tracking branch 'tor-gitlab/mr/276' 2021-02-22 20:52:44 +00:00
David Goulet
94b56eaa75 dos: New client connect rate detection
This is a new detection type which is that a relay can now control the rate of
client connections from a single address.

The mechanism is pretty simple, if the rate/burst is reached, the address is
marked for a period of time and any connection from that address is denied.

Closes #40253

Signed-off-by: David Goulet <dgoulet@torproject.org>
2021-02-22 15:48:42 -05:00
Nick Mathewson
8907800549 Merge remote-tracking branch 'tor-gitlab/mr/319' 2021-02-22 15:39:30 -05:00
Nick Mathewson
6e3a7c410f Merge branch 'maint-0.4.5' 2021-02-22 15:37:39 -05:00
Nick Mathewson
bc21ed3290 Merge remote-tracking branch 'tor-gitlab/mr/316' into maint-0.4.5 2021-02-22 15:37:31 -05:00
David Goulet
d98c77b78e relay: Reduce streaming compression ratio from HIGH to LOW
Fixes #40301

Signed-off-by: David Goulet <dgoulet@torproject.org>
2021-02-22 14:47:42 -05:00
Alexander Færøy
a4df1e8ea4 Merge branch 'maint-0.4.5' 2021-02-22 19:13:12 +00:00
Alexander Færøy
26c2e843f9 Merge remote-tracking branch 'tor-gitlab/mr/309' into maint-0.4.5 2021-02-22 19:12:53 +00:00
David Goulet
4d7f31b964 relay: Move log notice after suggested address lookup
When trying to find our address to publish, we would log notice if we couldn't
find it from the cache but then we would look at the suggested cache (which
contains the address from the authorities) in which we might actually have the
address.

Thus that log notice was misplaced. Move it down after the suggested address
cache lookup.

Closes #40300

Signed-off-by: David Goulet <dgoulet@torproject.org>
2021-02-22 09:13:54 -05:00
Neel Chauhan
88559aca2d Make dirauths vote the Sybil flag when other flags are zeroed out 2021-02-19 10:44:11 -08:00
Nick Mathewson
ede88c374c Disable the dump_desc() function.
It can be called with strings that should have been
length-delimited, but which in fact are not.  This can cause a
CPU-DoS bug or, in a worse case, a crash.

Since this function isn't essential, the best solution for older
Tors is to just turn it off.

Fixes bug 40286; bugfix on 0.2.2.1-alpha when dump_desc() was
introduced.
2021-02-19 12:31:19 -05:00
George Kadianakis
03c686563b Merge remote-tracking branch 'tor-gitlab/mr/308' into maint-0.4.5 2021-02-19 13:26:33 +02:00
George Kadianakis
cf1f03fe1d Merge remote-tracking branch 'tor-gitlab/mr/308' 2021-02-19 13:25:47 +02:00
Mike Perry
b2f025cb56 Merge branch 'bug40168+34088-035-v3' into bug40168+34088-035-v3-master 2021-02-18 18:17:18 +00:00
Mike Perry
525195a715 Bug 34088: Changes file 2021-02-18 11:21:25 -06:00
Mike Perry
1fadb1bdf1 Bug 40168 changes file 2021-02-18 11:21:25 -06:00
David Goulet
2709828494 Merge branch 'tor-gitlab/mr/311' 2021-02-17 13:22:36 -05:00
Nick Mathewson
aebd0a4080 Make our configure.ac script use the portable = comparison
Back in 0.4.5.1-alpha we added an `==` comparison, which isn't
portable.

Fixes bug #40298; bugfix on 0.4.5.1-alpha.
2021-02-17 12:36:23 -05:00
Roger Dingledine
8a8045c788 relay: No longer test dirport reachability for authorities
Now that exit relays don't allow exit connections to directory authority
DirPorts, the follow-up step is to make directory authorities stop doing
DirPort reachability checks.

Fixes #40287

Signed-off-by: David Goulet <dgoulet@torproject.org>
2021-02-17 10:28:18 -05:00
David Goulet
9f61d9238c metrics: Handle the connection finished flushing event
Turns out, we forgot to add the METRICS connection type fo the finished
flushing handler.

Fixes #40295

Signed-off-by: David Goulet <dgoulet@torproject.org>
2021-02-17 09:54:05 -05:00
Nick Mathewson
e74fc69448 Remove changes files from master that will appear in 0.4.5.6 2021-02-12 13:43:38 -05:00
David Goulet
71e9c56578 Merge branch 'maint-0.4.5' 2021-02-12 13:13:57 -05:00
David Goulet
5887c1f1f3 Merge branch 'tor-gitlab/mr/304' into maint-0.4.5 2021-02-12 13:13:50 -05:00