DNSSeed doesn't work with Tor, 'leaks' DNS #739

issue gmaxwell opened this issue on January 3, 2012
  1. gmaxwell commented at 1:12 AM on January 3, 2012: contributor

    Either some way of making dnsseed work correctly with Tor should be found or dnsseed should be disabled when fTor.

  2. gmaxwell commented at 4:15 PM on January 3, 2012: contributor

    It looks to me like the best way to solve this is to add support for the Tor socks extension that adds a resolve command. The tor-resolve tool uses this functionality to do DNS lookups for users: https://gitweb.torproject.org/tor.git/blob/c3e63483b2f16eb1717035eac4c14315b95671f5:/src/tools/tor-resolve.c

    Downside are that it only appears to return a single IP per query and that many exit nodes screw up DNS making it kind of a crapshoot at times.

    Alternatively, we could include a tiny TCP dns resolver and a list of public dns servers that allow TCP querying. This is the approach of TTDNSD: http://www.mulliner.org/collin/ttdnsd.php The advantage with this is that its potentially useful for both tor users and non-tor users that happen to be behind a broken resolver. It would be more code to support though.

  3. gavinandresen commented at 5:01 PM on January 3, 2012: contributor

    Fixed in a pull today (please help test if you can).

    Relevant code is all in init.cpp:

    bool fTor = (fUseProxy && addrProxy.port == htons(9050));
    if (fTor)
    {
        // Use SoftSetArg here so user can override any of these if they wish.
        // Note: the GetBoolArg() calls for all of these must happen later.
        SoftSetArg("-nolisten", true);
        SoftSetArg("-noirc", true);
        SoftSetArg("-nodnsseed", true);
        SoftSetArg("-noupnp", true);
        SoftSetArg("-upnp", false);
        SoftSetArg("-dns", false);
    }
    
  4. gmaxwell commented at 5:32 PM on January 3, 2012: contributor

    Great— though it brings up another issue: Our assumption of tor==proxy on 9050 is broken.

    Good tor practice now is to run multiple socks ports because a single socks port will share tor circuts. E.g. you visit a website and login as GavinMcSecret then using the same socks port start bitcoin and send some txn. Tor will very likely reuse the circuits and exit them from the same place potentially creating a surprising identity binding if the exit operator is watching.

    So I guess the addrProxy.port == htons(9050) tests should become some kind of GetBoolArg||addrProxy.port == htons(9050).

  5. laanwj commented at 1:51 PM on February 7, 2012: member

    @gmaxwell: yes, I don't think there is a way to detect tor, hence the awkward heuristic of checking for port 9050. So probably we should add a "tor" checkbox in the UI and a -tor commandline option?

  6. sipa commented at 2:13 AM on April 5, 2012: member

    @gmaxwell For IPv6, I've already implemented SOCKS5 client support, which is also provided by Tor. SOCKS5 supports IPv4, IPv6 and hostname destinations.

    Is there any reason to stick to SOCKS4?

  7. laanwj commented at 5:28 AM on April 5, 2012: member

    Some legacy and/or custom proxy software supports only SOCKS4.

    I really don't know how much of a problem this is for bitcoin, but dropping support for v4 based on implementing v5 is not very common. Most software has a 'proxy type' setting which can be set to either 4 or 5 (sometimes also 4a which is 4 + hostnames and HTTP proxy CONNECT)

  8. sipa commented at 11:40 PM on May 12, 2012: member

    I think this can be considered fixed since -proxydns?

  9. gmaxwell closed this on May 12, 2012

  10. ptschip referenced this in commit de34ae3fc1 on Aug 14, 2017
  11. Losangelosgenetics referenced this in commit 40e6086adc on Mar 12, 2020
  12. Losangelosgenetics referenced this in commit 5cd26d39f8 on Mar 12, 2020
  13. rajarshimaitra referenced this in commit f2e1edf6d0 on Aug 5, 2021
  14. DrahtBot locked this on Sep 8, 2021

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-04-18 21:16 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me