Encrypted connections
Running in productionComing in 12.5.6

Encrypted connections

How two nodes encrypt their P2P connection, what it protects, the node's identity fingerprint, pins, the warnings and what to do about them.

Two nodes that both run 12.5.6 or later encrypt their P2P connection, on the ordinary P2P port. Nothing has to be set up: no certificate, no proxy. Peers that do not support it (older versions, other software) keep the plain protocol.

What you get #

Nobody on the path can read the trafficalways, between two nodes that support it
Recorded traffic stays unreadable if a node's files are stolen lateryes: the keys of a connection are made for it alone and never stored
An interceptor that decrypts and re-encrypts is detectedfor peers you pinned, and for peers your node met before
Someone who blocks the encryption offer to force plainvisible (warning and alert), refused only with a pin, p2pencryptdowngradewait or required
The same on the very first connection to a peerno: pin the peers that matter
Hiding that two machines speak Lotus, or how muchno

Keys: X25519 for each connection, AES-256-GCM for the traffic, replaced after 1 GiB or 10 minutes. Identity: an RSA-4096 key per node, made at the first start.

The lock in the peers table #

On the Network page every peer has a lock:

LockMeaning
greenencrypted, and the peer proved the identity key your node knew for it, or the one you pinned
blueencrypted; the identity is not checked (a peer that connected to you, or one that showed no key), or a wss:// peer under TLS
red, "key changed"encrypted, but the peer shows another key than before: it was reinstalled, or someone sits in between
open, greynot encrypted: the peer does not support it

Click a peer for the detail: cipher, the peer's fingerprint, how long the session keys have been in use.

Your node's fingerprint #

"This node" on the Network page, or:

lotus-cli p2pidentity show

The fingerprint is public: give it to the operators who want to pin your node. The private key stays in node.sqlite and is in no API answer.

Pinning a peer #

addnode=node.example.org:10605 p2ppin=node.example.org:10605=<fingerprint of that node, 64 hex digits>

The address is written exactly as in addnode. A pinned peer that shows another key is refused, and a pinned peer is never spoken to in plain.

When a peer's key changed #

The Network page shows an alert with both fingerprints. Ask the operator of that node, by another channel, whether they reinstalled it and what its fingerprint is now. If it matches:

lotus-cli p2pidentity accept "<address>"

Until then your node keeps the old key on record and flags every connection to that peer.

Changing your own key #

lotus-cli p2pidentity rotate

Peers that knew the old key follow the new one by themselves. If the old key may have been copied, use rotate compromised: peers are warned instead, and you confirm the new fingerprint with them. Pins on your node have to be updated by their owners either way.

Options #

OptionDefault
p2pencrypt11: encrypted with every peer that supports it. required: plain peers are refused in both directions (today: every node before 12.5.6, browsers, Lotus Desktop, the seeder). 0: off
p2ppinnone<address>=<fingerprint>, repeatable
p2pencryptdowngradewait0seconds a peer that was encrypted before is refused in plain; 0: connected in plain with a warning
p2pidentitybits4096size of the key made at the first start (3072 or 4096)

When a peer stops offering encryption #

A peer that was encrypted before and no longer offers it (it moved back to an older version, or someone on the path is dropping the offer) is still connected, in plain, and never silently: an orange open lock and a "no longer encrypted" tag in the peers table, an alert on the Network page, a WARNING in the log.

That is the default so that a node stays reachable when its peers change version. It means someone who can interfere with the packets between two nodes can make them speak plain, visibly. To refuse instead:

p2ppin on the peernever plain with that peer
p2pencryptdowngradewait=86400no plain for a day with any peer that was encrypted before; lift it after a deliberate rollback with lotus-cli p2pidentity forget all
p2pencrypt=requiredno plain connection at all
Source share/www/docs/p2p-encryption.md in the lotusd repository
Checked against doc/p2p-encryption.md src/net_encrypt.h src/net_encrypt.cpp src/init.cpp src/rpc/net.cpp