Commit Graph

9747 Commits

Author SHA1 Message Date
David Goulet
d425dbf04a port: Don't ignore ports of a different family
Commit c3a0f75796 added this feature for ORPort
that we ignore any port that is not the family of our default address when
parsing the port. So if port_parse_config() was called with an IPv4 default
address, all IPv6 address would be ignored.

That makes sense for ORPort since we call twice port_parse_config() for
0.0.0.0 and [::] but for the rest of the ports, it is not good since a
perfectly valid configuration can be:

  SocksPort 9050
  SocksPort [::1]:9050

Any non-ORPort only binds by default to an IPv4 except the ORPort that binds
to both IPv4 and IPv6 by default.

The fix here is to always parse all ports within port_parse_config() and then,
specifically for ORPort, remove the duplicates or superseding ones. The
warning is only emitted when a port supersedes another.

A unit tests is added to make sure SocksPort of different family always exists
together.

Fixes #40183

Signed-off-by: David Goulet <dgoulet@torproject.org>
2020-11-13 08:38:22 -05:00
Neel Chauhan
d1494d140c Remove orconn_ext_or_id_map and related functions 2020-11-12 11:19:21 -08:00
Neel Chauhan
46ccde66a9 Use connection_or_change_state() in v3 handshaking state change 2020-11-12 12:06:34 -05:00
Nick Mathewson
ffa7b15950 Deliberately close OR connections if proxies leave extra data
We already did this, but we did it by accident, which is pretty
risky: if we hadn't, then our code would have treated extra data in
the inbuf as having been transmitted as TLS-authenticated data.

Closes ticket 40017; Found by opara.
2020-11-12 11:07:33 -05:00
Nick Mathewson
f2168d28f7 Fake the current time when we're loading TEST_DESCRIPTORS.
Fixes bug 40187; bugfix on 0.4.5.1-alpha.
2020-11-12 09:28:27 -05:00
Nick Mathewson
7d8290f0ac Merge remote-tracking branch 'tor-gitlab/mr/183' into master 2020-11-12 08:47:05 -05:00
Nick Mathewson
9306ac5aa8 changes file for bug 40172. 2020-11-10 17:29:37 -05:00
Nick Mathewson
ec0f000445 Merge branch 'maint-0.4.3' into maint-0.4.4 2020-11-09 16:17:42 -05:00
Nick Mathewson
0b2c64effd Merge branch 'maint-0.3.5' into maint-0.4.3 2020-11-09 16:13:42 -05:00
Nick Mathewson
52e439c13e Merge remote-tracking branch 'tor-gitlab/mr/189' into maint-0.3.5 2020-11-09 16:13:24 -05:00
Alexander Færøy
faa96f9a8e Merge remote-tracking branch 'tor-gitlab/mr/193' 2020-11-09 14:15:07 +00:00
Alexander Færøy
5e65a746aa Merge remote-tracking branch 'tor-gitlab/mr/190' 2020-11-09 14:12:45 +00:00
Nick Mathewson
4154158d79 Make config/parse_tcp_proxy_line work in the presence of DNS hijacking
We can use our existing mocking functionality to do this: We have
been in this position before.

Fixes part of #40179; bugfix on 0.4.3.1-alpha.
2020-11-05 09:47:32 -05:00
Nick Mathewson
31a6a101a0 Handle a change in the implementation of hashlib in Python 3.9
Previously, hashlib.shake_256 was a class (if present); now it can
also be a function.  This change invalidated our old
compatibility/workaround code, and made one of our tests fail.

Fixes bug 40179; bugfix on 0.3.1.6-rc when the workaround code was
added.
2020-11-05 09:34:36 -05:00
George Kadianakis
dd119b277b Merge remote-tracking branch 'tor-gitlab/mr/185' into master 2020-11-03 16:06:12 +02:00
David Goulet
486ddde2c4 configure: Check STAP_PROBEV macro when building with USDT tracing
It turns out that STAP_PROBEV() is not available on FreeBSD thus having
sdt/sdt.h is not enough. Look for it now at configure time.

Closes #40174

Signed-off-by: David Goulet <dgoulet@torproject.org>
2020-11-03 09:05:53 -05:00
George Kadianakis
4f5a116618 Merge remote-tracking branch 'tor-gitlab/mr/187' into master 2020-11-03 13:04:09 +02:00
George Kadianakis
f2da7b05b0 Add changes file for v3 metrics.
Closes ticket #23126.
2020-11-03 11:12:17 +02:00
David Goulet
474369e3fa Merge branch 'tor-gitlab/mr/186' 2020-11-02 13:14:02 -05:00
David Goulet
8b240fbe40 Merge branch 'tor-gitlab/mr/188' 2020-11-02 13:09:15 -05:00
Nick Mathewson
7a75a1064f Fix another duplicate typedef.
Fixes #40177; bugfix on 0.4.5.1-alpha.
2020-11-02 07:15:10 -05:00
Daniel Pinto
f3b9be4422 Implement WIN32 tor_cond_wait using condition variables #30187
Fix bug where running a relay on Windows would use 100% CPU
after some time. Makes Windows >= Vista the required Windows
version to build and run tor.
2020-11-01 03:10:25 +00:00
Nick Mathewson
7e56f80376 Start a changelog for 0.4.5.1-alpha. 2020-10-30 10:57:21 -04:00
Nick Mathewson
148b5b03a3 Merge branch 'bug40080_035' 2020-10-30 10:51:20 -04:00
George Kadianakis
54e6109499 Merge remote-tracking branch 'tor-gitlab/mr/174' into master 2020-10-30 14:14:14 +02:00
Nick Mathewson
f7d0bde4f0 Remove "GETINFO network-status".
It was deprecated 0.3.1.1-alpha.

According to #22473, nothing uses it.

Closes #22473.
2020-10-28 11:48:23 -04:00
Alexander Færøy
b0e6ec627c Merge branch 'maint-0.4.3' into maint-0.4.4 2020-10-28 15:39:37 +00:00
Alexander Færøy
4876409c2a Merge branch 'maint-0.3.5' into maint-0.4.3 2020-10-28 15:39:37 +00:00
Nick Mathewson
3f442987f1 Log a warning if Tor was built with any "risky" compile-time options
These options are meant for testing builds only, and are likely to
cause trouble if used in a production environment.

Closes #18888.
2020-10-28 11:34:30 -04:00
Alexander Færøy
c37d05d0c6 Merge remote-tracking branch 'tor-gitlab/mr/171' 2020-10-28 15:15:39 +00:00
Nick Mathewson
c48d25ac8d Fix a previously overstrict log message check.
OpenSSL doesn't seem to report error locations in the same way as
before, which broke one of our tests.

Fixes bug 40170; bugfix on 0.2.8.1-alpha.
2020-10-28 10:47:39 -04:00
Nick Mathewson
59f76a8a1f Changes file for #40165 (openssl deprecation warnings) 2020-10-28 10:34:22 -04:00
Nick Mathewson
511822529a Revise fix for bug 32178 (spaces at end of log msg).
The loop in the earlier patch would invoke undefined behavior in two
ways: First, it would check whether it was looking at a space before
it checked whether the pointer was in-range.  Second, it would let a
pointer reach a position _before_ the start of a string, which is
not allowed.

I've removed the assertion about empty messages: empty messages can
be their own warning IMO.

I've also added tests for this formatting code, to make sure it
actually works.
2020-10-28 09:41:51 -04:00
Amadeusz Pawlik
4520fbc05e adds change file 2020-10-28 09:09:00 -04:00
Neel Chauhan
09b3af578d Stop forcing IPv4 and IPv6 traffic on non-SOCKSPorts 2020-10-27 17:57:48 -07:00
Neel Chauhan
0c79cddc6b Avoid asserts with flag 2020-10-27 14:47:42 -07:00
David Goulet
f2e4204590 changes: File for ticket 40063, the MetricsPort
Signed-off-by: David Goulet <dgoulet@torproject.org>
2020-10-27 10:43:42 -04:00
David Goulet
26cfac1880 Merge branch 'tor-gitlab/mr/176' into maint-0.4.4 2020-10-27 10:18:16 -04:00
David Goulet
6338fc2afa Merge branch 'tor-gitlab/mr/173' 2020-10-27 09:43:04 -04:00
David Goulet
683c794273 Merge branch 'tor-gitlab/mr/176' 2020-10-27 09:36:16 -04:00
Nick Mathewson
c90535c539 Merge branch 'maint-0.4.4' 2020-10-26 16:39:31 -04:00
Nick Mathewson
c1bcc1da03 Make ticket40164 compliant with style 2020-10-26 16:39:24 -04:00
George Kadianakis
07f2a06c61 Merge remote-tracking branch 'tor-gitlab/mr/169' into master 2020-10-26 17:04:58 +02:00
Nick Mathewson
f43fe890dd Merge remote-tracking branch 'tor-gitlab/mr/127' 2020-10-23 11:47:40 -04:00
Nick Mathewson
fd58e74ddc Update required/recommended protocol lists more systematically
First I began with a set of candidates:

  The client's _required_ list starts with all the protocols
  supported by every release in 0.2.9-stable through current
  master.

  The client's _required_ list starts with all the protocols
  supported by every release in 0.3.5-stable through current
  master.

  Everybody's _recommended_ list starts with all the protocols
  supported by every release in 0.3.5-stable through current master.

Then I removed the protocol versions that we do not actually want to
require or recommend:

  DirCache=1 (deprecated)
  HSDir=1, HSIntro=1-3, HSRend=1 (deprecated)
  (All HS* protocol requirements for clients)
  Link=1-3 (deprecated)
  LinkAuth=1 (obsolete)
  Relay=1 (obsolete)
2020-10-23 11:23:08 -04:00
Nick Mathewson
2908086694 Merge branch 'combined_libs' 2020-10-23 10:33:07 -04:00
Nick Mathewson
e834702f9d Changes file for ticket 40127 2020-10-23 10:32:08 -04:00
Roger Dingledine
00118355f5 Turn ConsensusParams into a Linelist
Make it possible to specify multiple ConsensusParams torrc
lines.

Now directory authority operators can for example put the
main ConsensusParams config in one torrc file and then add to it
from a different torrc file.

Closes ticket 40164.
2020-10-22 03:26:03 -04:00
Nick Mathewson
c9ddf191cf Make "check-changes" work on bug32671. 2020-10-21 07:44:54 -04:00
Daniel Pinto
bb9707420e Allow mutiple lines on configuration for ROUTERSET entries. #28361
Affected entries are: EntryNodes, ExcludeNodes, ExcludeExitNodes,
ExitNodes, MiddleNodes, HSLayer2Nodes and HSLayer3Nodes.
2020-10-21 01:53:50 +01:00
Guinness
0668437b58
Set is_padding_timer_scheduled to 0
When calling `circpad_send_padding_cell_for_callback()`, the flag
`is_padding_timer_scheduled` was not resetted to 0 which caused an issue
in the circpad simulator.
This commit fixes this problem.

Fixes #32671.
2020-10-20 21:04:33 +02:00
Nick Mathewson
66cd12e044 reindent changes/ticket40053 2020-10-20 09:03:51 -04:00
Nick Mathewson
579f200efc Merge branch 'mr_175_squashed' 2020-10-20 09:03:26 -04:00
Guinness
5248d08ede Consider 301 as an error like 404
Tor does not follow redirects when bootstraping so we encountered an
error.

Fixes #40053
2020-10-20 08:57:42 -04:00
George Kadianakis
19302a1dfd Merge remote-tracking branch 'tor-gitlab/mr/148' into master 2020-10-20 13:26:19 +03:00
Nick Mathewson
151d446aa1 Merge remote-tracking branch 'tor-gitlab/mr/167' 2020-10-19 11:15:20 -04:00
Nick Mathewson
d872c69255 Update required/recommended protocol versions.
Cons=1 is the old format of consensuses, without ed25519 keys. It
  is no longer required or recommended.

  Cons=2 is the new format of consensuses, with ed25519 keys. It
  is now required.

  (Similarly for Desc=1,2 and Microdesc=1,2)

No supported client or relay versions should be affected by this
change, since these versions are supported by clients and relays
running 0.2.9 and later.  It will only take effect once enough
authorities vote for it.

Closes ticket 40162.
2020-10-18 16:23:53 -04:00
Nick Mathewson
e934d713b3 Mark as required fields from prop315.
This change breaks some unit tests; it's time to fix those in
subsequent commits.
2020-10-15 18:02:16 -04:00
Nick Mathewson
5718f38c85 Add ed25519 identities to relay descriptions.
(Or at least, to all those relay descriptions that derive from
format_node_description()).

Closes #22668.
2020-10-15 10:29:01 -04:00
Nick Mathewson
33fb51a111 Protover: simplify implementation structure to use 64-bit property
Now that prop318 is in, we can simplify our representation for
protocol range sets to just be a bitmask.
2020-10-14 13:09:29 -04:00
Nick Mathewson
4a80dde43c Merge branch 'prop318_limit_protover_035' into prop318_limit_protover_045 2020-10-14 11:31:58 -04:00
Nick Mathewson
dd63b97288 Implement proposal 318: Limit protovers to 0..63
In brief: we go through a lot of gymnastics to handle huge protover
numbers, but after years of development we're not even close to 10
for any of our current versions.  We also have a convenient
workaround available in case we ever run out of protocols: if (for
example) we someday need Link=64, we can just add Link2=0 or
something.

This patch is a minimal patch to change tor's behavior; it doesn't
take advantage of the new restrictions.

Implements #40133 and proposal 318.
2020-10-14 11:28:37 -04:00
David Goulet
bb249a221f Merge branch 'tor-gitlab/mr/170' 2020-10-14 09:46:44 -04:00
Nick Mathewson
a251cff0c3 Add changes file for 40139 (removing usecreatefast and useoptimisticdata 2020-10-13 14:42:59 -04:00
Alexander Færøy
78aa037c41 Merge remote-tracking branch 'tor-gitlab/mr/161' 2020-10-13 13:50:14 +00:00
Neel Chauhan
05242f5555 Pass the SOCKS request address in relay begin cells 2020-10-12 20:46:42 -07:00
Alex Xu (Hello71)
29065db381 dirclient: print bandwidth usage on one line (#40159) 2020-10-08 09:48:38 -04:00
Nick Mathewson
c4812698c3 Remove long-obsolete members from the state file.
Tor has a feature to preserve unrecognized state file entries in
order to maintain forward compatibility.  But this feature, along
with some unused code that we never actually removed, led to us
keeping items that were of no use to the user, other than at worst
to preserve ancient information about them.

This commit adds a feature to remove obsolete entries when we load
the file.

Closes ticket 40137.
2020-10-07 20:46:37 +03:00
Nick Mathewson
2ceea13140 Merge remote-tracking branch 'tor-gitlab/mr/164' 2020-10-07 09:42:37 -04:00
Nick Mathewson
741edf1b45 Merge remote-tracking branch 'tor-github/pr/1827/head' into maint-0.3.5 2020-10-07 09:29:07 -04:00
David Goulet
17e9d40c16 Merge branch 'tor-gitlab/mr/159' 2020-10-07 09:00:10 -04:00
Nick Mathewson
de03f7a13d Changes file for autoconf improvements in 40138 2020-10-07 09:00:06 -04:00
Nick Mathewson
40f0db75bd Merge branch 'maint-0.3.5' into maint-0.4.3 2020-10-07 08:38:30 -04:00
David Goulet
b404f085ad hs-v2: Add deprecation warning for service
If at least one service is configured as a version 2, a log warning is emitted
once and only once.

Closes #40003

Signed-off-by: David Goulet <dgoulet@torproject.org>
2020-10-07 08:38:23 -04:00
Nick Mathewson
0e2e517019 Merge branch 'maint-0.4.3' into maint-0.4.4 2020-10-07 08:35:18 -04:00
Neel Chauhan
884cad3edf Make HSFETCH take the decoded length into account, not the base32 one 2020-10-07 08:35:12 -04:00
Nick Mathewson
3e9fa5a029 Merge branch 'maint-0.3.5' into maint-0.4.3 2020-10-07 08:29:31 -04:00
Nick Mathewson
5f5587ee50 Merge remote-tracking branch 'tor-gitlab/mr/77' into maint-0.3.5 2020-10-07 08:29:23 -04:00
Nick Mathewson
701a1936fa Merge branch 'maint-0.3.5' into maint-0.4.3 2020-10-07 08:26:04 -04:00
Nick Mathewson
ad7ffa5240 Merge remote-tracking branch 'tor-gitlab/mr/79' into maint-0.3.5 2020-10-07 08:25:55 -04:00
Nick Mathewson
98e14720b5 Merge remote-tracking branch 'tor-github/pr/1661/head' into maint-0.3.5 2020-10-07 08:14:46 -04:00
Nick Mathewson
9587512578 Merge branch 'maint-0.3.5' into maint-0.4.3 2020-10-07 08:10:08 -04:00
Nick Mathewson
968b6c30c1 Merge remote-tracking branch 'tor-gitlab/mr/43' into maint-0.3.5 2020-10-07 08:09:59 -04:00
Nick Mathewson
8505dd5e37 Merge branch 'maint-0.4.3' into maint-0.4.4 2020-10-07 08:08:02 -04:00
Nick Mathewson
9029444482 Merge branch 'maint-0.3.5' into maint-0.4.3 2020-10-07 08:08:01 -04:00
Nick Mathewson
e0e0ef713e Merge remote-tracking branch 'tor-gitlab/mr/137' into maint-0.3.5 2020-10-07 08:07:53 -04:00
Nick Mathewson
8a561fc5bf Merge branch 'maint-0.3.5' into maint-0.4.3 2020-10-07 08:05:40 -04:00
Nick Mathewson
84a5bd48e2 Merge remote-tracking branch 'tor-gitlab/mr/103' into maint-0.3.5 2020-10-07 08:05:31 -04:00
Nick Mathewson
b5a88e8d47 Merge branch 'maint-0.3.5' into maint-0.4.3 2020-10-07 08:01:37 -04:00
Nick Mathewson
ed6a328297 Merge branch 'mr_124_squashed' into maint-0.3.5 2020-10-07 08:00:59 -04:00
Nick Mathewson
c5ba8b6221 Parallelize src/test/test into chunks.
First, we introduce a flag to teach src/test/test to split its work
into chunks.  Then we replace our invocation of src/test/test in our
"make check" target with a set of 8 scripts that invoke the first
8th of the tests, the second 8th, and so on.

This change makes our "make -kj4 check" target in our hardened
gitlab build more than twice as fast, since src/test/test was taking
the longest to finish.

Closes 40098.
2020-10-07 08:00:49 -04:00
George Kadianakis
438aba6c0b Merge branch 'maint-0.4.4' into master 2020-10-07 13:42:57 +03:00
George Kadianakis
a914ac5d7c Merge remote-tracking branch 'tor-gitlab/mr/154' into maint-0.4.4 2020-10-07 13:32:17 +03:00
George Kadianakis
84e825598a Merge branch 'maint-0.4.4' into master 2020-10-07 13:29:16 +03:00
George Kadianakis
149b7a2418 Merge remote-tracking branch 'tor-gitlab/mr/163' into maint-0.4.4 2020-10-07 13:29:00 +03:00
Alexander Færøy
5f61e19d8a Expose TOR_PT_OUTBOUND_BIND_ADDRESS_{V4,V6} to Pluggable Transports.
This patch adds support for exposing the environment variables
`TOR_PT_OUTBOUND_BIND_ADDRESS_V4` and `TOR_PT_OUTBOUND_BIND_ADDRESS_V6` to
Pluggable Transport proccesses. These two values will contain the IPv4
and IPv6 address that the user have specified in torrc that they wish
the PT to use for all outgoing IP packets.

It is important to note here that it is up to the indvidual Pluggable
Transport if they are willing to honor these values or ignore them
completely.

One can test this feature using the following dummy PT written in POSIX
shell script:

    #!/bin/sh

    echo "LOG SEVERITY=warning MESSAGE=\"Value for IPv4: ${TOR_PT_OUTBOUND_BIND_ADDRESS_V4}\""
    echo "LOG SEVERITY=warning MESSAGE=\"Value for IPv6: ${TOR_PT_OUTBOUND_BIND_ADDRESS_V6}\""

    while true ; do
        sleep 1
    done

with the following entries in your torrc:

    OutboundBindAddressPT 203.0.113.4
    OutboundBindAddress 203.0.113.5
    OutboundBindAddressPT 2001:db8::4
    OutboundBindAddress 2001:db8::5

See: https://bugs.torproject.org/5304
2020-10-06 09:30:11 -04:00
Daniel Pinto
304ae473ca Fix %include bug with pattern with */ on glibc < 2.19 #40141
Fix bug where %including a pattern ending in */ would include
files and folders (instead of folders only) in versions of
glibc < 2.19.
2020-10-03 04:10:52 +01:00
Nick Mathewson
f5ddc45647 Merge branch 'bug40133_035' into bug40133_043 2020-09-28 10:37:14 -04:00
Nick Mathewson
79d7773968 Merge branch 'maint-0.3.5' into bug40133_035 2020-09-28 10:35:12 -04:00
Nick Mathewson
5c9b4a0060 Remove support for old android "logcat" API
This is apparently obsolete; syslog is modern instead.  If users
have an android log configured, given them a syslog if we can.

Closes #32181.
2020-09-23 12:33:58 -04:00