Skip to content

Conversation

jonatack
Copy link
Member

@jonatack jonatack commented Sep 16, 2020

It looks like doc/tor.md could use some updates and improvements, not only for Tor v3, but also for setting multiple addresses with -externalip (see the conversation from http://www.erisian.com.au/bitcoin-core-dev/log-2020-09-16.html#l-39), how to see information about your Tor config via Bitcoin Core, and other improvements.

Closes #19924.

@fanquake fanquake added the Docs label Sep 16, 2020
Copy link
Contributor

@RiccardoMasutti RiccardoMasutti left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACK. Seems good to me.

@Saibato
Copy link
Contributor

Saibato commented Sep 16, 2020

Pls feel free to grab from 654dc04

Then I can strip this from #19358 and rename that and re push
As.
torcontrol :do not override with default proxy settings in hidden service, if the user has chosen otherwise according with the wording in the docs .

Since we until now notoriously in disrespect override the users wished settings with the defaults in torcontrol.

PR #19358 should be applied or tor.md doc changed to reflect that footgun.

@jonatack
Copy link
Member Author

@Saibato thanks, I'll look at testing and pulling in that commit. In any case I need to verify and improve this draft. @RiccardoMasutti thanks.

doc/tor.md Outdated
-externalip=X You can tell bitcoin about its publicly reachable addresses
using this option, and this can be a .onion address. Given
the above configuration, you can find your .onion address in
/var/lib/tor/bitcoin-service/hostname. For connections
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When a hidden service is created via tor-control, /var/lib/tor/bitcoin-service/hostname is not created (credits to @vasild).

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But this new text reads:

Given the above configuration ...

and just a few lines above it says how to configure the hidden service via torrc:

HiddenServiceDir /var/lib/tor/bitcoin-service/
HiddenServicePort 8333 127.0.0.1:8333
HiddenServicePort 18333 127.0.0.1:18333

So it is ok to mention /var/lib/tor/bitcoin-service/hostname.

I would suggest to drop the last line HiddenServicePort 18333 127.0.0.1:18333 because it is for testnet and also to add HiddenServiceVersion 3 so that the tor daemon creates a v3 service:

HiddenServiceDir /var/lib/tor/bitcoin-service/
HiddenServiceVersion 3
HiddenServicePort 8333 127.0.0.1:8333

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does bitcoind configure its onion service via torrc?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#19961 (comment)
Even given the above configuration, you make a point to consider we are talking about the operation of the parameter.

If the hidden service is created via tor-control and you need to discover it please check you debug.log for lines similar to the following, it should automatically be added as AddLocal

2020-08-11T13:42:26Z tor: Got service ID {random_service}, advertising service {random_service}.onion:8333
2020-08-11T13:42:26Z AddLocal({random_service}.onion:8333,4)

Copy link
Contributor

@vasild vasild left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACK a326956

@vasild
Copy link
Contributor

vasild commented Sep 23, 2020

Maybe split the white-space changes in a separate commit to ease further reviewers.

Copy link

@ghost ghost left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Few things that we can add in the updates:

Examples to run Bitcoin as onion service, use of tor bridges and safe ways to connect over tor: #19923

We can mention "How to check onion address"? : #19924

@Willtech
Copy link
Contributor

Willtech commented Oct 5, 2020

Few things that we can add in the updates:

Examples to run Bitcoin as onion service, use of tor bridges and safe ways to connect over tor: #19923

We can mention "How to check onion address"? : #19924

I have replied on each FR where it is appropriate.

@jonatack
Copy link
Member Author

Thanks everyone for the feedback. There are quite a few updates to do to bring this doc up-to-date. Will bring it out of draft status soon.

@Rspigler
Copy link
Contributor

Thanks for taking this on! My concern is that the doc doesn't really help the most common end users.

Connecting to Tor's control socket API requires one of two authentication methods to be configured. It also requires the control socket to be enabled, e.g. put ControlPort 9051 in torrc config file. For cookie authentication the user running bitcoind must have read access to the CookieAuthFile specified in Tor configuration.

This is nonsense/scary to most people. This ultimately means that most users either don't end up enabling Hidden Services, or have to go to other websites/tutorials to do so (which could be giving them wrong information). I think our docs could do a much better job explaining to the layperson how to do so.

@jonatack
Copy link
Member Author

I have a number of updates written that I haven't yet pushed. My concern is that they are changing too much and will discourage review and not be merged. It's on my list to scale them down and push soon.

@ghost
Copy link

ghost commented Dec 14, 2020

I think our docs could do a much better job explaining to the layperson how to do so.

Agree. I think adding screenshots and examples could help.

@jonatack
Copy link
Member Author

I think our docs could do a much better job explaining to the layperson how to do so.

I don't know if a tutorial for non-technical people is the kind of doc that should be in the source code repository, but it is indeed beyond the scope of what I planned to propose (which I'm scaling down to be reviewable).

@Rspigler
Copy link
Contributor

@jonatack That makes sense. Maybe that's something I'll work on updating for the BitcoinWiki after the recent tor/GUI changes get merged.

@jonatack jonatack marked this pull request as ready for review December 16, 2020 15:17
@jonatack
Copy link
Member Author

Updated. If everyone can review today, maybe this can still be in 0.21 as rc4 is being finalised.

It may be easiest to review each commit separately. Happy to drop the last commit if it's too much to review.

@jonatack
Copy link
Member Author

I also recommend viewing the diff by clicking on the "Display the rich diff" button at top right.

@Saibato
Copy link
Contributor

Saibato commented Dec 16, 2020

@jonatack
for some config and setup hints to add u could add, u might want to look into
https://github.com/ElementsProject/lightning/blob/master/doc/TOR.md
pls also note that the Torcontrol and onlynet bug fix PR;s are not merged in 0.21
so maybe some hint her fro the user to be not surprised by unexpected behavior might be a good idea.
ref. 654dc04
or #20582

doc/tor.md Outdated
than onion you *cannot* disable onion connections; outgoing onion
connections will be enabled when you use -proxy or -onion. Use
-noonion or -onion=0 if you want to be sure there are no outbound
onion connections over the default proxy or your defined -proxy.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this mean onlynet=ipv4 onion=0 does not disable onion connections? This seems confusing.

-noonion or onion=0 is always needed to explicitly disable outbound onion access, as described in the -proxy and onion section?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(I missed this last commit, glad you asked for the clarification. I ACKd 42e6180)

Copy link
Contributor

@Saibato Saibato Dec 17, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this mean onlynet=ipv4 onion=0 does not disable onion connections? This seems confusing.

Yes and No , a default fallback outbound pure .onion not IP name resolving proxy just for onion address will be created by default even without -proxy definition if ̶o̶n̶i̶o̶n̶!̶=̶0̶ ̶ ̶ to be precise if -onion== "" and regardless of -onlynet= if -listenonion=1 ( default) if the inbound Tor onion service could be created successfully by the ever polling torcontroller in bitcoind (What creates your advertised Tor address created by bitcoind independent of what onion services defined in torrc ) The idea was, (i guess) if that is successfully to create also an outbound proxy to reach Tor onion nodes.

So suppose u have a running bitcoind daemon and edit at some point just torrc to allow the control port or start the Tor service, bitcoind does if -listeonion=1 permanent poll for such changes and instantly creates on the fly an inbound onion address and an outbound proxy. So if u want to be sure that the outbound default proxy is disabled since u want i.e. just ipv4 set -noonion since -onlynet=ipv4 wont do that and please note the inbound Tor is created regardless of that if -listenonion=1 what is the default.

If that is a desired way to act depends, fixes or changes to that are not merged yet and at least that's the way it is and its now documented so that users are aware of that.

Copy link
Contributor

@Saibato Saibato Dec 17, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jonatack did edit the comment text to be more precise, so please review ur thumbs up ;-)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Dropping this commit.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jonatack i am almost certain there will be an rc5 and some backport's ping @luke-jr, so no time to rush here and have another release that is not precise in what the options and Tor-controller does.

Do u need a detailed descriiption and log to show the real behavior?

Copy link
Contributor

@Saibato Saibato Dec 17, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Rspigler tyi, only explicit -nonion or -onion=0 can prevent outbound onion connections, solely -onllynet=pv4/ipv6 is not sufficient to disable that.

that what is said in the PR now dropped.

Please use -noonion or -onion=0 if you want to be sure to have no
outbound onion connections over the default proxy or your defined proxy..

654dc04#diff-a33b1b15efbc14c65460ef7a883b530ca52144a4f06642e4a188351d959f9894R42

So please be so kind to hint what was misunderstanding in this wording that u came to the conclusion that -onion=0 would not prevent all outbound onion connections so that we can adapt that in followup PR

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Saibato I might propose the dropped commits, including yours, in a new PR and make some of the changes suggested by @vasild.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Saibato thanks for the explanation/edits. Although now dropped, would ACK in a new PR

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Saibato thanks for the explanation/edits. Although now dropped, would ACK in a new PR

Done in #20757, please add suggestions or ACKs there.

doc/tor.md Outdated
Comment on lines 48 to 52
ipv4, ipv6 or onion. If you use this option with values other
than onion you *cannot* disable onion connections; outgoing onion
connections will be enabled when you use -proxy or -onion. Use
-noonion or -onion=0 if you want to be sure there are no outbound
onion connections over the default proxy or your defined -proxy.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Huh! :-( This is indeed a strange behavior, but I think something like the following belongs to bitcoind -help rather than doc/tor.md:

If -onlynet= is used with other networks and -onlynet=onion is not among them, but -onion= or -proxy is provided then outbound onion connections will still be made! Use -noonion or -onion=0 to disable outbound onion connections in this case.

Given that this is a guide on how to enable and configure Tor, not how to disable it, I would suggest to drop the last part and leave it to just:

-onlynet=onion  Make outgoing connections only to .onion addresses. Incoming
	        connections are not affected by this option.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Dropped the commit completely.

Copy link
Contributor

@Saibato Saibato Dec 17, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vasild

-onlynet=onion Make outgoing connections only to .onion addresses. Incoming
connections are not affected by this option.

I guess its hard to grasp and i was 🤦‍♀️ too when i stumbled about, but what we believed the code does from src comments or doc and almost any post i am aware about bitcoin and Tor and social media is
not what really happens when assuming option do what they say and u follow the docs.

only -noonion or -onion=0 can prevent that, onlynet= is buggy since #7553 (2016)
Similar but also fact is that although seeders are not called directly in IP if the DNS returns are random that is not the case when bootstrap over Tor here the seeders have full control and can be sure ( or ther MITM'S or proxys) that the first entry in the DNS return a exit gets will be called since socks5 works that way all seeders ( or what they want to be called ) will be called in a distinct sequence over exist and then ADDR gossip that is highly disturbing give the timing correlation bogus Tor relays and exits can do.
Tacking in account that all that happens and wrong configured at bootstrap at least once, pure Tor nodes are quite f***ed if they not aware.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Brought back the commits and added also to the -onlynet help in #20757, please add suggestions or ACKs there.

@jonatack
Copy link
Member Author

jonatack commented Dec 17, 2020

Dropped the last two commits to reduce the scope to have this merged in time for rc4. I think they were good but they can be proposed in another PR.

Can everyone please ACK?

@laanwj
Copy link
Member

laanwj commented Dec 17, 2020

ACK a34eceb

@laanwj laanwj merged commit 7ef6b1c into bitcoin:master Dec 17, 2020
@jonatack jonatack deleted the update-tor-md branch December 17, 2020 10:48
@vasild
Copy link
Contributor

vasild commented Dec 17, 2020

ACK a34eceb

maflcko pushed a commit to maflcko/bitcoin-core that referenced this pull request Dec 17, 2020
maflcko pushed a commit to maflcko/bitcoin-core that referenced this pull request Dec 17, 2020
maflcko pushed a commit to maflcko/bitcoin-core that referenced this pull request Dec 17, 2020
sidhujag pushed a commit to syscoin/syscoin that referenced this pull request Dec 17, 2020
@Rspigler
Copy link
Contributor

Post-merge ACK a34eceb

@Willtech
Copy link
Contributor

FYI: There is a reviewed tutorial here for using Bitcoin Core with Tor that seems to have a permalink, albeit the tutorial deliberately steps over many things in Tor that a user could benefit from having a detailed explanation of, such as participation in the tor network, https://bitcoin.stackexchange.com/q/70069/75001

Copy link

@felipsoarez felipsoarez left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACK a34eceb

maflcko pushed a commit to bitcoin-core/gui that referenced this pull request Jan 27, 2021
193f9a9 doc: update tor.md manual config, move after automatic config (Jon Atack)
9af99b6 doc: update/improve automatic tor section of tor.md (Jon Atack)
dfc4ce1 doc: update -proxy, -onion and -onlynet info in tor.md (saibato)
784a278 doc: update -onlynet help in src/init.cpp (Jon Atack)

Pull request description:

  This continues the tor documentation and help improvements of #19961 and clarifies issues that contributors have been mentioning and noticing, like in bitcoin/bitcoin#20555 (comment).

  More info:

  - bitcoin/bitcoin#19961 (comment)
  - bitcoin/bitcoin#19961 (comment)

ACKs for top commit:
  Rspigler:
    ACK 193f9a9
  prayank23:
    ACK bitcoin/bitcoin@193f9a9 bitcoin/bitcoin@9af99b6 bitcoin/bitcoin@dfc4ce1

Tree-SHA512: edb1b776c4624e1c2e30d829511c226a6492b719f5d1aaaeee1eaade47c108a99c09004d13a05f70b2d65f36db3db647902b5ea36807a87065f34acade33ccea
furszy added a commit to furszy/bitcoin-core that referenced this pull request Jul 29, 2021
furszy added a commit to furszy/bitcoin-core that referenced this pull request Jul 30, 2021
furszy added a commit to furszy/bitcoin-core that referenced this pull request Jul 31, 2021
furszy added a commit to furszy/bitcoin-core that referenced this pull request Aug 1, 2021
furszy added a commit to furszy/bitcoin-core that referenced this pull request Aug 4, 2021
furszy added a commit to furszy/bitcoin-core that referenced this pull request Aug 5, 2021
furszy added a commit to furszy/bitcoin-core that referenced this pull request Aug 8, 2021
furszy added a commit to furszy/bitcoin-core that referenced this pull request Aug 10, 2021
Fabcien pushed a commit to Bitcoin-ABC/bitcoin-abc that referenced this pull request Feb 15, 2022
Summary:
> doc: update tor.md address examples from onion v2 to v3

> doc: add tor.md section on how to get tor info via bitcoind

> doc: update -externalip documentation in tor.md

This is a backport of [[bitcoin/bitcoin#19961 | core#19961]]

Test Plan: proofreading

Reviewers: #bitcoin_abc, Fabien

Reviewed By: #bitcoin_abc, Fabien

Subscribers: Fabien

Differential Revision: https://reviews.bitcoinabc.org/D11031
@bitcoin bitcoin locked as resolved and limited conversation to collaborators Aug 18, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Onion address in Bitcoin Core Wallet
10 participants