Commit graph

35 commits

Author SHA1 Message Date
Jack Grigg
0182a11737
torcontrol: Log invalid parameters in Tor reply strings where meaningful 2017-05-16 18:22:22 +12:00
Jack Grigg
0b6f40d4ca
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-05-16 18:22:19 +12:00
Jack Grigg
d63677bbb2
torcontrol: Fix ParseTorReplyMapping
- Ignore remaining input if it is an OptArguments
- Correctly handle escapes
2017-05-16 18:22:16 +12:00
Jack Grigg
d8e03c0340
torcontrol: Improve comments 2017-05-16 18:21:54 +12:00
Wladimir J. van der Laan
75594bd7f2 torcontrol: Use fs::path instead of std::string for private key path 2017-04-03 12:33:14 +02:00
Gregory Maxwell
6b3bb3d9ba Change LogAcceptCategory to use uint32_t rather than sets of strings.
This changes the logging categories to boolean flags instead of strings.

This simplifies the acceptance testing by avoiding accessing a scoped
 static thread local pointer to a thread local set of strings.  It
 eliminates the only use of boost::thread_specific_ptr outside of
 lockorder debugging.

This change allows log entries to be directed to multiple categories
 and makes it easy to change the logging flags at runtime (e.g. via
 an RPC, though that isn't done by this commit.)

It also eliminates the fDebug global.

Configuration of unknown logging categories now produces a warning.
2017-04-01 18:53:29 +00:00
Pavel Janík
c4b60b3d9c Make some global variables less-global (static) 2017-03-18 07:59:50 +01:00
Pavel Janík
bb2aaeeeea Prevent -Wshadow warnings with gcc versions 4.8.5, 5.3.1 and 6.2.1. 2017-03-18 07:59:50 +01:00
practicalswift
cc16d99f1d [trivial] Fix typos in comments 2017-01-27 21:22:35 +01:00
isle2983
27765b6403 Increment MIT Licence copyright header year on files modified in 2016
Edited via:

$ contrib/devtools/copyright_header.py update .
2016-12-31 11:01:21 -07:00
Karl-Johan Alm
8c1dbc5e9d Refactor: Removed begin/end_ptr functions. 2016-12-09 13:15:19 +09:00
Wladimir J. van der Laan
7d3b627395 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.
2016-11-28 17:18:46 +01:00
Pavel Janík
4731cab8fb Do not shadow variables 2016-09-27 09:25:15 +02:00
Cory Fields
8945384bca net: Have LookupNumeric return a CService directly
Also fix up a few small issues:
- Lookup with "badip:port" now sets the port to 0
- Don't allow assert to have side-effects
2016-08-04 16:41:39 -04:00
Cory Fields
21ba407a73 net: narrow include scope after moving to netaddress
Net functionality is no longer needed for CAddress/CAddrman/etc. now that
CNetAddr/CService/CSubNet are dumb storage classes.
2016-07-31 14:01:44 -04:00
Cory Fields
f96c7c4d91 net: Split resolving out of CService 2016-07-31 13:24:07 -04:00
Wladimir J. van der Laan
761cddb690
Merge #7703: tor: Change auth order to only use password auth if -torpassword
2e49448 tor: Change auth order to only use HASHEDPASSWORD if -torpassword (Wladimir J. van der Laan)
2016-06-08 13:09:41 +02:00
Wladimir J. van der Laan
2e494489c3 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.
2016-06-06 10:38:54 +02:00
Cory Fields
d39f5b425d net: disable resolving from storage structures
CNetAddr/CService/CSubnet can no longer resolve DNS.
2016-04-20 13:08:19 -04:00
Jonas Schnelli
3d7e97376a
Fix torcontrol.cpp unused private field warning 2016-03-14 16:07:42 +01:00
Wladimir J. van der Laan
9f14e5ad91
Merge #7553: Remove vfReachable and modify IsReachable to only use vfLimited.
110b62f Remove vfReachable and modify IsReachable to only use vfLimited. (Patrick Strateman)
2016-03-11 08:25:28 +01:00
Wladimir J. van der Laan
e219503711 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.
2016-03-03 13:31:26 +01:00
Patrick Strateman
110b62f069 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.
2016-02-17 23:21:27 -08:00
jloughry
37767fd46f fix spelling of advertise in src and doc 2016-02-12 12:51:54 -07:00
Wladimir J. van der Laan
9189e30b12
Merge #7300: [trivial] Add missing copyright headers
fabcee1 Remove copyright header from autogenerated chainparamsseeds.h (MarcoFalke)
fa60d05 Add missing copyright headers (MarcoFalke)
fa7e4c0 Bump copyright headers to 2014 (MarcoFalke)
2016-01-27 12:06:31 +01:00
Wladimir J. van der Laan
5e00147838
Merge pull request #7313
0331aa3 Fixing typos on security-check.py and torcontrol.cpp (calebogden)
2016-01-18 10:45:25 +01:00
Chris Wheeler
9d263bd17c Typo fixes in comments 2016-01-17 11:03:56 +00:00
calebogden
0331aa350c Fixing typos on security-check.py and torcontrol.cpp 2016-01-08 13:31:42 -08:00
MarcoFalke
fa60d05a4e Add missing copyright headers 2016-01-05 21:34:15 +01:00
MarcoFalke
fa8c8d7fa6 torcontrol debug: Change to a blanket message that covers both cases 2015-12-16 12:57:06 +01:00
Daniel Cousens
4531fc4272 torcontrol: only output disconnect if -debug=tor 2015-11-30 22:20:43 +11:00
Peter Todd
cde857f2d9
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.
2015-11-26 05:14:31 -05:00
Wladimir J. van der Laan
09c1ae1c01 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
2015-11-12 17:58:15 +01:00
Peter Todd
2f796e5fe7 Better error message if Tor version too old 2015-11-10 17:29:56 +01:00
Wladimir J. van der Laan
8f4e67f152 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.
2015-11-10 17:29:56 +01:00