summaryrefslogtreecommitdiff
path: root/src
AgeCommit message (Collapse)Author
2017-08-08test: Fix prop224 HS descriptor to use subcredentialGeorge Kadianakis
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>
2017-08-08test: Add unit test coverage of hs_service.cDavid Goulet
Signed-off-by: David Goulet <dgoulet@torproject.org>
2017-08-08test: Refactor HS tests to use the new ESTABLISH_INTRO cell codeDavid Goulet
Signed-off-by: David Goulet <dgoulet@torproject.org>
2017-08-08test: Add test_hs_common unit testsDavid Goulet
Move tests from test_hs_service.c to this file. Signed-off-by: David Goulet <dgoulet@torproject.org>
2017-08-08test: Add test_hs_ntor unit testsDavid Goulet
Move the ntor test from test_hs_service.c to this file. Signed-off-by: David Goulet <dgoulet@torproject.org>
2017-08-08test: Add test_hs_cell unit testsDavid Goulet
Move ESTABLISH_INTRO tests from test_hs_service.c to this new file. Signed-off-by: David Goulet <dgoulet@torproject.org>
2017-08-08prop224: Link rendezvous circuit to edge connectionDavid Goulet
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>
2017-08-08hs: Refactor the service exit connection codeDavid Goulet
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>
2017-08-08prop224: Sandbox support for serviceDavid Goulet
Signed-off-by: David Goulet <dgoulet@torproject.org>
2017-08-08prop224: Make the number of extra intro point a consensus paramDavid Goulet
Signed-off-by: David Goulet <dgoulet@torproject.org>
2017-08-08prop224: Make intro point min/max lifetime a consensus paramDavid Goulet
Signed-off-by: David Goulet <dgoulet@torproject.org>
2017-08-08prop224: Make INTRODUCE2 min/max a consensus paramDavid Goulet
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>
2017-08-08prop224: Implement a service intro point failure cacheDavid Goulet
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>
2017-08-08prop224: Upload service descriptorsDavid Goulet
Signed-off-by: David Goulet <dgoulet@torproject.org>
2017-08-08prop224: Directory function to upload descriptorDavid Goulet
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>
2017-08-08prop224: Add a responsible HSDir functionDavid Goulet
Signed-off-by: David Goulet <dgoulet@torproject.org>
2017-08-08prop224: Add hsdir consensus parametersDavid Goulet
Signed-off-by: David Goulet <dgoulet@torproject.org>
2017-08-08prop224: Build hsdir index for node_tDavid Goulet
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>
2017-08-08prop224: Add service replay cacheDavid Goulet
Signed-off-by: David Goulet <dgoulet@torproject.org>
2017-08-08prop224: Support INTRODUCE2 cell replay cacheDavid Goulet
Signed-off-by: David Goulet <dgoulet@torproject.org>
2017-08-08prop224: Support legacy INTRODUCE2 cellDavid Goulet
Also rename some function to follow a bit more the naming convention in that file. Signed-off-by: David Goulet <dgoulet@torproject.org>
2017-08-08prop224: Handle service RENDEZVOUS1 cellDavid Goulet
Signed-off-by: David Goulet <dgoulet@torproject.org>
2017-08-08prop224: Establish rendezvous circuit for serviceDavid Goulet
Signed-off-by: David Goulet <dgoulet@torproject.org>
2017-08-08prop224: Handle service INTRODUCE2 cellDavid Goulet
At this commit, launching rendezvous circuit is not implemented, only a placeholder. Signed-off-by: David Goulet <dgoulet@torproject.org>
2017-08-08prop224: Add helper function to lookup HS objectsDavid Goulet
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>
2017-08-08prop224: Handle service INTRO_ESTABLISHED cellDavid Goulet
Signed-off-by: David Goulet <dgoulet@torproject.org>
2017-08-08prop224: Circuit has opened and ESTABLISH_INTRO cellDavid Goulet
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>
2017-08-08prop224: Introduction circuit creationDavid Goulet
Signed-off-by: David Goulet <dgoulet@torproject.org>
2017-08-08prop224: Service v3 descriptor creation and logicDavid Goulet
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>
2017-08-08prop224: Implement subcredential creationDavid Goulet
Signed-off-by: David Goulet <dgoulet@torproject.org>
2017-08-08prop224: Add descriptor overlap mode functionGeorge Kadianakis
The function has been added but not used except for the unit tests. Signed-off-by: David Goulet <dgoulet@torproject.org>
2017-08-08prop224: Scheduled events for serviceDavid Goulet
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>
2017-08-08prop224: API for the creation of blinded keysDavid Goulet
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>
2017-08-08hs: Implement constructor for hs_desc_intro_point_tDavid Goulet
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>
2017-07-25prop224: Add onion key to service descriptor intro pointDavid Goulet
Signed-off-by: David Goulet <dgoulet@torproject.org>
2017-07-25prop224: Add the introduction point onion key to descriptorDavid Goulet
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>
2017-07-25prop224: Helper to dup a link_specifier_t objectDavid Goulet
Signed-off-by: David Goulet <dgoulet@torproject.org>
2017-07-25prop224: Update hs identifier circuitDavid Goulet
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>
2017-07-25trunnel: Add prop224 RENDEZVOUS1 cell definitionDavid Goulet
Signed-off-by: David Goulet <dgoulet@torproject.org>
2017-07-25fix wordo in commentRoger Dingledine
2017-07-24Fix remaining cases of hs_config failures without af_unixNick Mathewson
2017-07-24Fix hs_config unit test on systems without unix socketsNick Mathewson
Bugfix on 418059dd96f5f427eceffff1daeb2a2f6c4adbeb; jenkins found this.
2017-07-24Rename the hybrid_encrypt/decrypt functions; label them as dangerousNick Mathewson
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.
2017-07-24Improve comment about why we disable TLS compression.Nick Mathewson
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.
2017-07-24test: Remove buggy unit test in test_hs_serviceDavid Goulet
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>
2017-07-23fix whitespace issueRoger Dingledine
2017-07-14Merge branch 'bug17750_029_squashed'Nick Mathewson
2017-07-14Fix a signed integer overflow in dir/download_status_random_backoffNick Mathewson
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.
2017-07-14Fix 32-bit warnings in hs_common.cNick Mathewson
2017-07-14Merge branch 'maint-0.3.1'Nick Mathewson