Authorization and Authentication #3170
-
im building p2p for private network, have implemented custom SecureTransport that uses certificate signed by self signed certificate and check if other peers certificate contains this self signed certificate in its chains i.e RootCA else it denies the connection. any ideas how i can secure the network here , we should secure both internal (compromised system) and external attacks . |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 3 replies
-
@MOHANKUMAR-IT Limit peer connections to a known allowlist based on PeerIDs, rather than relying solely on certificates and implement basic certificate revocation by maintaining a blocklist of revoked PeerIDs that your nodes check before accepting connections. If you want extra security without overcomplicating things, you can introduce a simple pre-shared secret (PSK) check before establishing secure connections. I hope it helps :) |
Beta Was this translation helpful? Give feedback.
-
I think what you need is PNet: https://github.com/libp2p/go-libp2p/blob/master/options.go#L210 Though all such methods will depend on not leaking the private keys ever. |
Beta Was this translation helpful? Give feedback.
-
Can we use PSK with libp2p.Insecure transport option . Will it provide same security as TLS 1.3 |
Beta Was this translation helpful? Give feedback.
@MOHANKUMAR-IT
Yes, multistream negotiation happens before TLS negotiation. When a peer connects, it first goes through the multistream protocol selection process to determine the security module to use (mTLS in your case). Only after that does the TLS handshake occur.
Your test makes sense: since you initiated a plain TCP connection, the node responded with /multistream/1.0.0 before rejecting it due to missing TLS authentication. That confirms that libp2p expects the multistream handshake before establishing an mTLS connection.
If you want to test proper mTLS authentication, you should modify your Python client to complete the multistream negotiation first before attempting mTLS authenti…