create Mutual Witness Protocol specs and implementation. mwp aims to be
a zero-infrastructure NAT traversal
This commit is contained in:
@@ -266,7 +266,7 @@ pub fn attemptConnectionInternalImpl(p2p: *P2P, address: Address) Error!PeerId {
|
||||
std.log.info("Key pinning: first connection from peer, key pinned (TOFU)", .{});
|
||||
},
|
||||
.key_changed => {
|
||||
std.log.warn("SECURITY: Peer key changed from pinned key! Potential MITM attack. Peer: {x}", .{peer_id.bytes[0..8].*});
|
||||
std.log.warn("SECURITY: Peer key changed from pinned key! Potential MITM attack. Peer: ", .{});
|
||||
try p2p.emitEvent(P2PEvent.create(.connection_failed, .{ .connection_failed = .{
|
||||
.peer_id = peer_id,
|
||||
.err = Error.EncryptionFailed,
|
||||
@@ -274,7 +274,7 @@ pub fn attemptConnectionInternalImpl(p2p: *P2P, address: Address) Error!PeerId {
|
||||
return Error.EncryptionFailed;
|
||||
},
|
||||
.unknown_peer => {
|
||||
std.log.warn("Key pinning: unknown peer rejected (strict mode). Peer: {x}", .{peer_id.bytes[0..8].*});
|
||||
std.log.warn("Key pinning: unknown peer rejected (strict mode). Peer: ", .{});
|
||||
try p2p.emitEvent(P2PEvent.create(.connection_failed, .{ .connection_failed = .{
|
||||
.peer_id = peer_id,
|
||||
.err = Error.EncryptionFailed,
|
||||
@@ -507,7 +507,7 @@ pub fn acceptConnectionsImpl(p2p: *P2P) Error!void {
|
||||
std.log.info("Key pinning: first connection from peer, key pinned (TOFU)", .{});
|
||||
},
|
||||
.key_changed => {
|
||||
std.log.warn("SECURITY: Incoming peer key changed from pinned key! Potential MITM attack. Peer: {x}", .{peer_id.bytes[0..8].*});
|
||||
std.log.warn("SECURITY: Incoming peer key changed from pinned key! Potential MITM attack. Peer: ", .{});
|
||||
if (p2p.connection_backoff) |backoff| {
|
||||
const addr_hash = network.connection_backoff.hashAddress(&ip_bytes, peer_addr.port);
|
||||
_ = backoff.recordFailure(addr_hash, Error.EncryptionFailed);
|
||||
@@ -515,7 +515,7 @@ pub fn acceptConnectionsImpl(p2p: *P2P) Error!void {
|
||||
return;
|
||||
},
|
||||
.unknown_peer => {
|
||||
std.log.warn("Key pinning: unknown incoming peer rejected (strict mode). Peer: {x}", .{peer_id.bytes[0..8].*});
|
||||
std.log.warn("Key pinning: unknown incoming peer rejected (strict mode). Peer: ", .{});
|
||||
if (p2p.connection_backoff) |backoff| {
|
||||
const addr_hash = network.connection_backoff.hashAddress(&ip_bytes, peer_addr.port);
|
||||
_ = backoff.recordFailure(addr_hash, Error.EncryptionFailed);
|
||||
|
||||
Reference in New Issue
Block a user