]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
Add a rate-limit to our warning about the disabled .exit notation
authorNick Mathewson <nickm@torproject.org>
Wed, 18 Sep 2019 19:38:33 +0000 (15:38 -0400)
committerNick Mathewson <nickm@torproject.org>
Wed, 18 Sep 2019 19:38:33 +0000 (15:38 -0400)
This warning would previously be given every time we tried to open a
connection to a foo.exit address, which could potentially be used to
flood the logs.  Now, we don't allow this warning to appear more
than once every 15 minutes.

Fixes bug 31466; bugfix on 0.2.2.1-alpha, when .exit was first
deprecated.

changes/ticket31466 [new file with mode: 0644]
src/or/connection_edge.c

diff --git a/changes/ticket31466 b/changes/ticket31466
new file mode 100644 (file)
index 0000000..e535b45
--- /dev/null
@@ -0,0 +1,5 @@
+  o Minor bugfixes (logging):
+    - Rate-limit our the logging message about the obsolete .exit notation.
+      Previously, there was no limit on this warning, which could potentially
+      be triggered many times by a hostile website. Fixes bug 31466;
+      bugfix on 0.2.2.1-alpha.
index 7a97c632d171e5c2817bfbc790e860e56d3369ac..5638d9a1be1582569dd5ffe159fed0af5a8a42d2 100644 (file)
@@ -1186,9 +1186,11 @@ connection_ap_handshake_rewrite(entry_connection_t *conn,
    * disallowed when they're coming straight from the client, but you're
    * allowed to have them in MapAddress commands and so forth. */
   if (!strcmpend(socks->address, ".exit") && !options->AllowDotExit) {
-    log_warn(LD_APP, "The  \".exit\" notation is disabled in Tor due to "
-             "security risks. Set AllowDotExit in your torrc to enable "
-             "it (at your own risk).");
+    static ratelim_t exit_warning_limit = RATELIM_INIT(60*15);
+    log_fn_ratelim(&exit_warning_limit, LOG_WARN, LD_APP,
+                   "The  \".exit\" notation is disabled in Tor due to "
+                   "security risks.  Set AllowDotExit in your torrc to enable "
+                   "it (at your own risk).");
     control_event_client_status(LOG_WARN, "SOCKS_BAD_HOSTNAME HOSTNAME=%s",
                                 escaped(socks->address));
     out->end_reason = END_STREAM_REASON_TORPROTOCOL;