Warn and refuse to submit proofs if we detect duplicate ed/x25519 keys (#1121)

This commit is contained in:
Jason Rhinelander 2020-04-13 21:53:40 -03:00 committed by GitHub
parent cb4dde8b0c
commit 8dc42c1a97
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 0 deletions

View file

@ -2060,6 +2060,15 @@ namespace cryptonote
if ((uint64_t) std::time(nullptr) < next_proof_time)
return;
auto pubkey = m_service_node_list.get_pubkey_from_x25519(m_service_node_keys->pub_x25519);
if (pubkey != crypto::null_pkey && pubkey != m_service_node_keys->pub)
{
MGINFO_RED(
"Failed to submit uptime proof: another service node on the network is using the same ed/x25519 keys as "
"this service node. This typically means both have the same 'key_ed25519' private key file.");
return;
}
if (!check_external_ping(m_last_storage_server_ping, STORAGE_SERVER_PING_LIFETIME, "the storage server"))
{
MGINFO_RED(

View file

@ -2066,6 +2066,10 @@ namespace service_nodes
{
my_uptime_proof_confirmation = false;
LOG_PRINT_L2("Accepted uptime proof from " << proof.pubkey);
if (m_service_node_keys && proof.pubkey_ed25519 == m_service_node_keys->pub_ed25519)
MGINFO_RED("Uptime proof from SN " << proof.pubkey << " is not us, but is using our ed/x25519 keys; "
"this is likely to lead to deregistration of one or both service nodes.");
}
auto old_x25519 = iproof.pubkey_x25519;