Setting torcontrol overrides proxy address #25265

issue kroese openend this issue on June 1, 2022
  1. kroese commented at 11:28 pm on June 1, 2022: none

    When using Bitcoin in combination with Tor, to generate a hidden service to allow for inbound connections, it is needed to add torcontrol like this:

    0proxy=1.2.3.4:9050
    1torcontrol=1.2.3.4:29501
    

    The problem is that adding torcontrol results in overriding the proxy address with 127.0.0.1 and the end-result is that Bitcoin cannot connect to Tor any longer:

    connect() to 127.0.0.1:9050 failed after wait: Connection refused (111)

    It should have connected to 1.2.3.4 instead.

    So why does adding torcontrol overrides the configured address for proxy?

  2. kroese added the label Bug on Jun 1, 2022
  3. kroese renamed this:
    Setting torcontrol overrides proxy
    Setting torcontrol overrides proxy address
    on Jun 1, 2022
  4. fjahr commented at 3:08 pm on June 19, 2022: member
    @kroese can you share any relevant logs outputs and also what other settings you are using that are networking related?
  5. laanwj added the label P2P on Jun 20, 2022
  6. laanwj commented at 4:50 pm on June 20, 2022: member

    So why does adding torcontrol overrides the configured address for proxy?

    To be precise, it overrides the specific proxy for NET_ONION, e.g. -onion. See https://github.com/bitcoin/bitcoin/blob/master/src/torcontrol.cpp#L385

    I guess it shouldn’t be doing so if an explicit one was provided on the command line.

  7. fjahr commented at 10:06 pm on June 20, 2022: member

    So why does adding torcontrol overrides the configured address for proxy?

    To be precise, it overrides the specific proxy for NET_ONION, e.g. -onion. See https://github.com/bitcoin/bitcoin/blob/master/src/torcontrol.cpp#L385

    I guess it shouldn’t be doing so if an explicit one was provided on the command line.

    That’s a good hint! I will look into it unless you have already started working on it.

  8. laanwj commented at 4:50 am on June 21, 2022: member
    No I haven’t, feel free to pick it up!
  9. luke-jr commented at 3:04 am on July 26, 2022: member
    If you want to override -torcontrol, you should be using -onion. Overriding -proxy is expected behaviour (otherwise why use -torcontrol at all?).
  10. fjahr commented at 7:27 pm on July 26, 2022: member

    If you want to override -torcontrol, you should be using -onion. Overriding -proxy is expected behaviour (otherwise why use -torcontrol at all?).

    To me, this doesn’t make sense. -onion is the more specific version of -proxy, so it makes sense that -onion overrides -proxy. But the interactions with any other parameter should be consistent between the two. Everything else is very confusing.

  11. vasild commented at 8:11 am on August 18, 2022: member

    This was briefly discussed in #15423 (review). Related PR: #22830.

    IMO it is ok that the auto-discovered Tor proxy overrides the generic one from -proxy because -proxy could be just an ordinary SOCKS5 proxy unrelated to the Tor network. If that is not ok, then the user has the option to override the auto-discovered one by using -onion. That is, -proxy < -torcontrol (auto-discover) < -onion looks reasonable to me.

    If it is changed to -torcontrol (auto-discover) < -proxy < -onion then there is no way for the user to setup a configuration that uses auto-discovery + a manually specified non-Tor-related SOCKS5 proxy (with -proxy). The auto-discovery is nice because it returns a correct location, even after configuration changes in the network or the Tor daemon, without user interaction.


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: 2024-09-29 01:12 UTC

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