summaryrefslogtreecommitdiff
path: root/src/or/rendcommon.c
AgeCommit message (Collapse)Author
2017-03-15Run the copyright update script.Nick Mathewson
2017-01-18prop224: Add INTRODUCE1 cell relay supportDavid Goulet
Closes #20029 Signed-off-by: David Goulet <dgoulet@torproject.org>
2016-12-14prop224: Introduce the new introduction point code.George Kadianakis
(pun not intended) Now our code supports both legacy and prop224 ESTABLISH_INTRO cells :) hs_intro_received_establish_intro() is the new entry point.
2016-11-04Fix make check-spacesNick Mathewson
2016-11-04Merge branch 'ticket17238_029_02-resquash'Nick Mathewson
Conflicts: src/or/rendclient.c src/or/rendcommon.c src/or/routerparse.c src/test/test_dir.c src/trunnel/ed25519_cert.h
2016-11-04Make check-spaces happy :)George Kadianakis
Signed-off-by: David Goulet <dgoulet@torproject.org> Signed-off-by: George Kadianakis <desnacked@riseup.net>
2016-11-04hs: Refactor rend_data_t for multi version supportDavid Goulet
In order to implement proposal 224, we need the data structure rend_data_t to be able to accomodate versionning that is the current version of hidden service (2) and the new version (3) and future version. For that, we implement a series of accessors and a downcast function to get the v2 data structure. rend_data_t becomes a top level generic place holder. The entire rend_data_t API has been moved to hs_common.{c|h} in order to seperate code that is shared from between HS versions and unshared code (in rendcommon.c). Closes #19024 Signed-off-by: David Goulet <dgoulet@torproject.org> Signed-off-by: George Kadianakis <desnacked@riseup.net>
2016-09-13Fix a check-spaces warning.Nick Mathewson
2016-09-13Refactor Single Onion code to improve consistencyteor
* Check consistency between the two single onion torrc options * Use the more relevant option each time we check for single onion mode * Clarify log messages * Clarify comments * Otherwise, no behaviour change
2016-09-13Implement Prop #260: Single Onion Servicesteor (Tim Wilson-Brown)
Add experimental OnionServiceSingleHopMode and OnionServiceNonAnonymousMode options. When both are set to 1, every hidden service on a tor instance becomes a non-anonymous Single Onion Service. Single Onions make one-hop (direct) connections to their introduction and renzedvous points. One-hop circuits make Single Onion servers easily locatable, but clients remain location-anonymous. This is compatible with the existing hidden service implementation, and works on the current tor network without any changes to older relays or clients. Implements proposal #260, completes ticket #17178. Patch by teor & asn. squash! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! Implement Prop #260: Single Onion Services Redesign single onion service poisoning. When in OnionServiceSingleHopMode, each hidden service key is poisoned (marked as non-anonymous) on creation by creating a poison file in the hidden service directory. Existing keys are considered non-anonymous if this file exists, and anonymous if it does not. Tor refuses to launch in OnionServiceSingleHopMode if any existing keys are anonymous. Similarly, it refuses to launch in anonymous client mode if any existing keys are non-anonymous. Rewrite the unit tests to match and be more comprehensive. Adds a bonus unit test for rend_service_load_all_keys().
2016-06-09Reduce make check-spaces noiseAndrea Shepard
2016-05-09Merge branch 'feature15588_squashed'Nick Mathewson
2016-05-09Move rend client name checks to one functionJohn Brooks
2016-05-09Move rend auth cookie en-/decoding to a functionJohn Brooks
Tor stores client authorization cookies in two slightly different forms. The service's client_keys file has the standard base64-encoded cookie, including two chars of padding. The hostname file and the client remove the two padding chars, and store an auth type flag in the unused bits. The distinction makes no sense. Refactor all decoding to use the same function, which will accept either form, and use a helper function for encoding the truncated format.
2016-03-28Rename tor_dup_addr to tor_addr_to_str_dup.Nick Mathewson
Patch from icanhasaccount; closes 18462.
2016-03-11rip out rend_id_is_in_interval()Roger Dingledine
it was used by hid_serv_responsible_for_desc_id(), which we no longer use.
2016-03-11rip out hid_serv_acting_as_directory()Roger Dingledine
When we made HidServDirectoryV2 always 1, we removed the situation where a relay could choose not to be an HSDir. Now simplify the rest of the code to reflect this decision. (We have to remove two apparently unrelated free() calls in the unit tests, since they used to free stuff that we created as a side effect of calling router_get_my_routerinfo(), and now we no longer call that.)
2016-03-11rip out hid_serv_responsible_for_desc_id()Roger Dingledine
This simplifies relay behavior, because the relay offers the hsdir functionality independent of whether the directory authorities have decided this relay is suitable for clients to use yet. Implements ticket 18332.
2016-03-11moving hid_serv_get_responsible_directories and hid_serv_acting_as_directory ↵Hassan Alsibyani
from routerlist.c to rendcommon.c
2016-02-27Update the copyright year.Nick Mathewson
2015-11-25Merge branch 'bug17686_v2_027'Nick Mathewson
2015-11-25Now that crypto_rand() cannot fail, it should return void.Nick Mathewson
2015-09-08Add replica number to HS_DESC CREATED eventDonncha O'Cearbhaill
Including the replica number in the HS_DESC CREATED event provides more context to a control port client. The replica allows clients to more easily identify each replicated descriptor from the independantly output control events.
2015-08-25Store service descriptors in the service descriptor cacheDonncha O'Cearbhaill
Service descriptors are now generated regardless of the the PublishHidServDescriptors option. The generated descriptors are stored in the service descriptor cache. The PublishHidServDescriptors = 1 option now prevents descriptor publication to the HSDirs rather than descriptor generation.
2015-07-14Rename ambiguous introduction point functionsJohn Brooks
Task #15824
2015-06-18Move cache objects and functions to rendcache.{c|h}David Goulet
Every functions and objects that are used for hidden service descriptor caches are moved to rendcache.{c|h}. This commit does NOT change anything, just moving code around. Fixes #16399 Signed-off-by: David Goulet <dgoulet@ev0ke.net>
2015-06-18Merge remote-tracking branch 'origin/maint-0.2.6'Nick Mathewson
2015-06-16Revert "Do not replace a HS descriptor with a different replica of itself"David Goulet
This reverts commit 9407040c592184e05e45a3c1a00739c2dd302288. Small fix, "e->received" had to be removed since that variable doesn't exist anymore. Signed-off-by: David Goulet <dgoulet@ev0ke.net>
2015-06-03Always initialise return value in compute_desc_id in rendcommon.cteor
Fix on e6a581f126ba, released in 0.2.7.1-alpha.
2015-05-14Fix: init HSDirs list in rend_data_service_createDavid Goulet
Signed-off-by: David Goulet <dgoulet@ev0ke.net>
2015-05-14Add missing descriptor ID to HS_DESC control eventDavid Goulet
For FAILED and RECEIVED action of the HS_DESC event, we now sends back the descriptor ID at the end like specified in the control-spec section 4.1.25. Fixes #15881 Signed-off-by: David Goulet <dgoulet@ev0ke.net>
2015-05-11comment patch from dgoulet that was in my inbox too longNick Mathewson
2015-04-30whitespace fixesNick Mathewson
2015-04-30compilation fix: signed/unsigned comparisonNick Mathewson
2015-04-30Add a create function for rend_data_t objectDavid Goulet
Ground works for fixing #15816. This adds the rend_data_create() function in order to have a single place where we initialize that data structure. Furthermore, an array of descriptor IDs is added (one per replica) so we can keep a copy of the current id in the object. It will be used to purge the last hid serv request cache using those descriptor IDs. When they change, they will be replaced and the old ones will be purged from the cache. Signed-off-by: David Goulet <dgoulet@ev0ke.net>
2015-04-23Merge remote-tracking branch 'dgoulet/bug14847_027_06'Nick Mathewson
2015-04-23Merge branch 'feature15652_squashed'Nick Mathewson
2015-04-23Use a custom Base64 encoder with more control over the output format.Yawning Angel
2015-04-22Add function to validate HS descriptor IDDavid Goulet
Signed-off-by: David Goulet <dgoulet@ev0ke.net>
2015-04-21Control: unbolt rend_data from HS desc eventDavid Goulet
The HS_DESC event was using rend_data_t from the dir connection to reply the onion address and authentication type. With the new HSFETCH command, it's now possible to fetch a descriptor only using the descriptor id thus resulting in not having an onion address in any HS_DESC event. This patch removes rend_query from the hs desc control functions and replace it by an onion address string and an auth type. On a successful fetch, the service id is taken from the fetched descriptor. For that, an extra parameter is added to "store as a client" function that contains the cache entry stored. This will make the control event functions scale more easily over time if other values not present in rend_data_t are needed since the rend_data from the dir connection might not contained everything we need. Signed-off-by: David Goulet <dgoulet@ev0ke.net>
2015-04-21Refactor HS descriptor fetch to support descriptor IDDavid Goulet
Big refactor of the HS client descriptor fetch functionnality. This allows to fetch an HS descriptor using only a descriptor ID. Furthermore, it's also possible to provide a list of HSDir(s) now that are used instead of the automatically choosen one. The approach taken was to add a descriptor_id field to the rend_data_t structure so it can be used, if available, by the HS client. The onion address field however has priority over it that is if both are set, the onion address is used to fetch the descriptor. A new public function is introduced called rend_client_fetch_v2_desc(...) that does NOT lookup the client cache before fetching and can take a list of HSDirs as a parameter. The HSFETCH control command now uses this new function thus making it work and final. Signed-off-by: David Goulet <dgoulet@ev0ke.net>
2015-04-15Fix another space issueNick Mathewson
2015-04-15Merge remote-tracking branch 'dgoulet/bug14391_026_v2'Nick Mathewson
2015-04-06Merge remote-tracking branch 'origin/maint-0.2.6'Nick Mathewson
2015-04-06Merge remote-tracking branch 'origin/maint-0.2.5' into maint-0.2.6Nick Mathewson
2015-04-06Merge remote-tracking branch 'origin/maint-0.2.4' into maint-0.2.5Nick Mathewson
2015-04-06Treat empty introduction points sections as missing.Yawning Angel
Found by DonnchaC.
2015-03-16Remove extra newline at the end of HS descriptorDavid Goulet
The rend-spec.txt document doesn't specify this extra newline. Furthermore, this is the only descryptor type that contains one. Client and HSDir without this patch still work perfectly since the HS descriptor parsing doesn't expect a newline at the end. Fixes #15296 Signed-off-by: David Goulet <dgoulet@ev0ke.net>
2015-01-27Refactor rend_cache_lookup_entry() and how it's usedDavid Goulet
Here is why: 1) v0 descriptors are deprecated since 0.2.2.1 and not suppose to be alive in the network anymore. This function should only serve v2 version for now as the default. 2) It should return different error code depending on what's the actual error is. Right now, there is no distinction between a cache entry not found and an invalid query. 3) This function should NOT test if the intro points are usable or not. This adds some load on a function that should be "O(1)" and do one job. Furthermore, multiple callsites actually already test that doing twice the job... 4) While adding control event, it would be useful to be able to lookup a cache entry without having it checking the intro points. There are also places in the code that do want to lookup the cache entry without doing that. Fixes #14391 Signed-off-by: David Goulet <dgoulet@ev0ke.net>
2015-01-18Remove the unused rend_cache_entry_t->received field.Roger Dingledine
(Patch from arma, commit message from nick.) Closes #14222.