mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-12-06 19:41:15 +01:00
hs-v2: Remove client support
Related to #40266 Signed-off-by: David Goulet <dgoulet@torproject.org>
This commit is contained in:
@@ -103,7 +103,7 @@
|
||||
#include "feature/relay/routermode.h"
|
||||
#include "feature/relay/relay_config.h"
|
||||
#include "feature/relay/transport_config.h"
|
||||
#include "feature/rend/rendclient.h"
|
||||
#include "feature/rend/rendcommon.h"
|
||||
#include "feature/rend/rendservice.h"
|
||||
#include "lib/geoip/geoip.h"
|
||||
#include "feature/stats/geoip_stats.h"
|
||||
@@ -504,7 +504,6 @@ static const config_var_t option_vars_[] = {
|
||||
VAR("HiddenServiceOnionBalanceInstance",
|
||||
LINELIST_S, RendConfigLines, NULL),
|
||||
VAR("HiddenServiceStatistics", BOOL, HiddenServiceStatistics_option, "1"),
|
||||
V(HidServAuth, LINELIST, NULL),
|
||||
V(ClientOnionAuthDir, FILENAME, NULL),
|
||||
OBSOLETE("CloseHSClientCircuitsImmediatelyOnTimeout"),
|
||||
OBSOLETE("CloseHSServiceRendCircuitsImmediatelyOnTimeout"),
|
||||
|
||||
@@ -428,9 +428,6 @@ struct or_options_t {
|
||||
int NumCPUs; /**< How many CPUs should we try to use? */
|
||||
struct config_line_t *RendConfigLines; /**< List of configuration lines
|
||||
* for rendezvous services. */
|
||||
struct config_line_t *HidServAuth; /**< List of configuration lines for
|
||||
* client-side authorizations for hidden
|
||||
* services */
|
||||
char *ClientOnionAuthDir; /**< Directory to keep client
|
||||
* onion service authorization secret keys */
|
||||
char *ContactInfo; /**< Contact info to be published in the directory. */
|
||||
|
||||
@@ -46,7 +46,6 @@
|
||||
#include "feature/relay/ext_orport.h"
|
||||
#include "feature/relay/relay_config.h"
|
||||
#include "feature/rend/rendcache.h"
|
||||
#include "feature/rend/rendclient.h"
|
||||
#include "feature/stats/bwhist.h"
|
||||
#include "feature/stats/geoip_stats.h"
|
||||
#include "feature/stats/rephist.h"
|
||||
@@ -120,7 +119,6 @@ tor_free_all(int postfork)
|
||||
addressmap_free_all();
|
||||
dirserv_free_all();
|
||||
rend_cache_free_all();
|
||||
rend_service_authorization_free_all();
|
||||
rep_hist_free_all();
|
||||
bwhist_free_all();
|
||||
circuit_free_all();
|
||||
|
||||
@@ -106,7 +106,6 @@
|
||||
#include "feature/relay/dns.h"
|
||||
#include "feature/relay/ext_orport.h"
|
||||
#include "feature/relay/routermode.h"
|
||||
#include "feature/rend/rendclient.h"
|
||||
#include "feature/rend/rendcommon.h"
|
||||
#include "feature/stats/connstats.h"
|
||||
#include "feature/stats/rephist.h"
|
||||
|
||||
@@ -88,7 +88,7 @@
|
||||
#include "core/or/policies.h"
|
||||
#include "core/or/relay.h"
|
||||
#include "core/crypto/relay_crypto.h"
|
||||
#include "feature/rend/rendclient.h"
|
||||
#include "feature/rend/rendcache.h"
|
||||
#include "feature/rend/rendcommon.h"
|
||||
#include "feature/stats/predict_ports.h"
|
||||
#include "feature/stats/bwhist.h"
|
||||
|
||||
@@ -34,7 +34,6 @@
|
||||
#include "lib/crypt_ops/crypto_rand.h"
|
||||
#include "core/mainloop/mainloop.h"
|
||||
#include "feature/nodelist/networkstatus.h"
|
||||
#include "feature/rend/rendclient.h"
|
||||
#include "feature/rend/rendservice.h"
|
||||
#include "feature/relay/router.h"
|
||||
#include "app/config/statefile.h"
|
||||
|
||||
@@ -58,7 +58,6 @@
|
||||
#include "feature/nodelist/routerlist.h"
|
||||
#include "feature/relay/routermode.h"
|
||||
#include "feature/relay/selftest.h"
|
||||
#include "feature/rend/rendclient.h"
|
||||
#include "feature/rend/rendcommon.h"
|
||||
#include "feature/rend/rendservice.h"
|
||||
#include "feature/stats/predict_ports.h"
|
||||
@@ -2448,11 +2447,7 @@ circuit_get_open_circ_or_launch(entry_connection_t *conn,
|
||||
extend_info = hs_client_get_random_intro_from_edge(edge_conn);
|
||||
if (!extend_info) {
|
||||
log_info(LD_REND, "No intro points: re-fetching service descriptor.");
|
||||
if (edge_conn->rend_data) {
|
||||
rend_client_refetch_v2_renddesc(edge_conn->rend_data);
|
||||
} else {
|
||||
hs_client_refetch_hsdesc(&edge_conn->hs_ident->identity_pk);
|
||||
}
|
||||
hs_client_refetch_hsdesc(&edge_conn->hs_ident->identity_pk);
|
||||
connection_ap_mark_as_waiting_for_renddesc(conn);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -96,7 +96,6 @@
|
||||
#include "feature/relay/dns.h"
|
||||
#include "feature/relay/router.h"
|
||||
#include "feature/relay/routermode.h"
|
||||
#include "feature/rend/rendclient.h"
|
||||
#include "feature/rend/rendcommon.h"
|
||||
#include "feature/rend/rendservice.h"
|
||||
#include "feature/stats/predict_ports.h"
|
||||
@@ -251,24 +250,9 @@ connection_mark_unattached_ap_,(entry_connection_t *conn, int endreason,
|
||||
int line, const char *file))
|
||||
{
|
||||
connection_t *base_conn = ENTRY_TO_CONN(conn);
|
||||
edge_connection_t *edge_conn = ENTRY_TO_EDGE_CONN(conn);
|
||||
tor_assert(base_conn->type == CONN_TYPE_AP);
|
||||
ENTRY_TO_EDGE_CONN(conn)->edge_has_sent_end = 1; /* no circ yet */
|
||||
|
||||
/* If this is a rendezvous stream and it is failing without ever
|
||||
* being attached to a circuit, assume that an attempt to connect to
|
||||
* the destination hidden service has just ended.
|
||||
*
|
||||
* XXXX This condition doesn't limit to only streams failing
|
||||
* without ever being attached. That sloppiness should be harmless,
|
||||
* but we should fix it someday anyway. */
|
||||
if ((edge_conn->on_circuit != NULL || edge_conn->edge_has_sent_end) &&
|
||||
connection_edge_is_rendezvous_stream(edge_conn)) {
|
||||
if (edge_conn->rend_data) {
|
||||
rend_client_note_connection_attempt_ended(edge_conn->rend_data);
|
||||
}
|
||||
}
|
||||
|
||||
if (base_conn->marked_for_close) {
|
||||
/* This call will warn as appropriate. */
|
||||
connection_mark_for_close_(base_conn, line, file);
|
||||
@@ -1636,12 +1620,12 @@ consider_plaintext_ports(entry_connection_t *conn, uint16_t port)
|
||||
* The possible recognized forms are (where true is returned):
|
||||
*
|
||||
* If address is of the form "y.onion" with a well-formed handle y:
|
||||
* Put a NUL after y, lower-case it, and return ONION_V2_HOSTNAME or
|
||||
* ONION_V3_HOSTNAME depending on the HS version.
|
||||
* Put a NUL after y, lower-case it, and return ONION_V3_HOSTNAME
|
||||
* depending on the HS version.
|
||||
*
|
||||
* If address is of the form "x.y.onion" with a well-formed handle x:
|
||||
* Drop "x.", put a NUL after y, lower-case it, and return
|
||||
* ONION_V2_HOSTNAME or ONION_V3_HOSTNAME depending on the HS version.
|
||||
* ONION_V3_HOSTNAME depending on the HS version.
|
||||
*
|
||||
* If address is of the form "y.onion" with a badly-formed handle y:
|
||||
* Return BAD_HOSTNAME and log a message.
|
||||
@@ -1691,14 +1675,6 @@ parse_extended_hostname(char *address, hostname_type_t *type_out)
|
||||
if (q != address) {
|
||||
memmove(address, q, strlen(q) + 1 /* also get \0 */);
|
||||
}
|
||||
/* v2 onion address check. */
|
||||
if (strlen(query) == REND_SERVICE_ID_LEN_BASE32) {
|
||||
*type_out = ONION_V2_HOSTNAME;
|
||||
if (rend_valid_v2_service_id(query)) {
|
||||
goto success;
|
||||
}
|
||||
goto failed;
|
||||
}
|
||||
|
||||
/* v3 onion address check. */
|
||||
if (strlen(query) == HS_SERVICE_ADDR_LEN_BASE32) {
|
||||
@@ -1718,8 +1694,7 @@ parse_extended_hostname(char *address, hostname_type_t *type_out)
|
||||
failed:
|
||||
/* otherwise, return to previous state and return 0 */
|
||||
*s = '.';
|
||||
const bool is_onion = (*type_out == ONION_V2_HOSTNAME) ||
|
||||
(*type_out == ONION_V3_HOSTNAME);
|
||||
const bool is_onion = (*type_out == ONION_V3_HOSTNAME);
|
||||
log_warn(LD_APP, "Invalid %shostname %s; rejecting",
|
||||
is_onion ? "onion " : "",
|
||||
safe_str_client(address));
|
||||
@@ -2004,41 +1979,7 @@ connection_ap_handle_onion(entry_connection_t *conn,
|
||||
int rend_cache_lookup_result = -ENOENT;
|
||||
int descriptor_is_usable = 0;
|
||||
|
||||
if (addresstype == ONION_V2_HOSTNAME) { /* it's a v2 hidden service */
|
||||
rend_cache_entry_t *entry = NULL;
|
||||
/* Look up if we have client authorization configured for this hidden
|
||||
* service. If we do, associate it with the rend_data. */
|
||||
rend_service_authorization_t *client_auth =
|
||||
rend_client_lookup_service_authorization(socks->address);
|
||||
|
||||
const uint8_t *cookie = NULL;
|
||||
rend_auth_type_t auth_type = REND_NO_AUTH;
|
||||
if (client_auth) {
|
||||
log_info(LD_REND, "Using previously configured client authorization "
|
||||
"for hidden service request.");
|
||||
auth_type = client_auth->auth_type;
|
||||
cookie = client_auth->descriptor_cookie;
|
||||
}
|
||||
|
||||
/* Fill in the rend_data field so we can start doing a connection to
|
||||
* a hidden service. */
|
||||
rend_data_t *rend_data = ENTRY_TO_EDGE_CONN(conn)->rend_data =
|
||||
rend_data_client_create(socks->address, NULL, (char *) cookie,
|
||||
auth_type);
|
||||
if (rend_data == NULL) {
|
||||
return -1;
|
||||
}
|
||||
onion_address = rend_data_get_address(rend_data);
|
||||
log_info(LD_REND,"Got a hidden service request for ID '%s'",
|
||||
safe_str_client(onion_address));
|
||||
|
||||
rend_cache_lookup_result = rend_cache_lookup_entry(onion_address,-1,
|
||||
&entry);
|
||||
if (!rend_cache_lookup_result && entry) {
|
||||
descriptor_is_usable = rend_client_any_intro_points_usable(entry);
|
||||
}
|
||||
} else { /* it's a v3 hidden service */
|
||||
tor_assert(addresstype == ONION_V3_HOSTNAME);
|
||||
if (addresstype == ONION_V3_HOSTNAME) {
|
||||
const hs_descriptor_t *cached_desc = NULL;
|
||||
int retval;
|
||||
/* Create HS conn identifier with HS pubkey */
|
||||
@@ -2108,13 +2049,7 @@ connection_ap_handle_onion(entry_connection_t *conn,
|
||||
edge_connection_t *edge_conn = ENTRY_TO_EDGE_CONN(conn);
|
||||
connection_ap_mark_as_non_pending_circuit(conn);
|
||||
base_conn->state = AP_CONN_STATE_RENDDESC_WAIT;
|
||||
if (addresstype == ONION_V2_HOSTNAME) {
|
||||
tor_assert(edge_conn->rend_data);
|
||||
rend_client_refetch_v2_renddesc(edge_conn->rend_data);
|
||||
/* Whatever the result of the refetch, we don't go further. */
|
||||
return 0;
|
||||
} else {
|
||||
tor_assert(addresstype == ONION_V3_HOSTNAME);
|
||||
if (addresstype == ONION_V3_HOSTNAME) {
|
||||
tor_assert(edge_conn->hs_ident);
|
||||
/* Attempt to fetch the hsv3 descriptor. Check the retval to see how it
|
||||
* went and act accordingly. */
|
||||
@@ -2313,7 +2248,7 @@ connection_ap_handshake_rewrite_and_attach(entry_connection_t *conn,
|
||||
}
|
||||
|
||||
/* Now, we handle everything that isn't a .onion address. */
|
||||
if (addresstype != ONION_V2_HOSTNAME && addresstype != ONION_V3_HOSTNAME) {
|
||||
if (addresstype != ONION_V3_HOSTNAME) {
|
||||
/* Not a hidden-service request. It's either a hostname or an IP,
|
||||
* possibly with a .exit that we stripped off. We're going to check
|
||||
* if we're allowed to connect/resolve there, and then launch the
|
||||
@@ -2579,8 +2514,7 @@ connection_ap_handshake_rewrite_and_attach(entry_connection_t *conn,
|
||||
return 0;
|
||||
} else {
|
||||
/* If we get here, it's a request for a .onion address! */
|
||||
tor_assert(addresstype == ONION_V2_HOSTNAME ||
|
||||
addresstype == ONION_V3_HOSTNAME);
|
||||
tor_assert(addresstype == ONION_V3_HOSTNAME);
|
||||
tor_assert(!automap);
|
||||
return connection_ap_handle_onion(conn, socks, circ, addresstype);
|
||||
}
|
||||
|
||||
@@ -80,7 +80,6 @@ typedef enum hostname_type_t {
|
||||
BAD_HOSTNAME,
|
||||
EXIT_HOSTNAME,
|
||||
NORMAL_HOSTNAME,
|
||||
ONION_V2_HOSTNAME,
|
||||
ONION_V3_HOSTNAME,
|
||||
} hostname_type_t;
|
||||
|
||||
|
||||
@@ -15,10 +15,6 @@
|
||||
* some more effort:
|
||||
*
|
||||
* - circuit_list_path_impl()
|
||||
* - Functions dealing with cpaths in HSv2 create_rend_cpath() and
|
||||
* create_rend_cpath_legacy()
|
||||
* - The cpath related parts of rend_service_receive_introduction() and
|
||||
* rend_client_send_introduction().
|
||||
**/
|
||||
|
||||
#define CRYPT_PATH_PRIVATE
|
||||
|
||||
@@ -37,7 +37,6 @@
|
||||
#include "feature/nodelist/nodelist.h"
|
||||
#include "feature/nodelist/routerinfo.h"
|
||||
#include "feature/nodelist/routerlist.h"
|
||||
#include "feature/rend/rendclient.h"
|
||||
#include "feature/rend/rendcommon.h"
|
||||
#include "feature/rend/rendparse.h"
|
||||
#include "feature/rend/rendservice.h"
|
||||
@@ -1520,9 +1519,7 @@ handle_control_hsfetch(control_connection_t *conn,
|
||||
/* Trigger the fetch using the built rend query and possibly a list of HS
|
||||
* directory to use. This function ignores the client cache thus this will
|
||||
* always send a fetch command. */
|
||||
if (version == HS_VERSION_TWO) {
|
||||
rend_client_fetch_v2_desc(rend_query, hsdirs);
|
||||
} else if (version == HS_VERSION_THREE) {
|
||||
if (version == HS_VERSION_THREE) {
|
||||
hs_control_hsfetch_command(&v3_pk, hsdirs);
|
||||
}
|
||||
|
||||
|
||||
@@ -542,25 +542,14 @@ getinfo_helper_dir(control_connection_t *control_conn,
|
||||
hostname_type_t addr_type;
|
||||
|
||||
question += strlen("hs/client/desc/id/");
|
||||
if (rend_valid_v2_service_id(question)) {
|
||||
addr_type = ONION_V2_HOSTNAME;
|
||||
} else if (hs_address_is_valid(question)) {
|
||||
if (hs_address_is_valid(question)) {
|
||||
addr_type = ONION_V3_HOSTNAME;
|
||||
} else {
|
||||
*errmsg = "Invalid address";
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (addr_type == ONION_V2_HOSTNAME) {
|
||||
rend_cache_entry_t *e = NULL;
|
||||
if (!rend_cache_lookup_entry(question, -1, &e)) {
|
||||
/* Descriptor found in cache */
|
||||
*answer = tor_strdup(e->desc);
|
||||
} else {
|
||||
*errmsg = "Not found in cache";
|
||||
return -1;
|
||||
}
|
||||
} else {
|
||||
if (addr_type == ONION_V3_HOSTNAME) {
|
||||
ed25519_public_key_t service_pk;
|
||||
const char *desc;
|
||||
|
||||
@@ -584,25 +573,14 @@ getinfo_helper_dir(control_connection_t *control_conn,
|
||||
hostname_type_t addr_type;
|
||||
|
||||
question += strlen("hs/service/desc/id/");
|
||||
if (rend_valid_v2_service_id(question)) {
|
||||
addr_type = ONION_V2_HOSTNAME;
|
||||
} else if (hs_address_is_valid(question)) {
|
||||
if (hs_address_is_valid(question)) {
|
||||
addr_type = ONION_V3_HOSTNAME;
|
||||
} else {
|
||||
*errmsg = "Invalid address";
|
||||
return -1;
|
||||
}
|
||||
rend_cache_entry_t *e = NULL;
|
||||
|
||||
if (addr_type == ONION_V2_HOSTNAME) {
|
||||
if (!rend_cache_lookup_v2_desc_as_service(question, &e)) {
|
||||
/* Descriptor found in cache */
|
||||
*answer = tor_strdup(e->desc);
|
||||
} else {
|
||||
*errmsg = "Not found in cache";
|
||||
return -1;
|
||||
}
|
||||
} else {
|
||||
if (addr_type == ONION_V3_HOSTNAME) {
|
||||
ed25519_public_key_t service_pk;
|
||||
char *desc;
|
||||
|
||||
|
||||
@@ -48,7 +48,6 @@
|
||||
#include "feature/relay/routermode.h"
|
||||
#include "feature/relay/selftest.h"
|
||||
#include "feature/rend/rendcache.h"
|
||||
#include "feature/rend/rendclient.h"
|
||||
#include "feature/rend/rendcommon.h"
|
||||
#include "feature/rend/rendservice.h"
|
||||
#include "feature/stats/predict_ports.h"
|
||||
@@ -2861,7 +2860,6 @@ handle_response_fetch_renddesc_v2(dir_connection_t *conn,
|
||||
conn->identity_digest,
|
||||
body);
|
||||
conn->base_.purpose = DIR_PURPOSE_HAS_FETCHED_RENDDESC_V2;
|
||||
rend_client_desc_trynow(service_id);
|
||||
memwipe(service_id, 0, sizeof(service_id));
|
||||
}
|
||||
break;
|
||||
@@ -3024,17 +3022,6 @@ connection_dir_client_refetch_hsdesc_if_needed(dir_connection_t *dir_conn)
|
||||
{
|
||||
connection_t *conn = TO_CONN(dir_conn);
|
||||
|
||||
/* If we were trying to fetch a v2 rend desc and did not succeed, retry as
|
||||
* needed. (If a fetch is successful, the connection state is changed to
|
||||
* DIR_PURPOSE_HAS_FETCHED_RENDDESC_V2 or DIR_PURPOSE_HAS_FETCHED_HSDESC to
|
||||
* mark that refetching is unnecessary.) */
|
||||
if (conn->purpose == DIR_PURPOSE_FETCH_RENDDESC_V2 &&
|
||||
dir_conn->rend_data &&
|
||||
rend_valid_v2_service_id(
|
||||
rend_data_get_address(dir_conn->rend_data))) {
|
||||
rend_client_refetch_v2_renddesc(dir_conn->rend_data);
|
||||
}
|
||||
|
||||
/* Check for v3 rend desc fetch */
|
||||
if (conn->purpose == DIR_PURPOSE_FETCH_HSDESC &&
|
||||
dir_conn->hs_ident &&
|
||||
|
||||
@@ -68,7 +68,6 @@
|
||||
* router_upload_dir_desc_to_dirservers() in router.c
|
||||
* upload_service_descriptor() in rendservice.c
|
||||
* - directory_get_from_dirserver(), called from
|
||||
* rend_client_refetch_renddesc() in rendclient.c
|
||||
* run_scheduled_events() in main.c
|
||||
* do_hup() in main.c
|
||||
* - connection_dir_process_inbuf(), called from
|
||||
|
||||
@@ -29,7 +29,6 @@
|
||||
#include "feature/nodelist/describe.h"
|
||||
#include "feature/nodelist/nodelist.h"
|
||||
#include "feature/rend/rendservice.h"
|
||||
#include "feature/rend/rendclient.h"
|
||||
#include "feature/stats/rephist.h"
|
||||
#include "lib/crypt_ops/crypto_dh.h"
|
||||
#include "lib/crypt_ops/crypto_rand.h"
|
||||
@@ -647,9 +646,7 @@ cleanup_on_free_client_circ(circuit_t *circ)
|
||||
{
|
||||
tor_assert(circ);
|
||||
|
||||
if (circuit_is_hs_v2(circ)) {
|
||||
rend_client_circuit_cleanup_on_free(circ);
|
||||
} else if (circuit_is_hs_v3(circ)) {
|
||||
if (circuit_is_hs_v3(circ)) {
|
||||
hs_client_circuit_cleanup_on_free(circ);
|
||||
}
|
||||
/* It is possible the circuit has an HS purpose but no identifier (rend_data
|
||||
|
||||
@@ -34,7 +34,6 @@
|
||||
#include "feature/nodelist/networkstatus.h"
|
||||
#include "feature/nodelist/nodelist.h"
|
||||
#include "feature/nodelist/routerset.h"
|
||||
#include "feature/rend/rendclient.h"
|
||||
#include "lib/crypt_ops/crypto_format.h"
|
||||
#include "lib/crypt_ops/crypto_rand.h"
|
||||
#include "lib/crypt_ops/crypto_util.h"
|
||||
@@ -1959,9 +1958,6 @@ hs_client_note_connection_attempt_succeeded(const edge_connection_t *conn)
|
||||
if (conn->hs_ident) { /* It's v3: pass it to the prop224 handler */
|
||||
note_connection_attempt_succeeded(conn->hs_ident);
|
||||
return;
|
||||
} else if (conn->rend_data) { /* It's v2: pass it to the legacy handler */
|
||||
rend_client_note_connection_attempt_ended(conn->rend_data);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2087,9 +2083,7 @@ int
|
||||
hs_client_send_introduce1(origin_circuit_t *intro_circ,
|
||||
origin_circuit_t *rend_circ)
|
||||
{
|
||||
return (intro_circ->hs_ident) ? send_introduce1(intro_circ, rend_circ) :
|
||||
rend_client_send_introduction(intro_circ,
|
||||
rend_circ);
|
||||
return send_introduce1(intro_circ, rend_circ);
|
||||
}
|
||||
|
||||
/** Called when the client circuit circ has been established. It can be either
|
||||
@@ -2106,15 +2100,11 @@ hs_client_circuit_has_opened(origin_circuit_t *circ)
|
||||
case CIRCUIT_PURPOSE_C_INTRODUCING:
|
||||
if (circ->hs_ident) {
|
||||
client_intro_circ_has_opened(circ);
|
||||
} else {
|
||||
rend_client_introcirc_has_opened(circ);
|
||||
}
|
||||
break;
|
||||
case CIRCUIT_PURPOSE_C_ESTABLISH_REND:
|
||||
if (circ->hs_ident) {
|
||||
client_rendezvous_circ_has_opened(circ);
|
||||
} else {
|
||||
rend_client_rendcirc_has_opened(circ);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
@@ -2428,9 +2418,7 @@ hs_client_get_random_intro_from_edge(const edge_connection_t *edge_conn)
|
||||
{
|
||||
tor_assert(edge_conn);
|
||||
|
||||
return (edge_conn->hs_ident) ?
|
||||
client_get_random_intro(&edge_conn->hs_ident->identity_pk) :
|
||||
rend_client_get_random_intro(edge_conn->rend_data);
|
||||
return client_get_random_intro(&edge_conn->hs_ident->identity_pk);
|
||||
}
|
||||
|
||||
/** Called when get an INTRODUCE_ACK cell on the introduction circuit circ.
|
||||
@@ -2452,9 +2440,7 @@ hs_client_receive_introduce_ack(origin_circuit_t *circ,
|
||||
goto end;
|
||||
}
|
||||
|
||||
ret = (circ->hs_ident) ? handle_introduce_ack(circ, payload, payload_len) :
|
||||
rend_client_introduction_acked(circ, payload,
|
||||
payload_len);
|
||||
ret = handle_introduce_ack(circ, payload, payload_len);
|
||||
/* For path bias: This circuit was used successfully. NACK or ACK counts. */
|
||||
pathbias_mark_use_success(circ);
|
||||
|
||||
@@ -2488,9 +2474,8 @@ hs_client_receive_rendezvous2(origin_circuit_t *circ,
|
||||
log_info(LD_REND, "Got RENDEZVOUS2 cell from hidden service on circuit %u.",
|
||||
TO_CIRCUIT(circ)->n_circ_id);
|
||||
|
||||
ret = (circ->hs_ident) ? handle_rendezvous2(circ, payload, payload_len) :
|
||||
rend_client_receive_rendezvous(circ, payload,
|
||||
payload_len);
|
||||
ret = handle_rendezvous2(circ, payload, payload_len);
|
||||
|
||||
end:
|
||||
return ret;
|
||||
}
|
||||
@@ -2511,9 +2496,7 @@ hs_client_reextend_intro_circuit(origin_circuit_t *circ)
|
||||
|
||||
tor_assert(circ);
|
||||
|
||||
ei = (circ->hs_ident) ?
|
||||
client_get_random_intro(&circ->hs_ident->identity_pk) :
|
||||
rend_client_get_random_intro(circ->rend_data);
|
||||
ei = client_get_random_intro(&circ->hs_ident->identity_pk);
|
||||
if (ei == NULL) {
|
||||
log_warn(LD_REND, "No usable introduction points left. Closing.");
|
||||
circuit_mark_for_close(TO_CIRCUIT(circ), END_CIRC_REASON_INTERNAL);
|
||||
@@ -2591,9 +2574,6 @@ hs_client_free_all(void)
|
||||
void
|
||||
hs_client_purge_state(void)
|
||||
{
|
||||
/* v2 subsystem. */
|
||||
rend_client_purge_state();
|
||||
|
||||
/* Cancel all descriptor fetches. Do this first so once done we are sure
|
||||
* that our descriptor cache won't modified. */
|
||||
cancel_descriptor_fetches();
|
||||
|
||||
@@ -1559,9 +1559,8 @@ hs_clean_last_hid_serv_requests(time_t now)
|
||||
* <b>req_key_str</b> from the history of times of requests to hidden service
|
||||
* directories.
|
||||
*
|
||||
* This is called from rend_client_note_connection_attempt_ended(), which
|
||||
* must be idempotent, so any future changes to this function must leave it
|
||||
* idempotent too. */
|
||||
* This is called from purge_hid_serv_request(), which must be idempotent, so
|
||||
* any future changes to this function must leave it idempotent too. */
|
||||
void
|
||||
hs_purge_hid_serv_from_last_hid_serv_requests(const char *req_key_str)
|
||||
{
|
||||
|
||||
@@ -28,7 +28,6 @@
|
||||
#include "feature/hs/hs_client.h"
|
||||
#include "feature/hs/hs_ob.h"
|
||||
#include "feature/hs/hs_service.h"
|
||||
#include "feature/rend/rendclient.h"
|
||||
#include "feature/rend/rendservice.h"
|
||||
#include "lib/encoding/confline.h"
|
||||
#include "lib/conf/confdecl.h"
|
||||
@@ -717,11 +716,6 @@ hs_config_client_auth_all(const or_options_t *options, int validate_only)
|
||||
{
|
||||
int ret = -1;
|
||||
|
||||
/* Configure v2 authorization. */
|
||||
if (rend_parse_service_authorization(options, validate_only) < 0) {
|
||||
goto done;
|
||||
}
|
||||
|
||||
/* Configure v3 authorization. */
|
||||
if (hs_config_client_authorization(options, validate_only) < 0) {
|
||||
goto done;
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
# ADD_C_FILE: INSERT SOURCES HERE.
|
||||
LIBTOR_APP_A_SOURCES += \
|
||||
src/feature/rend/rendcache.c \
|
||||
src/feature/rend/rendclient.c \
|
||||
src/feature/rend/rendcommon.c \
|
||||
src/feature/rend/rendmid.c \
|
||||
src/feature/rend/rendparse.c \
|
||||
@@ -15,7 +14,6 @@ noinst_HEADERS += \
|
||||
src/feature/rend/rend_intro_point_st.h \
|
||||
src/feature/rend/rend_service_descriptor_st.h \
|
||||
src/feature/rend/rendcache.h \
|
||||
src/feature/rend/rendclient.h \
|
||||
src/feature/rend/rendcommon.h \
|
||||
src/feature/rend/rendmid.h \
|
||||
src/feature/rend/rendparse.h \
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,54 +0,0 @@
|
||||
/* Copyright (c) 2001 Matej Pfajfar.
|
||||
* Copyright (c) 2001-2004, Roger Dingledine.
|
||||
* Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson.
|
||||
* Copyright (c) 2007-2020, The Tor Project, Inc. */
|
||||
/* See LICENSE for licensing information */
|
||||
|
||||
/**
|
||||
* \file rendclient.h
|
||||
* \brief Header file for rendclient.c.
|
||||
**/
|
||||
|
||||
#ifndef TOR_RENDCLIENT_H
|
||||
#define TOR_RENDCLIENT_H
|
||||
|
||||
#include "feature/hs/hs_circuit.h"
|
||||
#include "feature/rend/rendcache.h"
|
||||
|
||||
void rend_client_purge_state(void);
|
||||
|
||||
void rend_client_introcirc_has_opened(origin_circuit_t *circ);
|
||||
void rend_client_rendcirc_has_opened(origin_circuit_t *circ);
|
||||
int rend_client_introduction_acked(origin_circuit_t *circ,
|
||||
const uint8_t *request,
|
||||
size_t request_len);
|
||||
void rend_client_refetch_v2_renddesc(rend_data_t *rend_query);
|
||||
int rend_client_fetch_v2_desc(rend_data_t *query, smartlist_t *hsdirs);
|
||||
void rend_client_cancel_descriptor_fetches(void);
|
||||
|
||||
int rend_client_report_intro_point_failure(extend_info_t *failed_intro,
|
||||
rend_data_t *rend_data,
|
||||
unsigned int failure_type);
|
||||
|
||||
int rend_client_receive_rendezvous(origin_circuit_t *circ,
|
||||
const uint8_t *request,
|
||||
size_t request_len);
|
||||
void rend_client_desc_trynow(const char *query);
|
||||
|
||||
void rend_client_note_connection_attempt_ended(const rend_data_t *rend_data);
|
||||
|
||||
extend_info_t *rend_client_get_random_intro(const rend_data_t *rend_query);
|
||||
int rend_client_any_intro_points_usable(const rend_cache_entry_t *entry);
|
||||
|
||||
int rend_client_send_introduction(origin_circuit_t *introcirc,
|
||||
origin_circuit_t *rendcirc);
|
||||
int rend_parse_service_authorization(const or_options_t *options,
|
||||
int validate_only);
|
||||
rend_service_authorization_t *rend_client_lookup_service_authorization(
|
||||
const char *onion_address);
|
||||
void rend_service_authorization_free_all(void);
|
||||
|
||||
void rend_client_circuit_cleanup_on_free(const circuit_t *circ);
|
||||
|
||||
#endif /* !defined(TOR_RENDCLIENT_H) */
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
#include "feature/hs/hs_common.h"
|
||||
#include "feature/hs/hs_intropoint.h"
|
||||
#include "feature/nodelist/networkstatus.h"
|
||||
#include "feature/rend/rendclient.h"
|
||||
#include "feature/rend/rendcache.h"
|
||||
#include "feature/rend/rendcommon.h"
|
||||
#include "feature/rend/rendmid.h"
|
||||
#include "feature/rend/rendparse.h"
|
||||
|
||||
@@ -34,7 +34,6 @@
|
||||
#include "feature/nodelist/node_select.h"
|
||||
#include "feature/nodelist/nodelist.h"
|
||||
#include "feature/nodelist/routerset.h"
|
||||
#include "feature/rend/rendclient.h"
|
||||
#include "feature/rend/rendcommon.h"
|
||||
#include "feature/rend/rendparse.h"
|
||||
#include "feature/rend/rendservice.h"
|
||||
|
||||
@@ -41,7 +41,6 @@
|
||||
#include "feature/nodelist/networkstatus.h"
|
||||
#include "feature/nodelist/nodelist.h"
|
||||
#include "core/or/policies.h"
|
||||
#include "feature/rend/rendclient.h"
|
||||
#include "feature/rend/rendservice.h"
|
||||
#include "feature/relay/relay_find_addr.h"
|
||||
#include "feature/relay/router.h"
|
||||
|
||||
@@ -728,46 +728,6 @@ test_entryconn_rewrite_mapaddress_automap_onion4(void *arg)
|
||||
test_entryconn_rewrite_mapaddress_automap_onion_common(arg, 0, 1);
|
||||
}
|
||||
|
||||
/** Test that rewrite functions can handle v2 addresses */
|
||||
static void
|
||||
test_entryconn_rewrite_onion_v2(void *arg)
|
||||
{
|
||||
int retval;
|
||||
entry_connection_t *conn = arg;
|
||||
|
||||
(void) arg;
|
||||
|
||||
rend_cache_init();
|
||||
|
||||
/* Make a SOCKS request */
|
||||
conn->socks_request->command = SOCKS_COMMAND_CONNECT;
|
||||
strlcpy(conn->socks_request->address,
|
||||
"pqeed46efnwmfuid.onion",
|
||||
sizeof(conn->socks_request->address));
|
||||
|
||||
/* Make an onion connection using the SOCKS request */
|
||||
conn->entry_cfg.onion_traffic = 1;
|
||||
ENTRY_TO_CONN(conn)->state = AP_CONN_STATE_SOCKS_WAIT;
|
||||
tt_assert(!ENTRY_TO_EDGE_CONN(conn)->rend_data);
|
||||
|
||||
/* Handle SOCKS and rewrite! */
|
||||
retval = connection_ap_handshake_rewrite_and_attach(conn, NULL, NULL);
|
||||
tt_int_op(retval, OP_EQ, 0);
|
||||
|
||||
/* Check connection state after rewrite */
|
||||
tt_int_op(ENTRY_TO_CONN(conn)->state, OP_EQ, AP_CONN_STATE_RENDDESC_WAIT);
|
||||
/* check that the address got rewritten */
|
||||
tt_str_op(conn->socks_request->address, OP_EQ,
|
||||
"pqeed46efnwmfuid");
|
||||
/* check that HS information got attached to the connection */
|
||||
tt_assert(ENTRY_TO_EDGE_CONN(conn)->rend_data);
|
||||
tt_assert(!ENTRY_TO_EDGE_CONN(conn)->hs_ident);
|
||||
|
||||
done:
|
||||
rend_cache_free_all();
|
||||
/* 'conn' is cleaned by handler */
|
||||
}
|
||||
|
||||
/** Test that rewrite functions can handle v3 onion addresses */
|
||||
static void
|
||||
test_entryconn_rewrite_onion_v3(void *arg)
|
||||
@@ -830,7 +790,6 @@ struct testcase_t entryconn_tests[] = {
|
||||
REWRITE(rewrite_mapaddress_automap_onion2),
|
||||
REWRITE(rewrite_mapaddress_automap_onion3),
|
||||
REWRITE(rewrite_mapaddress_automap_onion4),
|
||||
REWRITE(rewrite_onion_v2),
|
||||
REWRITE(rewrite_onion_v3),
|
||||
|
||||
END_OF_TESTCASES
|
||||
|
||||
@@ -787,11 +787,8 @@ test_parse_extended_hostname(void *arg)
|
||||
hostname_type_t type;
|
||||
|
||||
char address1[] = "fooaddress.onion";
|
||||
char address2[] = "aaaaaaaaaaaaaaaa.onion";
|
||||
char address3[] = "fooaddress.exit";
|
||||
char address4[] = "www.torproject.org";
|
||||
char address5[] = "foo.abcdefghijklmnop.onion";
|
||||
char address6[] = "foo.bar.abcdefghijklmnop.onion";
|
||||
char address7[] = ".abcdefghijklmnop.onion";
|
||||
char address8[] =
|
||||
"www.25njqamcweflpvkl73j4szahhihoc4xt3ktcgjnpaingr5yhkenl5sid.onion";
|
||||
@@ -803,24 +800,12 @@ test_parse_extended_hostname(void *arg)
|
||||
tt_assert(!parse_extended_hostname(address1, &type));
|
||||
tt_int_op(type, OP_EQ, BAD_HOSTNAME);
|
||||
|
||||
tt_assert(parse_extended_hostname(address2, &type));
|
||||
tt_int_op(type, OP_EQ, ONION_V2_HOSTNAME);
|
||||
tt_str_op(address2, OP_EQ, "aaaaaaaaaaaaaaaa");
|
||||
|
||||
tt_assert(parse_extended_hostname(address3, &type));
|
||||
tt_int_op(type, OP_EQ, EXIT_HOSTNAME);
|
||||
|
||||
tt_assert(parse_extended_hostname(address4, &type));
|
||||
tt_int_op(type, OP_EQ, NORMAL_HOSTNAME);
|
||||
|
||||
tt_assert(parse_extended_hostname(address5, &type));
|
||||
tt_int_op(type, OP_EQ, ONION_V2_HOSTNAME);
|
||||
tt_str_op(address5, OP_EQ, "abcdefghijklmnop");
|
||||
|
||||
tt_assert(parse_extended_hostname(address6, &type));
|
||||
tt_int_op(type, OP_EQ, ONION_V2_HOSTNAME);
|
||||
tt_str_op(address6, OP_EQ, "abcdefghijklmnop");
|
||||
|
||||
tt_assert(!parse_extended_hostname(address7, &type));
|
||||
tt_int_op(type, OP_EQ, BAD_HOSTNAME);
|
||||
|
||||
|
||||
@@ -2389,14 +2389,6 @@ test_options_validate__rend(void *ignored)
|
||||
"Failed to configure rendezvous options. See logs for details.");
|
||||
tor_free(msg);
|
||||
|
||||
free_options_test_data(tdata);
|
||||
tdata = get_options_test_data("HidServAuth failed\n");
|
||||
ret = options_validate(NULL, tdata->opt, &msg);
|
||||
tt_int_op(ret, OP_EQ, -1);
|
||||
tt_str_op(msg, OP_EQ, "Failed to configure client authorization for hidden "
|
||||
"services. See logs for details.");
|
||||
tor_free(msg);
|
||||
|
||||
done:
|
||||
policies_free_all();
|
||||
teardown_capture_of_logs();
|
||||
|
||||
Reference in New Issue
Block a user