Skip to main content

End-to-End Encryption

Muti Metroo provides automatic end-to-end encryption for all stream data. Only the ingress (entry) and exit agents can read the payload - transit agents cannot decrypt it.

Overview

All stream data is encrypted automatically using modern cryptography:

  • Key Exchange: X25519 elliptic curve Diffie-Hellman
  • Encryption: ChaCha20-Poly1305 authenticated encryption
  • Forward Secrecy: Each stream uses unique ephemeral keys

Security Properties

PropertyDescription
ConfidentialityOnly ingress and exit can read stream data
IntegrityTampering is detected and rejected
Forward SecrecyEach stream uses ephemeral keys
Transit OpacityTransit agents see only encrypted data

What Is Encrypted

DataEncryptedNotes
Stream payloadYesAll application data
Destination address/portNoRequired for routing

No Configuration Required

End-to-end encryption is enabled automatically. There is no configuration to set up - it just works.

Key Generation

Each agent automatically generates an X25519 keypair on first start:

FilePurposePermissions
{data_dir}/agent_keyPrivate key (never shared)0600 (owner only)
{data_dir}/agent_key.pubPublic key (distributed to peers)0644 (world readable)

The keypair is persistent - once generated, it's reused on subsequent starts. The public key is automatically distributed to other agents via NodeInfo advertisements, so peers can encrypt data destined for this agent.

Stream Encryption Flow

When a stream is opened:

  1. Ingress and exit agents exchange ephemeral public keys
  2. Both derive a shared secret using X25519 ECDH
  3. All stream data is encrypted with ChaCha20-Poly1305
  4. Transit agents forward encrypted data unchanged

Performance Impact

MetricImpact
CPUMinimal (~5-10% for encryption)
LatencyNegligible
Bandwidth+28 bytes per frame

ChaCha20-Poly1305 is highly optimized and runs at several GB/s on modern CPUs.

E2E vs Management Encryption

Muti Metroo uses two separate encryption systems:

FeatureE2E EncryptionManagement Encryption
PurposeProtect stream payload dataProtect mesh topology metadata
What's encryptedApplication data in streamsNodeInfo (hostnames, IPs, OS)
Key typePer-agent persistent keypairShared across all agents
AutomaticYes, always onNo, requires configuration
AlgorithmX25519 + ChaCha20-Poly1305X25519 + ChaCha20-Poly1305 (sealed boxes)

Both systems use the same cryptographic primitives but serve different purposes. E2E encryption protects your traffic; management encryption protects your infrastructure topology.

See Red Team Operations for management encryption details.

Threat Protection

Protected Against

  • Passive eavesdropping at transit nodes
  • Compromised transit agents reading your data
  • Replay attacks
  • Message tampering

Not Protected Against

  • Compromised ingress or exit agent (secure your endpoints)
  • Traffic analysis (timing, volume patterns)
  • Metadata leakage (destination is visible for routing)

Troubleshooting

Decryption Failures

If streams fail with decryption errors:

  1. Version mismatch: Ensure all agents are running the same version
  2. Corrupted frames: Check network reliability
  3. Clock skew: Verify system time is synchronized

Key Issues

# Verify keypair exists
ls -la {data_dir}/agent_key*

# Regenerate if corrupted (will change agent identity)
rm {data_dir}/agent_key*
muti-metroo init -d {data_dir}

Next Steps