aboutsummaryrefslogtreecommitdiff
path: root/src/rpc/core_rpc_server.cpp
diff options
context:
space:
mode:
authormoneromooo-monero <moneromooo-monero@users.noreply.github.com>2020-12-20 12:48:34 +0000
committermoneromooo-monero <moneromooo-monero@users.noreply.github.com>2020-12-22 23:39:07 +0000
commitd2fda6c25f476c45acbc875721106f965435d99f (patch)
tree57d87f47240d0d5526e83837cddb26cf4c88fbfa /src/rpc/core_rpc_server.cpp
parentMerge pull request #7151 (diff)
downloadmonero-d2fda6c25f476c45acbc875721106f965435d99f.tar.xz
restrict public node checks a little
do not include blocked hosts in peer lists or public node lists by default, warn about no https on clearnet and about untrusted peers likely being spies
Diffstat (limited to 'src/rpc/core_rpc_server.cpp')
-rw-r--r--src/rpc/core_rpc_server.cpp9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/rpc/core_rpc_server.cpp b/src/rpc/core_rpc_server.cpp
index 01735d62e..3970be087 100644
--- a/src/rpc/core_rpc_server.cpp
+++ b/src/rpc/core_rpc_server.cpp
@@ -190,6 +190,7 @@ namespace cryptonote
request.gray = true;
request.white = true;
+ request.include_blocked = false;
if (!on_get_public_nodes(request, response) || response.status != CORE_RPC_STATUS_OK)
{
return {};
@@ -1383,6 +1384,8 @@ namespace cryptonote
for (auto & entry : white_list)
{
+ if (!req.include_blocked && m_p2p.is_host_blocked(entry.adr, NULL))
+ continue;
if (entry.adr.get_type_id() == epee::net_utils::ipv4_network_address::get_type_id())
res.white_list.emplace_back(entry.id, entry.adr.as<epee::net_utils::ipv4_network_address>().ip(),
entry.adr.as<epee::net_utils::ipv4_network_address>().port(), entry.last_seen, entry.pruning_seed, entry.rpc_port, entry.rpc_credits_per_hash);
@@ -1395,6 +1398,8 @@ namespace cryptonote
for (auto & entry : gray_list)
{
+ if (!req.include_blocked && m_p2p.is_host_blocked(entry.adr, NULL))
+ continue;
if (entry.adr.get_type_id() == epee::net_utils::ipv4_network_address::get_type_id())
res.gray_list.emplace_back(entry.id, entry.adr.as<epee::net_utils::ipv4_network_address>().ip(),
entry.adr.as<epee::net_utils::ipv4_network_address>().port(), entry.last_seen, entry.pruning_seed, entry.rpc_port, entry.rpc_credits_per_hash);
@@ -1413,8 +1418,10 @@ namespace cryptonote
{
RPC_TRACKER(get_public_nodes);
+ COMMAND_RPC_GET_PEER_LIST::request peer_list_req;
COMMAND_RPC_GET_PEER_LIST::response peer_list_res;
- const bool success = on_get_peer_list(COMMAND_RPC_GET_PEER_LIST::request(), peer_list_res, ctx);
+ peer_list_req.include_blocked = req.include_blocked;
+ const bool success = on_get_peer_list(peer_list_req, peer_list_res, ctx);
res.status = peer_list_res.status;
if (!success)
{