Commit Graph

19 Commits

Author SHA1 Message Date
jl777
e73b2055c6 Merge branch 'beta' into mergemaster
# Conflicts:
#	src/main.cpp
2018-04-16 10:16:01 +03:00
Jack Grigg
87b7f4d878 torcontrol: Log invalid parameters in Tor reply strings where meaningful 2017-03-26 14:35:13 +13:00
Jack Grigg
3290567bbd torcontrol: Check for reading errors in ReadBinaryFile
This ensures that ReadBinaryFile never returns exactly TOR_COOKIE_SIZE bytes if
the file was larger than that.
2017-03-26 13:53:13 +13:00
Jack Grigg
64101d0407 torcontrol: Fix ParseTorReplyMapping
- Ignore remaining input if it is an OptArguments
- Correctly handle escapes
2017-03-26 00:35:13 +13:00
Jack Grigg
8966598033 torcontrol: Improve comments 2017-03-25 20:25:59 +13:00
Pavel Janík
4b5ba449bb Make some global variables less-global (static) 2017-03-25 20:25:57 +13:00
Pavel Janík
f0e9019223 Prevent -Wshadow warnings with gcc versions 4.8.5, 5.3.1 and 6.2.1.
Zcash: partial (ignoring src/test/script_tests.cpp due to merge conflicts)
2017-03-25 20:25:56 +13:00
Wladimir J. van der Laan
9e5c9d0a04 torcontrol: Explicitly request RSA1024 private key
When generating a new service key, explicitly request a RSA1024 one.

The bitcoin P2P protocol has no support for the longer hidden service names
that will come with ed25519 keys, until it does, we depend on the old
hidden service type so make this explicit.

See #9214.
2017-03-25 20:25:55 +13:00
Wladimir J. van der Laan
ca5e229514 tor: Change auth order to only use HASHEDPASSWORD if -torpassword
Change authentication order to make it more clear (see #7700).

- If the `-torpassword` option is provided, force use of
  `HASHEDPASSWORD` auth.

- Give error message if `-torpassword` provided, but
  `HASHEDPASSWORD` auth is not available.

- Give error message if only `HASHEDPASSWORD` available, but
  `-torpassword` not given.
2017-03-25 20:25:50 +13:00
Jonas Schnelli
1a41e3f660 Fix torcontrol.cpp unused private field warning 2017-03-25 20:25:48 +13:00
Wladimir J. van der Laan
3d7cddcaa2 Fix memleak in TorController [rework]
It looks like, TorController::disconnected_cb(TorControlConnection&
conn) gets called multiple times which results in multiple event_new().

Avoid this by creating the event only once in the constructore, and
deleting it only once in the destructor (thanks to Cory Fields for the
idea).

Replaces the fix by Jonas Schnelli in #7610, see discussion there.
2017-03-25 20:25:46 +13:00
Patrick Strateman
a05be280e7 Remove vfReachable and modify IsReachable to only use vfLimited.
We do not know that a class of Network is reachable, only that it is not.
2017-03-25 20:25:45 +13:00
calebogden
e10e212470 Fixing typos on security-check.py and torcontrol.cpp 2017-03-25 20:25:41 +13:00
MarcoFalke
9b46a35b8d torcontrol debug: Change to a blanket message that covers both cases 2017-03-25 20:25:39 +13:00
Daniel Cousens
65fd8eb134 torcontrol: only output disconnect if -debug=tor 2017-03-25 20:25:35 +13:00
Peter Todd
2b30758b2f Connect to Tor hidden services by default
Adds 127.0.0.1:9050 for the .onion proxy if we can succesfully connect
to the control port.

Natural followup to creating hidden services automatically.
2017-03-25 20:24:58 +13:00
Wladimir J. van der Laan
975dc649af torcontrol improvements and fixes
- Force AUTHCOOKIE size to be 32 bytes: This provides protection against
  an attack where a process pretends to be Tor and uses the cookie
  authentication method to nab arbitrary files such as the
  wallet
- torcontrol logging
- fix cookie auth
- add HASHEDPASSWORD auth, fix fd leak when fwrite() fails
- better error reporting when cookie file is not ok
- better init/shutdown flow
- stop advertizing service when disconnected from tor control port
- COOKIE->SAFECOOKIE auth
2017-03-25 20:22:12 +13:00
Peter Todd
77e5601e9e Better error message if Tor version too old 2017-03-25 20:22:11 +13:00
Wladimir J. van der Laan
eb5f63fe58 net: Automatically create hidden service, listen on Tor
Starting with Tor version 0.2.7.1 it is possible, through Tor's control socket
API, to create and destroy 'ephemeral' hidden services programmatically.
https://stem.torproject.org/api/control.html#stem.control.Controller.create_ephemeral_hidden_service

This means that if Tor is running (and proper authorization is available),
bitcoin automatically creates a hidden service to listen on, without user
manual configuration. This will positively affect the number of available
.onion nodes.

- When the node is started, connect to Tor through control socket
- Send `ADD_ONION` command
- First time:
    - Make it create a hidden service key
    - Save the key in the data directory for later usage
- Make it redirect port 8333 to the local port 8333 (or whatever port we're listening on).
- Keep control socket connection open for as long node is running. The hidden service will
  (by default) automatically go away when the connection is closed.
2017-03-25 20:22:09 +13:00