aboutsummaryrefslogtreecommitdiff
path: root/src/or/rendservice.c
AgeCommit message (Collapse)Author
2016-03-21Scrub service name in introduction circuit warningJohn Brooks
Fixes bug 18600.
2016-03-11Merge remote-tracking branch 'teor/bug8976_01_028'Nick Mathewson
2016-02-27Update the copyright year.Nick Mathewson
2016-01-26Replace Alice/Bob with client/service in hidden service commentsteor (Tim Wilson-Brown)
2015-12-08Don't allow a rendezvous point to have a private addressDavid Goulet
When an HS process an INTRODUCE2 cell, we didn't validate if the IP address of the rendezvous point was a local address. If it's the case, we end up wasting resources by trying to extend to a local address which fails since we do not allow that in circuit_extend(). This commit now rejects a rendezvous point that has a local address once seen at the hidden service side unless ExtendAllowPrivateAddresses is set. Fixes #8976 Signed-off-by: David Goulet <dgoulet@ev0ke.net>
2015-11-25Merge branch 'maint-0.2.7'Nick Mathewson
2015-11-23Fix: use the right list in find_expiring_intro_point()David Goulet
The wrong list was used when looking up expired intro points in a rend service object causing what we think could be reachability issues and triggering a BUG log. Fixes #16702 Signed-off-by: David Goulet <dgoulet@ev0ke.net>
2015-10-02Merge remote-tracking branch 'donncha/feature14846_4'Nick Mathewson
2015-09-02correct the doc for find_rp_for_intro.Nick Mathewson
Thanks to Roger for spotting this!
2015-09-01Simplify API for find_rp_for_intro()Nick Mathewson
The function now unconditionally allocates a new extend_info_t. This should convince coverity that we're not leaking memory. (CID 1311875)
2015-08-25Generate service descriptors when PublishHidServDescriptors = 0Donncha O'Cearbhaill
Removes a check to PublishHidServDescriptors in rend_consider_services_upload(). This allows descriptors to be generated and stored in the local cache when PublishHidServDescriptor = 0. Keep the PublishHidServDescriptors option check in rend_consider_descriptor_republication(). We will never need to republish a descriptor if we are not publishing descriptors to the HSDirs.
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-08-25Preparatory indentation changesDonncha O'Cearbhaill
Deindent a block of code inside the PublishHidServDescriptors option check in upload_service_descriptor(). Stylistic commit to make the subsequent reworking of this code cleaner.
2015-07-16Break some wide linesNick Mathewson
2015-07-14Remove empty rend_service_validate_intro_early functionJohn Brooks
2015-07-14Rename ambiguous introduction point functionsJohn Brooks
Task #15824
2015-07-09Fix comments in rendservice.cDavid Goulet
Signed-off-by: David Goulet <dgoulet@ev0ke.net>
2015-07-09Count intro circuit and not only established onesDavid Goulet
When cleaning up extra circuits that we've opened for performance reason, we need to count all the introduction circuit and not only the established ones else we can end up with too many introduction points. This also adds the check for expiring nodes when serving an INTRODUCE cell since it's possible old clients are still using them before we have time to close them. Signed-off-by: David Goulet <dgoulet@ev0ke.net>
2015-07-09Upload descriptor when all intro points are readyDavid Goulet
To upload a HS descriptor, this commits makes it that we wait for all introduction point to be fully established. Else, the HS ends up uploading a descriptor that may contain intro points that are not yet "valid" meaning not yet established or proven to work. It could also trigger three uploads for the *same* descriptor if every intro points takes more than 30 seconds to establish because of desc_is_dirty being set at each intro established. To achieve that, n_intro_points_established varialbe is added to the rend_service_t object that is incremented when we established introduction point and decremented when we remove a valid intro point from our list. The condition to upload a descriptor also changes to test if all intro points are ready by making sure we have equal or more wanted intro points that are ready. The desc_id_dirty flag is kept to be able to still use the RendInitialPostPeriod option. This partially fixes #13483. Signed-off-by: David Goulet <dgoulet@ev0ke.net>
2015-07-09Reuse intro points that failed but are still validDavid Goulet
There is a case where if the introduction circuit fails but the node is still in the consensus, we clean up the intro point and choose an other one. This commit fixes that by trying to reuse the existing intro point with a maximum value of retry. A retry_nodes list is added to rend_services_introduce() and when we remove an invalid intro points that fits the use case mentionned before, we add the node to the retry list instead of removing it. Then, we retry on them before creating new ones. This means that the requirement to remove an intro point changes from "if no intro circuit" to "if no intro circuit then if no node OR we've reached our maximum circuit creation count". For now, the maximum retries is set to 3 which it completely arbitrary. It should also at some point be tied to the work done on detecting if our network is down or not. Fixes #8239 Signed-off-by: David Goulet <dgoulet@ev0ke.net>
2015-07-09Refactor rend_services_introduce()David Goulet
The reasoning for refactoring this function is that removing the introduction point adaptative algorithm (#4862) ended up changing quite a bit rend_services_introduce(). Also, to fix some open issues (#8239, #8864 and #13483), this work had to be done. First, this removes time_expiring variable in an intro point object and INTRO_POINT_EXPIRATION_GRACE_PERIOD trickery and use an expiring_nodes list where intro nodes that should expire are moved to that list and cleaned up only once the new descriptor is successfully uploaded. The previous scheme was adding complexity and arbitrary timing to when we expire an intro point. We keep the intro points until we are sure that the new descriptor is uploaded and thus ready to be used by clients. For this, rend_service_desc_has_uploaded() is added to notify the HS subsystem that the descriptor has been successfully uploaded. The purpose of this function is to cleanup the expiring nodes and circuits if any. Secondly, this adds the remove_invalid_intro_points() function in order to split up rend_services_introduce() a bit with an extra modification to it that fixes #8864. We do NOT close the circuit nor delete the intro point if the circuit is still alive but the node was removed from the consensus. Due to possible information leak, we let the circuit and intro point object expire instead. Finally, the whole code flow is simplified and large amount of documentation has been added to mostly explain the why of things in there. Fixes #8864 Signed-off-by: David Goulet <dgoulet@ev0ke.net>
2015-06-29Add the torrc option HiddenServiceNumIntroductionPointsDavid Goulet
This is a way to specify the amount of introduction points an hidden service can have. Maximum value is 10 and the default is 3. Fixes #4862 Signed-off-by: David Goulet <dgoulet@ev0ke.net>
2015-06-29Remove intro points adaptative algorithmDavid Goulet
Partially fixes #4862 Signed-off-by: David Goulet <dgoulet@ev0ke.net>
2015-06-17Extend intro point to a 4th hop on cannibalizationDavid Goulet
Fixes #16260 Signed-off-by: David Goulet <dgoulet@ev0ke.net>
2015-06-01Appease make check-spacesAndrea Shepard
2015-05-28Avoid double-free on rend_add_service() failureNick Mathewson
Rend_add_service() frees its argument on failure; no need to free again. Fixes bug 16228, bugfix on 0.2.7.1-alpha Found by coverity; this is CID 1301387.
2015-05-20Add support for 'HiddenServiceMaxStream' to 'ADD_ONION'.Yawning Angel
Done as a separate commit to ease backporting the tunables to 0.2.6.x.
2015-05-20Add "HiddenServiceMaxStreams" as a per-HS tunable.Yawning Angel
When set, this limits the maximum number of simultaneous streams per rendezvous circuit on the server side of a HS, with further RELAY_BEGIN cells being silently ignored. This can be modified via "HiddenServiceMaxStreamsCloseCircuit", which if set will cause offending rendezvous circuits to be torn down instead. Addresses part of #16052.
2015-05-16Fix crash on HUP with mixed ephemeral servicesJohn Brooks
Ephemeral services will be listed in rend_services_list at the end of rend_config_services, so it must check whether directory is non-NULL before comparing. This crash happens when reloading config on a tor with mixed configured and ephemeral services. Fixes bug #16060. Bugfix on 0.2.7.1-alpha.
2015-05-14Fix rend_config_services() indentationDavid Goulet
Not sure what happened but whitespace gone wild! :) Signed-off-by: David Goulet <dgoulet@ev0ke.net>
2015-05-14Use safe_str_client() for service ID in logDavid Goulet
Scrub the service ID in a warning log. Signed-off-by: David Goulet <dgoulet@ev0ke.net>
2015-05-05Merge remote-tracking branch 'public/bug15821_025'Nick Mathewson
2015-05-05Fix out-of-bounds read in INTRODUCE2 client authJohn Brooks
The length of auth_data from an INTRODUCE2 cell is checked when the auth_type is recognized (1 or 2), but not for any other non-zero auth_type. Later, auth_data is assumed to have at least REND_DESC_COOKIE_LEN bytes, leading to a client-triggered out of bounds read. Fixed by checking auth_len before comparing the descriptor cookie against known clients. Fixes #15823; bugfix on 0.2.1.6-alpha.
2015-05-04Add "+HSPOST" and related "HS_DESC" event flags to the controller.Donncha O'Cearbhaill
"+HSPOST" and the related event changes allow the uploading of HS descriptors via the control port, and more comprehensive event monitoring of HS descriptor upload status.
2015-04-30Use rend_data_client/service_create() in codeDavid Goulet
Every callsite that use to allocate a rend_data_t object now use the rend_data_client/service_create() function. Signed-off-by: David Goulet <dgoulet@ev0ke.net>
2015-04-28Add "ADD_ONION"/"DEL_ONION" and "GETINFO onions/*" to the controller.Yawning Angel
These commands allow for the creation and management of ephemeral Onion ("Hidden") services that are either bound to the lifetime of the originating control connection, or optionally the lifetime of the tor instance. Implements #6411.
2015-04-23Merge remote-tracking branch 'public/bug15745_027_03'Nick Mathewson
2015-04-23Use a custom Base64 encoder with more control over the output format.Yawning Angel
2015-04-21Add crypto_rand_int_range() and use itDavid Goulet
Incidently, this fixes a bug where the maximum value was never used when only using crypto_rand_int(). For instance this example below in rendservice.c never gets to INTRO_POINT_LIFETIME_MAX_SECONDS. int intro_point_lifetime_seconds = INTRO_POINT_LIFETIME_MIN_SECONDS + crypto_rand_int(INTRO_POINT_LIFETIME_MAX_SECONDS - INTRO_POINT_LIFETIME_MIN_SECONDS); Signed-off-by: David Goulet <dgoulet@ev0ke.net>
2015-04-20Use a random count of INTRODUCE2 for IP rotationDavid Goulet
An introduction point is currently rotated when the amount of INTRODUCE2 cells reached a fixed value of 16384. This makes it pretty easy for an attacker to inflate that number and observe when the IP rotates which leaks the popularity of the HS (amount of client that passed through the IP). This commit makes it a random count between the current value of 16384 and two times that. Fixes #15745 Signed-off-by: David Goulet <dgoulet@ev0ke.net>
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-06Validate the RSA key size received when parsing INTRODUCE2 cells.Yawning Angel
Fixes bug 15600; reported by skruffy
2015-04-03Merge remote-tracking branch 'origin/maint-0.2.6'Nick Mathewson
2015-04-03Decrease the amount of rend circ relaunches for hidden services.George Kadianakis
2015-03-13const-ify the new failure vars, and one old oneNick Mathewson
2015-03-12Don't init hs intro key as side effect of an assertSebastian Hahn
2015-02-17Remove tor_strclear(), and replace previous calls with memwipe().Yawning Angel
2015-02-09Reserve enough space for rend_service_port_config_tSebastian Hahn
In #14803, Damian noticed that his Tor sometimes segfaults. Roger noted that his valgrind gave an invalid write of size one here. Whenever we use FLEXIBLE_ARRAY_MEMBER, we have to make sure to actually malloc a thing that's large enough. Fixes bug #14803, not in any released version of Tor.