Commit Graph

71 Commits

Author SHA1 Message Date
mailchuck 47f1c0c267 Thread names for IPv6
Thread names for IPv6 contained ":". This caused problems in log
parsers.
2016-05-02 15:00:23 +02:00
Peter Šurda e4f31d25fc Flood mitigation optimisation
Flood mitigation was done both in the ObjectProcessorQueue as well as
receiveData threads. This patch removes the mitigation in receiveData
threads and cleans up the one in the ObjectProcessorQueue
2016-05-02 15:00:23 +02:00
mailchuck e4a7e71790 SSL fixes 2016-05-02 15:00:21 +02:00
mailchuck 281630757e SSL fixes 2016-05-02 15:00:21 +02:00
mailchuck 18f7ef06e2 SSL fixes
Handle old Python compatibility better.
2016-05-02 15:00:21 +02:00
mailchuck b7ad34cf15 Trusted peer flood protection
Is not needed.
Fixed Bitmessage#786
2016-05-02 15:00:21 +02:00
mailchuck 231219a193 Improved logging
Fixes #118

- changed almost all "print" into logger
- threads have nicer names
- logger can have configuration in "logger.dat" in the same directory as
"keys.dat", and the logger will pick the one named "default" to replace
the "console" and "file" that are in PyBitmessage otherwise

Example file for logging to syslog:

[loggers]
keys = root,syslog

[logger_root]
level=NOTSET
handlers=syslog

[logger_syslog]
level=DEBUG
handlers=syslog
qualname=default

[handlers]
keys = syslog

[handler_syslog]
class = handlers.SysLogHandler
formatter = syslog
level = DEBUG
args=(('localhost', handlers.SYSLOG_UDP_PORT),
handlers.SysLogHandler.LOG_LOCAL7)

[formatters]
keys = syslog

[formatter_syslog]
format=%(asctime)s %(threadName)s %(filename)s@%(lineno)d %(message)s
datefmt=%b %d %H:%M:%S
2016-05-02 15:00:21 +02:00
mailchuck 2fd85bfa69 SSL workaround
Python < 2.7.9 does not support anonymous SSL server through
ssl.wrap_socket, so we have to disable it. Works fine as client.
Try to prefer secp256k1 curve (again, requires python >= 2.7.9)
2016-05-02 15:00:21 +02:00
mailchuck c7fb9e6a43 SSL fixes
- uses constants for service flags
- requires SSL to use TLSv1 version (protection against POODLE-style
attacks)
- retry if sock.recv incomplete
2016-05-02 15:00:21 +02:00
mailchuck 53b0d2749b Opportunistic encryption with TLS (1 of 2)
Fixes Bitmessage#264
Fixes Bitmessage#648
2016-05-02 15:00:20 +02:00
mailchuck ceda22ec94 Private IP range update
Addresses Bitmessage#768
2016-05-02 15:00:20 +02:00
mailchuck 2ec04ede40 Passive version check
Bitmessage will now notify you if it encounters someone with a newer
version. Takes into account that it should not recommend switching from
stable to unstable and vice versa. Also, temporarily treats 0.5 as a
mailchuck fork.

Fixes #43
2016-05-02 15:00:19 +02:00
Jonathan Warren cc712cb8ff finished work on specifyTTL 2015-03-09 02:35:32 -04:00
Jonathan Warren 3527983fa6 Minor refactoring 2015-02-20 17:33:17 -05:00
Jonathan Warren 0c7330f900 fix misbehaving logger.warning line 2015-01-28 14:45:29 -05:00
Jonathan Warren 0865e863ec Added ability to limit network transfer rate 2014-09-10 16:47:51 -04:00
Jonathan Warren c306062282 Bitmessage Protocol Version Three 2014-08-27 03:14:32 -04:00
Jonathan Warren ea6f34ade6 removed use of memoryview so that we can support python 2.7.3 2014-08-06 15:54:59 -04:00
Jonathan Warren 9e16e81283 resolve merge conflict and show transfer rate 2014-08-01 17:25:47 -04:00
Jonathan Warren a2a7edc9be resolve merge conflict 2014-07-14 19:29:47 -04:00
Yuri f107b0fbd9 Addition of bytes received/sent counts on the network information tab. 2014-07-07 13:30:23 -07:00
bmng-dev 1f9991bcd0 Fix syntax error 2014-06-08 14:03:58 +00:00
bmng-dev 0f9625aac7 Refactor packet header extraction and generation
Demote payloadLength from class instance variable to processData local variable as no other function was using it
Improve processData:
 -Utilise shared.Header
 -Use a memoryview to reduce memory overhead
 -Clean up variables before a recursive call
 -Strip null bytes from command
Refactor sendData
Various functions:
 -Use shared.CreatePacket to generate packets
Fix typo in _checkIPv4Address
2014-05-22 15:57:48 +00:00
antius 53a3d1635a Make addDataPadding method to avoid clutter. 2014-05-02 16:46:36 +02:00
Jonathan Warren 38d7db24ad Merge pull request #639 from bpeel/wip/trusted-peer
Add a 'trustedpeer' option to keys.dat
2014-04-30 17:42:28 -04:00
Jonathan Warren 22934441dc Fix #662 - 'PyBitmessage does not wait for verack' 2014-04-30 15:39:25 -04:00
Jonathan Warren 114ba4e23a slightly modify IPv6 modifications so that IPv4-only hosts properly handle v6 IPs 2014-04-27 18:05:43 -04:00
Neil Roberts 7da6ea958f Add support for IPv6
It will now listen on an IPv6 socket if possible or fall back to IPv4
if that doesn't work. It will no longer filter out all IPv6 addresses
and instead it will only filter out those that point to the local
network.

It looks like the DNS bootstrapping should just automatically work
because getaddrinfo already returns IPv6 addresses from the AAAA
record.

In order to convert from the ASCII representation of IPv6 addresses
and back we need inet_ntop and inet_pton. Python 2 doesn't currently
provide these for Windows so instead this patch provides a hot patch
to the socket module which wraps WSAStringToAddress and
WSAAddressToString using ctypes.
2014-03-12 01:48:48 +00:00
Neil Roberts 03263156de Add a 'trustedpeer' option to keys.dat
If this option is specified in keys.dat then Bitmessage will connect
to the host specified there instead of connecting to the hosts in the
list of known nodes. It will also stop listening for incoming
connections and the timing attack mitigation will be disabled.

The expected use case is for example where a user is running a daemon
on a dedicated machine in their local network and they occasionally
want to check for messages using a second instance of the client on
their laptop. In that case it would be much faster to catch up with
the messages by directly downloading from the dedicated machine over
the LAN. There is no need to connect to multiple peers or to do the
timing attack mitigation because the daemon is trusted.

The host is specified as hostname:port. Eg, ‘192.168.1.8:8444’.
2014-02-06 13:16:07 +00:00
Jonathan Warren 0de659a04a Ignore, and don't save to memory, messages larger than 20MB (temporary) 2014-02-05 02:45:10 -05:00
Jonathan Warren 61389b64aa fix #590 2013-12-29 22:36:23 -05:00
Jonathan Warren 45a0046e7d completed work on objectProcessorThread 2013-11-20 01:29:37 -05:00
Jonathan Warren 2a1b6dd86d some initial objectProcessorThread work 2013-11-13 22:44:42 -05:00
Jonathan Warren a20711c2ab Fix whitelist functionality 2013-10-05 13:39:53 -04:00
Jonathan Warren f5b92b2fa5 turn timing attack mitigation back on 2013-09-29 23:06:24 -04:00
Jonathan Warren 498928405b Chan fix: initial work completed 2013-09-29 19:24:27 -04:00
Jonathan Warren 02ea2a50d3 more v4 address work. Should be done. 2013-09-18 00:04:01 -04:00
Jonathan Warren 79f6169803 further v4 address work 2013-09-14 21:06:26 -04:00
Jonathan Warren 56168e82b5 most initial work on v4 pubkeys completed 2013-09-13 00:27:34 -04:00
Jonathan Warren 90e60d8145 delay addr messages random number of seconds 2013-09-09 19:26:32 -04:00
Jonathan Warren f0bf3aad48 use locks when accessing dictionary inventory 2013-09-07 18:23:20 -04:00
Jonathan Warren a9b15f83ba initial testing inv refactorization 2013-09-06 18:55:12 -04:00
Jonathan Warren c06bbc14f8 Give user feedback when disk is full 2013-09-04 20:14:25 -04:00
Jonathan Warren 7ccdd14418 fix #474 2013-09-04 12:53:18 -04:00
Jonathan Warren 5fab298559 Refactor of the way PyBitmessage looks for interesting new objects in huge inv messages from peers 2013-09-03 22:45:45 -04:00
Jonathan Warren 6159d5e622 Show inventory lookup rate on Network Status tab 2013-09-03 18:08:29 -04:00
Grant T. Olson 92c1368691 use helper_sql in class_receiveDataThread 2013-08-29 08:03:05 -04:00
Jonathan Warren 1bb86794a8 undid support for receiving v4 addresses until more chanages are implemented 2013-08-26 15:23:12 -04:00
Jonathan Warren 82db79ca39 removed option from previous commit which allowed user-settable maximum network message size pending further discussion 2013-08-24 20:23:49 -04:00
Jonathan Warren a5c65f11e8 resolve merge conflict 2013-08-24 20:18:46 -04:00