]> git.ipfire.org Git - thirdparty/tor.git/log
thirdparty/tor.git
7 years agoRename a verified unverified-consensus to cached-consensus on the disk
Deepesh Pathak [Sat, 3 Feb 2018 01:15:52 +0000 (06:45 +0530)] 
Rename a verified unverified-consensus to cached-consensus on the disk

- Fixes ticket #4187
- Change the name of a unverified-*consensus to cached-*consensus
on disk when it has been verified.

7 years agofuzz: Move init_protocol_warning_severity_level() into global_init()
Nick Mathewson [Fri, 2 Feb 2018 22:42:23 +0000 (17:42 -0500)] 
fuzz: Move init_protocol_warning_severity_level() into global_init()

This is needed so llvm_fuzz will see it too.

7 years agoMerge remote-tracking branch 'dgoulet/ticket24902_029_05'
Nick Mathewson [Fri, 2 Feb 2018 20:00:35 +0000 (15:00 -0500)] 
Merge remote-tracking branch 'dgoulet/ticket24902_029_05'

7 years agoMerge branch 'ticket25122_029_02' into ticket24902_029_05
David Goulet [Fri, 2 Feb 2018 19:55:01 +0000 (14:55 -0500)] 
Merge branch 'ticket25122_029_02' into ticket24902_029_05

7 years agogeoip: Add clientmap_entry_new() function
David Goulet [Fri, 2 Feb 2018 18:24:37 +0000 (13:24 -0500)] 
geoip: Add clientmap_entry_new() function

Signed-off-by: David Goulet <dgoulet@torproject.org>
7 years agogeoip: Increment and decrement functions for the geoip client cache
David Goulet [Fri, 2 Feb 2018 18:14:50 +0000 (13:14 -0500)] 
geoip: Increment and decrement functions for the geoip client cache

These functions protect againts over and underflow. They BUG() in case we
overflow the counter.

Signed-off-by: David Goulet <dgoulet@torproject.org>
7 years agogeoip: Hook the client history cache into the OOM handler
David Goulet [Fri, 2 Feb 2018 15:15:28 +0000 (10:15 -0500)] 
geoip: Hook the client history cache into the OOM handler

If the cache is using 20% of our maximum allowed memory, clean 10% of it. Same
behavior as the HS descriptor cache.

Closes #25122

Signed-off-by: David Goulet <dgoulet@torproject.org>
7 years agoMerge branch 'maint-0.3.2'
Nick Mathewson [Fri, 2 Feb 2018 17:03:54 +0000 (12:03 -0500)] 
Merge branch 'maint-0.3.2'

7 years agoMerge branch 'bug25125_032_01_squashed' into maint-0.3.2
Nick Mathewson [Fri, 2 Feb 2018 17:03:48 +0000 (12:03 -0500)] 
Merge branch 'bug25125_032_01_squashed' into maint-0.3.2

7 years agosched: When releasing a channel, do not BUG() if absent from the pending list
David Goulet [Fri, 2 Feb 2018 13:48:34 +0000 (08:48 -0500)] 
sched: When releasing a channel, do not BUG() if absent from the pending list

The current code flow makes it that we can release a channel in a PENDING
state but not in the pending list. This happens while the channel is being
processed in the scheduler loop.

Fixes #25125

Signed-off-by: David Goulet <dgoulet@torproject.org>
7 years agoMerge branch 'maint-0.3.2'
Nick Mathewson [Thu, 1 Feb 2018 22:05:14 +0000 (17:05 -0500)] 
Merge branch 'maint-0.3.2'

7 years agotest: KIST Scheduler unit tests to test the pending list state
David Goulet [Thu, 1 Feb 2018 20:48:28 +0000 (15:48 -0500)] 
test: KIST Scheduler unit tests to test the pending list state

This tests many cases of the KIST scheduler with the pending list state by
calling entry point in the scheduler while channels are scheduled or not.

Also, it adds a test for the bug #24700.

Signed-off-by: David Goulet <dgoulet@torproject.org>
7 years agoMerge remote-tracking branch 'dgoulet/bug24700_032_01' into maint-0.3.2
Nick Mathewson [Thu, 1 Feb 2018 21:57:57 +0000 (16:57 -0500)] 
Merge remote-tracking branch 'dgoulet/bug24700_032_01' into maint-0.3.2

7 years agoMerge branch 'bug24700_032_01' into bug24700_033_01
David Goulet [Thu, 1 Feb 2018 21:39:04 +0000 (16:39 -0500)] 
Merge branch 'bug24700_032_01' into bug24700_033_01

7 years agosched: Use the sched_heap_idx field to double-check our fix for 24700.
Nick Mathewson [Thu, 1 Feb 2018 16:05:50 +0000 (11:05 -0500)] 
sched: Use the sched_heap_idx field to double-check our fix for 24700.

Signed-off-by: David Goulet <dgoulet@torproject.org>
7 years agoMerge remote-tracking branch 'teor/bug25070'
Nick Mathewson [Thu, 1 Feb 2018 20:28:25 +0000 (15:28 -0500)] 
Merge remote-tracking branch 'teor/bug25070'

7 years agoMerge branch 'maint-0.3.1' into maint-0.3.2
Nick Mathewson [Thu, 1 Feb 2018 20:28:17 +0000 (15:28 -0500)] 
Merge branch 'maint-0.3.1' into maint-0.3.2

7 years agoMerge branch 'maint-0.3.2'
Nick Mathewson [Thu, 1 Feb 2018 20:28:17 +0000 (15:28 -0500)] 
Merge branch 'maint-0.3.2'

7 years agoMerge remote-tracking branch 'teor/bug25070_031' into maint-0.3.1
Nick Mathewson [Thu, 1 Feb 2018 20:28:11 +0000 (15:28 -0500)] 
Merge remote-tracking branch 'teor/bug25070_031' into maint-0.3.1

7 years agoMerge branch 'bug24658-rsa_squashed'
Nick Mathewson [Thu, 1 Feb 2018 17:10:07 +0000 (12:10 -0500)] 
Merge branch 'bug24658-rsa_squashed'

7 years agoAdd crypto_rsa.[ch] to include.am
Fernando Fernandez Mancera [Fri, 26 Jan 2018 16:01:33 +0000 (17:01 +0100)] 
Add crypto_rsa.[ch] to include.am

Included crypto_rsa.[ch] into include.am in order to resolve a compiling issue.

Follows #24658.

Signed-off-by: Fernando Fernandez Mancera <ffmancera@riseup.net>
7 years agoTweaks into functions and variables in crypto_rsa.[ch]
Fernando Fernandez Mancera [Fri, 26 Jan 2018 15:43:46 +0000 (16:43 +0100)] 
Tweaks into functions and variables in crypto_rsa.[ch]

crypto_get_rsa_padding_overhead() and crypto_get_rsa_padding() are
not static inline anymore in order to split the crypto_rsa module
from crypto.[ch].

Also included necessary modules in order to solve dependency issues.

Also made two functions in crypto.c use crypto_pk_asn1_encdoe()
instead of reaching into the crypto_pk_t struct.

7 years agoRemove commented functions in crypto module.
Fernando Fernandez Mancera [Thu, 1 Feb 2018 15:42:30 +0000 (16:42 +0100)] 
Remove commented functions in crypto module.

OpenSSL never uses these callbacks anymore so the code is disabled.

Fixes #25097.

Signed-off-by: Fernando Fernandez Mancera <ffmancera@riseup.net>
7 years agoRemove nodelist_recompute_all_hsdir_indices() as unused.
Nick Mathewson [Thu, 1 Feb 2018 13:44:47 +0000 (08:44 -0500)] 
Remove nodelist_recompute_all_hsdir_indices() as unused.

Closes 25108.

7 years agoRevert "Change the sandbox behavior on all failed opens() to EACCES"
Nick Mathewson [Thu, 1 Feb 2018 13:39:38 +0000 (08:39 -0500)] 
Revert "Change the sandbox behavior on all failed opens() to EACCES"

This reverts commit 9a06282546418b2e9d21559d4853bcf124b953f4.

It appears that I misunderstood how the seccomp2 filter rules
interact.  It appears that `SCMP_ACT_ERRNO()` always takes
precedence over `SCMP_ACT_ALLOW()` -- I had thought instead that
earlier rules would override later ones.  But this change caused bug
25115 (not in any released Tor).

7 years agoMerge remote-tracking branch 'dgoulet/bug24469_033_01'
Nick Mathewson [Thu, 1 Feb 2018 13:22:44 +0000 (08:22 -0500)] 
Merge remote-tracking branch 'dgoulet/bug24469_033_01'

7 years agoMerge branch 'maint-0.3.2'
Nick Mathewson [Thu, 1 Feb 2018 13:13:35 +0000 (08:13 -0500)] 
Merge branch 'maint-0.3.2'

7 years agoMerge remote-tracking branch 'dgoulet/bug24975_032_01' into maint-0.3.2
Nick Mathewson [Thu, 1 Feb 2018 13:10:34 +0000 (08:10 -0500)] 
Merge remote-tracking branch 'dgoulet/bug24975_032_01' into maint-0.3.2

7 years agoMerge remote-tracking branch 'dgoulet/ticket24902_029_05'
Nick Mathewson [Wed, 31 Jan 2018 21:17:04 +0000 (16:17 -0500)] 
Merge remote-tracking branch 'dgoulet/ticket24902_029_05'

7 years agochannel_tls_get_remote_addr_method now returns real_addr.
Fernando Fernandez Mancera [Mon, 22 Jan 2018 14:20:17 +0000 (15:20 +0100)] 
channel_tls_get_remote_addr_method now returns real_addr.

The accurate address of a connection is real_addr, not the addr member.
channel_tls_get_remote_addr_method() now returns real_addr instead.

Fixes #24952; bugfix on 707c1e2 in 0.2.4.11-alpha.

Signed-off-by: Fernando Fernandez Mancera <ffmancera@riseup.net>
7 years agocirc: Don't cannibalize a circuit if the guard state is unusable
David Goulet [Wed, 31 Jan 2018 20:23:45 +0000 (15:23 -0500)] 
circ: Don't cannibalize a circuit if the guard state is unusable

Tor preemptiely builds circuits and they can be cannibalized later in their
lifetime. A Guard node can become unusable (from our guard state) but we can
still have circuits using that node opened. It is important to not pick those
circuits for any usage through the cannibalization process.

Fixes #24469

Signed-off-by: David Goulet <dgoulet@torproject.org>
7 years agoMerge remote-tracking branch 'public/bug16106_02_nm'
Nick Mathewson [Wed, 31 Jan 2018 20:51:58 +0000 (15:51 -0500)] 
Merge remote-tracking branch 'public/bug16106_02_nm'

7 years agoMerge branch 'bug23954_squashed'
Nick Mathewson [Wed, 31 Jan 2018 19:37:48 +0000 (14:37 -0500)] 
Merge branch 'bug23954_squashed'

7 years agoUse thread-safe types to store the LOG_PROTOCOL_WARN severity
Nick Mathewson [Wed, 24 Jan 2018 17:02:44 +0000 (12:02 -0500)] 
Use thread-safe types to store the LOG_PROTOCOL_WARN severity

Fixes a race condition; resolves 23954.

7 years agoMerge branch 'maint-0.3.2'
Nick Mathewson [Wed, 31 Jan 2018 19:33:27 +0000 (14:33 -0500)] 
Merge branch 'maint-0.3.2'

"ours" merge to avoid backport of #25105

7 years agoMerge branch 'bug25105_032' into maint-0.3.2
Nick Mathewson [Wed, 31 Jan 2018 19:33:12 +0000 (14:33 -0500)] 
Merge branch 'bug25105_032' into maint-0.3.2

7 years agoMerge branch 'bug25008'
Nick Mathewson [Wed, 31 Jan 2018 19:32:24 +0000 (14:32 -0500)] 
Merge branch 'bug25008'

7 years agons: Add a before and after consensus has changed notification
David Goulet [Wed, 31 Jan 2018 19:15:02 +0000 (14:15 -0500)] 
ns: Add a before and after consensus has changed notification

In 0.3.2.1-alpha, we've added notify_networkstatus_changed() in order to have
a way to notify other subsystems that the consensus just changed. The old and
new consensus are passed to it.

Before this patch, this was done _before_ the new consensus was set globally
(thus NOT accessible by getting the latest consensus). The scheduler
notification was assuming that it was set and select_scheduler() is looking at
the latest consensus to get the parameters it might needs. This was very wrong
because at that point it is still the old consensus set globally.

This commit changes the notify_networkstatus_changed() to be the "before"
function and adds an "after" notification from which the scheduler subsystem
is notified.

Fixes #24975

7 years agoLook at the correct protocol for supports_v3_rendezvous_point
Nick Mathewson [Wed, 31 Jan 2018 19:01:49 +0000 (14:01 -0500)] 
Look at the correct protocol for supports_v3_rendezvous_point

Fixes bug 25105; bugfix on 0.3.2.1-alpha.

(This is a backport of bbf2d9cf6bb97c3e15ada58 for 0.3.2.)

7 years agoFix a failing unit test.
Nick Mathewson [Wed, 31 Jan 2018 19:06:37 +0000 (14:06 -0500)] 
Fix a failing unit test.

When we stopped looking at the "protocols" variable directly, we
broke the hs_service/build_update_descriptors test, since it didn't
actually update any of the flags.

The fix here is to call summarize_protover_flags() from that test,
and to expose summarize_protover_flags() as "STATIC" from
routerparse.c.

7 years agoLook at the correct protocol for supports_v3_rendezvous_point
Nick Mathewson [Wed, 31 Jan 2018 19:01:49 +0000 (14:01 -0500)] 
Look at the correct protocol for supports_v3_rendezvous_point

Fixes bug 25105; bugfix on 0.3.2.1-alpha.

7 years agoRevert "ns: Call notify_networkstatus_changed() after the new consensus is set globally"
David Goulet [Wed, 31 Jan 2018 18:59:05 +0000 (13:59 -0500)] 
Revert "ns: Call notify_networkstatus_changed() after the new consensus is set globally"

This reverts commit 3a247ca92a06c864a2cb634fbe2bc23cf48fb977.

7 years agoDocument remaining cases for protocol support
Nick Mathewson [Wed, 31 Jan 2018 18:50:04 +0000 (13:50 -0500)] 
Document remaining cases for protocol support

For each support flag, document which subprotocol version it requires.

7 years agoMerge branch 'maint-0.3.2'
Nick Mathewson [Wed, 31 Jan 2018 18:47:01 +0000 (13:47 -0500)] 
Merge branch 'maint-0.3.2'

7 years agoMerge remote-tracking branch 'dgoulet/bug24975_032_01' into maint-0.3.2
Nick Mathewson [Wed, 31 Jan 2018 18:46:58 +0000 (13:46 -0500)] 
Merge remote-tracking branch 'dgoulet/bug24975_032_01' into maint-0.3.2

7 years agosched: Avoid adding the same channel twice to the KIST pending list
David Goulet [Wed, 31 Jan 2018 18:46:31 +0000 (13:46 -0500)] 
sched: Avoid adding the same channel twice to the KIST pending list

This is the quick fix that is keeping the channel in PENDING state so if we
ever try to reschedule the same channel, it won't happened.

Fixes #24700

Signed-off-by: David Goulet <dgoulet@torproject.org>
7 years agoMerge branch 'maint-0.3.2'
Nick Mathewson [Wed, 31 Jan 2018 17:51:45 +0000 (12:51 -0500)] 
Merge branch 'maint-0.3.2'

7 years agohs-v3: Remove a BUG() when storing a descriptor in the client cache
David Goulet [Wed, 31 Jan 2018 15:58:11 +0000 (10:58 -0500)] 
hs-v3: Remove a BUG() when storing a descriptor in the client cache

It is possible in normal circumstances that  a client fetches a descriptor
that has a lower revision counter than the one in its cache. This can happen
due to HSDir desync.

Fixes #24976

Signed-off-by: David Goulet <dgoulet@torproject.org>
7 years agons: Call notify_networkstatus_changed() after the new consensus is set globally
David Goulet [Wed, 31 Jan 2018 16:08:33 +0000 (11:08 -0500)] 
ns: Call notify_networkstatus_changed() after the new consensus is set globally

In 0.3.2.1-alpha, we've added this function in order to have a way to notify
other subsystems that the consensus just changed. The old consensus and the
new one are passed to it.

Before this patch, this was done _before_ the new consensus was set globally
(thus NOT accessible by getting the latest consensus). The scheduler
notification was assuming that it was set and select_scheduler() is looking at
the latest consensus to get the parameters it might needs. This was very wrong
because at that point it is still the old consensus set globally.

With this commit, notify_networkstatus_changed() has been moved _after_ the
new consensus is set globally. The main obvious reasons is to fix the bug
described above and in #24975. The other reason is that this notify function
doesn't return anything which could be allowing the possibility of refusing to
set the new consensus on error. In other words, the new consensus is set right
after the notification whatever happens.

It does no harm or change in behavior to set the new consensus first and then
notify the subsystems. The two functions currently used are for the control
port using the old and new consensus and sending the diff. The second is the
scheduler that needs the new consensus to be set globally before being called.

Of course, the function has been documented accordinly to clearly state it is
done _after_ the new consensus is set.

Fixes #24975

Signed-off-by: David Goulet <dgoulet@torproject.org>
7 years agoMerge branch 'maint-0.3.2'
Nick Mathewson [Wed, 31 Jan 2018 15:06:49 +0000 (10:06 -0500)] 
Merge branch 'maint-0.3.2'

7 years agoMerge branch 'maint-0.3.1' into maint-0.3.2
Nick Mathewson [Wed, 31 Jan 2018 15:06:49 +0000 (10:06 -0500)] 
Merge branch 'maint-0.3.1' into maint-0.3.2

7 years agoBut in most Earth cultures, there are 60s in a minute.
Nick Mathewson [Wed, 31 Jan 2018 15:06:43 +0000 (10:06 -0500)] 
But in most Earth cultures, there are 60s in a minute.

7 years agoMerge branch 'maint-0.3.2'
Nick Mathewson [Wed, 31 Jan 2018 15:01:13 +0000 (10:01 -0500)] 
Merge branch 'maint-0.3.2'

7 years agoMerge branch 'maint-0.3.1' into maint-0.3.2
Nick Mathewson [Wed, 31 Jan 2018 15:01:13 +0000 (10:01 -0500)] 
Merge branch 'maint-0.3.1' into maint-0.3.2

7 years agoadd a rate-limit.
Nick Mathewson [Wed, 31 Jan 2018 15:01:10 +0000 (10:01 -0500)] 
add a rate-limit.

7 years agoMerge branch 'maint-0.3.2'
Nick Mathewson [Wed, 31 Jan 2018 14:50:24 +0000 (09:50 -0500)] 
Merge branch 'maint-0.3.2'

7 years agoMerge branch 'maint-0.3.1' into maint-0.3.2
Nick Mathewson [Wed, 31 Jan 2018 14:50:24 +0000 (09:50 -0500)] 
Merge branch 'maint-0.3.1' into maint-0.3.2

7 years agoMerge branch 'bug24927'
Nick Mathewson [Wed, 31 Jan 2018 14:47:36 +0000 (09:47 -0500)] 
Merge branch 'bug24927'

7 years agoMerge remote-tracking branch 'public/ticket24849_032'
Nick Mathewson [Wed, 31 Jan 2018 14:38:24 +0000 (09:38 -0500)] 
Merge remote-tracking branch 'public/ticket24849_032'

7 years agoMerge remote-tracking branch 'dgoulet/ticket24902_029_05'
Nick Mathewson [Wed, 31 Jan 2018 14:35:07 +0000 (09:35 -0500)] 
Merge remote-tracking branch 'dgoulet/ticket24902_029_05'

7 years agotest: Add unit tests for overflows and underflows in cc_stats_refill_bucket
teor [Wed, 31 Jan 2018 00:22:20 +0000 (11:22 +1100)] 
test: Add unit tests for overflows and underflows in cc_stats_refill_bucket

Closes #25094.

Signed-off-by: David Goulet <dgoulet@torproject.org>
7 years agodos: Make sure cc_stats_refill_bucket can't overflow while calculating
teor [Wed, 31 Jan 2018 00:13:17 +0000 (11:13 +1100)] 
dos: Make sure cc_stats_refill_bucket can't overflow while calculating

Debug log the elapsed time in cc_stats_refill_bucket

Part of #25094.

Signed-off-by: David Goulet <dgoulet@torproject.org>
7 years agoMerge branch 'maint-0.3.2'
Nick Mathewson [Wed, 31 Jan 2018 14:19:55 +0000 (09:19 -0500)] 
Merge branch 'maint-0.3.2'

7 years agotest: Remove a redundant round from test_dos_bucket_refill
teor [Wed, 31 Jan 2018 00:11:08 +0000 (11:11 +1100)] 
test: Remove a redundant round from test_dos_bucket_refill

This round is left over from the tenths of a second code.

Part of #25094.

7 years agoremove a redundant semicolon
Nick Mathewson [Tue, 30 Jan 2018 23:11:16 +0000 (18:11 -0500)] 
remove a redundant semicolon

7 years agoMerge branch 'ticket24902_029_05' into ticket24902_033_02
David Goulet [Tue, 30 Jan 2018 14:33:12 +0000 (09:33 -0500)] 
Merge branch 'ticket24902_029_05' into ticket24902_033_02

7 years agodos: Add changes file for ticket 24902
David Goulet [Tue, 30 Jan 2018 14:15:33 +0000 (09:15 -0500)] 
dos: Add changes file for ticket 24902

Signed-off-by: David Goulet <dgoulet@torproject.org>
7 years agodos: Make circuit rate limit per second, not tenths anymore
David Goulet [Mon, 29 Jan 2018 16:50:11 +0000 (11:50 -0500)] 
dos: Make circuit rate limit per second, not tenths anymore

Because this touches too many commits at once, it is made into one single
commit.

Remove the use of "tenths" for the circuit rate to simplify things. We can
only refill the buckets at best once every second because of the use of
approx_time() and our token system is set to be 1 token = 1 circuit so make
the rate a flat integer of circuit per second.

Signed-off-by: David Goulet <dgoulet@torproject.org>
7 years agodos: Man page entry for DoS mitigation
David Goulet [Fri, 26 Jan 2018 14:00:17 +0000 (09:00 -0500)] 
dos: Man page entry for DoS mitigation

Signed-off-by: David Goulet <dgoulet@torproject.org>
7 years agotest: Add unit tests for the DoS subsystem
George Kadianakis [Thu, 25 Jan 2018 21:38:59 +0000 (16:38 -0500)] 
test: Add unit tests for the DoS subsystem

Signed-off-by: David Goulet <dgoulet@torproject.org>
7 years agodos: Clear connection tracked flag if geoip entry is removed
David Goulet [Thu, 25 Jan 2018 14:44:21 +0000 (09:44 -0500)] 
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>
7 years agodos: Add a heartbeat log
David Goulet [Thu, 25 Jan 2018 21:36:05 +0000 (16:36 -0500)] 
dos: Add a heartbeat log

Signed-off-by: David Goulet <dgoulet@torproject.org>
7 years agodos: Add the DoSRefuseSingleHopClientRendezvous option
David Goulet [Thu, 25 Jan 2018 21:32:28 +0000 (16:32 -0500)] 
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>
7 years agodos: Add the connection DoS mitigation subsystem
David Goulet [Thu, 25 Jan 2018 21:28:54 +0000 (16:28 -0500)] 
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>
7 years agodos: Apply defense for circuit creation DoS
David Goulet [Thu, 25 Jan 2018 21:20:52 +0000 (16:20 -0500)] 
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>
7 years agodos: Detect circuit creation denial of service
David Goulet [Thu, 25 Jan 2018 21:14:40 +0000 (16:14 -0500)] 
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>
7 years agodos: Track new and closed OR client connections
David Goulet [Thu, 25 Jan 2018 21:05:59 +0000 (16:05 -0500)] 
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>
7 years agogeoip: Remember client stats if DoS mitigation is enabled
David Goulet [Fri, 19 Jan 2018 18:15:07 +0000 (13:15 -0500)] 
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>
7 years agodos: Initial code of Denial of Service mitigation
David Goulet [Thu, 25 Jan 2018 20:54:58 +0000 (15:54 -0500)] 
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>
7 years agoChanges file for 25070
teor [Mon, 29 Jan 2018 14:55:56 +0000 (01:55 +1100)] 
Changes file for 25070

7 years agoAdd unit tests for supported protocols
teor [Mon, 29 Jan 2018 14:53:41 +0000 (01:53 +1100)] 
Add unit tests for supported protocols

Prevents future regressions like #25070.

7 years agoAdd Link protocol version 5 to the supported protocols list in protover.rs
teor [Mon, 29 Jan 2018 14:51:59 +0000 (01:51 +1100)] 
Add Link protocol version 5 to the supported protocols list in protover.rs

And fix the unsupported protover example so it uses a Link protover much
higher than 5.

Part of  #25070, bugfix on 0.3.3.1-alpha, which introduced the protover crate.

7 years agoChanges file for 25070
teor [Mon, 29 Jan 2018 14:55:56 +0000 (01:55 +1100)] 
Changes file for 25070

7 years agoAdd Link protocol version 5 to the supported protocols list in protover.c
teor [Mon, 29 Jan 2018 14:51:03 +0000 (01:51 +1100)] 
Add Link protocol version 5 to the supported protocols list in protover.c

Part of #25070, bugfix on 0.3.1.1-alpha.

7 years agoAdd Link protocol version 5 to the supported protocols list in protover.c
teor [Mon, 29 Jan 2018 14:51:03 +0000 (01:51 +1100)] 
Add Link protocol version 5 to the supported protocols list in protover.c

Part of #25070, bugfix on 0.3.1.1-alpha.

7 years agoMake more notes about important stuff in ReleasingTor.md
Nick Mathewson [Fri, 26 Jan 2018 19:39:08 +0000 (14:39 -0500)] 
Make more notes about important stuff in ReleasingTor.md

7 years agoReleasingTor.md: check for recommendation, listing on dl page
Nick Mathewson [Fri, 26 Jan 2018 19:34:25 +0000 (14:34 -0500)] 
ReleasingTor.md: check for recommendation, listing on dl page

Closes ticket 23118.

7 years agoImprove log when unable to add sigs to pending consensus
Nick Mathewson [Fri, 26 Jan 2018 19:19:59 +0000 (14:19 -0500)] 
Improve log when unable to add sigs to pending consensus

Closes ticket 24849.

7 years agoWhen a tor_cert_T check fails, log the reason why.
Nick Mathewson [Fri, 26 Jan 2018 18:55:25 +0000 (13:55 -0500)] 
When a tor_cert_T check fails, log the reason why.

Diagnostic attempt for 24972.

7 years agoRemove a needless (always-true) check.
Nick Mathewson [Fri, 26 Jan 2018 18:35:00 +0000 (13:35 -0500)] 
Remove a needless (always-true) check.

Also add an assertion and rename a variable.

Closes ticekt 24927.

7 years agoIf out-of-disk when saving a consensus cache entry, don't BUG.
Nick Mathewson [Fri, 26 Jan 2018 18:14:14 +0000 (13:14 -0500)] 
If out-of-disk when saving a consensus cache entry, don't BUG.

Just warn instead.

Fixes bug 24859.

7 years agoChange the sandbox behavior on all failed opens() to EACCES
Nick Mathewson [Fri, 26 Jan 2018 17:18:43 +0000 (12:18 -0500)] 
Change the sandbox behavior on all failed opens() to EACCES

Previously, most disallowed open(O_RDONLY) attempts would EACCES,
but others would fail with a crash.

7 years agoRefactor crypto.[ch] into smaller RSA module.
Fernando Fernandez Mancera [Thu, 25 Jan 2018 19:16:50 +0000 (20:16 +0100)] 
Refactor crypto.[ch] into smaller RSA module.

Add two new files (crypto_rsa.c, crypto_rsa.h) as new module of crypto.[ch].
This new module includes all functions and dependencies related to RSA
operations. Those have been removed from crypto.[ch].

All new changes related to RSA operations must be done in these files.

Follows #24658

Signed-off-by: Fernando Fernandez Mancera <ffmancera@riseup.net>
7 years agogeoip: Add a lookup function for client map entry
David Goulet [Thu, 25 Jan 2018 20:44:48 +0000 (15:44 -0500)] 
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>
7 years agoMerge remote-tracking branch 'ahf-oniongit/bugs/25026'
Nick Mathewson [Thu, 25 Jan 2018 18:57:37 +0000 (13:57 -0500)] 
Merge remote-tracking branch 'ahf-oniongit/bugs/25026'

7 years agoBump version to 0.3.3.1-alpha-dev
Nick Mathewson [Thu, 25 Jan 2018 18:50:55 +0000 (13:50 -0500)] 
Bump version to 0.3.3.1-alpha-dev

7 years agoReflow changelog tor-0.3.3.1-alpha
Nick Mathewson [Thu, 25 Jan 2018 18:27:49 +0000 (13:27 -0500)] 
Reflow changelog

7 years agoWe do not put a colon here.
Nick Mathewson [Thu, 25 Jan 2018 16:55:49 +0000 (11:55 -0500)] 
We do not put a colon here.

7 years agobump version to 0.3.3.1-alpha
Nick Mathewson [Thu, 25 Jan 2018 16:48:42 +0000 (11:48 -0500)] 
bump version to 0.3.3.1-alpha

7 years agoProofreading step by seborn (thx)
Nick Mathewson [Thu, 25 Jan 2018 16:37:01 +0000 (11:37 -0500)] 
Proofreading step by seborn (thx)