Commit Graph

470 Commits

Author SHA1 Message Date
selsta 76fe73b8bd
Revert "fix accessing an network address in a deleted context"
This reverts commit 4e74385a1a.
2021-01-12 12:18:23 +01:00
moneromooo-monero f10c9a16c4
remove obsolete pruning debug code 2021-01-08 15:41:59 +00:00
moneromooo-monero f815740403
p2p: make REQUEST_SUPPORT_FLAGS optional, pass flags in node data
removes a back and forth on connect, and the RPC can be removed
once all peers have updated
2021-01-04 13:33:34 +00:00
Alexander Blair dbaf95ac77
Merge pull request #7271
4e74385a1 fix accessing an network address in a deleted context (moneromooo-monero)
2021-01-03 18:24:50 -08:00
moneromooo-monero b652d598d1
add a max levin packet size by command type 2021-01-03 14:07:45 +00:00
moneromooo-monero 4e74385a1a
fix accessing an network address in a deleted context
Both drop_connection and add_host_fail can drop the connection,
which invalidates the context, and thus the address it contains.

Thanks to wfaressuissia[m] for lots of help and prodding when
debugging this
2021-01-03 13:04:55 +00:00
Alexander Blair 16c780d568
Merge pull request #7250
61b6e4cc6 Add aggressive restrictions to pre-handshake p2p buffer limit (Lee Clagett)
2021-01-01 22:35:59 -08:00
moneromooo-monero c5c278c339
p2p: only log to global when a blocked IP is not already blocked 2021-01-01 19:54:51 +00:00
moneromooo 1d1c430b1f
p2p: fix cubic selection in filtered peer list
Integer quantization biased the picks a lot (leading some indices
to never be selected)
2021-01-01 15:44:36 +00:00
moneromooo-monero f208d98492
p2p: ignore empty IP from DNS block list
ie, if the list ends in ;
2021-01-01 12:30:45 +00:00
moneromooo aa3e89a2ba
p2p: fix set_peer_just_seen ignoring last_seen 2020-12-31 03:10:10 +00:00
moneromooo 656b2f7ce1
p2p: fix deadlock banning while updating peer lists 2020-12-31 03:09:37 +00:00
Alexander Blair 5402121323
Merge pull request #7180
56748e1d7 ban lists may now include subnets (moneromooo-monero)
2020-12-26 13:42:37 -08:00
Alexander Blair cb712bf4f8
Merge pull request #7145
68637bca3 p2p: remove peers from grey and anchors lists when blocked (moneromooo-monero)
2020-12-26 13:40:19 -08:00
Alexander Blair 69ed0e0001
Merge pull request #7138
e9abfea16 Optional DNS based blocklist (moneromooo-monero)
2020-12-26 13:38:50 -08:00
Alexander Blair b9e444da5e
Merge pull request #7098
c0c75ac19 Fixed issues found by static analysis (SChernykh)
2020-12-26 13:36:01 -08:00
Lee Clagett 927141bcc4 Command max_bytes moved from dynamic map to static switch 2020-12-22 20:54:16 +00:00
moneromooo-monero 56748e1d74
ban lists may now include subnets 2020-12-22 02:12:41 +00:00
moneromooo-monero e9abfea165
Optional DNS based blocklist
If enabled, pulls IPs to block on blocklist.moneropulse.*, and
blocks then for 8 days (so IPs dropping from the list will
eventually get unblocked, and DNS failures don't result in
instant clearing of the blocklist).

Enable with --enable-dns-blocklist
2020-12-20 02:09:58 +00:00
luigi1111 0dac64afb3
Merge pull request #7143
58651d1 p2p: ignore incoming peer list entries when we have them blocked (moneromooo-monero)
2020-12-19 17:24:21 -06:00
luigi1111 7ee37e4b38
Merge pull request #7075
f3c0d4f protocol: remove unused (and cunningly uninitialized) field (moneromooo-monero)
8e62362 p2p: ifx getting seed nodes for uncommon cases (moneromooo-monero)
2020-12-19 17:20:29 -06:00
Lee Clagett 61b6e4cc67 Add aggressive restrictions to pre-handshake p2p buffer limit 2020-12-17 00:36:10 +00:00
moneromooo-monero 8e62362cd3
p2p: ifx getting seed nodes for uncommon cases
The code is technically correct, but liable to easily become incorrect with changes
2020-12-15 01:32:15 +00:00
moneromooo-monero 68637bca3f
p2p: remove peers from grey and anchors lists when blocked 2020-12-13 23:27:44 +00:00
moneromooo-monero 58651d16c0
p2p: ignore incoming peer list entries when we have them blocked 2020-12-13 23:14:05 +00:00
SChernykh c0c75ac19d Fixed issues found by static analysis
- rolling_median: tried to free uninitialized pointer in a constructor
- net_node.inl: erase-remove idiom was used incorrectly. remove_if doesn't actually remove elements, see http://cpp.sh/6fcjv
- bulletproofs.cc: call to sizeof() instead of vector.size(), luckily it only impacts performance and not code logic there
2020-12-08 18:43:44 +01:00
luigi1111 b7425c14c8
Merge pull request #7072
bc7cd78 p2p: drop peers that spam peer lists (moneromooo-monero)
2020-12-07 10:24:30 -06:00
luigi1111 fb73f2b2be
Merge pull request #7070
281b42a p2p: fix race condition accessing a deleted context (moneromooo-monero)
2020-12-07 10:23:24 -06:00
luigi1111 3d2a50a5c0
Merge pull request #7055
ff7fdf6 protocol: drop peers that don't reply to queries (moneromooo-monero)
89e984d keep only the last seen node on a given host in the white list (moneromooo-monero)
c74d8ff protocol: drop peers that decrease claimed height (moneromooo-monero)
61f5001 protocol: add scoring system to drop peers that don't behave (moneromooo-monero)
2020-12-07 10:07:33 -06:00
moneromooo-monero 281b42a281
p2p: fix race condition accessing a deleted context 2020-12-06 12:40:07 +00:00
moneromooo-monero bc7cd78870
p2p: drop peers that spam peer lists
There's always some people who just want to abuse things
2020-12-05 13:12:58 +00:00
Alexander Blair 7ca4ef0d74
Merge pull request #7068
2395e0e67 p2p: add a tor seed node (moneromooo-monero)
2020-12-04 13:28:02 -08:00
Alexander Blair 1eae7574b5
Merge pull request #7017
13350f79d Do not use peer_id tracking method over i2p/tor (Lee Clagett)
2020-12-04 13:21:13 -08:00
moneromooo 89e984d93b
keep only the last seen node on a given host in the white list 2020-12-04 01:55:22 +00:00
moneromooo-monero 2395e0e678
p2p: add a tor seed node 2020-12-03 23:45:38 +00:00
Alexander Blair e78669257e
Merge pull request #7056
c64b94bd1 p2p: fix endianness when checking IPv6 addresses mapping to IPv4 (moneromooo-monero)
67f2bec2d p2p: make this work with boost <= 1.65 (pffff) (moneromooo-monero)
ffdf1fb1d p2p: rewrite boost's make_address_v4 to cater for < 1.66 (moneromooo)
2020-12-03 12:19:15 -08:00
Alexander Blair 84bae315f8
Merge pull request #6984
7a5e11645 net_node: add tor / i2p seed nodes (selsta)
2020-12-03 12:17:44 -08:00
moneromooo-monero c64b94bd14
p2p: fix endianness when checking IPv6 addresses mapping to IPv4 2020-12-03 00:31:32 +00:00
moneromooo-monero 67f2bec2df
p2p: make this work with boost <= 1.65 (pffff) 2020-12-03 00:31:32 +00:00
moneromooo ffdf1fb1de
p2p: rewrite boost's make_address_v4 to cater for < 1.66 2020-12-03 00:31:29 +00:00
moneromooo 6c9980a55b
p2p: give all hosts the same chance of being picked for connecting
even if some run more than one node
2020-11-29 15:55:58 +00:00
selsta 7a5e11645f
net_node: add tor / i2p seed nodes
Co-authored-by: Lee Clagett <code@leeclagett.com>
2020-11-29 13:49:03 +01:00
luigi1111 ad843541d5
Merge pull request #7008
3247f11 Silence stupid warnings (Howard Chu)
2020-11-29 01:57:24 -06:00
luigi1111 9a4d813136
Merge pull request #6943
cb069d0 p2p: remove banned peers from the white list (moneromooo-monero)
2020-11-29 01:51:41 -06:00
luigi1111 2be7a4c04f
Merge pull request #6933
1f04a31 p2p: use /16 filtering on IPv4-within-IPv6 addresses (moneromooo-monero)
2020-11-29 01:46:46 -06:00
luigi1111 c5b3fd1fec
Merge pull request #6920
aad2f87 net_node: add --ban-list option (selsta)
2020-11-29 01:38:27 -06:00
luigi1111 52006df9bb
Merge pull request #6897
2abdbf6 Add support for i2p and tor seed nodes (vtnerd)
2020-11-29 00:42:27 -06:00
Howard Chu 91fd634768
Better log message for unusable anon networks 2020-11-16 12:36:37 +00:00
Howard Chu 3247f11638
Silence stupid warnings 2020-11-11 02:34:14 +00:00
moneromooo-monero 1f04a3186b
p2p: use /16 filtering on IPv4-within-IPv6 addresses
IPv6 addresses include a range that can map IPv4 addresses,
which allowed those mapped addresses to bypass filtering.

This filter should be replaced by AS filtering at some point.
2020-11-03 00:46:07 +00:00
moneromooo cb069d0a42
p2p: remove banned peers from the white list 2020-10-27 22:35:14 +00:00
selsta aad2f87a53
net_node: add --ban-list option 2020-10-20 19:39:44 +02:00
Lee Clagett 2abdbf63cf Add support for i2p and tor seed nodes 2020-10-19 13:13:07 +00:00
Lee Clagett 13350f79df Do not use peer_id tracking method over i2p/tor 2020-10-15 16:47:59 +00:00
xiphon a12a8174e0 Dandelion++: skip desynced peers in stem phase 2020-10-12 13:44:06 +00:00
moneromooo-monero 7175dcb107
replace most boost serialization with existing monero serialization
This reduces the attack surface for data that can come from
malicious sources (exported output and key images, multisig
transactions...) since the monero serialization is already
exposed to the outside, and the boost lib we were using had
a few known crashers.

For interoperability, a new load-deprecated-formats wallet
setting is added (off by default). This allows loading boost
format data if there is no alternative. It will likely go
at some point, along with the ability to load those.

Notably, the peer lists file still uses the boost serialization
code, as the data it stores is define in epee, while the new
serialization code is in monero, and migrating it was fairly
hairy. Since this file is local and not obtained from anyone
else, the marginal risk is minimal, but it could be migrated
later if needed.

Some tests and tools also do, this will stay as is for now.
2020-08-17 16:23:58 +00:00
Alexander Blair 9414194b1e
Merge pull request #6571
1d31e6c00 net_node: remove dead seed nodes (selsta)
2020-08-05 07:57:54 -07:00
Alexander Blair a0d179e528
Merge pull request #6512
5ef0607da Update copyright year to 2020 (SomaticFanatic)
2020-07-19 03:32:59 -07:00
Lee Clagett 7aeb503547 Fix boost <1.60 compilation and fix boost 1.73+ warnings 2020-05-31 21:18:11 -04:00
selsta 1d31e6c000
net_node: remove dead seed nodes 2020-05-20 01:06:03 +02:00
SomaticFanatic 5ef0607da6 Update copyright year to 2020
Update copyright year to 2020
2020-05-06 22:36:54 -04:00
luigi1111 8d0f1696df
Merge pull request #6471
c6a1294 add another seed node (Gingeropolous/selsta)
9faf3d1 Add erciccione's seed node (erciccione/selsta)
2020-05-06 00:23:59 -05:00
luigi1111 6e7b883212
Merge pull request #6443
145be6d p2p: startup speedup, init seed nodes on first 'connect_to_seed()' (xiphon)
2020-05-01 15:23:05 -05:00
Gingeropolous c6a1294b5e
add another seed node
node is funded by random people and managed by me. currently functioning as public node at uwillrunanodesoon.moneroworld.com
2020-04-22 15:43:22 +02:00
erciccione 9faf3d1a72
Add erciccione's seed node 2020-04-22 10:24:40 +02:00
xiphon 145be6dbdb p2p: startup speedup, init seed nodes on first 'connect_to_seed()' 2020-04-21 23:40:04 +00:00
guy 79a1653a07 p2p: add seed node. 2020-04-21 15:35:30 +02:00
luigi1111 97af9649c9
Merge pull request #6372
7b9017f p2p: plug tor to clearnet association vector (Aaron Hook)
2020-04-04 13:09:55 -05:00
moneromooo-monero 21fe6a289b
p2p: fix frequent weak_ptr exception on connection
When a handshake fails, it can fail due to timeout or destroyed
connection, in which case the connection will be, or already is,
closed, and we don't want to do it twice.
Additionally, when closing a connection directly from the top
level code, ensure the connection is gone from the m_connects
list so it won't be used again.

AFAICT this is now clean in netstat, /proc/PID/fd and print_cn.

This fixes a noisy (but harmless) exception.
2020-03-31 20:29:41 +00:00
Alexander Blair 3ed5e7ce9f
Merge pull request #6295
bcae95a2 p2p: do not add recently failed addresses to the peerlist (moneromooo-monero)
2020-03-27 12:30:06 -07:00
Alexander Blair e160e0b517
Merge pull request #6283
a84131ce p2p: fix off by one adding fallback peers (moneromooo-monero)
2020-03-27 12:19:55 -07:00
Alexander Blair c038cc8b79
Merge pull request #6280
b818522d p2p: fix spurious warning when we're connected to at last one seed (moneromooo-monero)
2020-03-27 12:17:54 -07:00
Alexander Blair 3baa68bbab
Merge pull request #6279
36bdf402 p2p: fix adding wrong indices to the filtered peer list (moneromooo-monero)
2020-03-27 12:17:07 -07:00
Lee Clagett 02d887c2e5 Adding Dandelion++ support to public networks:
- New flag in NOTIFY_NEW_TRANSACTION to indicate stem mode
  - Stem loops detected in tx_pool.cpp
  - Embargo timeout for a blackhole attack during stem phase
2020-03-26 15:01:30 +00:00
luigi1111 7c74e1919e
Merge pull request #6405
8d23047 p2p: add another seed node (moneromooo-monero)
2020-04-10 16:13:04 -05:00
moneromooo-monero 8d230473ef
p2p: add another seed node
Node from syksy, administered by mooo
2020-03-27 22:51:44 +00:00
Aaron Hook aa93e38862 p2p: remove old debug commands 2020-03-20 22:09:44 -07:00
moneromooo-monero bcae95a22e
p2p: do not add recently failed addresses to the peerlist 2020-03-20 15:45:26 +00:00
Alexander Blair 092a57df99
Merge pull request #6243
4771a7ae p2p: remove obsolete local time in handshake (moneromooo-monero)
2fbbc4a2 p2p: avoid sending the same peer list over and over (moneromooo-monero)
3004835b epee: remove backward compatible endian specific address serialization (moneromooo-monero)
39a343d7 p2p: remove backward compatible peer list (moneromooo-monero)
60631802 p2p: simplify last_seen serialization now we have optional stores (moneromooo-monero)
9467b2e4 cryptonote_protocol: omit top 64 bits of difficulty when 0 (moneromooo-monero)
b595583f serialization: do not write optional fields with default value (moneromooo-monero)
5f98b46d p2p: remove obsolete local time from TIMED_SYNC (moneromooo-monero)
2020-03-12 00:32:46 -07:00
Aaron Hook 7b9017f671
p2p: plug tor to clearnet association vector
During the handshake for an incoming connection, the peer id is checked against the local node's peer id only for the specific zone of the incoming peer, in order to avoid linking public addresses to tor addresses:
5d7ae2d279/src/p2p/net_node.inl (L2343)

However, on handshakes for outgoing connections, all zones are checked:
5d7ae2d279/src/p2p/net_node.inl (L1064)

If an attacker wanted to link a specific tor node to a public node, they could potentially connect to as many public nodes as possible, get themselves added to the peer whitelist, maybe stuff some more attacker-owned addresses into the greylist, then disconnect, and for any future incoming connections, respond with the tor node's id in an attempt to link the public/tor addresses.
2020-03-07 18:12:59 +00:00
Alexander Blair 4764d18eeb
Merge pull request #6248
21c3d42e p2p: drop the peerlist dump to TRACE (moneromooo-monero)
2020-02-28 20:21:27 -08:00
Alexander Blair 34d7ea62f6
Merge pull request #6053
deb350b7 always print peer IDs in the same format (moneromooo-monero)
2020-02-06 00:28:47 -08:00
moneromooo-monero b818522d29
p2p: fix spurious warning when we're connected to at last one seed 2020-01-31 15:11:22 +00:00
moneromooo-monero 4771a7aec1
p2p: remove obsolete local time in handshake
Also removes a potential fingerprinting vector
2020-01-29 14:39:58 +00:00
moneromooo-monero 2fbbc4a2d3
p2p: avoid sending the same peer list over and over
Nodes remember which connections have been sent which peer addresses
and won't send it again. This causes more addresses to be sent as
the connection lifetime grows, since there is no duplication anymore,
which increases the diffusion speed of peer addresses. The whole
white list is now considered for sending, not just the most recent
seen peers. This further hardens against topology discovery, though
it will more readily send peers that have been last seen earlier
than it otherwise would. While this does save a fair amount of net
bandwidth, it makes heavy use of std::set lookups, which does bring
network_address::less up the profile, though not too aggressively.
2020-01-29 14:39:56 +00:00
moneromooo-monero 39a343d76e
p2p: remove backward compatible peer list 2020-01-26 18:37:33 +00:00
moneromooo-monero 606318026e
p2p: simplify last_seen serialization now we have optional stores 2020-01-26 18:37:32 +00:00
moneromooo-monero 5f98b46d58
p2p: remove obsolete local time from TIMED_SYNC 2020-01-26 18:37:26 +00:00
moneromooo-monero 56a4469ef3
network: log traffic and add a simple traffic analysis script 2020-01-26 00:33:41 +00:00
Alexander Blair f20a962774
Merge pull request #6153
24adee4a p2p: don't request flags after closing connection (moneromooo-monero)
2020-01-24 20:06:46 -08:00
Alexander Blair d1b08c00cf
Merge pull request #6146
70c9cd3c Change to Tx diffusion (Dandelion++ fluff) instead of flooding (Lee Clagett)
2020-01-24 20:06:34 -08:00
Alexander Blair c6f4113265
Merge pull request #6119
6f45cfa5 p2p: zero last seen timestamp when inserting a new peer (moneromooo-monero)
2020-01-16 17:29:27 -08:00
moneromooo-monero a84131cea3
p2p: fix off by one adding fallback peers
The code would ignore the first one to be added
2020-01-07 14:40:26 +00:00
moneromooo-monero 36bdf40288
p2p: fix adding wrong indices to the filtered peer list 2020-01-03 17:56:54 +00:00
moneromooo-monero 21c3d42eb9
p2p: drop the peerlist dump to TRACE
It's spammy
2019-12-17 20:27:04 +00:00
moneromooo-monero 24adee4a08
p2p: don't request flags after closing connection 2019-11-19 02:03:39 +00:00
moneromooo-monero 6f45cfa5c5
p2p: zero last seen timestamp when inserting a new peer 2019-11-11 12:44:35 +00:00
Lee Clagett 70c9cd3c9c Change to Tx diffusion (Dandelion++ fluff) instead of flooding 2019-11-04 09:23:20 +00:00
Lee Clagett 5d7ae2d279 Adding support for hidden (anonymity) txpool 2019-11-02 20:36:03 +00:00
moneromooo-monero deb350b783
always print peer IDs in the same format 2019-10-29 11:30:20 +00:00