|
@@ -155,13 +155,13 @@ parse_port_config(const char *string)
|
|
|
sl = smartlist_create();
|
|
|
smartlist_split_string(sl, string, " ", SPLIT_SKIP_SPACE|SPLIT_IGNORE_BLANK, 0);
|
|
|
if (smartlist_len(sl) < 1 || smartlist_len(sl) > 2) {
|
|
|
- log_fn(LOG_WARN, "Bad syntax in hidden service port configuration");
|
|
|
+ log_fn(LOG_WARN, "Bad syntax in hidden service port configuration.");
|
|
|
goto err;
|
|
|
}
|
|
|
|
|
|
virtport = atoi(smartlist_get(sl,0));
|
|
|
if (virtport < 1 || virtport > 65535) {
|
|
|
- log_fn(LOG_WARN, "Missing or invalid port in hidden service port configuration");
|
|
|
+ log_fn(LOG_WARN, "Missing or invalid port in hidden service port configuration.");
|
|
|
goto err;
|
|
|
}
|
|
|
|
|
@@ -173,7 +173,7 @@ parse_port_config(const char *string)
|
|
|
addrport = smartlist_get(sl,1);
|
|
|
if (strchr(addrport, ':') || strchr(addrport, '.')) {
|
|
|
if (parse_addr_port(addrport, NULL, &addr, &p)<0) {
|
|
|
- log_fn(LOG_WARN,"Unparseable address in hidden service port configuration");
|
|
|
+ log_fn(LOG_WARN,"Unparseable address in hidden service port configuration.");
|
|
|
goto err;
|
|
|
}
|
|
|
realport = p?p:virtport;
|
|
@@ -229,7 +229,7 @@ rend_config_services(or_options_t *options, int validate_only)
|
|
|
continue;
|
|
|
}
|
|
|
if (!service) {
|
|
|
- log_fn(LOG_WARN, "HiddenServicePort with no preceding HiddenServiceDir directive");
|
|
|
+ log_fn(LOG_WARN, "HiddenServicePort with no preceding HiddenServiceDir directive.");
|
|
|
rend_service_free(service);
|
|
|
return -1;
|
|
|
}
|
|
@@ -242,14 +242,14 @@ rend_config_services(or_options_t *options, int validate_only)
|
|
|
smartlist_add(service->ports, portcfg);
|
|
|
} else if (!strcasecmp(line->key, "HiddenServiceNodes")) {
|
|
|
if (service->intro_prefer_nodes) {
|
|
|
- log_fn(LOG_WARN, "Got multiple HiddenServiceNodes lines for a single service");
|
|
|
+ log_fn(LOG_WARN, "Got multiple HiddenServiceNodes lines for a single service.");
|
|
|
return -1;
|
|
|
}
|
|
|
service->intro_prefer_nodes = tor_strdup(line->value);
|
|
|
} else {
|
|
|
tor_assert(!strcasecmp(line->key, "HiddenServiceExcludeNodes"));
|
|
|
if (service->intro_exclude_nodes) {
|
|
|
- log_fn(LOG_WARN, "Got multiple HiddenServiceExcludedNodes lines for a single service");
|
|
|
+ log_fn(LOG_WARN, "Got multiple HiddenServiceExcludedNodes lines for a single service.");
|
|
|
return -1;
|
|
|
}
|
|
|
service->intro_exclude_nodes = tor_strdup(line->value);
|
|
@@ -292,7 +292,7 @@ rend_service_update_descriptor(rend_service_t *service)
|
|
|
for (i=0; i < n; ++i) {
|
|
|
router = router_get_by_nickname(smartlist_get(service->intro_nodes, i));
|
|
|
if (!router) {
|
|
|
- log_fn(LOG_WARN,"Router '%s' not found. Skipping.",
|
|
|
+ log_fn(LOG_INFO,"Router '%s' not found. Skipping.",
|
|
|
(char*)smartlist_get(service->intro_nodes, i));
|
|
|
continue;
|
|
|
}
|
|
@@ -331,7 +331,7 @@ rend_service_load_keys(void)
|
|
|
/* Load key */
|
|
|
if (strlcpy(fname,s->directory,sizeof(fname)) >= sizeof(fname) ||
|
|
|
strlcat(fname,"/private_key",sizeof(fname)) >= sizeof(fname)) {
|
|
|
- log_fn(LOG_WARN, "Directory name too long: \"%s\"", s->directory);
|
|
|
+ log_fn(LOG_WARN, "Directory name too long: \"%s\".", s->directory);
|
|
|
return -1;
|
|
|
}
|
|
|
s->private_key = init_key_from_file(fname);
|
|
@@ -340,16 +340,16 @@ rend_service_load_keys(void)
|
|
|
|
|
|
/* Create service file */
|
|
|
if (rend_get_service_id(s->private_key, s->service_id)<0) {
|
|
|
- log_fn(LOG_WARN, "Couldn't encode service ID");
|
|
|
+ log_fn(LOG_WARN, "Internal error: couldn't encode service ID.");
|
|
|
return -1;
|
|
|
}
|
|
|
if (crypto_pk_get_digest(s->private_key, s->pk_digest)<0) {
|
|
|
- log_fn(LOG_WARN, "Couldn't compute hash of public key");
|
|
|
+ log_fn(LOG_WARN, "Couldn't compute hash of public key.");
|
|
|
return -1;
|
|
|
}
|
|
|
if (strlcpy(fname,s->directory,sizeof(fname)) >= sizeof(fname) ||
|
|
|
strlcat(fname,"/hostname",sizeof(fname)) >= sizeof(fname)) {
|
|
|
- log_fn(LOG_WARN, "Directory name too long: \"%s\"", s->directory);
|
|
|
+ log_fn(LOG_WARN, "Directory name too long: \"%s\".", s->directory);
|
|
|
return -1;
|
|
|
}
|
|
|
tor_snprintf(buf, sizeof(buf),"%s.onion\n", s->service_id);
|
|
@@ -412,11 +412,11 @@ rend_service_introduce(circuit_t *circuit, const char *request, size_t request_l
|
|
|
|
|
|
base32_encode(serviceid, REND_SERVICE_ID_LEN+1,
|
|
|
circuit->rend_pk_digest,10);
|
|
|
- log_fn(LOG_INFO, "Received INTRODUCE2 cell for service %s on circ %d",
|
|
|
+ log_fn(LOG_INFO, "Received INTRODUCE2 cell for service %s on circ %d.",
|
|
|
serviceid, circuit->n_circ_id);
|
|
|
|
|
|
if (circuit->purpose != CIRCUIT_PURPOSE_S_INTRO) {
|
|
|
- log_fn(LOG_WARN, "Got an INTRODUCE2 over a non-introduction circuit %d",
|
|
|
+ log_fn(LOG_WARN, "Got an INTRODUCE2 over a non-introduction circuit %d.",
|
|
|
circuit->n_circ_id);
|
|
|
return -1;
|
|
|
}
|
|
@@ -424,7 +424,7 @@ rend_service_introduce(circuit_t *circuit, const char *request, size_t request_l
|
|
|
/* min key length plus digest length plus nickname length */
|
|
|
if (request_len < DIGEST_LEN+REND_COOKIE_LEN+(MAX_NICKNAME_LEN+1)+
|
|
|
DH_KEY_LEN+42) {
|
|
|
- log_fn(LOG_WARN, "Got a truncated INTRODUCE2 cell on circ %d",
|
|
|
+ log_fn(LOG_WARN, "Got a truncated INTRODUCE2 cell on circ %d.",
|
|
|
circuit->n_circ_id);
|
|
|
return -1;
|
|
|
}
|
|
@@ -432,20 +432,20 @@ rend_service_introduce(circuit_t *circuit, const char *request, size_t request_l
|
|
|
/* first DIGEST_LEN bytes of request is service pk digest */
|
|
|
service = rend_service_get_by_pk_digest(request);
|
|
|
if (!service) {
|
|
|
- log_fn(LOG_WARN, "Got an INTRODUCE2 cell for an unrecognized service %s",
|
|
|
+ log_fn(LOG_WARN, "Got an INTRODUCE2 cell for an unrecognized service %s.",
|
|
|
serviceid);
|
|
|
return -1;
|
|
|
}
|
|
|
if (memcmp(circuit->rend_pk_digest, request, DIGEST_LEN)) {
|
|
|
base32_encode(serviceid, REND_SERVICE_ID_LEN+1, request, 10);
|
|
|
- log_fn(LOG_WARN, "Got an INTRODUCE2 cell for the wrong service (%s)",
|
|
|
+ log_fn(LOG_WARN, "Got an INTRODUCE2 cell for the wrong service (%s).",
|
|
|
serviceid);
|
|
|
return -1;
|
|
|
}
|
|
|
|
|
|
keylen = crypto_pk_keysize(service->private_key);
|
|
|
if (request_len < keylen+DIGEST_LEN) {
|
|
|
- log_fn(LOG_WARN, "PK-encrypted portion of INTRODUCE2 cell was truncated");
|
|
|
+ log_fn(LOG_WARN, "PK-encrypted portion of INTRODUCE2 cell was truncated.");
|
|
|
return -1;
|
|
|
}
|
|
|
/* Next N bytes is encrypted with service key */
|
|
@@ -453,7 +453,7 @@ rend_service_introduce(circuit_t *circuit, const char *request, size_t request_l
|
|
|
service->private_key,buf,request+DIGEST_LEN,request_len-DIGEST_LEN,
|
|
|
PK_PKCS1_OAEP_PADDING,1);
|
|
|
if (r<0) {
|
|
|
- log_fn(LOG_WARN, "Couldn't decrypt INTRODUCE2 cell");
|
|
|
+ log_fn(LOG_WARN, "Couldn't decrypt INTRODUCE2 cell.");
|
|
|
return -1;
|
|
|
}
|
|
|
len = r;
|
|
@@ -497,7 +497,7 @@ rend_service_introduce(circuit_t *circuit, const char *request, size_t request_l
|
|
|
/* XXX when 0.1.0.x is obsolete, change this to reject version < 2. */
|
|
|
ptr=memchr(rp_nickname,0,nickname_field_len);
|
|
|
if (!ptr || ptr == rp_nickname) {
|
|
|
- log_fn(LOG_WARN, "Couldn't find a null-padded nickname in INTRODUCE2 cell");
|
|
|
+ log_fn(LOG_WARN, "Couldn't find a null-padded nickname in INTRODUCE2 cell.");
|
|
|
return -1;
|
|
|
}
|
|
|
if ((version == 0 && !is_legal_nickname(rp_nickname)) ||
|
|
@@ -511,7 +511,7 @@ rend_service_introduce(circuit_t *circuit, const char *request, size_t request_l
|
|
|
len -= rp_nickname - buf; /* also remove header space used by version, if any */
|
|
|
router = router_get_by_nickname(rp_nickname);
|
|
|
if (!router) {
|
|
|
- log_fn(LOG_WARN, "Couldn't found router '%s' named in rendezvous cell.",
|
|
|
+ log_fn(LOG_INFO, "Couldn't find router '%s' named in rendezvous cell.",
|
|
|
rp_nickname);
|
|
|
goto err;
|
|
|
}
|
|
@@ -530,12 +530,12 @@ rend_service_introduce(circuit_t *circuit, const char *request, size_t request_l
|
|
|
/* Try DH handshake... */
|
|
|
dh = crypto_dh_new();
|
|
|
if (!dh || crypto_dh_generate_public(dh)<0) {
|
|
|
- log_fn(LOG_WARN, "Couldn't build DH state or generate public key");
|
|
|
+ log_fn(LOG_WARN, "Internal error: couldn't build DH state or generate public key.");
|
|
|
goto err;
|
|
|
}
|
|
|
if (crypto_dh_compute_secret(dh, ptr+REND_COOKIE_LEN, DH_KEY_LEN, keys,
|
|
|
DIGEST_LEN+CPATH_KEY_MATERIAL_LEN)<0) {
|
|
|
- log_fn(LOG_WARN, "Couldn't complete DH handshake");
|
|
|
+ log_fn(LOG_WARN, "Internal error: couldn't complete DH handshake");
|
|
|
goto err;
|
|
|
}
|
|
|
|
|
@@ -554,12 +554,12 @@ rend_service_introduce(circuit_t *circuit, const char *request, size_t request_l
|
|
|
break;
|
|
|
}
|
|
|
if (!launched) { /* give up */
|
|
|
- log_fn(LOG_WARN,"Giving up launching first hop of circuit to rendezvous point '%s' for service %s",
|
|
|
+ log_fn(LOG_WARN,"Giving up launching first hop of circuit to rendezvous point '%s' for service %s.",
|
|
|
extend_info->nickname, serviceid);
|
|
|
goto err;
|
|
|
}
|
|
|
log_fn(LOG_INFO,
|
|
|
- "Accepted intro; launching circuit to '%s' (cookie %s) for service %s",
|
|
|
+ "Accepted intro; launching circuit to '%s' (cookie %s) for service %s.",
|
|
|
extend_info->nickname, hexcookie, serviceid);
|
|
|
tor_assert(launched->build_state);
|
|
|
/* Fill in the circuit's state. */
|
|
@@ -622,7 +622,7 @@ rend_service_relaunch_rendezvous(circuit_t *oldcirc)
|
|
|
newcirc = circuit_launch_by_extend_info(CIRCUIT_PURPOSE_S_CONNECT_REND,
|
|
|
oldstate->chosen_exit, 0, 1, 1);
|
|
|
if (!newcirc) {
|
|
|
- log_fn(LOG_WARN,"Couldn't relaunch rendezvous circuit to %s",
|
|
|
+ log_fn(LOG_WARN,"Couldn't relaunch rendezvous circuit to %s.",
|
|
|
oldstate->chosen_exit->nickname);
|
|
|
return;
|
|
|
}
|
|
@@ -654,7 +654,7 @@ rend_service_launch_establish_intro(rend_service_t *service, const char *nicknam
|
|
|
++service->n_intro_circuits_launched;
|
|
|
launched = circuit_launch_by_nickname(CIRCUIT_PURPOSE_S_ESTABLISH_INTRO, nickname, 1, 0, 1);
|
|
|
if (!launched) {
|
|
|
- log_fn(LOG_WARN, "Can't launch circuit to establish introduction at '%s'",
|
|
|
+ log_fn(LOG_INFO, "Can't launch circuit to establish introduction at '%s'.",
|
|
|
nickname);
|
|
|
return -1;
|
|
|
}
|
|
@@ -689,7 +689,7 @@ rend_service_intro_has_opened(circuit_t *circuit)
|
|
|
|
|
|
service = rend_service_get_by_pk_digest(circuit->rend_pk_digest);
|
|
|
if (!service) {
|
|
|
- log_fn(LOG_WARN, "Unrecognized service ID %s on introduction circuit %d",
|
|
|
+ log_fn(LOG_WARN, "Unrecognized service ID %s on introduction circuit %d.",
|
|
|
serviceid, circuit->n_circ_id);
|
|
|
goto err;
|
|
|
}
|
|
@@ -710,14 +710,14 @@ rend_service_intro_has_opened(circuit_t *circuit)
|
|
|
len += 20;
|
|
|
r = crypto_pk_private_sign_digest(service->private_key, buf+len, buf, len);
|
|
|
if (r<0) {
|
|
|
- log_fn(LOG_WARN, "Couldn't sign introduction request");
|
|
|
+ log_fn(LOG_WARN, "Internal error: couldn't sign introduction request.");
|
|
|
goto err;
|
|
|
}
|
|
|
len += r;
|
|
|
|
|
|
if (connection_edge_send_command(NULL, circuit,RELAY_COMMAND_ESTABLISH_INTRO,
|
|
|
buf, len, circuit->cpath->prev)<0) {
|
|
|
- log_fn(LOG_WARN,
|
|
|
+ log_fn(LOG_INFO,
|
|
|
"Couldn't send introduction request for service %s on circuit %d",
|
|
|
serviceid, circuit->n_circ_id);
|
|
|
goto err;
|
|
@@ -737,12 +737,12 @@ rend_service_intro_established(circuit_t *circuit, const char *request, size_t r
|
|
|
rend_service_t *service;
|
|
|
|
|
|
if (circuit->purpose != CIRCUIT_PURPOSE_S_ESTABLISH_INTRO) {
|
|
|
- log_fn(LOG_WARN, "received INTRO_ESTABLISHED cell on non-intro circuit");
|
|
|
+ log_fn(LOG_WARN, "received INTRO_ESTABLISHED cell on non-intro circuit.");
|
|
|
goto err;
|
|
|
}
|
|
|
service = rend_service_get_by_pk_digest(circuit->rend_pk_digest);
|
|
|
if (!service) {
|
|
|
- log_fn(LOG_WARN, "Unknown service on introduction circuit %d",
|
|
|
+ log_fn(LOG_WARN, "Unknown service on introduction circuit %d.",
|
|
|
circuit->n_circ_id);
|
|
|
goto err;
|
|
|
}
|
|
@@ -783,7 +783,7 @@ rend_service_rendezvous_has_opened(circuit_t *circuit)
|
|
|
|
|
|
service = rend_service_get_by_pk_digest(circuit->rend_pk_digest);
|
|
|
if (!service) {
|
|
|
- log_fn(LOG_WARN, "Internal error: unrecognized service ID on introduction circuit");
|
|
|
+ log_fn(LOG_WARN, "Internal error: unrecognized service ID on introduction circuit.");
|
|
|
goto err;
|
|
|
}
|
|
|
|
|
@@ -791,7 +791,7 @@ rend_service_rendezvous_has_opened(circuit_t *circuit)
|
|
|
memcpy(buf, circuit->rend_cookie, REND_COOKIE_LEN);
|
|
|
if (crypto_dh_get_public(hop->dh_handshake_state,
|
|
|
buf+REND_COOKIE_LEN, DH_KEY_LEN)<0) {
|
|
|
- log_fn(LOG_WARN,"Couldn't get DH public key");
|
|
|
+ log_fn(LOG_WARN,"Couldn't get DH public key.");
|
|
|
goto err;
|
|
|
}
|
|
|
memcpy(buf+REND_COOKIE_LEN+DH_KEY_LEN, hop->handshake_digest,
|
|
@@ -801,7 +801,7 @@ rend_service_rendezvous_has_opened(circuit_t *circuit)
|
|
|
if (connection_edge_send_command(NULL, circuit, RELAY_COMMAND_RENDEZVOUS1,
|
|
|
buf, REND_COOKIE_LEN+DH_KEY_LEN+DIGEST_LEN,
|
|
|
circuit->cpath->prev)<0) {
|
|
|
- log_fn(LOG_WARN, "Couldn't send RENDEZVOUS1 cell");
|
|
|
+ log_fn(LOG_WARN, "Couldn't send RENDEZVOUS1 cell.");
|
|
|
goto err;
|
|
|
}
|
|
|
|
|
@@ -877,7 +877,7 @@ upload_service_descriptor(rend_service_t *service, int version)
|
|
|
version,
|
|
|
service->private_key,
|
|
|
&desc, &desc_len)<0) {
|
|
|
- log_fn(LOG_WARN, "Couldn't encode service descriptor; not uploading");
|
|
|
+ log_fn(LOG_WARN, "Internal error: couldn't encode service descriptor; not uploading.");
|
|
|
return;
|
|
|
}
|
|
|
|
|
@@ -964,7 +964,7 @@ rend_services_introduce(void)
|
|
|
service->intro_exclude_nodes, exclude_routers, 1, 0,
|
|
|
get_options()->_AllowUnverified & ALLOW_UNVERIFIED_INTRODUCTION, 0);
|
|
|
if (!router) {
|
|
|
- log_fn(LOG_WARN, "Could only establish %d introduction points for %s",
|
|
|
+ log_fn(LOG_WARN, "Could only establish %d introduction points for %s.",
|
|
|
smartlist_len(service->intro_nodes), service->service_id);
|
|
|
break;
|
|
|
}
|
|
@@ -989,7 +989,7 @@ rend_services_introduce(void)
|
|
|
intro = smartlist_get(service->intro_nodes, j);
|
|
|
r = rend_service_launch_establish_intro(service, intro);
|
|
|
if (r<0) {
|
|
|
- log_fn(LOG_WARN, "Error launching circuit to node %s for service %s",
|
|
|
+ log_fn(LOG_WARN, "Error launching circuit to node %s for service %s.",
|
|
|
intro, service->service_id);
|
|
|
}
|
|
|
}
|
|
@@ -1084,7 +1084,7 @@ rend_service_set_connection_addr_port(connection_t *conn, circuit_t *circ)
|
|
|
circ->rend_pk_digest,10);
|
|
|
service = rend_service_get_by_pk_digest(circ->rend_pk_digest);
|
|
|
if (!service) {
|
|
|
- log_fn(LOG_WARN, "Couldn't find any service associated with pk %s on rendezvous circuit %d; closing",
|
|
|
+ log_fn(LOG_WARN, "Couldn't find any service associated with pk %s on rendezvous circuit %d; closing.",
|
|
|
serviceid, circ->n_circ_id);
|
|
|
return -1;
|
|
|
}
|