Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add External Tor Usage Documentation #1262

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

preland
Copy link
Contributor

@preland preland commented Sep 8, 2024

This PR addresses #1253.

@preland preland requested a review from a team as a code owner September 8, 2024 23:25
@boldsuck
Copy link
Contributor

boldsuck commented Sep 9, 2024

Hi @preland,
external Tor for Haveno Client can be used in 2 ways.

  1. Your way with ControlPort: Haveno Client creates a hidden service with jtorctl. (You can not use HiddenServices options.)
    Important: Haveno user must be in tor group to use ControlPort.
    Add user to tor group on Debian/Ubuntu sudo usermod -aG debian-tor <user>.

  2. Or how the seednodes, use the SocksPort. (Haveno user must not in tor group)
    The HiddenService must be created in /etc/tor/torrc. (You can use all HiddenServices options.)
    e.g.:

# Haveno incoming anonymity connections
HiddenServiceDir /var/lib/tor/haveno_service/
HiddenServicePort 9999 127.0.0.1:9999
HiddenServicePort 9999 [::1]:9999

With Haveno flags --hiddenServiceAddress=some.onion --nodePort=9999 or in haveno.properties.
#1170 (comment)

Maybe you can link to the seednode documentation ### Install Tor
https://github.com/haveno-dex/haveno/blob/master/docs/deployment-guide.md#install-tor
Install Tor from deb.torproject.org is preferred, Debian backports are also OK. Usually only a few days later. Both are from the same maintainer.

Prove if PoW is enabled: tor --list-modules
Tor config e.g. CookieAuthFile is preconfigured on Debian derivatives by /usr/share/tor/tor-service-defaults-torrc


### 1. Download and Install Tor
#### Linux
You can install Tor through your system's package manager, or directly by going to torproject.org. Note that your package manager's version of tor might be outdated or non-GNU (see below note).
Copy link
Contributor

@woodser woodser Sep 13, 2024

Choose a reason for hiding this comment

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

Can you give an example using a common package manager? For example apt install ...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

All of the issues mentioned should be addressed

#### Linux
You can install Tor through your system's package manager, or directly by going to torproject.org. Note that your package manager's version of tor might be outdated or non-GNU (see below note).
#### MacOS
You can install Tor through Homebrew (brew install tor), or directly by going to torproject.org. Note that the Homebrew version of tor might be outdated or non-GNU (see note below).
Copy link
Contributor

Choose a reason for hiding this comment

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

Change to `brew install tor` with the backticks, so it's clear it's a command.

```
> The "CookieAuthFile" path should be in a relatively stable and safe place. A good place to put it is in the same directory as torrc.

### The location of your torrc file varies depending on your system:
Copy link
Contributor

Choose a reason for hiding this comment

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

Should be '####' so it's not at same level as main numbers?

Copy link
Contributor

Choose a reason for hiding this comment

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

These files do not exist by default after installing (at least on mac). Should they create it manually? Or start tor and stop tor to create the default file?

You can install Tor directly by going to torproject.org.
> For best results, ensure that your version of tor matches the one currently used by Haveno. To improve loading times, it is highly recommended to use the GNU build, as it has support for POW. You can check if your build is GNU by running tor --version and looking for a response mentioning GNU.

### 2. Add the following lines to your torrc:
Copy link
Contributor

Choose a reason for hiding this comment

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

Please change to "torcc file:" for clarity / consistency.

CookieAuthentication 1
CookieAuthFile <path to cookie auth file>
```
> The "CookieAuthFile" path should be in a relatively stable and safe place. A good place to put it is in the same directory as torrc.
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe show an example path to use for CookieAuthFile?

Something like:

"For example, on Linux you could use CookieAuthFile /etc/tor/torrc"

#### Windows
```\Browser\TorBrowser\Data\Tor\torrc``` (when using the Tor Browser Bundle)

> The above locations are best guesses, and may be incorrect depending on your installation method or platform distribution. In the case that you cannot find the correct directory to place your torrc, tor can be ran in the following format to use a custom torrc: ```tor -f <torrc>```
Copy link
Contributor

@woodser woodser Sep 13, 2024

Choose a reason for hiding this comment

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

Suggested tweaks:

"The above locations may vary depending on your installation method or platform distribution. If you cannot find the correct directory to place your torrc file, you can specify a custom path to torcc in the following format: tor -f <path to torcc>

## Using External Tor with Haveno:
Run the Haveno binary with the following extra flags:
```
--torControlPort=9051 --torControlCookieFile=<path to cookie auth file> --torControlUseSafeCookieAuth=true
Copy link
Contributor

Choose a reason for hiding this comment

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

Just confirming, the user must repeat these definitions, both in the torcc file and when invoking the Haveno binary?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes; this tells Haveno to use the tor port and authentication for the external tor instead of the internal tor

```
> Replace the ```<path to cookie auth file>``` with the location you specified in step 2.

> Depending on how your version of Haveno was distributed, you may not have direct access to the haveno binary. In this case, you should look inside your Haveno distribution for the binary, and then run the binary using the above flags. For example, on MacOS the binary will be located within the app at Haveno.app/Contents/MacOS/Haveno, or something similar.
Copy link
Contributor

Choose a reason for hiding this comment

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

"haveno" should be capitalized for consistency.

@woodser
Copy link
Contributor

woodser commented Sep 18, 2024

I can't get tor to create my cookie authentication file for some reason. Not sure what I'm doing wrong, but it's not created when tor is started. I've configured my torrc file (installed through homebrew):

ControlPort 9051
CookieAuthentication 1
CookieAuthFile /opt/homebrew/etc/tor/control_auth_cookie

Tor has permission to write to that directory.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants