summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
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-28fix a windows unused var warningNick Mathewson
2015-06-27Whoops; fix linux build againNick Mathewson
2015-06-27Fix some compilation issues.Nick Mathewson
2015-06-27Avoid a segfault when reading an encrypted key that isn't thereNick Mathewson
Patch from cypherpunks. Fixes bug 16449. Bug not in any released tor.
2015-06-25Merge remote-tracking branch 'origin/maint-0.2.6'Nick Mathewson
2015-06-25Merge remote-tracking branch 'origin/maint-0.2.5' into maint-0.2.6Nick Mathewson
2015-06-25Merge remote-tracking branch 'origin/maint-0.2.4' into maint-0.2.5Nick Mathewson
2015-06-25Merge remote-tracking branch 'karsten/geoip6-jun2015' into maint-0.2.4Nick Mathewson
2015-06-25Merge remote-tracking branch 'origin/maint-0.2.3' into maint-0.2.4Nick Mathewson
2015-06-25Merge branch 'bug16288_027_03_squashed'Nick Mathewson
2015-06-25Validate the open file limit when creating a socketDavid Goulet
Fixes #16288 Signed-off-by: David Goulet <dgoulet@ev0ke.net>
2015-06-25Merge remote-tracking branch 'origin/maint-0.2.6'Nick Mathewson
2015-06-25Merge remote-tracking branch 'public/bug16013_025' into maint-0.2.6Nick Mathewson
2015-06-25Avoid crashing on busy/NEWNYM+hidden service clientsNick Mathewson
When we ran out of intro points for a hidden service (which could happen on a newnym), we would change the connection's state back to "waiting for hidden service descriptor." But this would make an assertion fail if we went on to call circuit_get_open_circ_or_launch again. This fixes bug 16013; I believe the bug was introduced in 38be533c69417aacf28cedec1c3bae808ce29f4, where we made it possible for circuit_get_open_circ_or_launch() to change the connection's state.
2015-06-25Merge branch 'readpassphrase_v2'Nick Mathewson
2015-06-25Remove janky getpass implementationsNick Mathewson
2015-06-25Add a getpass implementation for windows that won't totally suckNick Mathewson
The logic here is inspired by Python's win_getpass(), which I'm assuming is better than nothing.
2015-06-25Merge remote-tracking branch 'origin/maint-0.2.6'Nick Mathewson
2015-06-25Merge remote-tracking branch 'public/bug16400_026' into maint-0.2.6Nick Mathewson
2015-06-24Work around nytimes.com's broken hostnames in our SOCKS checks.Yawning Angel
RFC 952 is approximately 30 years old, and people are failing to comply, by serving A records with '_' as part of the hostname. Since relaxing the check is a QOL improvement for our userbase, relax the check to allow such abominations as destinations, especially since there are likely to be other similarly misconfigured domains out there.
2015-06-22Repair breakage in early-error case of microdesc parsingNick Mathewson
When I fixed #11243, I made it so we would take the digest of a descriptor before tokenizing it, so we could desist from download attempts if parsing failed. But when I did that, I didn't remove an assertion that the descriptor began with "onion-key". Usually, this was enforced by "find_start_of_next_microdescriptor", but when find_start_of_next_microdescriptor returned NULL, the assertion was triggered. Fixes bug 16400. Thanks to torkeln for reporting and cypherpunks_backup for diagnosing and writing the first fix here.
2015-06-19Merge remote-tracking branch 'dgoulet/rendcache_027_01'Nick Mathewson
2015-06-19fix some memory leaks that coverity foundNick Mathewson
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-18Add rendcache.{c|h}David Goulet
For now, rend_cache_entry_t has been moved from or.h to rendcache.h and those files have been added to the build system. In the next commit, these will contain hidden service descriptor cache ABI and API for both client and directory side. The goal is to consolidate the descriptor caches in one location to ease development, maintenance, review and improve documentation for each cache behavior and algorithm. Signed-off-by: David Goulet <dgoulet@ev0ke.net>
2015-06-18Merge remote-tracking branch 'origin/maint-0.2.6'Nick Mathewson
2015-06-18Merge remote-tracking branch 'dgoulet/bug16381_026_01-revert' into maint-0.2.6Nick Mathewson
2015-06-17Handle "keygen" if datadir does not yet existNick Mathewson
2015-06-17add test-memwipe to .gitignoreNick Mathewson
2015-06-17Fix an unchecked-case warning on windowsNick Mathewson
2015-06-17changes file for 13642Nick Mathewson
2015-06-17Add the openssh 6.8p1 readpassphrase implementationNick Mathewson
This way glibc users don't have to fall back to getpass. Windows users are still out of luck
2015-06-17Add readpassphrase.c in src/extNick Mathewson
This is taken verbatim from openssh 6.8p1, which appears to have lightly tweaked it from the openbsd version.
2015-06-17Merge branch '13642_offline_master_v2_squashed'Nick Mathewson
2015-06-17Support encrypted offline master keys with a new --keygen flagNick Mathewson
When --keygen is provided, we prompt for a passphrase when we make a new master key; if it is nonempty, we store the secret key in a new crypto_pwbox. Also, if --keygen is provided and there *is* an encrypted master key, we load it and prompt for a passphrase unconditionally. We make a new signing key unconditionally when --keygen is provided. We never overwrite a master key.
2015-06-17Add a tor_getpass to read passphrases. Needs better backend.Nick Mathewson
2015-06-17Extend intro point to a 4th hop on cannibalizationDavid Goulet
Fixes #16260 Signed-off-by: David Goulet <dgoulet@ev0ke.net>
2015-06-17Merge remote-tracking branch 'origin/maint-0.2.6'Nick Mathewson
2015-06-17Merge remote-tracking branch 'origin/maint-0.2.5' into maint-0.2.6Nick Mathewson
2015-06-17Correctly handle failed crypto_early_initteor
If crypto_early_init fails, a typo in a return value from tor_init means that tor_main continues running, rather than returning an error value. Fixes bug 16360; bugfix on d3fb846d8c98 in 0.2.5.2-alpha, introduced when implementing #4900. Patch by "teor".
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-16Document the consensus download interval used by hidden servicesteor
In the comments in update_consensus_networkstatus_fetch_time_impl in networkstatus.c
2015-06-16Fix spacing in tortls.cteor