Browse Source

Merge branch 'remove_allow_dotexit_v2'

Nick Mathewson 6 years ago
parent
commit
37302e64a4
6 changed files with 22 additions and 61 deletions
  1. 4 0
      changes/bug23426
  2. 1 7
      doc/tor.1.txt
  3. 1 6
      src/or/config.c
  4. 10 11
      src/or/connection_edge.c
  5. 0 7
      src/or/or.h
  6. 6 30
      src/test/test_entryconn.c

+ 4 - 0
changes/bug23426

@@ -0,0 +1,4 @@
+  o Removed features:
+    - The AllowDotExit option has been removed as unsafe.  It has
+      been deprecated since 0.2.9.2-alpha.  Closes ticket 23426.
+

+ 1 - 7
doc/tor.1.txt

@@ -954,7 +954,7 @@ The following options are useful only for clients (that is, if
     The ExcludeNodes option overrides this option: any node listed in both
     The ExcludeNodes option overrides this option: any node listed in both
     ExitNodes and ExcludeNodes is treated as excluded. +
     ExitNodes and ExcludeNodes is treated as excluded. +
  +
  +
-    The .exit address notation, if enabled via AllowDotExit, overrides
+    The .exit address notation, if enabled via MapAddress, overrides
     this option.
     this option.
 
 
 [[EntryNodes]] **EntryNodes** __node__,__node__,__...__::
 [[EntryNodes]] **EntryNodes** __node__,__node__,__...__::
@@ -1358,12 +1358,6 @@ The following options are useful only for clients (that is, if
     resolved. This helps trap accidental attempts to resolve URLs and so on.
     resolved. This helps trap accidental attempts to resolve URLs and so on.
     (Default: 0)
     (Default: 0)
 
 
-[[AllowDotExit]] **AllowDotExit** **0**|**1**::
-    If enabled, we convert "www.google.com.foo.exit" addresses on the
-    SocksPort/TransPort/NATDPort into "www.google.com" addresses that exit from
-    the node "foo". Disabled by default since attacking websites and exit
-    relays can use it to manipulate your path selection. (Default: 0)
-
 [[HTTPTunnelPort]] **HTTPTunnelPort**  \['address':]__port__|**auto** [_isolation flags_]::
 [[HTTPTunnelPort]] **HTTPTunnelPort**  \['address':]__port__|**auto** [_isolation flags_]::
     Open this port to listen for proxy connections using the "HTTP CONNECT"
     Open this port to listen for proxy connections using the "HTTP CONNECT"
     protocol instead of SOCKS. Set this to 0
     protocol instead of SOCKS. Set this to 0

+ 1 - 6
src/or/config.c

@@ -208,7 +208,7 @@ static config_var_t option_vars_[] = {
   VAR("AccountingRule",          STRING,   AccountingRule_option,  "max"),
   VAR("AccountingRule",          STRING,   AccountingRule_option,  "max"),
   V(AccountingStart,             STRING,   NULL),
   V(AccountingStart,             STRING,   NULL),
   V(Address,                     STRING,   NULL),
   V(Address,                     STRING,   NULL),
-  V(AllowDotExit,                BOOL,     "0"),
+  OBSOLETE("AllowDotExit"),
   OBSOLETE("AllowInvalidNodes"),
   OBSOLETE("AllowInvalidNodes"),
   V(AllowNonRFC953Hostnames,     BOOL,     "0"),
   V(AllowNonRFC953Hostnames,     BOOL,     "0"),
   OBSOLETE("AllowSingleHopCircuits"),
   OBSOLETE("AllowSingleHopCircuits"),
@@ -684,11 +684,6 @@ static const config_var_t testing_tor_network_defaults[] = {
 #undef OBSOLETE
 #undef OBSOLETE
 
 
 static const config_deprecation_t option_deprecation_notes_[] = {
 static const config_deprecation_t option_deprecation_notes_[] = {
-  /* Deprecated since 0.2.9.2-alpha... */
-  { "AllowDotExit", "Unrestricted use of the .exit notation can be used for "
-    "a wide variety of application-level attacks." },
-  /* End of options deprecated since 0.2.9.2-alpha. */
-
   /* Deprecated since 0.3.2.0-alpha. */
   /* Deprecated since 0.3.2.0-alpha. */
   { "HTTPProxy", "It only applies to direct unencrypted HTTP connections "
   { "HTTPProxy", "It only applies to direct unencrypted HTTP connections "
     "to your directory server, which your Tor probably wasn't using." },
     "to your directory server, which your Tor probably wasn't using." },

+ 10 - 11
src/or/connection_edge.c

@@ -1237,10 +1237,9 @@ connection_ap_handshake_rewrite(entry_connection_t *conn,
   /* Check for whether this is a .exit address.  By default, those are
   /* Check for whether this is a .exit address.  By default, those are
    * disallowed when they're coming straight from the client, but you're
    * disallowed when they're coming straight from the client, but you're
    * allowed to have them in MapAddress commands and so forth. */
    * allowed to have them in MapAddress commands and so forth. */
-  if (!strcmpend(socks->address, ".exit") && !options->AllowDotExit) {
+  if (!strcmpend(socks->address, ".exit")) {
     log_warn(LD_APP, "The  \".exit\" notation is disabled in Tor due to "
     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).");
+             "security risks.");
     control_event_client_status(LOG_WARN, "SOCKS_BAD_HOSTNAME HOSTNAME=%s",
     control_event_client_status(LOG_WARN, "SOCKS_BAD_HOSTNAME HOSTNAME=%s",
                                 escaped(socks->address));
                                 escaped(socks->address));
     out->end_reason = END_STREAM_REASON_TORPROTOCOL;
     out->end_reason = END_STREAM_REASON_TORPROTOCOL;
@@ -1674,23 +1673,23 @@ connection_ap_handshake_rewrite_and_attach(entry_connection_t *conn,
     const node_t *node = NULL;
     const node_t *node = NULL;
 
 
     /* If this .exit was added by an AUTOMAP, then it came straight from
     /* If this .exit was added by an AUTOMAP, then it came straight from
-     * a user.  Make sure that options->AllowDotExit permits that! */
-    if (exit_source == ADDRMAPSRC_AUTOMAP && !options->AllowDotExit) {
-      /* Whoops; this one is stale.  It must have gotten added earlier,
-       * when AllowDotExit was on. */
-      log_warn(LD_APP,"Stale automapped address for '%s.exit', with "
-               "AllowDotExit disabled. Refusing.",
+     * a user.  That's not safe. */
+    if (exit_source == ADDRMAPSRC_AUTOMAP) {
+      /* Whoops; this one is stale.  It must have gotten added earlier?
+       * (Probably this is not possible, since AllowDotExit no longer
+       * exists.) */
+      log_warn(LD_APP,"Stale automapped address for '%s.exit'. Refusing.",
                safe_str_client(socks->address));
                safe_str_client(socks->address));
       control_event_client_status(LOG_WARN, "SOCKS_BAD_HOSTNAME HOSTNAME=%s",
       control_event_client_status(LOG_WARN, "SOCKS_BAD_HOSTNAME HOSTNAME=%s",
                                   escaped(socks->address));
                                   escaped(socks->address));
       connection_mark_unattached_ap(conn, END_STREAM_REASON_TORPROTOCOL);
       connection_mark_unattached_ap(conn, END_STREAM_REASON_TORPROTOCOL);
+      tor_assert_nonfatal_unreached();
       return -1;
       return -1;
     }
     }
 
 
     /* Double-check to make sure there are no .exits coming from
     /* Double-check to make sure there are no .exits coming from
      * impossible/weird sources. */
      * impossible/weird sources. */
-    if (exit_source == ADDRMAPSRC_DNS ||
-        (exit_source == ADDRMAPSRC_NONE && !options->AllowDotExit)) {
+    if (exit_source == ADDRMAPSRC_DNS || exit_source == ADDRMAPSRC_NONE) {
       /* It shouldn't be possible to get a .exit address from any of these
       /* It shouldn't be possible to get a .exit address from any of these
        * sources. */
        * sources. */
       log_warn(LD_BUG,"Address '%s.exit', with impossible source for the "
       log_warn(LD_BUG,"Address '%s.exit', with impossible source for the "

+ 0 - 7
src/or/or.h

@@ -4169,13 +4169,6 @@ typedef struct {
    * if we are a cache).  For authorities, this is always true. */
    * if we are a cache).  For authorities, this is always true. */
   int DownloadExtraInfo;
   int DownloadExtraInfo;
 
 
-  /** If true, we convert "www.google.com.foo.exit" addresses on the
-   * socks/trans/natd ports into "www.google.com" addresses that
-   * exit from the node "foo". Disabled by default since attacking
-   * websites and exit relays can use it to manipulate your path
-   * selection. */
-  int AllowDotExit;
-
   /** If true, we're configured to collect statistics on clients
   /** If true, we're configured to collect statistics on clients
    * requesting network statuses from us as directory. */
    * requesting network statuses from us as directory. */
   int DirReqStatistics_option;
   int DirReqStatistics_option;

+ 6 - 30
src/test/test_entryconn.c

@@ -76,7 +76,6 @@ test_entryconn_rewrite_bad_dotexit(void *arg)
   entry_connection_t *ec = arg;
   entry_connection_t *ec = arg;
   rewrite_result_t rr;
   rewrite_result_t rr;
 
 
-  get_options_mutable()->AllowDotExit = 0;
   tt_assert(ec->socks_request);
   tt_assert(ec->socks_request);
   strlcpy(ec->socks_request->address, "www.TORproject.org.foo.exit",
   strlcpy(ec->socks_request->address, "www.TORproject.org.foo.exit",
           sizeof(ec->socks_request->address));
           sizeof(ec->socks_request->address));
@@ -480,7 +479,7 @@ test_entryconn_rewrite_reject_internal_reverse(void *arg)
   ;
   ;
 }
 }
 
 
-/* Rewrite into .exit because of virtual address mapping */
+/* Rewrite into .exit because of virtual address mapping.  */
 static void
 static void
 test_entryconn_rewrite_automap_exit(void *arg)
 test_entryconn_rewrite_automap_exit(void *arg)
 {
 {
@@ -491,43 +490,21 @@ test_entryconn_rewrite_automap_exit(void *arg)
 
 
   ec2 = entry_connection_new(CONN_TYPE_AP, AF_INET);
   ec2 = entry_connection_new(CONN_TYPE_AP, AF_INET);
 
 
-  get_options_mutable()->AutomapHostsOnResolve = 1;
-  get_options_mutable()->AllowDotExit = 1;
   smartlist_add_strdup(get_options_mutable()->AutomapHostsSuffixes,
   smartlist_add_strdup(get_options_mutable()->AutomapHostsSuffixes,
                 ".EXIT");
                 ".EXIT");
   parse_virtual_addr_network("127.1.0.0/16", AF_INET, 0, &msg);
   parse_virtual_addr_network("127.1.0.0/16", AF_INET, 0, &msg);
 
 
-  /* Automap this on resolve. */
+  /* Try to automap this on resolve. */
   strlcpy(ec->socks_request->address, "website.example.exit",
   strlcpy(ec->socks_request->address, "website.example.exit",
           sizeof(ec->socks_request->address));
           sizeof(ec->socks_request->address));
   ec->socks_request->command = SOCKS_COMMAND_RESOLVE;
   ec->socks_request->command = SOCKS_COMMAND_RESOLVE;
   connection_ap_handshake_rewrite(ec, &rr);
   connection_ap_handshake_rewrite(ec, &rr);
 
 
-  tt_int_op(rr.automap, OP_EQ, 1);
-  tt_int_op(rr.should_close, OP_EQ, 0);
-  tt_int_op(rr.end_reason, OP_EQ, 0);
-  tt_i64_op(rr.map_expires, OP_EQ, TIME_MAX);
-  tt_int_op(rr.exit_source, OP_EQ, ADDRMAPSRC_NONE);
-  tt_str_op(rr.orig_address, OP_EQ, "website.example.exit");
-  tt_str_op(ec->original_dest_address, OP_EQ, "website.example.exit");
-
-  tt_assert(!strcmpstart(ec->socks_request->address,"127.1."));
-
-  /* Connect to it and make sure we get the original address back. */
-  strlcpy(ec2->socks_request->address, ec->socks_request->address,
-          sizeof(ec2->socks_request->address));
-
-  ec2->socks_request->command = SOCKS_COMMAND_CONNECT;
-  connection_ap_handshake_rewrite(ec2, &rr);
-
+  /* Make sure it isn't allowed -- there is no longer an AllowDotExit
+   * option. */
   tt_int_op(rr.automap, OP_EQ, 0);
   tt_int_op(rr.automap, OP_EQ, 0);
-  tt_int_op(rr.should_close, OP_EQ, 0);
-  tt_int_op(rr.end_reason, OP_EQ, 0);
-  tt_i64_op(rr.map_expires, OP_EQ, TIME_MAX);
-  tt_int_op(rr.exit_source, OP_EQ, ADDRMAPSRC_AUTOMAP);
-  tt_str_op(rr.orig_address, OP_EQ, ec->socks_request->address);
-  tt_str_op(ec2->original_dest_address, OP_EQ, ec->socks_request->address);
-  tt_str_op(ec2->socks_request->address, OP_EQ, "website.example.exit");
+  tt_int_op(rr.should_close, OP_EQ, 1);
+  tt_int_op(rr.end_reason, OP_EQ, END_STREAM_REASON_TORPROTOCOL);
 
 
  done:
  done:
   connection_free_(ENTRY_TO_CONN(ec2));
   connection_free_(ENTRY_TO_CONN(ec2));
@@ -577,7 +554,6 @@ test_entryconn_rewrite_mapaddress_automap_onion(void *arg)
   ec4 = entry_connection_new(CONN_TYPE_AP, AF_INET);
   ec4 = entry_connection_new(CONN_TYPE_AP, AF_INET);
 
 
   get_options_mutable()->AutomapHostsOnResolve = 1;
   get_options_mutable()->AutomapHostsOnResolve = 1;
-  get_options_mutable()->AllowDotExit = 1;
   smartlist_add_strdup(get_options_mutable()->AutomapHostsSuffixes,
   smartlist_add_strdup(get_options_mutable()->AutomapHostsSuffixes,
                 ".onion");
                 ".onion");
   parse_virtual_addr_network("192.168.0.0/16", AF_INET, 0, &msg);
   parse_virtual_addr_network("192.168.0.0/16", AF_INET, 0, &msg);