Commit Graph

27090 Commits

Author SHA1 Message Date
David Goulet a3714268f6 dos: Man page entry for DoS mitigation
Signed-off-by: David Goulet <dgoulet@torproject.org>
2018-01-30 09:18:16 -05:00
George Kadianakis c3c2b55dec test: Add unit tests for the DoS subsystem
Signed-off-by: David Goulet <dgoulet@torproject.org>
2018-01-30 09:18:16 -05:00
David Goulet 82de4ea900 dos: Clear connection tracked flag if geoip entry is removed
Imagine this scenario. We had 10 connections over the 24h lifetime of a geoip
cache entry. The lifetime of the entry has been reached so it is about to get
freed but 2 connections remain for it. After the free, a third connection
comes in thus making us create a new geoip entry for that address matching the
2 previous ones that are still alive. If they end up being closed, we'll have
a concurrent count desynch from what the reality is.

To mitigate this probably very rare scenario in practice, when we free a geoip
entry and it has a concurrent count above 0, we'll go over all connections
matching the address and clear out the tracked flag. So once they are closed,
we don't try to decrement the count.

Signed-off-by: David Goulet <dgoulet@torproject.org>
2018-01-30 09:18:16 -05:00
David Goulet 14a8b87852 dos: Add a heartbeat log
Signed-off-by: David Goulet <dgoulet@torproject.org>
2018-01-30 09:18:16 -05:00
David Goulet 36a0ae151f dos: Add the DoSRefuseSingleHopClientRendezvous option
This option refuses any ESTABLISH_RENDEZVOUS cell arriving from a client
connection. Its default value is "auto" for which we can turn it on or off
with a consensus parameter. Default value is 0.

Signed-off-by: David Goulet <dgoulet@torproject.org>
2018-01-30 09:18:16 -05:00
David Goulet acf7ea77d8 dos: Add the connection DoS mitigation subsystem
Defend against an address that has reached the concurrent connection count
threshold.

Signed-off-by: David Goulet <dgoulet@torproject.org>
2018-01-30 09:18:15 -05:00
David Goulet 1bfc91a029 dos: Apply defense for circuit creation DoS
If the client address was detected as malicious, apply a defense which is at
this commit to return a DESTROY cell.

Signed-off-by: David Goulet <dgoulet@torproject.org>
2018-01-30 09:18:15 -05:00
David Goulet 97abb3543b dos: Detect circuit creation denial of service
Add a function that notifies the DoS subsystem that a new CREATE cell has
arrived. The statistics are updated accordingly and the IP address can also be
marked as malicious if it is above threshold.

At this commit, no defense is applied, just detection with a circuit creation
token bucket system.

Signed-off-by: David Goulet <dgoulet@torproject.org>
2018-01-30 09:18:15 -05:00
David Goulet c05272783d dos: Track new and closed OR client connections
Implement a basic connection tracking that counts the number of concurrent
connections when they open and close.

This commit also adds the circuit creation mitigation data structure that will
be needed at later commit to keep track of the circuit rate.

Signed-off-by: David Goulet <dgoulet@torproject.org>
2018-01-30 09:18:15 -05:00
David Goulet 51fda85c23 geoip: Remember client stats if DoS mitigation is enabled
Make the geoip cache track client address if the DoS subsystem is enabled.

Signed-off-by: David Goulet <dgoulet@torproject.org>
2018-01-30 09:18:15 -05:00
David Goulet 64149353dd dos: Initial code of Denial of Service mitigation
This commit introduces the src/or/dos.{c|h} files that contains the code for
the Denial of Service mitigation subsystem. It currently contains basic
functions to initialize and free the subsystem. They are used at this commit.

The torrc options and consensus parameters are defined at this commit and
getters are implemented.

Signed-off-by: David Goulet <dgoulet@torproject.org>
2018-01-30 09:18:15 -05:00
teor 9656ad3232
Changes file for 25070 2018-01-30 02:08:42 +11:00
teor a8e5e3a492
Add Link protocol version 5 to the supported protocols list in protover.c
Part of #25070, bugfix on 0.3.1.1-alpha.
2018-01-30 01:56:50 +11:00
Nick Mathewson ee5c624beb When a tor_cert_T check fails, log the reason why.
Diagnostic attempt for 24972.
2018-01-26 13:55:25 -05:00
Nick Mathewson 9c2bc441f8 If out-of-disk when saving a consensus cache entry, don't BUG.
Just warn instead.

Fixes bug 24859.
2018-01-26 13:14:14 -05:00
David Goulet 93b826faaa geoip: Add a lookup function for client map entry
The upcoming DoS mitigation subsytem needs to keep information on a per-IP
basis which is also what the geoip clientmap does.

For another subsystem to access that clientmap, this commit adds a lookup
function that returns the entry. For this, the clientmap_entry_t had to be
moved to the header file.

Signed-off-by: David Goulet <dgoulet@torproject.org>
2018-01-25 15:44:48 -05:00
Nick Mathewson 6ba2881aec Fix a memory leak in scheduler/loop_kist
Fixes bug 25005.
2018-01-24 12:07:45 -05:00
Nick Mathewson 0dbe3ddc33 Make Tor support TLS1.3 ciphers with OpenSSL 1.1.1
Without this patch, not only will TLS1.3 not work with Tor, but
OpenSSL 1.1.1 with TLS1.3 enabled won't build any connections at
all: It requires that either TLS1.3 be disabled, or some TLS1.3
ciphersuites be listed.

Closes ticket 24978.
2018-01-23 09:23:21 -05:00
Nick Mathewson 129456e222 Merge branch 'maint-0.3.1' into maint-0.3.2 2018-01-19 16:30:50 -05:00
Nick Mathewson de3cf40fa6 Merge remote-tracking branch 'dgoulet/bug24895_032_02' into maint-0.3.2 2018-01-19 16:30:44 -05:00
Nick Mathewson 7f2e23e7ac Merge branch 'maint-0.3.0' into maint-0.3.1
"ours" merge to avoid maint-0.3.0's version of 24895.
2018-01-19 16:30:12 -05:00
Nick Mathewson 00a42277ea Merge remote-tracking branch 'dgoulet/bug24895_031_02' into maint-0.3.1 2018-01-19 16:30:02 -05:00
Nick Mathewson b39c50cde8 Merge branch 'maint-0.2.9' into maint-0.3.0
Conflicts:
        src/or/rendservice.c
2018-01-19 16:29:43 -05:00
Nick Mathewson a2aaf9509b Merge remote-tracking branch 'dgoulet/bug24895_029_02' into maint-0.2.9 2018-01-19 16:29:15 -05:00
David Goulet f870f9c8bc Merge branch 'bug24895_031_02' into bug24895_032_02 2018-01-19 16:26:26 -05:00
David Goulet f98f7ca898 Merge branch 'bug24895_029_02' into bug24895_031_02 2018-01-19 16:21:55 -05:00
Roger Dingledine 490ae26b24 hs: Use hs_service_max_rdv_failures consensus param, defaulting to 2 2018-01-19 16:13:54 -05:00
Nick Mathewson e2aacf100f Merge branch 'maint-0.3.1' into maint-0.3.2 2018-01-19 10:18:29 -05:00
Nick Mathewson 483a59ec2a Merge remote-tracking branch 'tlyu-github/travis-workaround-031' into maint-0.3.1 2018-01-19 10:18:21 -05:00
Nick Mathewson 9b19e33bed Merge branch 'maint-0.3.0' into maint-0.3.1
"ours" merge to avoid 0.2.5 version of #24863 fix.
2018-01-19 10:17:33 -05:00
Nick Mathewson 1cf11b6940 Merge branch 'maint-0.2.9' into maint-0.3.0 2018-01-19 10:17:05 -05:00
Nick Mathewson 36567c5ca4 Merge branch 'maint-0.2.5' into maint-0.2.9 2018-01-19 10:16:47 -05:00
Roger Dingledine cc5a9e9667 turn MAX_REND_FAILURES into a function
no actual changes in behavior
2018-01-19 02:38:07 -05:00
Roger Dingledine a15eb9ff43 MAX_REND_FAILURES is 1, but we would try three times
Fix an "off by 2" error in counting rendezvous failures on the onion
service side.

While we thought we would stop the rendezvous attempt after one failed
circuit, we were actually making three circuit attempts before giving up.

Fixes bug 24895; bugfix on 0.0.6.
2018-01-19 02:28:55 -05:00
Nick Mathewson 44388757c4 Merge branch 'maint-0.3.1' into maint-0.3.2 2018-01-18 08:13:48 -05:00
Nick Mathewson f406b9df05 Merge branch 'bug24826_031' into maint-0.3.1 2018-01-18 08:13:45 -05:00
Taylor Yu 0e7f1b06e9 Work around Travis CI ptrace regression
Travis CI deployed a change that disables ptrace capabilities in
container builds, which prevents LeakSanitizer on clang from working
properly.  Set "sudo: required" to force non-container builds for
clang and work around this.
2018-01-17 14:10:04 -06:00
Taylor Yu 49de586add Work around Travis CI ptrace regression
Travis CI deployed a change that disables ptrace capabilities in
container builds, which prevents LeakSanitizer on clang from working
properly.  Set "sudo: required" to force non-container builds for
clang and work around this.
2018-01-17 13:40:34 -06:00
Nick Mathewson 4e653ac2ca Merge branch 'maint-0.3.1' into maint-0.3.2 2018-01-17 11:12:15 -05:00
Nick Mathewson f02c6bcad0 Merge remote-tracking branch 'arma/bug24894' into maint-0.3.2 2018-01-17 10:49:45 -05:00
Nick Mathewson 0bfd5a6597 Add a cast to avoid a signed/unsigned comparison 2018-01-17 09:06:32 -05:00
Nick Mathewson 0cb89eb828 Merge remote-tracking branch 'public/bug24652_032' into maint-0.3.2 2018-01-16 13:35:52 -05:00
Nick Mathewson 4bb831e087 Improve fragile-hardening performance of consensus_split_lines.
For whatever reason, in my testing, using memchr() here improves
performance over strchr() by a great deal.

Fixes bug 24826; bugfix on 0.3.1.1-alpha.
2018-01-16 12:42:40 -05:00
Roger Dingledine af8cadf3a9 Remove false positives from channel_is_client()
Fix a set of false positives where relays would consider connections
to other relays as being client-only connections (and thus e.g.
deserving different link padding schemes) if those relays fell out
of the consensus briefly.

Now we look only at the initial handshake and whether the connection
authenticated as a relay.

Fixes bug 24898; bugfix on 0.3.1.1-alpha.
2018-01-15 22:33:40 -05:00
Roger Dingledine 7ce335c921 v3 onion services now obey MAX_REND_FAILURES
New-style (v3) onion services now obey the "max rendezvous circuit
attempts" logic.

Previously they would make as many rendezvous circuit attempts as they
could fit in the MAX_REND_TIMEOUT second window before giving up.

Fixes bug 24894; bugfix on 0.3.2.1-alpha.
2018-01-15 16:41:47 -05:00
Sebastian Hahn db5aa54a42 Reword requirement to set Myfamily correctly 2018-01-11 20:00:23 -05:00
Nick Mathewson 4c651b8c04 Note contactinfo and myfamily as required in more places
Includes a sentence from cypherpunks; for ticket 24526.
2018-01-11 20:00:18 -05:00
Nick Mathewson 34c6034aa7 Increment version to 0.3.2.9-dev 2018-01-09 10:12:25 -05:00
Nick Mathewson 1f7f930f9e Increment version to 0.3.2.9 2018-01-08 11:39:24 -05:00
Nick Mathewson b85fa0bd5f Merge branch 'maint-0.2.9' into maint-0.3.0 2018-01-08 11:10:36 -05:00