]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
Merge branch 'haxxpop/tcp_proxy_squashed' into tcp_proxy_squshed_and_merged
authorNick Mathewson <nickm@torproject.org>
Mon, 6 Jan 2020 18:41:20 +0000 (13:41 -0500)
committerNick Mathewson <nickm@torproject.org>
Mon, 6 Jan 2020 18:41:20 +0000 (13:41 -0500)
17 files changed:
1  2 
doc/tor.1.txt
src/app/config/config.c
src/app/config/config.h
src/app/config/or_options_st.h
src/core/include.am
src/core/mainloop/connection.c
src/core/or/connection_or.c
src/core/or/or.h
src/core/or/or_connection_st.h
src/feature/client/transports.c
src/test/include.am
src/test/test.c
src/test/test.h
src/test/test_config.c
src/test/test_connection.c
src/test/test_helpers.c
src/test/test_options.c

diff --cc doc/tor.1.txt
index 85369dfcefd6b9a3c4942030de53e0890262a04f,5bcb6ec2bdc05665ba5668ce820aa80fe44d7a32..e1738c9ba3da03a7af83df5c6797e39f569122f8
@@@ -880,63 -910,8 +880,79 @@@ forward slash (/) in the configuration 
      If KIST is used in Schedulers, this is a multiplier of the per-socket
      limit calculation of the KIST algorithm. (Default: 1.0)
  
 -CLIENT OPTIONS
 ---------------
 +
 +[[ServerTransportListenAddr]] **ServerTransportListenAddr** __transport__ __IP__:__PORT__::
 +    When this option is set, Tor will suggest __IP__:__PORT__ as the
 +    listening address of any pluggable transport proxy that tries to
 +    launch __transport__. (IPv4 addresses should written as-is; IPv6
 +    addresses should be wrapped in square brackets.) (Default: none)
 +
 +[[ServerTransportOptions]] **ServerTransportOptions** __transport__ __k=v__ __k=v__ ...::
 +    When this option is set, Tor will pass the __k=v__ parameters to
 +    any pluggable transport proxy that tries to launch __transport__. +
 +    (Example: ServerTransportOptions obfs45 shared-secret=bridgepasswd cache=/var/lib/tor/cache) (Default: none)
 +
 +[[ServerTransportPlugin]] **ServerTransportPlugin** __transport__ exec __path-to-binary__ [options]::
 +    The Tor relay launches the pluggable transport proxy in __path-to-binary__
 +    using __options__ as its command-line options, and expects to receive
 +    proxied client traffic from it. (Default: none)
 +
 +[[Socks4Proxy]] **Socks4Proxy** __host__[:__port__]::
 +    Tor will make all OR connections through the SOCKS 4 proxy at host:port
 +    (or host:1080 if port is not specified).
 +
 +[[Socks5Proxy]] **Socks5Proxy** __host__[:__port__]::
 +    Tor will make all OR connections through the SOCKS 5 proxy at host:port
 +    (or host:1080 if port is not specified).
 +
 +// Out of order because Username logically precedes Password
 +[[Socks5ProxyUsername]] **Socks5ProxyUsername** __username__ +
 +
 +[[Socks5ProxyPassword]] **Socks5ProxyPassword** __password__::
 +    If defined, authenticate to the SOCKS 5 server using username and password
 +    in accordance to RFC 1929. Both username and password must be between 1 and
 +    255 characters.
 +
 +[[SyslogIdentityTag]] **SyslogIdentityTag** __tag__::
 +    When logging to syslog, adds a tag to the syslog identity such that
 +    log entries are marked with "Tor-__tag__". Can not be changed while tor is
 +    running. (Default: none)
 +
++[[TCPProxy]] **TCPProxy** __protocol__ __host__:__port__::
++      Tor will use the given protocol to make all its OR (SSL) connections through
++      a TCP proxy on host:port, rather than connecting directly to servers. You may
++      want to set **FascistFirewall** to restrict the set of ports you might try to
++      connect to, if your proxy only allows connecting to certain ports. There is no
++      equivalent option for directory connections, because all Tor client versions
++      that support this option download directory documents via OR connections. +
+++
++      The only protocol supported right now 'haproxy'. This option is only for
++      clients. (Default: none) +
+++
++      The HAProxy version 1 proxy protocol is described in detail at
++      https://www.haproxy.org/download/1.8/doc/proxy-protocol.txt +
+++
++      Both source IP address and source port will be set to zero.
++
 +[[TruncateLogFile]] **TruncateLogFile** **0**|**1**::
 +    If 1, Tor will overwrite logs at startup and in response to a HUP signal,
 +    instead of appending to them. (Default: 0)
 +
 +[[UnixSocksGroupWritable]] **UnixSocksGroupWritable** **0**|**1**::
 +    If this option is set to 0, don't allow the filesystem group to read and
 +    write unix sockets (e.g. SocksPort unix:). If the option is set to 1, make
 +    the Unix socket readable and writable by the default GID. (Default: 0)
 +
 +[[UseDefaultFallbackDirs]] **UseDefaultFallbackDirs** **0**|**1**::
 +    Use Tor's default hard-coded FallbackDirs (if any). (When a
 +    FallbackDir line is present, it replaces the hard-coded FallbackDirs,
 +    regardless of the value of UseDefaultFallbackDirs.) (Default: 1)
 +
 +[[User]] **User** __Username__::
 +    On startup, setuid to this user and setgid to their primary group.
 +    Can not be changed while tor is running.
 +
 +== CLIENT OPTIONS
  
  The following options are useful only for clients (that is, if
  **SocksPort**, **HTTPTunnelPort**, **TransPort**, **DNSPort**, or
index 72ab065fb59bd0c798fe246f08484e0a25f5e5d0,c67f547cf838fd402f7d88efe8b33b4e99d55db6..65a4dcb0ee25d41a88f2ec785c6d02f9ce81aad1
@@@ -538,8 -522,9 +538,9 @@@ static const config_var_t option_vars_[
    V(Socks5Proxy,                 STRING,   NULL),
    V(Socks5ProxyUsername,         STRING,   NULL),
    V(Socks5ProxyPassword,         STRING,   NULL),
 -  VAR("KeyDirectory",            FILENAME, KeyDirectory_option, NULL),
 -  V(KeyDirectoryGroupReadable,   BOOL,     "0"),
+   V(TCPProxy,                    STRING,   NULL),
 +  VAR_IMMUTABLE("KeyDirectory",  FILENAME, KeyDirectory_option, NULL),
 +  V(KeyDirectoryGroupReadable,   AUTOBOOL, "auto"),
    VAR_D("HSLayer2Nodes",         ROUTERSET,  HSLayer2Nodes,  NULL),
    VAR_D("HSLayer3Nodes",         ROUTERSET,  HSLayer3Nodes,  NULL),
    V(KeepalivePeriod,             INTERVAL, "5 minutes"),
index 15c93524672c88eea3668cde042ca3a3ead71f00,aa2b052c017f17cf68d7318fa6d8100091c38ddf..2c03714fd7bbd77f2012eeae96a199649b575cc6
@@@ -286,6 -259,15 +286,8 @@@ STATIC const struct config_mgr_t *get_o
  STATIC void or_options_free_(or_options_t *options);
  STATIC int options_validate_single_onion(or_options_t *options,
                                           char **msg);
 -STATIC int options_validate(or_options_t *old_options,
 -                            or_options_t *options,
 -                            or_options_t *default_options,
 -                            int from_setconf, char **msg);
 -STATIC int parse_transport_line(const or_options_t *options,
 -                                const char *line, int validate_only,
 -                                int server);
+ STATIC int parse_tcp_proxy_line(const char *line, or_options_t *options,
+                                 char **msg);
  STATIC int consider_adding_dir_servers(const or_options_t *options,
                                         const or_options_t *old_options);
  STATIC void add_default_trusted_dir_authorities(dirinfo_type_t type);
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
diff --cc src/test/test.c
Simple merge
diff --cc src/test/test.h
Simple merge
Simple merge
index 0d2827670249f3d1757afb30594ad4bbd77f412e,34ef3fdf181a51512ad4d2e17ef6a4a49623ee44..73699812844cf702db6536ef2de3212ad3c5f92f
@@@ -888,8 -969,10 +970,11 @@@ test_failed_orconn_tracker(void *arg
  /* where arg is an expression (constant, variable, compound expression) */
  #define CONNECTION_TESTCASE_ARG(name, fork, setup, arg)                  \
    { #name "_" #arg, test_conn_##name, fork, &setup, (void *)arg }
 +#endif /* !defined(COCCI) */
  
+ static const unsigned int PROXY_CONNECT_ARG = PROXY_CONNECT;
+ static const unsigned int PROXY_HAPROXY_ARG = PROXY_HAPROXY;
  struct testcase_t connection_tests[] = {
    CONNECTION_TESTCASE(get_basic, TT_FORK, test_conn_get_basic_st),
    CONNECTION_TESTCASE(get_rend,  TT_FORK, test_conn_get_rend_st),
index 29743a0d15aa162f60f462ba5b0364b50bf8fd9f,f972aca5bac94940c7cdee882443ae26357a1361..31bf1fcc2ab27518afe28b7ceecedc8a4d856baf
  
  #include "lib/buf/buffers.h"
  #include "app/config/config.h"
 -#include "lib/confmgt/confparse.h"
 +#include "lib/confmgt/confmgt.h"
  #include "app/main/subsysmgr.h"
  #include "core/mainloop/connection.h"
+ #include "core/or/connection_or.h"
  #include "lib/crypt_ops/crypto_rand.h"
  #include "core/mainloop/mainloop.h"
  #include "feature/nodelist/nodelist.h"
index b99ae789321298eb31daaf368d9b5b63cc8a1993,394aff45b9765f2ddf95f14bc5b22f77c628c11b..ce05eb01f7f07c29ada37e1b840905b60c507408
@@@ -2801,23 -2946,27 +2801,24 @@@ test_options_validate__proxy(void *igno
    tor_free(msg);
  
    free_options_test_data(tdata);
 -  tdata = get_options_test_data(TEST_OPTIONS_DEFAULT_VALUES
 -                                "Socks4Proxy 215.1.1.1\n"
 +  tdata = get_options_test_data("Socks4Proxy 215.1.1.1\n"
                                  "Socks5Proxy 215.1.1.2\n"
                                  );
 -  ret = options_validate(tdata->old_opt, tdata->opt, tdata->def_opt, 0, &msg);
 +  ret = options_validate(NULL, tdata->opt, &msg);
    tt_int_op(ret, OP_EQ, -1);
    tt_str_op(msg, OP_EQ, "You have configured more than one proxy type. "
-             "(Socks4Proxy|Socks5Proxy|HTTPSProxy)");
+             "(Socks4Proxy|Socks5Proxy|HTTPSProxy|TCPProxy)");
    tor_free(msg);
  
    free_options_test_data(tdata);
 -  tdata = get_options_test_data(TEST_OPTIONS_DEFAULT_VALUES
 -                                "HttpProxy 215.1.1.1\n"
 -                                );
 +  tdata = get_options_test_data("HttpProxy 215.1.1.1\n");
    mock_clean_saved_logs();
 -  ret = options_validate(tdata->old_opt, tdata->opt, tdata->def_opt, 0, &msg);
 +  ret = options_validate(NULL, tdata->opt, &msg);
    tt_int_op(ret, OP_EQ, 0);
-   expect_log_msg("HTTPProxy configured, but no SOCKS "
-             "proxy or HTTPS proxy configured. Watch out: this configuration "
-             "will proxy unencrypted directory connections only.\n");
+   expect_log_msg("HTTPProxy configured, but no SOCKS proxy, "
+             "HTTPS proxy, or any other TCP proxy configured. Watch out: "
+             "this configuration will proxy unencrypted directory "
+             "connections only.\n");
    tor_free(msg);
  
    free_options_test_data(tdata);