]> git.ipfire.org Git - thirdparty/tor.git/log
thirdparty/tor.git
8 years agoSR: Compute the start time of the current protocol run.
George Kadianakis [Mon, 17 Jul 2017 11:45:14 +0000 (14:45 +0300)] 
SR: Compute the start time of the current protocol run.

This function will be used to make the HS desc overlap function be
independent of absolute times.

8 years agoprop224: HSDir v3 support is >= 0.3.0.8
David Goulet [Fri, 14 Jul 2017 20:37:13 +0000 (16:37 -0400)] 
prop224: HSDir v3 support is >= 0.3.0.8

Because of bug #22447, we have to select nodes that are at least this version.

Signed-off-by: David Goulet <dgoulet@torproject.org>
8 years agoprop224: Move get_intro_circuit() to hs_circuit.c
David Goulet [Wed, 19 Jul 2017 15:42:04 +0000 (11:42 -0400)] 
prop224: Move get_intro_circuit() to hs_circuit.c

Make this function public so we can use it both in hs_circuit.c and
hs_service.c to avoid code duplication.

Signed-off-by: David Goulet <dgoulet@torproject.org>
8 years agoprop224: Make circuit prediction aware of v3 services
David Goulet [Tue, 11 Jul 2017 15:18:23 +0000 (11:18 -0400)] 
prop224: Make circuit prediction aware of v3 services

Signed-off-by: David Goulet <dgoulet@torproject.org>
8 years agoprop224: Add service rendezvous circuit relaunch
David Goulet [Tue, 30 May 2017 20:11:59 +0000 (16:11 -0400)] 
prop224: Add service rendezvous circuit relaunch

This introduces a callback to relaunch a service rendezvous circuit when a
previous one failed to build or expired.

It unifies the legacy function rend_service_relaunch_rendezvous() with one for
specific to prop224. There is now only one entry point for that which is
hs_circ_retry_service_rendezvous_point() supporting both legacy and prop224
circuits.

Signed-off-by: David Goulet <dgoulet@torproject.org>
8 years agoprop224: Different intro point timings with TestingNetwork
David Goulet [Fri, 26 May 2017 18:20:00 +0000 (14:20 -0400)] 
prop224: Different intro point timings with TestingNetwork

Change the timing for intro point's lifetime and maximum amount of circuit we
are allowed to launch in a TestingNetwork. This is particurlarly useful for
chutney testing to test intro point rotation.

Signed-off-by: David Goulet <dgoulet@torproject.org>
8 years agoprop224: Add a circuit has closed callback
David Goulet [Thu, 25 May 2017 14:28:00 +0000 (10:28 -0400)] 
prop224: Add a circuit has closed callback

When the circuit is about to be freed which has been marked close before, for
introduction circuit we now call this has_closed() callback so we can cleanup
any introduction point that have retried to many times or at least flag them
that their circuit is not established anymore.

Signed-off-by: David Goulet <dgoulet@torproject.org>
8 years agohs: Rename num_rend_services()
David Goulet [Mon, 10 Jul 2017 15:31:51 +0000 (11:31 -0400)] 
hs: Rename num_rend_services()

Renamed to rend_num_services() so it is consistent with the legacy naming.

Signed-off-by: David Goulet <dgoulet@torproject.org>
8 years agotest: Fix prop224 HS descriptor to use subcredential
George Kadianakis [Thu, 1 Jun 2017 12:11:03 +0000 (15:11 +0300)] 
test: Fix prop224 HS descriptor to use subcredential

We used to use NULL subcredential which is a terrible terrible idea.  Refactor
HS unittests to use subcredentials.

Also add some non-fatal asserts to make sure that we always use subcredentials
when decoding/encoding descs.

Signed-off-by: David Goulet <dgoulet@torproject.org>
8 years agotest: Add unit test coverage of hs_service.c
David Goulet [Fri, 5 May 2017 18:55:26 +0000 (14:55 -0400)] 
test: Add unit test coverage of hs_service.c

Signed-off-by: David Goulet <dgoulet@torproject.org>
8 years agotest: Refactor HS tests to use the new ESTABLISH_INTRO cell code
David Goulet [Fri, 28 Apr 2017 17:41:34 +0000 (13:41 -0400)] 
test: Refactor HS tests to use the new ESTABLISH_INTRO cell code

Signed-off-by: David Goulet <dgoulet@torproject.org>
8 years agotest: Add test_hs_common unit tests
David Goulet [Thu, 20 Apr 2017 15:20:02 +0000 (11:20 -0400)] 
test: Add test_hs_common unit tests

Move tests from test_hs_service.c to this file.

Signed-off-by: David Goulet <dgoulet@torproject.org>
8 years agotest: Add test_hs_ntor unit tests
David Goulet [Thu, 20 Apr 2017 14:04:28 +0000 (10:04 -0400)] 
test: Add test_hs_ntor unit tests

Move the ntor test from test_hs_service.c to this file.

Signed-off-by: David Goulet <dgoulet@torproject.org>
8 years agotest: Add test_hs_cell unit tests
David Goulet [Thu, 20 Apr 2017 13:58:21 +0000 (09:58 -0400)] 
test: Add test_hs_cell unit tests

Move ESTABLISH_INTRO tests from test_hs_service.c to this new file.

Signed-off-by: David Goulet <dgoulet@torproject.org>
8 years agoprop224: Link rendezvous circuit to edge connection
David Goulet [Wed, 10 May 2017 19:04:40 +0000 (15:04 -0400)] 
prop224: Link rendezvous circuit to edge connection

This commit refactors the handle_hs_exit_conn() function introduced at a prior
commit that connects the rendezvous circuit to the edge connection used to
connect to the service virtual port requested in a BEGIN cell.

The refactor adds the support for prop224 adding the
hs_service_set_conn_addr_port() function that has the same purpose has
rend_service_set_connection_addr_port() from the legacy code.

The rend_service_set_connection_addr_port() has also been a bit refactored so
the common code can be shared between the two HS subsystems (legacy and
prop224).

In terms of functionallity, nothing has changed, we still close the circuits
in case of failure for the same reasons as the legacy system currently does.

Signed-off-by: David Goulet <dgoulet@torproject.org>
8 years agohs: Refactor the service exit connection code
David Goulet [Wed, 10 May 2017 17:43:37 +0000 (13:43 -0400)] 
hs: Refactor the service exit connection code

This commit simply moves the code from the if condition of a rendezvous
circuit to a function to handle such a connection. No code was modified
_except_ the use or rh.stream_id changed to n_stream->stream_id so we don't
have to pass the cell header to the function.

This is groundwork for prop224 support which will break down the
handle_hs_exit_conn() depending on the version of hidden service the circuit
and edge connection is for.

Signed-off-by: David Goulet <dgoulet@torproject.org>
8 years agoprop224: Sandbox support for service
David Goulet [Wed, 10 May 2017 15:04:06 +0000 (11:04 -0400)] 
prop224: Sandbox support for service

Signed-off-by: David Goulet <dgoulet@torproject.org>
8 years agoprop224: Make the number of extra intro point a consensus param
David Goulet [Tue, 9 May 2017 20:15:12 +0000 (16:15 -0400)] 
prop224: Make the number of extra intro point a consensus param

Signed-off-by: David Goulet <dgoulet@torproject.org>
8 years agoprop224: Make intro point min/max lifetime a consensus param
David Goulet [Tue, 9 May 2017 20:10:14 +0000 (16:10 -0400)] 
prop224: Make intro point min/max lifetime a consensus param

Signed-off-by: David Goulet <dgoulet@torproject.org>
8 years agoprop224: Make INTRODUCE2 min/max a consensus param
David Goulet [Tue, 9 May 2017 20:05:28 +0000 (16:05 -0400)] 
prop224: Make INTRODUCE2 min/max a consensus param

Introduction point are rotated either if we get X amounts of INTRODUCE2 cells
on it or a time based expiration. This commit adds two consensus parameters
which are the min and max value bounding the random value X.

Signed-off-by: David Goulet <dgoulet@torproject.org>
8 years agoprop224: Implement a service intro point failure cache
David Goulet [Tue, 9 May 2017 18:31:17 +0000 (14:31 -0400)] 
prop224: Implement a service intro point failure cache

Imagine a Tor network where you have only 8 nodes available due to some
reasons. And your hidden service wants 8 introduction points. Everything is
fine but then a node goes down bringing the network to 7. The service will
retry 3 times that node and then give up but keep it in a failure cache for 5
minutes (INTRO_CIRC_RETRY_PERIOD) so it doesn't retry it non stop and exhaust
the maximum number of circuit retry.

In the real public network today, this is unlikely to happen unless the
ExcludeNodes list is extremely restrictive.

Signed-off-by: David Goulet <dgoulet@torproject.org>
8 years agoprop224: Upload service descriptors
David Goulet [Wed, 19 Apr 2017 19:27:11 +0000 (15:27 -0400)] 
prop224: Upload service descriptors

Signed-off-by: David Goulet <dgoulet@torproject.org>
8 years agoprop224: Directory function to upload descriptor
David Goulet [Wed, 19 Apr 2017 18:36:53 +0000 (14:36 -0400)] 
prop224: Directory function to upload descriptor

This commit adds a directory command function to make an upload directory
request for a service descriptor.

It is not used yet, just the groundwork.

Signed-off-by: David Goulet <dgoulet@torproject.org>
8 years agoprop224: Add a responsible HSDir function
David Goulet [Wed, 19 Apr 2017 16:23:43 +0000 (12:23 -0400)] 
prop224: Add a responsible HSDir function

Signed-off-by: David Goulet <dgoulet@torproject.org>
8 years agoprop224: Add hsdir consensus parameters
David Goulet [Wed, 19 Apr 2017 15:06:19 +0000 (11:06 -0400)] 
prop224: Add hsdir consensus parameters

Signed-off-by: David Goulet <dgoulet@torproject.org>
8 years agoprop224: Build hsdir index for node_t
David Goulet [Tue, 18 Apr 2017 19:06:44 +0000 (15:06 -0400)] 
prop224: Build hsdir index for node_t

This hsdir index value is used to give an index value to all node_t (relays)
that supports HSDir v3. An index value is then computed using the blinded key
to know where to fetch/upload the service descriptor from/to.

To avoid computing that index value everytime the client/service needs it, we
do that everytime we get a new consensus which then doesn't change until the
next one. The downside is that we need to sort them once we need to compute
the set of responsible HSDir.

Finally, the "hs_index" function is also added but not used. It will be used
in later commits to compute which node_t is a responsible HSDir for the
service we want to fetch/upload the descriptor.

Signed-off-by: David Goulet <dgoulet@torproject.org>
8 years agoprop224: Add service replay cache
David Goulet [Thu, 6 Apr 2017 18:58:13 +0000 (14:58 -0400)] 
prop224: Add service replay cache

Signed-off-by: David Goulet <dgoulet@torproject.org>
8 years agoprop224: Support INTRODUCE2 cell replay cache
David Goulet [Thu, 6 Apr 2017 18:37:24 +0000 (14:37 -0400)] 
prop224: Support INTRODUCE2 cell replay cache

Signed-off-by: David Goulet <dgoulet@torproject.org>
8 years agoprop224: Support legacy INTRODUCE2 cell
David Goulet [Wed, 5 Apr 2017 16:26:02 +0000 (12:26 -0400)] 
prop224: Support legacy INTRODUCE2 cell

Also rename some function to follow a bit more the naming convention in that
file.

Signed-off-by: David Goulet <dgoulet@torproject.org>
8 years agoprop224: Handle service RENDEZVOUS1 cell
David Goulet [Thu, 9 Mar 2017 17:54:51 +0000 (12:54 -0500)] 
prop224: Handle service RENDEZVOUS1 cell

Signed-off-by: David Goulet <dgoulet@torproject.org>
8 years agoprop224: Establish rendezvous circuit for service
David Goulet [Wed, 8 Mar 2017 22:31:36 +0000 (17:31 -0500)] 
prop224: Establish rendezvous circuit for service

Signed-off-by: David Goulet <dgoulet@torproject.org>
8 years agoprop224: Handle service INTRODUCE2 cell
David Goulet [Tue, 7 Mar 2017 19:57:14 +0000 (14:57 -0500)] 
prop224: Handle service INTRODUCE2 cell

At this commit, launching rendezvous circuit is not implemented, only a
placeholder.

Signed-off-by: David Goulet <dgoulet@torproject.org>
8 years agoprop224: Add helper function to lookup HS objects
David Goulet [Wed, 8 Mar 2017 17:08:03 +0000 (12:08 -0500)] 
prop224: Add helper function to lookup HS objects

Add this helper function that can lookup and return all the needed object from
a circuit identifier. It is a pattern we do often so make it nicer and avoid
duplicating it everywhere.

Signed-off-by: David Goulet <dgoulet@torproject.org>
8 years agoprop224: Handle service INTRO_ESTABLISHED cell
David Goulet [Tue, 7 Mar 2017 19:33:03 +0000 (14:33 -0500)] 
prop224: Handle service INTRO_ESTABLISHED cell

Signed-off-by: David Goulet <dgoulet@torproject.org>
8 years agoprop224: Circuit has opened and ESTABLISH_INTRO cell
David Goulet [Tue, 21 Feb 2017 19:20:39 +0000 (14:20 -0500)] 
prop224: Circuit has opened and ESTABLISH_INTRO cell

Add the entry point from the circuit subsystem of "circuit has opened" which
is for all type of hidden service circuits. For the introduction point, this
commit actually adds the support for handling those circuits when opened and
sending ESTABLISH_INTRO on a circuit.

Rendevzou point circuit aren't supported yet at this commit.

Signed-off-by: David Goulet <dgoulet@torproject.org>
8 years agoprop224: Introduction circuit creation
David Goulet [Thu, 16 Feb 2017 20:55:12 +0000 (15:55 -0500)] 
prop224: Introduction circuit creation

Signed-off-by: David Goulet <dgoulet@torproject.org>
8 years agoprop224: Service v3 descriptor creation and logic
David Goulet [Fri, 3 Feb 2017 20:30:46 +0000 (15:30 -0500)] 
prop224: Service v3 descriptor creation and logic

This commit adds the functionality for a service to build its descriptor.
Also, a global call to build all descriptors for all services is added to the
service scheduled events.

Signed-off-by: David Goulet <dgoulet@torproject.org>
8 years agoprop224: Implement subcredential creation
David Goulet [Thu, 11 May 2017 14:16:28 +0000 (10:16 -0400)] 
prop224: Implement subcredential creation

Signed-off-by: David Goulet <dgoulet@torproject.org>
8 years agoprop224: Add descriptor overlap mode function
George Kadianakis [Mon, 13 Feb 2017 13:32:13 +0000 (15:32 +0200)] 
prop224: Add descriptor overlap mode function

The function has been added but not used except for the unit tests.

Signed-off-by: David Goulet <dgoulet@torproject.org>
8 years agoprop224: Scheduled events for service
David Goulet [Fri, 3 Feb 2017 20:29:31 +0000 (15:29 -0500)] 
prop224: Scheduled events for service

Add the main loop entry point to the HS service subsystem. It is run every
second and make sure that all services are in their quiescent state after that
which means valid descriptors, all needed circuits opened and latest
descriptors have been uploaded.

For now, only v2 is supported and placeholders for v3 actions for that main
loop callback.

Signed-off-by: David Goulet <dgoulet@torproject.org>
8 years agoprop224: API for the creation of blinded keys
David Goulet [Mon, 6 Feb 2017 17:26:36 +0000 (12:26 -0500)] 
prop224: API for the creation of blinded keys

Add a function for both the client and service side that is building a blinded
key from a keypair (service) and from a public key (client). Those two
functions uses the current time period information to build the key.

Signed-off-by: David Goulet <dgoulet@torproject.org>
8 years agohs: Implement constructor for hs_desc_intro_point_t
David Goulet [Thu, 20 Jul 2017 15:34:32 +0000 (11:34 -0400)] 
hs: Implement constructor for hs_desc_intro_point_t

Add a new and free function for hs_desc_intro_point_t so the service can use
them to setup those objects properly.

Signed-off-by: David Goulet <dgoulet@torproject.org>
8 years agoprop224: Add onion key to service descriptor intro point
David Goulet [Thu, 20 Jul 2017 16:16:39 +0000 (12:16 -0400)] 
prop224: Add onion key to service descriptor intro point

Signed-off-by: David Goulet <dgoulet@torproject.org>
8 years agoprop224: Add the introduction point onion key to descriptor
David Goulet [Wed, 19 Jul 2017 17:42:35 +0000 (13:42 -0400)] 
prop224: Add the introduction point onion key to descriptor

A prop224 descriptor was missing the onion key for an introduction point which
is needed to extend to it by the client.

Closes #22979

Signed-off-by: David Goulet <dgoulet@torproject.org>
8 years agoprop224: Helper to dup a link_specifier_t object
David Goulet [Sun, 23 Jul 2017 14:43:16 +0000 (10:43 -0400)] 
prop224: Helper to dup a link_specifier_t object

Signed-off-by: David Goulet <dgoulet@torproject.org>
8 years agoprop224: Update hs identifier circuit
David Goulet [Mon, 24 Jul 2017 17:45:01 +0000 (13:45 -0400)] 
prop224: Update hs identifier circuit

Remove the legacy intro point key because both service and client only uses
the ed25519 key even though the intro point chosen is a legacy one.

This also adds the CLIENT_PK key that is needed for the ntor handshake.

Signed-off-by: David Goulet <dgoulet@torproject.org>
8 years agotrunnel: Add prop224 RENDEZVOUS1 cell definition
David Goulet [Sun, 23 Jul 2017 16:32:16 +0000 (12:32 -0400)] 
trunnel: Add prop224 RENDEZVOUS1 cell definition

Signed-off-by: David Goulet <dgoulet@torproject.org>
8 years agofix wordo in comment
Roger Dingledine [Tue, 25 Jul 2017 15:14:39 +0000 (11:14 -0400)] 
fix wordo in comment

8 years agoFix remaining cases of hs_config failures without af_unix
Nick Mathewson [Mon, 24 Jul 2017 19:58:11 +0000 (15:58 -0400)] 
Fix remaining cases of hs_config failures without af_unix

8 years agoFix hs_config unit test on systems without unix sockets
Nick Mathewson [Mon, 24 Jul 2017 19:13:23 +0000 (15:13 -0400)] 
Fix hs_config unit test on systems without unix sockets

Bugfix on 418059dd96f5f427eceffff1daeb2a2f6c4adbeb; jenkins found
this.

8 years agoRename the hybrid_encrypt/decrypt functions; label them as dangerous
Nick Mathewson [Mon, 24 Jul 2017 18:32:59 +0000 (14:32 -0400)] 
Rename the hybrid_encrypt/decrypt functions; label them as dangerous

We need to keep these around for TAP and old-style hidden services,
but they're obsolete, and we shouldn't encourage anyone to use them.
So I've added "obsolete" to their names, and a comment explaining
what the problem is.

Closes ticket 23026.

8 years agoImprove comment about why we disable TLS compression.
Nick Mathewson [Mon, 24 Jul 2017 18:15:40 +0000 (14:15 -0400)] 
Improve comment about why we disable TLS compression.

Closes bug 22964.  Based on Teor's replacement there, but tries
to put the comment in a more logical place, and explain why we're
actually disabling compression in the first place.

8 years agotest: Remove buggy unit test in test_hs_service
David Goulet [Mon, 24 Jul 2017 15:31:54 +0000 (11:31 -0400)] 
test: Remove buggy unit test in test_hs_service

There isn't much of a point of this buggy test afterall to add twice the same
service object but with a different key which ultinately can end up failing
the test because 1/N_BUCKETS of probability that we end up to put the service
in the same bucket.

Fixes #23023

Signed-off-by: David Goulet <dgoulet@torproject.org>
8 years agofix whitespace issue
Roger Dingledine [Sun, 23 Jul 2017 04:57:10 +0000 (00:57 -0400)] 
fix whitespace issue

8 years agoMerge branch 'bug17750_029_squashed'
Nick Mathewson [Fri, 14 Jul 2017 19:07:09 +0000 (15:07 -0400)] 
Merge branch 'bug17750_029_squashed'

8 years agoFix a signed integer overflow in dir/download_status_random_backoff
Nick Mathewson [Fri, 14 Jul 2017 17:56:40 +0000 (13:56 -0400)] 
Fix a signed integer overflow in dir/download_status_random_backoff

Fix for 22924. Bugfix on 0.2.9.1-alpha when the test was introducd
-- though it couldn't actually overflow until we fixed 17750.

Additionally, this only seems to overflow on 32-bit, and only when
the compiler doesn't re-order the (possibly dead) assignment out of
the way.  We ran into it on a 32-bit ubuntu trusty builder.

8 years agoFix 32-bit warnings in hs_common.c
Nick Mathewson [Fri, 14 Jul 2017 15:33:12 +0000 (11:33 -0400)] 
Fix 32-bit warnings in hs_common.c

8 years agoMerge branch 'maint-0.3.1'
Nick Mathewson [Fri, 14 Jul 2017 13:11:14 +0000 (09:11 -0400)] 
Merge branch 'maint-0.3.1'

8 years agoMerge branch 'maint-0.3.0' into maint-0.3.1
Nick Mathewson [Fri, 14 Jul 2017 13:11:14 +0000 (09:11 -0400)] 
Merge branch 'maint-0.3.0' into maint-0.3.1

8 years agoMerge branch 'maint-0.2.9' into maint-0.3.0
Nick Mathewson [Fri, 14 Jul 2017 13:11:14 +0000 (09:11 -0400)] 
Merge branch 'maint-0.2.9' into maint-0.3.0

8 years agoMerge branch 'bug22916_027' into maint-0.2.9
Nick Mathewson [Fri, 14 Jul 2017 13:11:08 +0000 (09:11 -0400)] 
Merge branch 'bug22916_027' into maint-0.2.9

8 years agoMerge branch 'maint-0.3.1'
Nick Mathewson [Fri, 14 Jul 2017 13:06:44 +0000 (09:06 -0400)] 
Merge branch 'maint-0.3.1'

8 years agoMerge branch 'maint-0.3.0' into maint-0.3.1
Nick Mathewson [Fri, 14 Jul 2017 13:06:44 +0000 (09:06 -0400)] 
Merge branch 'maint-0.3.0' into maint-0.3.1

8 years agoMerge branch 'bug22803_030' into maint-0.3.0
Nick Mathewson [Fri, 14 Jul 2017 13:06:33 +0000 (09:06 -0400)] 
Merge branch 'bug22803_030' into maint-0.3.0

8 years agoFix compiler warnings with openssl-scrypt/libscrypt test on clang
Nick Mathewson [Thu, 13 Jul 2017 21:49:48 +0000 (17:49 -0400)] 
Fix compiler warnings with openssl-scrypt/libscrypt test on clang

Clang didn't like that we were passing uint64_t values to an API
that wanted uint32_t.  GCC has either not cared, or has figured out
that the values in question were safe to cast to uint32_t.

Fixes bug22916; bugfix on 0.2.7.2-alpha.

8 years agoMerge remote-tracking branch 'dgoulet/ticket21979_032_04'
Nick Mathewson [Thu, 13 Jul 2017 21:23:37 +0000 (17:23 -0400)] 
Merge remote-tracking branch 'dgoulet/ticket21979_032_04'

8 years agoprop224: Fix clang warnings
David Goulet [Thu, 13 Jul 2017 21:18:11 +0000 (17:18 -0400)] 
prop224: Fix clang warnings

Signed-off-by: David Goulet <dgoulet@torproject.org>
8 years agoMerge remote-tracking branch 'isis/bug19476'
Nick Mathewson [Thu, 13 Jul 2017 20:58:45 +0000 (16:58 -0400)] 
Merge remote-tracking branch 'isis/bug19476'

8 years agoMerge branch 'maint-0.3.1'
Nick Mathewson [Thu, 13 Jul 2017 20:55:06 +0000 (16:55 -0400)] 
Merge branch 'maint-0.3.1'

8 years agoMerge branch 'fewer-diffs' into maint-0.3.1
Nick Mathewson [Thu, 13 Jul 2017 20:55:02 +0000 (16:55 -0400)] 
Merge branch 'fewer-diffs' into maint-0.3.1

8 years agoMerge branch 'maint-0.3.1'
Nick Mathewson [Thu, 13 Jul 2017 20:52:20 +0000 (16:52 -0400)] 
Merge branch 'maint-0.3.1'

8 years agoMerge branch 'bug22520_031' into maint-0.3.1
Nick Mathewson [Thu, 13 Jul 2017 20:52:16 +0000 (16:52 -0400)] 
Merge branch 'bug22520_031' into maint-0.3.1

8 years agoMerge branch 'maint-0.3.1'
Nick Mathewson [Thu, 13 Jul 2017 20:51:18 +0000 (16:51 -0400)] 
Merge branch 'maint-0.3.1'

8 years agoMerge remote-tracking branch 'isis/bug22830_0.3.1' into maint-0.3.1
Nick Mathewson [Thu, 13 Jul 2017 20:51:09 +0000 (16:51 -0400)] 
Merge remote-tracking branch 'isis/bug22830_0.3.1' into maint-0.3.1

8 years agoprop224: Move service version into config object
David Goulet [Thu, 13 Jul 2017 12:51:14 +0000 (08:51 -0400)] 
prop224: Move service version into config object

It makes more sense to have the version in the configuration object of the
service because it is afterall a torrc option (HiddenServiceVersion).

Signed-off-by: David Goulet <dgoulet@torproject.org>
8 years agoprop224: Use the service config object when configuring
David Goulet [Wed, 12 Jul 2017 17:52:19 +0000 (13:52 -0400)] 
prop224: Use the service config object when configuring

Both configuration function now takes the service config object instead of the
service itself.

Signed-off-by: David Goulet <dgoulet@torproject.org>
8 years agoprop224: Don't use char * for binary data
David Goulet [Wed, 12 Jul 2017 17:41:33 +0000 (13:41 -0400)] 
prop224: Don't use char * for binary data

It turns out that some char * sneaked in our hs_common.c code. Replace those
by uint8_t *.

Signed-off-by: David Goulet <dgoulet@torproject.org>
8 years agoprop224: Add a clear configuration function
David Goulet [Wed, 12 Jul 2017 15:53:26 +0000 (11:53 -0400)] 
prop224: Add a clear configuration function

The added function frees any allocated pointers in a service configuration
object and reset all values to 0.

Signed-off-by: David Goulet <dgoulet@torproject.org>
8 years agoprop224: Don't use an array of config handlers
David Goulet [Wed, 12 Jul 2017 15:17:26 +0000 (11:17 -0400)] 
prop224: Don't use an array of config handlers

As per nickm suggestion, an array of config handlers will not play well with
our callgraph tool.

Instead, we'll go with a switch case on the version which has a good side
effect of allowing us to control what we pass to the function intead of a fix
set of parameters.

Signed-off-by: David Goulet <dgoulet@torproject.org>
8 years agoprop224: Detect duplicate configuration options
David Goulet [Wed, 12 Jul 2017 15:02:59 +0000 (11:02 -0400)] 
prop224: Detect duplicate configuration options

Signed-off-by: David Goulet <dgoulet@torproject.org>
8 years agoprop224: Use a common function to parse uint64_t
David Goulet [Wed, 12 Jul 2017 14:37:10 +0000 (10:37 -0400)] 
prop224: Use a common function to parse uint64_t

Add a helper function to parse uint64_t and also does logging so we can reduce
the amount of duplicate code.

Signed-off-by: David Goulet <dgoulet@torproject.org>
8 years agoRevert "fixup! prop224: Add hs_config.{c|h} with a refactoring"
David Goulet [Tue, 11 Jul 2017 20:17:58 +0000 (16:17 -0400)] 
Revert "fixup! prop224: Add hs_config.{c|h} with a refactoring"

This reverts commit e2497e2ba038133026a475f0f93c9054187b2a1d.

8 years agotest: Add v3 service load keys and accessors
David Goulet [Thu, 2 Feb 2017 20:26:04 +0000 (15:26 -0500)] 
test: Add v3 service load keys and accessors

Signed-off-by: David Goulet <dgoulet@torproject.org>
8 years agotest: Add v3 service config and registration test
David Goulet [Tue, 17 Jan 2017 17:09:54 +0000 (12:09 -0500)] 
test: Add v3 service config and registration test

This tests our hs_config.c API to properly load v3 services and register them
to the global map. It does NOT test the service object validity, that will be
the hs service unit test later on.

At this commit, we have 100% code coverage of hs_config.c.

Signed-off-by: David Goulet <dgoulet@torproject.org>
8 years agohs: Add rend_service_init()
David Goulet [Thu, 29 Jun 2017 15:18:24 +0000 (11:18 -0400)] 
hs: Add rend_service_init()

Initialize both the global and staging service lists.

Signed-off-by: David Goulet <dgoulet@torproject.org>
8 years agoprop224: Add a function to check for invalid opts
David Goulet [Fri, 7 Jul 2017 19:34:36 +0000 (15:34 -0400)] 
prop224: Add a function to check for invalid opts

Every hidden service option don't apply to every version so this new function
makes sure we don't have for instance an option that is only for v2 in a v3
configured service.

This works using an exclude lists for a specific version. Right now, there is
only one option that is not allowed in v3. The rest is common.

Signed-off-by: David Goulet <dgoulet@torproject.org>
8 years agoprop224: Load and/or generate v3 service keys
David Goulet [Wed, 1 Feb 2017 14:18:58 +0000 (09:18 -0500)] 
prop224: Load and/or generate v3 service keys

Try to load or/and generate service keys for v3. This write both the public
and private key file to disk along with the hostname file containing the onion
address.

Signed-off-by: David Goulet <dgoulet@torproject.org>
8 years agoprop224: Service address creation/validation
David Goulet [Mon, 30 Jan 2017 22:33:18 +0000 (17:33 -0500)] 
prop224: Service address creation/validation

This also adds unit test and a small python script generating a deterministic
test vector that a unit test tries to match.

Signed-off-by: David Goulet <dgoulet@torproject.org>
8 years agoprop224: Configure v3 service from options
David Goulet [Fri, 13 Jan 2017 21:00:07 +0000 (16:00 -0500)] 
prop224: Configure v3 service from options

This commit adds the support in the HS subsystem for loading a service from a
set of or_options_t and put them in a staging list.

To achieve this, service accessors have been created and a global hash map
containing service object indexed by master public key. However, this is not
used for now. It's ground work for registration process.

Signed-off-by: David Goulet <dgoulet@torproject.org>
8 years agotest: Add HS v2 service configuration unit tests
David Goulet [Fri, 13 Jan 2017 16:20:31 +0000 (11:20 -0500)] 
test: Add HS v2 service configuration unit tests

Signed-off-by: David Goulet <dgoulet@torproject.org>
8 years agohs: Use v3 maximum intro points value when decoding v3
David Goulet [Wed, 10 May 2017 13:37:41 +0000 (09:37 -0400)] 
hs: Use v3 maximum intro points value when decoding v3

Signed-off-by: David Goulet <dgoulet@torproject.org>
8 years agoprop224: Add a init/free_all function for the whole subsystem
David Goulet [Mon, 16 Jan 2017 18:29:03 +0000 (13:29 -0500)] 
prop224: Add a init/free_all function for the whole subsystem

Introduces hs_init() located in hs_common.c which initialize the entire HS v3
subsystem. This is done _prior_ to the options being loaded because we need to
allocate global data structure before we load the configuration.

The hs_free_all() is added to release everything from tor_free_all().

Note that both functions do NOT handle v2 service subsystem but does handle
the common interface that both v2 and v3 needs such as the cache and
circuitmap.

Signed-off-by: David Goulet <dgoulet@torproject.org>
8 years agoprop224: Add hs_config.{c|h} with a refactoring
David Goulet [Mon, 16 Jan 2017 18:19:44 +0000 (13:19 -0500)] 
prop224: Add hs_config.{c|h} with a refactoring

Add the hs_config.{c|h} files contains everything that the HS subsystem needs
to load and configure services. Ultimately, it should also contain client
functions such as client authorization.

This comes with a big refactoring of rend_config_services() which has now
changed to only configure a single service and it is stripped down of the
common directives which are now part of the generic handler.

This is ground work for prop224 of course but only touches version 2 services
and add XXX note for version 3.

Signed-off-by: David Goulet <dgoulet@torproject.org>
8 years agoprop224: Initial import of hs_service_t
David Goulet [Sun, 15 Jan 2017 15:09:13 +0000 (10:09 -0500)] 
prop224: Initial import of hs_service_t

This object is the foundation of proposal 224 service work. It will change
and be adapted as it's being used more and more in the codebase. So, this
version is just a basic skeleton one that *will* change.

Signed-off-by: David Goulet <dgoulet@torproject.org>
8 years agorephist: Remove unused crypto_pk statistics.
Isis Lovecruft [Thu, 13 Jul 2017 19:31:13 +0000 (19:31 +0000)] 
rephist: Remove unused crypto_pk statistics.

These statistics were largely ununsed, and kept track of statistical information
on things like how many time we had done TLS or how many signatures we had
verified.  This information is largely not useful, and would only be logged
after receiving a SIGUSR1 signal (but only if the logging severity level was
less than LOG_INFO).

 * FIXES #19871.
 * REMOVES note_crypto_pk_op(), dump_pk_op(), and pk_op_counts from
   src/or/rephist.c.
 * REMOVES every external call to these functions.

8 years agoAdd a changes file for bug22830.
Isis Lovecruft [Thu, 13 Jul 2017 18:01:54 +0000 (18:01 +0000)] 
Add a changes file for bug22830.

8 years agouse CARGO_HOME instead of HOME when building with rust
Chelsea H. Komlo [Mon, 10 Jul 2017 02:33:34 +0000 (22:33 -0400)] 
use CARGO_HOME instead of HOME when building with rust

8 years agoNew configuration option MaxConsensusAgeForDiffs
Nick Mathewson [Wed, 12 Jul 2017 17:15:16 +0000 (13:15 -0400)] 
New configuration option MaxConsensusAgeForDiffs

Relay operators (especially bridge operators) can use this to lower
or raise the number of consensuses that they're willing to hold for
diff generation purposes.

This enables a workaround for bug 22883.

8 years agoMerge branch 'maint-0.3.1'
Nick Mathewson [Wed, 12 Jul 2017 14:16:06 +0000 (10:16 -0400)] 
Merge branch 'maint-0.3.1'

8 years agoMerge branch 'bug22349_029' into maint-0.3.1
Nick Mathewson [Wed, 12 Jul 2017 14:15:49 +0000 (10:15 -0400)] 
Merge branch 'bug22349_029' into maint-0.3.1