Commit Graph

26829 Commits

Author SHA1 Message Date
David Goulet
5138a9c3c2 relay: Don't look at omit flag when building descriptor
That comes from 685c4866ac which added that
check correctly except for when we build a descriptor.

We already omit the IPv6 address, if we need to, when we encode the descriptor
but we need to keep the actual discovered address in the descriptor so we can
notice future IP changes and be able to assess that we are not publishable as
long as we don't specifically set the omit flag.

This lead to also having tor noticing that our IP changed from <nothing> (no
IPv6 in the descriptor) to a discovered one which would trigger every minute.

Fixes #40279, #40288

Signed-off-by: David Goulet <dgoulet@torproject.org>
2021-02-10 11:47:17 -05:00
Nick Mathewson
758000aa98 Merge remote-tracking branch 'tor-gitlab/mr/296' into maint-0.4.5 2021-02-08 14:30:11 -05:00
David Goulet
01c4abc2d4 conn: Properly close MetricsPort socket on EOF
Handle the EOF situation for a metrics connection. Furthermore, if we failed
to fetch the data from the inbuf properly, mark the socket as closed because
the caller, connection_process_inbuf(), assumes that we did so on error.

Fixes #40257

Signed-off-by: David Goulet <dgoulet@torproject.org>
2021-02-08 14:26:45 -05:00
David Goulet
685c4866ac relay: Look at the omit IPv6 flag when publishing
In two instances we must look at this flag:

1. When we build the descriptor so the IPv6 is NOT added to the descriptor in
   case we judge that we need to omit the address but still publish.

2. When we are deciding if the descriptor is publishable. This flags tells us
   that the IPv6 was not found reachable but we should still publish.

Fixes #40279

Signed-off-by: David Goulet <dgoulet@torproject.org>
2021-02-08 11:51:45 -05:00
Alexander Færøy
3496804827 Merge branch 'maint-0.4.4' into maint-0.4.5 2021-02-05 17:17:05 +00:00
Alexander Færøy
af9107aff2 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-02-05 17:12:52 +00:00
Alexander Færøy
0a40892e8c Merge branch 'maint-0.4.4' into maint-0.4.5 2021-02-05 16:05:57 +00:00
Alexander Færøy
6578a3e865 Merge branch 'tor-gitlab/mr/292_squashed' into maint-0.4.4 2021-02-05 16:04:53 +00:00
Alexander Færøy
67aefd5520 Only check for bindable ports if we are unsure if it will fail.
We currently assume that the only way for Tor to listen on ports in the
privileged port range (1 to 1023), on Linux, is if we are granted the
NET_BIND_SERVICE capability. Today on Linux, it's possible to specify
the beginning of the unprivileged port range using a sysctl
configuration option. Docker (and thus the CI service Tor uses) recently
changed this sysctl value to 0, which causes our tests to fail as they
assume that we should NOT be able to bind to a privileged port *without*
the NET_BIND_SERVICE capability.

In this patch, we read the value of the sysctl value via the /proc/sys/
filesystem iff it's present, otherwise we assume the default
unprivileged port range begins at port 1024.

See: tor#40275
2021-02-05 16:04:21 +00:00
Nick Mathewson
f3ba71bbee bump to 0.4.4.7-dev 2021-02-03 13:39:03 -05:00
Nick Mathewson
21317c9229 Bump to 0.3.5.13-dev. 2021-02-03 13:37:28 -05:00
David Goulet
44b4aa82aa nodelist: Remove merge artefact
Signed-off-by: David Goulet <dgoulet@torproject.org>
2021-02-03 09:35:45 -05:00
David Goulet
9e91bb31cc Merge branch 'maint-0.4.4' into maint-0.4.5 2021-02-03 09:11:15 -05:00
David Goulet
61e38deb56 Merge branch 'maint-0.4.3' into maint-0.4.4 2021-02-03 09:11:14 -05:00
David Goulet
890a9e89ba Merge branch 'maint-0.3.5' into maint-0.4.3 2021-02-03 09:11:14 -05:00
David Goulet
f322ea3fa8 Merge branch 'ticket40269_035_01' into maint-0.3.5 2021-02-03 09:11:09 -05:00
David Goulet
6f95cdf87e Remove unused addr_port_set code
Signed-off-by: David Goulet <dgoulet@torproject.org>
2021-02-03 09:11:01 -05:00
David Goulet
a0b3e9116d Merge branch 'maint-0.4.4' into maint-0.4.5 2021-02-03 08:58:02 -05:00
David Goulet
eda81ea27e Merge branch 'maint-0.4.3' into maint-0.4.4 2021-02-03 08:56:38 -05:00
David Goulet
cc5d5a5d1e Merge branch 'maint-0.3.5' into maint-0.4.3 2021-02-03 08:56:38 -05:00
David Goulet
a3cef41fc3 Merge branch 'ticket40270_035_01' into maint-0.3.5 2021-02-03 08:56:30 -05:00
David Goulet
903bfc4eca Merge branch 'maint-0.4.3' into maint-0.4.4 2021-02-03 08:54:40 -05:00
David Goulet
e50648582b Merge branch 'maint-0.3.5' into maint-0.4.3 2021-02-03 08:54:40 -05:00
David Goulet
c2cee6c780 node: Move reentry set to use a digestmap_t
Any lookup now will be certain and not probabilistic as the bloomfilter.

Closes #40269

Signed-off-by: David Goulet <dgoulet@torproject.org>
2021-02-03 08:54:02 -05:00
David Goulet
59f1a41a7f relay: Send back CONNECTION_REFUSED on reentry
The TORPROTOCOL reason causes the client to close the circuit which is not
what we want because other valid streams might be on it.

Instead, CONNECTION_REFUSED will leave it open but will not allow more streams
to be attached to it. The client then open a new circuit to the destination.

Closes #40270

Signed-off-by: David Goulet <dgoulet@torproject.org>
2021-02-03 08:52:48 -05:00
David Goulet
36b51a1c71 Merge branch 'maint-0.4.3' into maint-0.4.4 2021-02-03 08:51:37 -05:00
David Goulet
0f8195406e Merge branch 'maint-0.3.5' into maint-0.4.3 2021-02-03 08:51:36 -05:00
David Goulet
98590621bb relay: Double the size of the relay reentry set
This is to minimize false positive and thus deny reentry to Exit connections
that were in reality not re-entering. Helps with overall UX.

Signed-off-by: David Goulet <dgoulet@torproject.org>
2021-02-03 08:51:00 -05:00
David Goulet
ce3af5dd59 relay: Follow consensus parameter for network reentry
Obey the "allow-network-reentry" consensus parameters in order to decide to
allow it or not at the Exit.

Closes #40268

Signed-off-by: David Goulet <dgoulet@torproject.org>
2021-02-03 08:50:56 -05:00
Nick Mathewson
40eeb63b5e bump to 0.4.5.5-rc-dev 2021-02-01 16:14:07 -05:00
David Goulet
ed373eaa8d Merge branch 'tor-gitlab/mr/289' into maint-0.4.5 2021-02-01 14:09:58 -05:00
David Goulet
387d1d8835 relay: Send back CONNECTION_REFUSED on reentry
The TORPROTOCOL reason causes the client to close the circuit which is not
what we want because other valid streams might be on it.

Instead, CONNECTION_REFUSED will leave it open but will not allow more streams
to be attached to it. The client then open a new circuit to the destination.

Closes #40270

Signed-off-by: David Goulet <dgoulet@torproject.org>
2021-02-01 12:45:32 -05:00
David Goulet
627e7d6625 Remove unused addr_port_set code
Signed-off-by: David Goulet <dgoulet@torproject.org>
2021-02-01 12:28:29 -05:00
David Goulet
bd4a3f64a1 node: Move reentry set to use a digestmap_t
Any lookup now will be certain and not probabilistic as the bloomfilter.

Closes #40269

Signed-off-by: David Goulet <dgoulet@torproject.org>
2021-02-01 12:22:23 -05:00
David Goulet
838e07be9d relay: Double the size of the relay reentry set
This is to minimize false positive and thus deny reentry to Exit connections
that were in reality not re-entering. Helps with overall UX.

Signed-off-by: David Goulet <dgoulet@torproject.org>
2021-02-01 09:04:50 -05:00
David Goulet
2c3c30e58f relay: Follow consensus parameter for network reentry
Obey the "allow-network-reentry" consensus parameters in order to decide to
allow it or not at the Exit.

Closes #40268

Signed-off-by: David Goulet <dgoulet@torproject.org>
2021-02-01 08:56:27 -05:00
David Goulet
b2434d30d2 Merge branch 'tor-gitlab/mr/285' into ticket2667_044_01 2021-01-29 14:54:21 -05:00
David Goulet
705fd37875 Merge branch 'tor-gitlab/mr/284' into ticket2667_043_01 2021-01-29 14:51:38 -05:00
George Kadianakis
46efbcb116 test: Add test for exits blocking reentry to the network
Signed-off-by: David Goulet <dgoulet@torproject.org>
2021-01-29 14:28:56 -05:00
Roger Dingledine
632688c797 exit: Deny re-entry into the network
Exit relays now reject exit attempts to known relay addresses + ORPort and
also to authorities on the ORPort and DirPort.

Closes #2667

Signed-off-by: David Goulet <dgoulet@torproject.org>
2021-01-29 14:28:54 -05:00
David Goulet
8dda7bfdb8 relay: Add bloomfiter of relay address + {OR|Dir}Port
In order to deny re-entry in the network, we now keep a bloomfilter of relay
ORPort + address and authorities ORPort + address and DirPort + address
combinations.

So when an Exit stream is handled, we deny anything connecting back into the
network on the ORPorts for relays and on the ORPort+DirPort for the
authorities.

Related to #2667

Signed-off-by: David Goulet <dgoulet@torproject.org>
2021-01-29 14:28:51 -05:00
George Kadianakis
9eba65bd8b test: Add test for exits blocking reentry to the network
Signed-off-by: David Goulet <dgoulet@torproject.org>
2021-01-29 14:19:17 -05:00
Roger Dingledine
93ac6ec4d3 exit: Deny re-entry into the network
Exit relays now reject exit attempts to known relay addresses + ORPort and
also to authorities on the ORPort and DirPort.

Closes #2667

Signed-off-by: David Goulet <dgoulet@torproject.org>
2021-01-29 14:19:17 -05:00
David Goulet
f26950fa7a relay: Add bloomfiter of relay address + {OR|Dir}Port
In order to deny re-entry in the network, we now keep a bloomfilter of relay
ORPort + address and authorities ORPort + address and DirPort + address
combinations.

So when an Exit stream is handled, we deny anything connecting back into the
network on the ORPorts for relays and on the ORPort+DirPort for the
authorities.

Related to #2667

Signed-off-by: David Goulet <dgoulet@torproject.org>
2021-01-29 14:19:17 -05:00
David Goulet
ea38016202 Merge branch 'maint-0.4.3' into maint-0.4.4 2021-01-28 12:46:31 -05:00
David Goulet
79cb47cfc2 Merge branch 'maint-0.3.5' into maint-0.4.3 2021-01-28 12:46:31 -05:00
David Goulet
9556276f07 Merge branch 'tor-gitlab/mr/50' into maint-0.3.5 2021-01-28 12:46:24 -05:00
David Goulet
be81ecba3a Merge branch 'maint-0.4.3' into maint-0.4.4 2021-01-28 12:42:31 -05:00
David Goulet
f058db1f3d Merge branch 'maint-0.3.5' into maint-0.4.3 2021-01-28 12:42:31 -05:00
David Goulet
290007e3c4 Merge branch 'tor-gitlab/mr/239' into maint-0.3.5 2021-01-28 12:42:26 -05:00