Add Tor icon #86

pull hebasto wants to merge 9 commits into bitcoin-core:master from hebasto:200902-tor changing 18 files +120 −136
  1. hebasto commented at 8:30 am on September 10, 2020: member

    New behavior:

    • the Tor icon is showed in the status bar iif all peer connections are made via Tor (credits to Sjors)
    • a click on the Tor icon opens the “Network” tab of the “Options” dialog

    Designer: Bosch-0 Icon PNG file is optimized with optimize-pngs.py

    Fix https://github.com/bitcoin/bitcoin/issues/7734 Fix #58

    Screenshots: Screenshot from 2020-09-09 17-04-56 Screenshot from 2020-09-09 17-03-54

    Screenshot from 2020-10-17 10-03-35

    Based on https://github.com/bitcoin/bitcoin/pull/20172 (the first five commits).

  2. hebasto commented at 8:31 am on September 10, 2020: member
  3. in src/interfaces/node.cpp:91 in 4930c92dbd outdated
    86@@ -87,6 +87,12 @@ class NodeImpl : public Node
    87         }
    88     }
    89     bool getProxy(Network net, proxyType& proxy_info) override { return GetProxy(net, proxy_info); }
    90+
    91+    bool hasTorOnlyConnections() override
    


    MarcoFalke commented at 11:17 am on September 10, 2020:
    would it make sense to expose this bool over rpc as well?

    hebasto commented at 12:07 pm on September 10, 2020:

    hebasto commented at 9:55 pm on October 16, 2020:
  4. hebasto force-pushed on Sep 10, 2020
  5. hebasto commented at 12:07 pm on September 10, 2020: member

    Updated 4930c92dbdb7e8579d0b8f47cdd5dcdc876de0dd -> 082a680ea8b2769ff96ae06f870adc9bf2be6819 (pr86.01 -> pr86.02, diff):

    would it make sense to expose this bool over rpc as well?

  6. jonasschnelli commented at 12:11 pm on September 10, 2020: contributor

    Concept ACK.

    If one adds a non-TOR node via addnode, will the icon change (I haven’t looked through the code yet)?

  7. hebasto commented at 12:14 pm on September 10, 2020: member

    @jonasschnelli

    If one adds a non-TOR node via addnode, will the icon change (I haven’t looked through the code yet)?

    No. updateTorIcon() is called only once in BitcoinGUI::setClientModel(). Going to address this issue.

    UPDATE: changed in #86 (comment)

  8. jonasschnelli commented at 1:10 pm on September 10, 2020: contributor

    No. updateTorIcon() is called only once in BitcoinGUI::setClientModel(). Going to address this issue.

    Thanks!

    I think for TOR only,… it’s very important that users can’t end up with the icon “confirming” tor-only when the actually have non-tor connections.

  9. hebasto force-pushed on Sep 11, 2020
  10. hebasto commented at 9:31 am on September 11, 2020: member

    Updated 082a680ea8b2769ff96ae06f870adc9bf2be6819 -> e61b1203406f975891cacf410985ced88d7aac45 (pr86.02 -> pr86.03, diff):

    I think for TOR only,… it’s very important that users can’t end up with the icon “confirming” tor-only when the actually have non-tor connections.

  11. hebasto commented at 9:34 am on September 11, 2020: member
    @fanquake @MarcoFalke Is this PR in its current state (with net part refactoring) placed in this repo correctly?
  12. hebasto force-pushed on Sep 11, 2020
  13. Fichte42 commented at 12:19 pm on September 11, 2020: none

    Concept ACK.

    Not tested, code looks pretty straight forward. I would maybe rename tor_connected to tor_only_connections or something like that to reflect that all connections are via tor.

  14. in src/net.cpp:2597 in 01fb75ea7f outdated
    2593@@ -2594,20 +2594,26 @@ bool CConnman::RemoveAddedNode(const std::string& strNode)
    2594     return false;
    2595 }
    2596 
    2597-size_t CConnman::GetNodeCount(NumConnections flags)
    2598+size_t CConnman::PeerCount()
    


    jnewbery commented at 2:58 pm on September 11, 2020:
    style: this could be a one statement function if you use WITH_LOCK, and might make sense to just move the definition to the header file.

    hebasto commented at 5:19 pm on September 11, 2020:
  15. in src/net.cpp:2605 in 01fb75ea7f outdated
    2607-    for (const auto& pnode : vNodes) {
    2608-        if (flags & (pnode->IsInboundConn() ? CONNECTIONS_IN : CONNECTIONS_OUT)) {
    2609-            nNum++;
    2610+ConnCounts CConnman::ConnectionCounts()
    2611+{
    2612+    int num_in = 0;
    


    jnewbery commented at 2:59 pm on September 11, 2020:
    style: consider using the more modern braced initialization.

    hebasto commented at 5:19 pm on September 11, 2020:
  16. in src/net.h:173 in 01fb75ea7f outdated
    167@@ -168,18 +168,28 @@ enum class ConnectionType {
    168     ADDR_FETCH,
    169 };
    170 
    171+struct ConnCounts
    172+{
    173+    const int all = 0;
    


    jnewbery commented at 3:00 pm on September 11, 2020:
    style: this is redundant. I think it’s better to let the client calculate this rather than including it in the interface.

    hebasto commented at 4:39 pm on September 11, 2020:
    Disagree. This is an invariant forced by constructor, and it reduces code duplication on client sites.

    jnewbery commented at 8:28 am on September 14, 2020:
    ok!
  17. in src/net.h:174 in 01fb75ea7f outdated
    167@@ -168,18 +168,28 @@ enum class ConnectionType {
    168     ADDR_FETCH,
    169 };
    170 
    171+struct ConnCounts
    172+{
    173+    const int all = 0;
    174+    const int in = 0;
    


    jnewbery commented at 3:00 pm on September 11, 2020:
    style: consider using braced initialization.

    hebasto commented at 5:19 pm on September 11, 2020:
  18. in src/rpc/mining.cpp:666 in 01fb75ea7f outdated
    662@@ -663,7 +663,7 @@ static RPCHelpMan getblocktemplate()
    663     if(!node.connman)
    664         throw JSONRPCError(RPC_CLIENT_P2P_DISABLED, "Error: Peer-to-peer functionality missing or disabled");
    665 
    666-    if (node.connman->GetNodeCount(CConnman::CONNECTIONS_ALL) == 0)
    667+    if (node.connman->PeerCount() == 0)
    


    jnewbery commented at 3:03 pm on September 11, 2020:
    style: add braces to comply with current style when touching old code.

    hebasto commented at 5:20 pm on September 11, 2020:
  19. jnewbery commented at 3:05 pm on September 11, 2020: contributor

    Concept ACK and code review ACK of the net code changes. I’ve left a bunch of style comments, which you can feel free to ignore, but might be good to address if you have to touch the branch again.

    I’m not familiar with the qt code, but I’ve skimmed the changes and they seem fine.

  20. hebasto force-pushed on Sep 11, 2020
  21. hebasto commented at 5:18 pm on September 11, 2020: member

    Updated 01fb75ea7f3921d4fb522bbfedee051fa85f1102 -> 6549abcb072d73e0ac91c7992cc5d86eb4064b70 (pr86.04 -> pr86.05, diff):

    I would maybe rename tor_connected to tor_only_connections or something like that to reflect that all connections are via tor.

    The icon name is used only once, and there is the only Tor icon in the repo. I’d keep the more general name for now.

  22. Rspigler commented at 8:43 pm on September 12, 2020: contributor

    these conditions could be achieved with -onlynet=onion, -listen=0, and -listenonion=1 options)

    onlynet=onion makes it so that Core only connects out to Hidden Services. What about also detecting situations like:

    proxy=127.0.0.1:9050 bind=127.0.0.1

    This disables listening, so could be with OR without:

    listen=1 AND the ephemeral hidden services supported since Tor version 0.2.7.1 and Core 0.12.0

  23. hebasto commented at 9:20 pm on September 12, 2020: member

    @Rspigler

    these conditions could be achieved with -onlynet=onion, -listen=0, and -listenonion=1 options)

    onlynet=onion makes it so that Core only connects out to Hidden Services. What about also detecting situations like:

    proxy=127.0.0.1:9050 bind=127.0.0.1

    This disables listening, so could be with OR without:

    listen=1 AND the ephemeral hidden services supported since Tor version 0.2.7.1 and Core 0.12.0

    Currently, only the CNetAddr::IsTor() function is used for checking. Command line options in the OP are listed for testing purposes.

  24. Bosch-0 commented at 3:53 am on September 14, 2020: none

    ACK, looks good on windows 10. Though I did have to add the below to my .config file - it would be ideal if the user did not have to do this.

    onlynet=onion listen=0 listenonion=1

    image

    A quick note, this was the first PR I have reviewed and as non super technical designer, I did not find the process too difficult - I will be making a concerted effort with the Bitcoin Design community to get more reviewers looking at these kind of PRs.

  25. jnewbery commented at 8:29 am on September 14, 2020: contributor
    Code review ACK 6549abcb07 (node changes only. Did not fully review qt changes)
  26. jonatack commented at 9:04 am on September 14, 2020: contributor

    ACK, looks good on windows 10. Though I did have to add the below to my .config file - it would be ideal if the user did not have to do this.

    onlynet=onion listen=0 listenonion=1 @Bosch-0 if you have tor configured and running, running the default configuration of Bitcoin Core should automatically start an onion service. See “3. Automatically listen on Tor” in doc/tor.md.

  27. hebasto commented at 9:09 am on September 14, 2020: member

    @jonatack

    @Bosch-0 if you have tor configured and running, running the default configuration of Bitcoin Core should automatically start an onion service. See “3. Automatically listen on Tor” in doc/tor.md.

    Correct. But the default setup does not prevent non-onion connections. Therefore, the Tor icon will not be shown to a user.

  28. jonatack commented at 9:10 am on September 14, 2020: contributor
    The additional configuration is if you only want onion connections. onlynet=onion isn’t necessarily recommended, IIUC. Though I can understand why we’d want to indicate when we’re running on onion-only.
  29. hebasto commented at 9:12 am on September 14, 2020: member

    The additional configuration is if you only want onion connections. onlynet=onion isn’t necessarily recommended, IIUC.

    Correct. onlynet=onion is for outgoing connection. That (the making outgoing connections Tor-only) is optional, ofc.

  30. Bosch-0 commented at 1:42 pm on September 14, 2020: none

    The additional configuration is if you only want onion connections. onlynet=onion isn’t necessarily recommended, IIUC

    Why is this not recommended?

  31. jonatack commented at 3:01 pm on September 14, 2020: contributor

    The additional configuration is if you only want onion connections. onlynet=onion isn’t necessarily recommended, IIUC

    Why is this not recommended?

    1. https://en.bitcoin.it/wiki/Setting_up_a_Tor_hidden_service:
    • “If you additionally want Bitcoin Core to only connect out to Tor hidden services, also add this line (not particularly recommended):”

      onlynet=onion
      
    • “Doing so will make your specific bitcoind node arguably more secure because it will never have an unencrypted connection to another node, but if everyone used onlynet=onion nobody on the onion bitcoin chain would be able to communicate with the clearnet chain. It is essential that some nodes access both clearnet and Tor. If you need to submit bitcoin transactions to the network with the highest level of obscurity, use onlynet=onion. If you only wish to give access to your node to other Tor users, do not use it.”

    1. Also, if you’re interested, google “Bitcoin over Tor isn’t a good idea” (from 2015). Possible countermeasures include BIP324 (in the future) or using addnode to ensure connection to trusted “good” onion peers.

    2. Finally, Tor v2 seems increasingly compromised and begins its deprecation period tomorrow (September 15, 2020), which is why implementation of BIP155 is important to move to Tor v3, I2P, CJDNS, etc.

    Edit: don’t let this hijack the PR! Concept ACK.

  32. Rspigler commented at 4:45 am on September 15, 2020: contributor

    Though I can understand why we’d want to indicate when we’re running on onion-only.

    I think for the very reason that it risks partitioning the network, and less educated users may think that there is a greater benefit than there really is, we shouldn’t have an icon to indicate an onion only mode (this PR doesn’t do that).

    That (the making outgoing connections) is optional, ofc.

    Outgoing connections is default, incoming connections are optional. For outgoing connections, you can set a proxy command in the conf file to put all connections behind tor, or set onlynet=onion to connect out only to HS (not recommended).

    For incoming connections, since Tor version 0.2.7.1 and Core 0.12.0, Core can create and destroy ephemeral hidden services programmatically.

  33. in src/qt/rpcconsole.cpp:860 in 00985b689a outdated
    851@@ -854,19 +852,6 @@ void RPCConsole::updateNetworkState()
    852     ui->numberOfConnections->setText(connections);
    853 }
    854 
    855-void RPCConsole::setNumConnections()
    856-{
    857-    if (!clientModel)
    


    Sjors commented at 12:05 pm on September 16, 2020:
    Was this check already superfluous?
  34. in src/net.cpp:2601 in dad3717d83 outdated
    2597@@ -2598,13 +2598,16 @@ ConnCounts CConnman::ConnectionCounts()
    2598 {
    2599     int num_in{0};
    2600     int num_out{0};
    2601+    bool tor_only{false};
    


    Sjors commented at 12:10 pm on September 16, 2020:
    Maybe this should be an Optional, but I don’t care deeply.
  35. in src/rpc/net.cpp:547 in dad3717d83 outdated
    543@@ -544,6 +544,7 @@ static UniValue getnetworkinfo(const JSONRPCRequest& request)
    544         obj.pushKV("connections", conn_counts.all);
    545         obj.pushKV("connections_in", conn_counts.in);
    546         obj.pushKV("connections_out", conn_counts.out);
    547+        obj.pushKV("connections_tor_only", conn_counts.tor_only);
    


    Sjors commented at 12:10 pm on September 16, 2020:
    connections_tor_only should be documented in the RPCResult above

    MarcoFalke commented at 12:24 pm on September 22, 2020:
    Also, the RPC and net changes are not gui related, so should go into the main repo

    hebasto commented at 9:57 pm on October 16, 2020:
  36. in src/net.cpp:2607 in dad3717d83 outdated
    2602     {
    2603         LOCK(cs_vNodes);
    2604+        if (!vNodes.empty()) tor_only = true;
    2605         for (const auto& pnode : vNodes) {
    2606             pnode->IsInboundConn() ? ++num_in : ++num_out;
    2607+            if (!pnode->addr.IsTor()) tor_only = false;
    


    Sjors commented at 12:12 pm on September 16, 2020:
    I didn’t test if IsTor() behaves correctly when you have an inbound connection via a hidden service.

    hebasto commented at 4:33 pm on September 16, 2020:

    I didn’t test if IsTor() behaves correctly when you have an inbound connection via a hidden service.

    No, it doesn’t. Going to rework his code.


    vasild commented at 8:22 am on September 17, 2020:

    Sjors commented at 9:38 am on September 17, 2020:
    If it’s too tedious, I’m fine with the current change and just leaving correct handling of hidden service as a (well documented) TODO. At least this PR shows the Tor icon in a subset of acceptable circumstances.

    hebasto commented at 11:58 am on September 22, 2020:
    The solution suggested by @laanwj submitted in https://github.com/bitcoin/bitcoin/pull/19991.
  37. Sjors approved
  38. Sjors commented at 12:13 pm on September 16, 2020: member

    tACK 6549abcb072d73e0ac91c7992cc5d86eb4064b70 with notes for followup

    We can decide in another PR whether to encourage Tor more, as well as make it less painful to correctly configure.

    Tested on macOS 10.15.6 with the Tor proxy configured in the GUI (using port 9150 which the Tor browser offers), -onlynet=onion and -listen=0.

    Note that the Tor icon won’t appear until at least one peer is connected. This is the same behavior as connections_tor_only in getnetworkinfo (uses the same code).

    I didn’t try launching a hidden service; someone running Linux should.

    In light of the 727af0f0c00092f473368aa4d7cad7c321d4a4de refactor, I also tested that setnetworkactive still works with bitcoin-cli and from the GUI console.

    In the event this PR doesn’t make it, there’s some useful refactoring commits that should be salvaged.

  39. DrahtBot added the label Needs rebase on Sep 23, 2020
  40. laanwj referenced this in commit f79a4a8952 on Oct 12, 2020
  41. sidhujag referenced this in commit 2180fb4d7a on Oct 13, 2020
  42. net: Replace uiInterface global with CConnman::clientInterface member 2596322109
  43. Drop unused argument in NetworkActiveChanged signal 7eccce5788
  44. Drop unused argument in NumConnectionsChanged signal f4cbe6b4c2
  45. Split CConnman::GetNodeCount() in two functions
    This change prevents repetitive traversing vNodes.
    0ea8ba4bc4
  46. rpc: Add `connections_onion_only` to `getnetworkinfo` output 174848ffb8
  47. hebasto commented at 9:03 pm on October 16, 2020: member

    @MarcoFalke

    Also, the RPC and net changes are not gui related, so should go into the main repo

    Done in https://github.com/bitcoin/bitcoin/pull/20172.

  48. qt: Make RPCConsole::updateNetworkState a slot 2a22d05d9f
  49. qt: Make BitcoinGUI::updateNetworkState a slot b876644aa9
  50. gui: Add Tor icons to the repo
    Co-authored-by: bosch <bosch5@pm.me>
    d8dc1f5264
  51. qt: Add "All connections are via Tor" icon to the status bar bd8df33356
  52. hebasto force-pushed on Oct 16, 2020
  53. hebasto commented at 9:54 pm on October 16, 2020: member
    Rebased 6549abcb072d73e0ac91c7992cc5d86eb4064b70 -> bd8df33356134efd6e2ccf1acb4e12dad44cb006 (pr86.05 -> pr86.06) on top of the https://github.com/bitcoin/bitcoin/pull/20172.
  54. DrahtBot removed the label Needs rebase on Oct 16, 2020
  55. Rspigler commented at 0:05 am on October 20, 2020: contributor

    @Sjors basically said this in #58 already, but the Tor icon should only be activated when:

    1. All outbound (default) connections are through Tor (either through the proxy, or to HS’s only); AND

    2. Inbound (optional) connections are EITHER disabled (this is the default when using -proxy), or are all through user’s HS (automatic or manual).

    Adding a non HS outbound node should remove the Tor icon.

    I am testing the combinations of the above.

  56. hebasto commented at 10:53 am on October 20, 2020: member

    @Sjors basically said this in #58 already, but the Tor icon should only be activated when:

    1. All outbound (default) connections are through Tor (either through the proxy, or to HS’s only); AND

    2. Inbound (optional) connections are EITHER disabled (this is the default when using -proxy), or are all through user’s HS (automatic or manual).

    Adding a non HS outbound node should remove the Tor icon.

    I am testing the combinations of the above.

    That exactly describes the current behavior :)

  57. Rspigler commented at 6:09 pm on October 23, 2020: contributor

    Some questions/notes I have from testing:

    Something I found, was that the Proxy Icon appears when there is no peers, and the Tor Icon appears only when there are peers, both independent of settings that could cause unsecured settings in the future. I’m concerned about marking connections as secure (that are secured in the moment) but that could become unsecured in the future.

    For example, currently if proxy is set, and listening is explicitly set as well (against defaults), the Proxy Icon still appears, even though an incoming clearnet connection could be made at any time, IIUC. If there isn’t a HS, listen should be off for the Proxy Icon to appear, IMO. (HS’s require listen=1).

    Another place I saw this was with the Tor Icon. If onlynet=onion, and listen=1, the Tor Icon appears because (at the moment) there are only Tor connections. I am concerned of the use case where someone may be thinking they have set up their node for a particular scenario where they need the utmost privacy, see the icon, think they have succeeded, but then come back later and see a bunch of clearnet connections. Perhaps there should be code to check for listen=0 and onionlisten=1?

    A third place I found this was if a proxy was set with a HS. If you have proxy=127.0.0.1:9050 and listen=1, you will have outgoing connections to HS’s and proxied outgoing connections to normal nodes. You will also have incoming connections to both your HS and clearnet connections to your node. However, here the Proxy Icon still appears. I believe it should only appear if you have bind=127.0.0.1?

    But this definitely complicates things, so maybe there should just be something in the release notes saying that the icons only indicate current connection status, not connection settings or future connection status, and in future PRs hopefully we can have easier configuration.

  58. hebasto commented at 6:27 pm on October 23, 2020: member

    @Rspigler

    Thanks for your valuable feedback!

    Regarding the proxy icon behavior it seems more appropriate to open a dedicated issue that could be discussed and addressed.

    Another place I saw this was with the Tor Icon. If onlynet=onion, and listen=1, the Tor Icon appears because (at the moment) there are only Tor connections. I am concerned of the use case where someone may be thinking they have set up their node for a particular scenario where they need the utmost privacy, see the icon, think they have succeeded, but then come back later and see a bunch of clearnet connections. Perhaps there should be code to check for listen=0 and onionlisten=1?

    The Tor icon is an indicator of current node connections. It is not a switch “keep node connections Tor only”. Having such a checkbox in the GUI is an orthogonal to this PR idea, and it deserves its own submitted issue to discuss.

    But this definitely complicates things, so maybe there should just be something in the release notes saying that the icons only indicate current connection status, not connection settings or future connection status, and in future PRs hopefully we can have easier configuration.

    Probably, you’d want to suggest a better tooltip text to explain the Tor icon behavior to users?

  59. Rspigler commented at 0:10 am on October 24, 2020: contributor

    Hi Hebasto,

    Thank you for your comments, those are all good points, and I agree. I will create a new issue for the discussion of having a setting in the GUI to create all connections Tor only.

  60. in src/qt/bitcoingui.cpp:934 in bd8df33356
    939-void BitcoinGUI::setNetworkActive(bool networkActive)
    940-{
    941-    updateNetworkState();
    942+    if (conn_counts.onion_only) {
    943+        m_tor_icon->setPixmap(platformStyle->SingleColorIcon(":/icons/tor_connected").pixmap(STATUSBAR_ICONSIZE, STATUSBAR_ICONSIZE));
    944+        m_tor_icon->setToolTip(tr("All connections are <b>via Tor</b> only"));
    


    Rspigler commented at 0:11 am on October 24, 2020:
    How about “All current connections are via Tor only”?
  61. luke-jr changes_requested
  62. luke-jr commented at 7:15 pm on October 24, 2020: member

    I don’t think the logic makes sense as-is.

    I see two possibilities for a Tor icon:

    1. Tor is working and usable (reachability).
    2. All connections, even hypothetically, will be only via Tor (network privacy).

    Right now, it’s “all connections at the moment happen to be via Tor”, which seems relatively useless - it doesn’t guarantee network privacy, nor reachability. What good is it?

    IMO the icon should probably be tri-state: “off”, or either scenario listed above.

  63. jonatack commented at 8:44 pm on October 24, 2020: contributor

    Agree with @luke-jr here. I’d suggest the first one, “Tor is working and usable on this node”, and not focus on the onion-only aspect for the reasons described above in #86 (comment).

    We may also want to distinguish between outbound (onlynet=onion) and inbound onion connections.

    The tooltip needs to be precise and clear about what the icon states signify.

  64. Rspigler commented at 9:09 pm on October 24, 2020: contributor
    I was hesitant to make an argument because I don’t review code, but as my comment (https://github.com/bitcoin-core/gui/pull/86#issuecomment-715496157) indicates above, I agree with @luke-jr and @jonatack as well. I would need someone else to analyze the partitioning risks of many nodes possibly going onion only, I don’t know enough to do so myself. But I prefer the ’tri-state’ option to Jonatack’s dual-state because it would be nice for user’s to know if they (1) have configured their HS properly and/or (2) have Tor only settings achieved.
  65. vasild commented at 10:15 am on October 26, 2020: contributor
    1. All connections, even hypothetically, will be only via Tor (network privacy).

    Currently we can’t “guarantee” this because we always have a listening port for clearnet. https://github.com/bitcoin/bitcoin/pull/20234 would make it possible. With that PR, if -bind=127.0.0.1:8334=onion is specified we would not bind on any other port and we can assume the node is running in Tor-only mode (for incoming connections, I guess -onlynet=onion would control the outgoing ones).

    Also, something to consider - once we have I2P connectivity, if “all connections, even hypothetically will be only via Tor or I2P”, should we then display both Tor or I2P icons or none of them (wrt the 3rd state “network privacy”)?

  66. Sjors commented at 11:23 am on October 26, 2020: member

    The combination ““All connections, at the moment happen to be via Tor” && “All connections, even hypothetically, will be only via Tor” makes sense as the boolean.

    A tristate works for me too, if there’s actually a way to verify reachability.

  67. Rspigler commented at 5:26 pm on October 26, 2020: contributor

    Currently we can’t “guarantee” this because we always have a listening port for clearnet.

    What about a HS with onlynet=onion listen=0 listenonion=1 ?

    once we have I2P connectivity, if “all connections, even hypothetically will be only via Tor or I2P”, should we then display both Tor or I2P icons or none of them (wrt the 3rd state “network privacy”)?

    Probably should be both, but maybe re-word the tooltip text from “All connections will be only via Tor” to something like “Clearnet connections are disabled for all connections. Tor is enabled) so there’s no error in logic when one or both is enabled.

  68. vasild commented at 8:15 am on October 27, 2020: contributor

    Currently we can’t “guarantee” this because we always have a listening port for clearnet.

    What about a HS with onlynet=onion listen=0 listenonion=1 ?

    listen=0 will cause us not to listen on any port, so we would not accept any incoming connections, regardless of whether clearnet or Tor. listenonion=1 will be automatically changed to listenonion=0 due to listen=0.

    But yes, just onlynet=onion listen=0 can be considered as Tor-only mode.

  69. Sjors commented at 8:53 am on October 27, 2020: member

    We could expand the behavior of onlynet=onion to prevent listening on the non-onion port.

    Currently:

    0  -onlynet=<net>
    1       Make outgoing connections only through network <net> (ipv4, ipv6 or
    2       onion). Incoming connections are not affected by this option.
    3       This option can be specified multiple times to allow multiple
    4       networks.
    
  70. Rspigler commented at 3:44 am on October 28, 2020: contributor

    listenonion=1 will be automatically changed to listenonion=0 due to listen=0.

    I don’t think this is true, because when I set onlynet=onion listen=0 and listenonion=1 my HS is enabled. But when I have onlynet=onion listen=0 and listenonion=0 in my config, my HS is disabled. So I would assume it would allow incoming onion connections

    We could expand the behavior of onlynet=onion to prevent listening on the non-onion port.

    I believe this was discussed here: https://github.com/bitcoin/bitcoin/issues/13436

  71. vasild commented at 8:51 am on October 28, 2020: contributor

    Alright, I was halfway wrong.

    listenonion=1 will be automatically changed to listenonion=0 due to listen=0

    ^ this is not true, as you have observed. However the following is true:

    listen=0 will cause us not to listen on any port, so we would not accept any incoming connections, regardless of whether clearnet or Tor.

     0$ bitcoind
     1...
     22020-10-28T08:41:57Z Config file arg: listen="0"
     32020-10-28T08:41:57Z Config file arg: listenonion="1"
     42020-10-28T08:41:57Z Config file arg: rpcport="8332"
     5...
     62020-10-28T08:42:19Z tor: Got service ID foo, advertising service foo.onion:8333
     72020-10-28T08:42:19Z AddLocal(foo.onion:8333,4)
     8
     9$ netstat
    10tcp4       0      0 127.0.0.1.8332         *.*                    LISTEN     
    11(bitcoind is only listening on the RPC port)
    

    I guess this can be considered as a bug because it will (I guess) advertise foo.onion:8333 where nobody is listening.

  72. Sjors commented at 3:02 pm on October 30, 2020: member

    I believe this was discussed here: bitcoin/bitcoin#13436

    That discussion was before we had a separate Tor port (binding to 127.0.0.1).

  73. Rspigler commented at 6:46 pm on October 30, 2020: contributor

    That discussion was before we had a separate Tor port (binding to 127.0.0.1).

    Ah, ok. IMO, that seems like it would be the easiest for the end user and also for this PR. Not sure how changing it would interact with other current network setting configurations we have.

  74. DrahtBot added the label Needs rebase on Dec 1, 2020
  75. DrahtBot commented at 9:39 am on December 1, 2020: contributor

    🐙 This pull request conflicts with the target branch and needs rebase.

    Want to unsubscribe from rebase notifications on this pull request? Just convert this pull request to a “draft”.

  76. Rspigler commented at 9:38 pm on December 14, 2020: contributor

    I think @luke-jr’s Tri-state should be combined w/ @jonatack’s inbound/outbound distinction. Discussed more here: #110 (comment)

    Is @vasild’s https://github.com/bitcoin/bitcoin/pull/20234 still a blocker for this? How does that work with/without expanding the behavior of onlynet=onion @Sjors ?

  77. Rspigler commented at 11:42 pm on December 14, 2020: contributor

    Edit: I feel less strongly about the concept of a Tor icon in general. Definitely supportive of switches in the GUI to help end users set up permanent configurations of connection types (https://github.com/bitcoin-core/gui/issues/110#issuecomment-744758113). But, if the user has done that, they should know what their connections are like.

    The icon possibility set is just too much. Tor incoming, both proxy and tor outgoing…etc. We would either need far too many icons, or the icons would only apply in rare scenarios (Would you give someone a Tor icon if they only have Tor outgoing and Incoming disabled? What about Tor outgoing and Proxy incoming? Or Tor outgoing and Tor incoming?)…

    This would get more complicated when I2P support is added. Maybe just have an icon for “My connections are only using privacy networks” as suggested by @kristapsk (https://github.com/bitcoin/bitcoin/pull/20172#issuecomment-722451210)

  78. hebasto marked this as a draft on Dec 23, 2020
  79. jarolrod commented at 0:29 am on January 19, 2021: member

    Concept ACK, Tested bd8df33356134efd6e2ccf1acb4e12dad44cb006 on macOS 11.1 with Qt 5.15.2

    Tor Only: Tor Icon Shows

    Tor and IPv4 Connection: Tor Icon Does not Show (intended)

    Thoughts on the discussion had so far: This is part of a bigger discussion, but it would be a good feature to represent the connection type in the form of an Icon, for all connection types. The Tor icon is one step towards this. While outside the scope of this PR, I would propose an Icon for each network type to show.

    Specifically concerning the Tor Icon: I think that the Tor Icon should show ONLY when ALL of our connections are Tor (Like this PR implements). Perhaps we show a (to be designed) Fusion icon when you have a combination of Tor and another network type like IPv4.

  80. rebroad commented at 6:59 pm on April 19, 2021: contributor
    @hebasto What’s a use case for this?
  81. hebasto commented at 1:40 pm on May 2, 2021: member

    @rebroad

    @hebasto What’s a use case for this?

    The initial idea was to give to a user some representation about her node privacy level.

  82. hebasto commented at 1:41 pm on May 2, 2021: member
    Closing. Leaving it up for grabs.
  83. hebasto closed this on May 2, 2021

  84. hebasto removed the label Needs rebase on May 2, 2021
  85. hebasto added the label Feature on May 2, 2021
  86. hebasto added the label up for grabs on May 2, 2021
  87. bitcoin-core locked this on Aug 16, 2022

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin-core/gui. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2024-10-23 00:20 UTC

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