]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
hs-v3: Silence some logging for client authorization
authorDavid Goulet <dgoulet@torproject.org>
Mon, 10 Sep 2018 19:04:22 +0000 (15:04 -0400)
committerDavid Goulet <dgoulet@torproject.org>
Mon, 24 Sep 2018 16:49:00 +0000 (12:49 -0400)
If a tor client gets a descriptor that it can't decrypt, chances are that the
onion requires client authorization.

If a tor client is configured with client authorization for an onion but
decryption fails, it means that the configured keys aren't working anymore.

In both cases, we'll log notice the former and log warn the latter and the
rest of the decryption errors are now at info level.

Two logs statement have been removed because it was redundant and printing the
fetched descriptor in the logs when 80% of it is encrypted wat not helping.

Fixes #27550

Signed-off-by: David Goulet <dgoulet@torproject.org>
changes/ticket27550 [new file with mode: 0644]
src/or/directory.c
src/or/hs_client.c
src/or/hs_descriptor.c

diff --git a/changes/ticket27550 b/changes/ticket27550
new file mode 100644 (file)
index 0000000..87f9b5c
--- /dev/null
@@ -0,0 +1,5 @@
+  o Minor bugfixes (hidden service v3):
+    - Don't warn so loudly when tor is unable to decode a descriptor. This can
+      now happen as a normal use case if a client gets a descriptor with
+      client authorization but the client is not authorized. Fixes bug 27550;
+      bugfix on 0.3.5.1-alpha.
index 8636f68410fe21d81535be529341c925c092ca12..ddb86cd9a42a0f35c48168de244fd3d15d2141a0 100644 (file)
@@ -3091,7 +3091,7 @@ handle_response_fetch_hsdesc_v3(dir_connection_t *conn,
   case 200:
     /* We got something: Try storing it in the cache. */
     if (hs_cache_store_as_client(body, &conn->hs_ident->identity_pk) < 0) {
-      log_warn(LD_REND, "Failed to store hidden service descriptor");
+      log_info(LD_REND, "Failed to store hidden service descriptor");
       /* Fire control port FAILED event. */
       hs_control_desc_event_failed(conn->hs_ident, conn->identity_digest,
                                    "BAD_DESC");
index 636226a1d50d50efdf00ae5e422056623ee59558..1d1bdda8cd95911eba638e10b91325f2435ab7d5 100644 (file)
@@ -1225,10 +1225,6 @@ hs_client_decode_descriptor(const char *desc_str,
   ret = hs_desc_decode_descriptor(desc_str, subcredential, desc);
   memwipe(subcredential, 0, sizeof(subcredential));
   if (ret < 0) {
-    log_warn(LD_GENERAL, "Could not parse received descriptor as client.");
-    if (get_options()->SafeLogging_ == SAFELOG_SCRUB_NONE) {
-      log_warn(LD_GENERAL, "%s", escaped(desc_str));
-    }
     goto err;
   }
 
index 0298c373224cf0c7532a974af7234f5e77956265..32278ec9f296d8963ff04fac40b6b6fa7b6113e7 100644 (file)
@@ -1361,7 +1361,7 @@ decrypt_desc_layer,(const hs_descriptor_t *desc,
    * This is a critical check that is making sure the computed MAC matches the
    * one in the descriptor. */
   if (!tor_memeq(our_mac, desc_mac, sizeof(our_mac))) {
-    log_warn(LD_REND, "Encrypted service descriptor MAC check failed");
+    log_info(LD_REND, "Encrypted service descriptor MAC check failed");
     goto err;
   }
 
@@ -1544,7 +1544,6 @@ desc_decrypt_all(const hs_descriptor_t *desc, char **decrypted_out)
                                         superencrypted_len,
                                         &encrypted_blob);
   if (!encrypted_len) {
-    log_warn(LD_REND, "Decrypting encrypted desc failed.");
     goto err;
   }
   tor_assert(encrypted_blob);
@@ -2046,7 +2045,11 @@ desc_decode_encrypted_v3(const hs_descriptor_t *desc,
    * in the descriptor as a blob of bytes. */
   message_len = desc_decrypt_all(desc, &message);
   if (!message_len) {
-    log_warn(LD_REND, "Service descriptor decryption failed.");
+    /* Inform at notice level that the onion address requested can't be
+     * reached without client authorization most likely. */
+    log_notice(LD_REND, "Fail to decrypt descriptor for requested onion "
+                        "address. It is likely requiring client "
+                        "authorization.");
     goto err;
   }
   tor_assert(message);