]> git.ipfire.org Git - thirdparty/tor.git/log
thirdparty/tor.git
8 years agotest: Fix typing issues found by clang
David Goulet [Fri, 11 Aug 2017 18:59:28 +0000 (14:59 -0400)] 
test: Fix typing issues found by clang

Partially fix #23224.

Signed-off-by: David Goulet <dgoulet@torproject.org>
8 years agotest: Fix memory leak in test_hs_common.c
David Goulet [Fri, 11 Aug 2017 18:46:27 +0000 (14:46 -0400)] 
test: Fix memory leak in test_hs_common.c

Partially fixes #23223

Signed-off-by: David Goulet <dgoulet@torproject.org>
8 years agotest: Fix hs common test for Windows
David Goulet [Fri, 11 Aug 2017 18:42:20 +0000 (14:42 -0400)] 
test: Fix hs common test for Windows

Use the PATH_SEPARATOR for a path comparaison so it works with Windows as
well.

Partially fix #23223

Signed-off-by: David Goulet <dgoulet@torproject.org>
8 years agoMerge branch 'ticket23220'
Nick Mathewson [Fri, 11 Aug 2017 18:08:26 +0000 (14:08 -0400)] 
Merge branch 'ticket23220'

8 years agoRaise MIN_DL_PER_REQUEST to 32
Nick Mathewson [Fri, 11 Aug 2017 17:54:01 +0000 (13:54 -0400)] 
Raise MIN_DL_PER_REQUEST to 32

This change should improve overhead for downloading small numbers of
descriptors and microdescriptors by improving compression
performance and lowering directory request overhead.

Closes ticket 23220.

8 years agoMerge branch 'bug18982'
Nick Mathewson [Fri, 11 Aug 2017 16:11:42 +0000 (12:11 -0400)] 
Merge branch 'bug18982'

8 years agoAdd # to "hop N" messages to disambiguate from old messages.
Nick Mathewson [Fri, 11 Aug 2017 16:11:27 +0000 (12:11 -0400)] 
Add # to "hop N" messages to disambiguate from old messages.

8 years agoMerge branch 'maint-0.3.1'
Nick Mathewson [Fri, 11 Aug 2017 15:51:06 +0000 (11:51 -0400)] 
Merge branch 'maint-0.3.1'

8 years agoMerge remote-tracking branch 'dgoulet/bug23091_032_01'
Nick Mathewson [Fri, 11 Aug 2017 13:39:57 +0000 (09:39 -0400)] 
Merge remote-tracking branch 'dgoulet/bug23091_032_01'

8 years agofix description of PublishServerDescriptor
Roger Dingledine [Wed, 9 Aug 2017 19:07:49 +0000 (15:07 -0400)] 
fix description of PublishServerDescriptor

the values of "v3" and "bridge" have to do with *where* you publish to,
not whether you publish.

8 years agoDocument all the arguments of PublishServerDescriptor.
Nick Mathewson [Wed, 9 Aug 2017 15:17:27 +0000 (11:17 -0400)] 
Document all the arguments of PublishServerDescriptor.

Implements 15645.

8 years agofix another 32-bit warning
Nick Mathewson [Wed, 9 Aug 2017 12:32:39 +0000 (08:32 -0400)] 
fix another 32-bit warning

8 years agoFix a warning on 32-bit clang
Nick Mathewson [Wed, 9 Aug 2017 12:31:44 +0000 (08:31 -0400)] 
Fix a warning on 32-bit clang

8 years agoprop224: Fix coverity warnings from #20657 merge.
George Kadianakis [Wed, 9 Aug 2017 10:45:37 +0000 (13:45 +0300)] 
prop224: Fix coverity warnings from #20657 merge.

- Fix various ssize_t/size_t confusions in the tests.

- Fix a weird memset argument:
  "bad_memset: Argument -16 in memset loses precision in
  memset(&desc_two->blinded_kp.pubkey.pubkey, -16, 32UL)."

- Fix check_after_deref instance in check_state_line_for_service_rev_counter():
  "check_after_deref: Null-checking items suggests that it may be null,
  but it has already been dereferenced on all paths leading to the
  check."

8 years agoRe-run trunnel.
Nick Mathewson [Wed, 9 Aug 2017 00:34:39 +0000 (20:34 -0400)] 
Re-run trunnel.

8 years agoMerge branch 'ticket20657_nickm_bugfixes_squashed'
Nick Mathewson [Wed, 9 Aug 2017 00:31:57 +0000 (20:31 -0400)] 
Merge branch 'ticket20657_nickm_bugfixes_squashed'

8 years agoPut comment in the trunnel file, so it wont go away.
Nick Mathewson [Wed, 9 Aug 2017 00:31:47 +0000 (20:31 -0400)] 
Put comment in the trunnel file, so it wont go away.

8 years agoprop224: Add XXX about opaqueness of link_specifier_t.
George Kadianakis [Tue, 8 Aug 2017 18:25:04 +0000 (21:25 +0300)] 
prop224: Add XXX about opaqueness of link_specifier_t.

8 years agoprop224: Function to inc/decrement num rendezvous stream
George Kadianakis [Mon, 31 Jul 2017 14:59:12 +0000 (17:59 +0300)] 
prop224: Function to inc/decrement num rendezvous stream

Add a common function for both legacy and prop224 hidden service to increment
and decrement the rendezvous stream counter on an origin circuit.

Signed-off-by: David Goulet <dgoulet@torproject.org>
8 years agoprop224: Always note down the use of internal circuit
David Goulet [Fri, 4 Aug 2017 16:06:34 +0000 (12:06 -0400)] 
prop224: Always note down the use of internal circuit

Also, this removes all the callsite of this rephist in the hs subsystem

Fixes #23097

Signed-off-by: David Goulet <dgoulet@torproject.org>
8 years agoAdd note about handling INTRODUCE2 cells.
George Kadianakis [Tue, 8 Aug 2017 08:51:16 +0000 (11:51 +0300)] 
Add note about handling INTRODUCE2 cells.

Also fix a check-spaces instance.

8 years agoStart caching disaster SRV values.
George Kadianakis [Tue, 8 Aug 2017 08:45:45 +0000 (11:45 +0300)] 
Start caching disaster SRV values.

Also add some unittests.

8 years agoFix the build_hs_index() function.
George Kadianakis [Mon, 7 Aug 2017 15:58:13 +0000 (18:58 +0300)] 
Fix the build_hs_index() function.

Also add a unittest for hs_get_responsible_hsdirs() which was used to
find and fix the bug.

8 years agoprop224: Improve comments and tests for ed25519 keys in IPs/RPs.
George Kadianakis [Mon, 7 Aug 2017 13:17:33 +0000 (16:17 +0300)] 
prop224: Improve comments and tests for ed25519 keys in IPs/RPs.

Also make sure we are not gonna advertise the ed25519 key of an intro
point that doesn't support it.

8 years agoImprove docs on rendezvous circ relaunch.
George Kadianakis [Mon, 7 Aug 2017 09:02:45 +0000 (12:02 +0300)] 
Improve docs on rendezvous circ relaunch.

8 years agoIncrease HS desc cert lifetime.
George Kadianakis [Sun, 6 Aug 2017 19:24:07 +0000 (22:24 +0300)] 
Increase HS desc cert lifetime.

We used to have a small HS desc cert lifetime but those certs can stick
around for 36 hours if they get initialized in the beginning of overlap
period.

[warn] Bug: Non-fatal assertion !(hs_desc_encode_descriptor(desc->desc, &desc->signing_kp, &encoded_desc) < 0) failed in
upload_descriptor_to_hsdir at src/or/hs_service.c:1886. Stack trace: (on Tor 0.3.2.0-alpha-dev b4a14555597fb9b3)

8 years agoprop224 tests: Better HS time period tests.
George Kadianakis [Sat, 5 Aug 2017 20:43:05 +0000 (23:43 +0300)] 
prop224 tests: Better HS time period tests.

8 years agoprop224 tests: Better HS address tests.
George Kadianakis [Sat, 5 Aug 2017 20:25:44 +0000 (23:25 +0300)] 
prop224 tests: Better HS address tests.

8 years agoprop224 tests: Improve SRV protocol tests.
George Kadianakis [Sat, 5 Aug 2017 20:11:37 +0000 (23:11 +0300)] 
prop224 tests: Improve SRV protocol tests.

8 years agoDo more type checking when setting HS idents.
George Kadianakis [Fri, 4 Aug 2017 21:33:34 +0000 (00:33 +0300)] 
Do more type checking when setting HS idents.

I repurposed the old directory_request_set_hs_ident() into a new
directory_request_upload_set_hs_ident() which is only used for the
upload purpose and so it can assert on the dir_purpose.

When coding the client-side we can make a second function for fetch.

8 years agoFix broken intro point unittest.
George Kadianakis [Fri, 4 Aug 2017 20:46:20 +0000 (23:46 +0300)] 
Fix broken intro point unittest.

The structure was not zeroed out, and left some boolean fields
uninitialized.

8 years agoExtract intro point onion key even with multiple types.
George Kadianakis [Fri, 4 Aug 2017 20:35:04 +0000 (23:35 +0300)] 
Extract intro point onion key even with multiple types.

8 years agoprop224 tests: test_gen_establish_intro_cell() check cell contents.
George Kadianakis [Fri, 4 Aug 2017 19:53:53 +0000 (22:53 +0300)] 
prop224 tests: test_gen_establish_intro_cell() check cell contents.

8 years agoImprove code based on Nick review:
George Kadianakis [Fri, 4 Aug 2017 19:02:28 +0000 (22:02 +0300)] 
Improve code based on Nick review:

- Fix some more crazy ternary ops.
- Fix the order of disaster SRV computation.
- Whitespace fixes.
- Remove a redundant warn.
- Better docs.

8 years agoDon't double hash the ed25519 blind key parameter.
George Kadianakis [Fri, 4 Aug 2017 09:37:48 +0000 (12:37 +0300)] 
Don't double hash the ed25519 blind key parameter.

We used to do:
   h = H(BLIND_STRING | H(A | s | B | N )
when we should be doing:
   h = H(BLIND_STRING | A | s | B | N)

Change the logic so that hs_common.c does the hashing, and our ed25519
libraries just receive the hashed parameter ready-made. That's easier
than doing the hashing on the ed25519 libraries, since that means we
would have to pass them a variable-length param (depending on whether
's' is set or not).

Also fix the ed25519 test vectors since they were also double hashing.

8 years agoDon't set HSDir index if we don't have a live consensus.
George Kadianakis [Fri, 4 Aug 2017 09:21:14 +0000 (12:21 +0300)] 
Don't set HSDir index if we don't have a live consensus.

We also had to alter the SRV functions to take a consensus as optional
input, since we might be setting our HSDir index using a consensus that
is currently being processed and won't be returned by the
networkstatus_get_live_consensus() function.

This change has two results:

a) It makes sure we are using a fresh consensus with the right SRV value
   when we are calculating the HSDir hash ring.

b) It ensures that we will not use the sr_get_current/previous()
   functions when we don't have a consensus which would have falsely
   triggered the disaster SRV logic.

8 years agoCorrectly assign HSDir flags based on protocol list
George Kadianakis [Thu, 3 Aug 2017 13:08:17 +0000 (16:08 +0300)] 
Correctly assign HSDir flags based on protocol list

In Nick's words:

"We want to always return false if the platform is a Tor version, and it
is not as new as 0.3.0.8 -- but if the platform is not a Tor version, or
if the version is as new as 0.3.0.8, then we want to obey the protocol
list.

That way, other implementations of our protocol won't have to claim any
particular Tor version, and future versions of Tor will have the freedom
to drop this protocol in the distant future."

8 years agoFix small easy bugs all around
George Kadianakis [Thu, 3 Aug 2017 13:04:25 +0000 (16:04 +0300)] 
Fix small easy bugs all around

- Fix log message format string.
- Do extra circuit purpose check.
- wipe memory in a clear function
- Make sure we don't double add intro points in our list
- Make sure we don't double close intro circuits.
- s/tt_u64_op/tt_i64_op/

8 years agoConstify functions that can be constified.
George Kadianakis [Thu, 3 Aug 2017 13:03:30 +0000 (16:03 +0300)] 
Constify functions that can be constified.

8 years agoImprove documentation all around the codebase.
George Kadianakis [Thu, 3 Aug 2017 13:02:51 +0000 (16:02 +0300)] 
Improve documentation all around the codebase.

8 years agoMake ed25519 id keys optional for IPs and RPs.
George Kadianakis [Thu, 3 Aug 2017 13:00:18 +0000 (16:00 +0300)] 
Make ed25519 id keys optional for IPs and RPs.

8 years agoImprove setting hsdir index procedure.
George Kadianakis [Thu, 3 Aug 2017 12:54:42 +0000 (15:54 +0300)] 
Improve setting hsdir index procedure.

- Fix memleak.

8 years agoMake HidServRevCounter be a LINELIST as it should.
George Kadianakis [Thu, 3 Aug 2017 12:52:01 +0000 (15:52 +0300)] 
Make HidServRevCounter be a LINELIST as it should.

8 years agoRename some free() functions that are actually clear().
George Kadianakis [Thu, 3 Aug 2017 12:51:24 +0000 (15:51 +0300)] 
Rename some free() functions that are actually clear().

8 years agoValidate intro point limits to avoid asserts.
George Kadianakis [Thu, 3 Aug 2017 12:49:42 +0000 (15:49 +0300)] 
Validate intro point limits to avoid asserts.

8 years agoRelax assertions: turn them to BUGs and non-fatal asserts.
George Kadianakis [Thu, 3 Aug 2017 12:47:06 +0000 (15:47 +0300)] 
Relax assertions: turn them to BUGs and non-fatal asserts.

8 years agoprop224: Don't use nodes as HSDirs if they don't have an HSDir index.
George Kadianakis [Wed, 2 Aug 2017 13:50:15 +0000 (16:50 +0300)] 
prop224: Don't use nodes as HSDirs if they don't have an HSDir index.

8 years agomemwipe interesting unused memory
George Kadianakis [Thu, 3 Aug 2017 12:42:30 +0000 (15:42 +0300)] 
memwipe interesting unused memory

8 years agoFix 32-bit bug when writing address to descriptor.
George Kadianakis [Thu, 3 Aug 2017 10:24:50 +0000 (13:24 +0300)] 
Fix 32-bit bug when writing address to descriptor.

We used to sizeof() a pointer. Let's just use asprintf to avoid having
to be smart.

8 years agoFix ternary operator abuse.
George Kadianakis [Mon, 31 Jul 2017 10:27:16 +0000 (13:27 +0300)] 
Fix ternary operator abuse.

8 years agoUse htonll() when INT_8 is used.
George Kadianakis [Thu, 3 Aug 2017 09:01:52 +0000 (12:01 +0300)] 
Use htonll() when INT_8 is used.

Also prepend period_length to any period_num, as specified by the spec.

8 years agoprop224: Remove INTRODUCE2 legacy handling
David Goulet [Tue, 1 Aug 2017 17:30:04 +0000 (13:30 -0400)] 
prop224: Remove INTRODUCE2 legacy handling

Turns out that introduction points don't care about the INTRODUCE2 cell
format as long as the top field is LEGACY_KEY_ID as expected. So let's
use a single INTRODUCE format regardless of the introduction point being
legacy or not.

This also removes the polymorphic void* situation.

Signed-off-by: David Goulet <dgoulet@torproject.org>
8 years agotest: Unbreak test_upload_descriptors()
George Kadianakis [Mon, 24 Jul 2017 10:17:59 +0000 (13:17 +0300)] 
test: Unbreak test_upload_descriptors()

To upload the descriptor we needed a state file to write the rev counters in,
but that test did not have a state file initialized.

Also fix the typo in its func name.

Signed-off-by: David Goulet <dgoulet@torproject.org>
8 years agotest: Unit tests for the revision counter state file codethe
George Kadianakis [Mon, 24 Jul 2017 10:03:19 +0000 (13:03 +0300)] 
test: Unit tests for the revision counter state file codethe

Signed-off-by: David Goulet <dgoulet@torproject.org>
8 years agoprop224: Use state file to save/load revision counters
George Kadianakis [Fri, 21 Jul 2017 12:53:17 +0000 (15:53 +0300)] 
prop224: Use state file to save/load revision counters

Signed-off-by: David Goulet <dgoulet@torproject.org>
8 years agoprop224: Refactor the overlap function to not use absolute time.
George Kadianakis [Tue, 18 Jul 2017 13:06:12 +0000 (16:06 +0300)] 
prop224: Refactor the overlap function to not use absolute time.

We consider to be in overlap mode when we are in the period of time between a
fresh SRV and the beginning of the new time period (in the normal network this
is between 00:00 and 12:00 UTC). This commit edits that function to use the
above semantic logic instead of absolute times.

Signed-off-by: David Goulet <dgoulet@torproject.org>
8 years agoprop224: Make prop224 time periods smaller in testnets.
George Kadianakis [Tue, 18 Jul 2017 15:10:26 +0000 (18:10 +0300)] 
prop224: Make prop224 time periods smaller in testnets.

It used to be that time periods were 24 hours long even on chutney,
which made testing harder. With this commit, time periods have the same
length as a full SRV protocol run, which means that they will change
every 4 minutes in a 10-second voting interval chutney network!

8 years agoprop224: Refactor hs_get_time_period_num() to not use absolute time.
George Kadianakis [Mon, 24 Jul 2017 10:31:17 +0000 (13:31 +0300)] 
prop224: Refactor hs_get_time_period_num() to not use absolute time.

Instead use the SRV protocol duration to calculate the rotation offset
that was previously hardcoded to 12 hours.

8 years agoprop224: Compute start time of next time period.
George Kadianakis [Tue, 18 Jul 2017 13:44:03 +0000 (16:44 +0300)] 
prop224: Compute start time of next time period.

8 years agoSR: Calculate current SRV phase/run duration.
George Kadianakis [Mon, 24 Jul 2017 10:30:04 +0000 (13:30 +0300)] 
SR: Calculate current SRV phase/run duration.

This is also needed to make the HS desc overlap mode function
independent of absolute hours.

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>