Skip to content
This repository has been archived by the owner on Mar 28, 2023. It is now read-only.

Tor #560

Merged
merged 26 commits into from
Jul 17, 2017
Merged

Tor #560

merged 26 commits into from
Jul 17, 2017

Conversation

rmisio
Copy link
Contributor

@rmisio rmisio commented Jul 11, 2017

This change-set wires in Tor controls to the client.

closes #315

To test:

  1. Ensure Tor will run on your machine without authentication
    a. Download the Tor browser.
    b. Start up the Tor browser.
    c. Attempt to start your server with the --tor flag. If it works, you'll see this in the terminal ([Execute] [NOTICE] Using Tor exclusively) and you're free to proceed to step 2. If it doesn't work, you'll likely see some type of auth error in the terminal. In that case, please ping @rmisio for further debugging.

The following steps will allow your client to masquerade as the bundled app and test Tor scenarios specific to the bundled (installer) version of the app.

  1. Ensure no OB servers are running.
  2. Start-up the client and run localStorage.clear() in the console.
  3. Shut-down the client.
  4. Download the latest Server release for your OS. Rename it to openbazaard on Linux or Mac, openbazaard.exe on Windows. Ensure the file is exectuable (chmod +x on Mac and Linux)
  5. Edit main.js with the path to the executable in the previous step. Find the first line, comment it out and add the second line.
// const serverPath = `${__dirname}${path.sep}..${path.sep}openbazaar-go${path.sep}`;
const serverPath = '/path/to/executable/'; // do not include filename, do include trailing `/`
  1. Start up the client. It will create a server configuration and attempt to connect to the built-in server that you downloaded.

If you are able to set-up a remote server, it would be a really good test to toggle your connection between a remote server and the built-in server and ensure that the connection is properly in Tor mode when you configure it (check 'use Tor') to be.

@cpacia
Copy link
Member

cpacia commented Jul 12, 2017

Not seeing the tor icon in the url bar

@rmisio
Copy link
Contributor Author

rmisio commented Jul 12, 2017

@cpacia The tor indicator will show up when the following conditions are met:

1.) Your are connected to a server that was started in tor mode and that server is returning tor: true via the ob/config api.
2.) In the client, the server configuration for that connection is configured to use Tor:

image

Are both those conditions met for you?

@cpacia
Copy link
Member

cpacia commented Jul 12, 2017

Oh duh that's right I have to set it in the config

@cpacia
Copy link
Member

cpacia commented Jul 12, 2017

image

Ok this is what I wanted to show... the icon is a bit choppy on my system.

@rmisio
Copy link
Contributor Author

rmisio commented Jul 12, 2017

I think I'll leave choppy icons to @morebrownies . The client is sizing the icon down to 13px to try and match the design. Do you want to play around with maybe bumping it up or down a pixel or two and seeing if that helps?

Maybe at 14px it looks better?

image

(It may just be an overly detailed icon that's not designed to be shown that small, at least on non-retina displays)

@morebrownies
Copy link

Ok, I'll try to get around to testing this later today.

@morebrownies
Copy link

@rmisio @cpacia I'm attempting to run my server with Tor and I'm running into this issue:

| => go run openbazaard.go start -t --tor
OpenBazaar Server v0.6.4 starting...
12:43:40.067 [Execute] [ERROR] Authentication failed: invalid (empty) COOKIEFILE
Authentication failed: invalid (empty) COOKIEFILE
exit status 1

Any idea what is going on with my 🍪 file?

@rmisio
Copy link
Contributor Author

rmisio commented Jul 13, 2017

@morebrownies Yeah, it's the same thing Josh is going through. You're basically confirming that the Tor Browser needs specific configuration before being able to work with OB. @jjeffryes is working through putting together an instruction doc for it as I type (for Win and Mac). You may want to wait until he's done and work off that.

Basically, you need to configure your Tor Browser to use a password and give that password to the OB config.

If you want the cliff's notes version (for Mac):

  • in terminal navigate to /Applications/TorBrowser.app/Contents/MacOS/Tor
  • execute ./tor.real --hash-password mypassword. This will output a hashed version of the password.
  • cd ~/Library/Application\ Support/TorBrowser-Data/Tor and edit torrc by adding this line:
    HashedControlPassword 16:0E016FA8F074C73460B7B55C1258A01CE5EA152282A20B8F7840948C3A
    (use the hashed password from the previous step in place of the hash in the line above)
  • also add in this line CookieAuthentication 0. If there already was a line for CookieAuthentication, then replace it so it is set to 0.
  • now edit your ob config, but give it the plain text password:
  "Tor-config": {
    "Password": "mypassword",
    "TorControl": ""
  },
  • now you should be able to start the OB server in Tor mode. You'll need to bounce the Tor browser.

@morebrownies
Copy link

Ok great thank you @rmisio I'll give this a shot

@morebrownies
Copy link

I didn't get very far on this one @rmisio

| => cd /Applications/TorBrowser.app/Contents/Resources/TorBrowser/Tor
total 5576
drwxr-xr-x@ 3 Wolf admin 102B Jul 2 10:28 PluggableTransports/
-rw-r--r--@ 1 Wolf admin 3.5M Jul 1 07:53 geoip
-rw-r--r--@ 1 Wolf admin 2.0M Jul 1 07:53 geoip6
-rwxr-xr-x@ 1 Wolf admin 735B Jul 1 07:53 tor
-rw-r--r--@ 1 Wolf admin 798B Jul 1 07:53 torrc-defaults


| /Applications/TorBrowser.app/Contents/Resources/TorBrowser/Tor @ Mikes-MacBook-Pro (Wolf)
| => ./tor.real --hash-password mypassword
-bash: ./tor.real: No such file or directory

@rmisio
Copy link
Contributor Author

rmisio commented Jul 13, 2017

Eternal damnation! I gave you the wrong path!

Sorry @morebrownies, it's /Applications/TorBrowser.app/Contents/MacOS/Tor

Copy link
Contributor

@jjeffryes jjeffryes left a comment

Choose a reason for hiding this comment

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

Looks good. I found one spot that looks like it has the wrong variable, and had a question. Very minor.

if (split.length !== 2) {
valid = false;
} else {
if (!is.ip(valid[0])) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Shouldn't this be split[0], since valid is a boolean, and split has the ip address?

// open, we won't auto send them to the config form, since it may interrupt something else
// they may be doing.
this.trigger('editConfig', {
model: this.collection.defaultConfig,
Copy link
Contributor

Choose a reason for hiding this comment

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

Can this also happen if you're using a configuration that isn't default, but is using Tor?

Copy link
Contributor Author

@rmisio rmisio Jul 14, 2017

Choose a reason for hiding this comment

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

No, we would only get a 'tor-not-available' error on the default (i.e. built-in) server, because that's the only one that we control and can start-up via the status command to determine if Tor is available. For stand-alon servers, it is the responsibility of the user to start the server in Tor mode. If they forget to start the Tor browser and they start the server with --tor, then it will fail to start.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

And... if they forget to start their server in Tor mode and connect via the client (even with Use Tor checked on the client), they have leaked their IP. They will not see the Tor indicator, but it's already too late.

Users managing their own server will have a big responsibility on them.

@rmisio
Copy link
Contributor Author

rmisio commented Jul 17, 2017

@jjeffryes this should be ready to code with code review updates. Also added in a 'Tor active' tooltip at @morebrownies request.

@jjeffryes jjeffryes merged commit 8663ba4 into master Jul 17, 2017
@jjeffryes jjeffryes deleted the tor branch July 17, 2017 17:55
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add Tor Controls in the Client
4 participants