Traffic Encryption Layers
Your network traffic goes through multiple encryption layers, each protecting against different threats.The Encryption Stack
When a client callshttps://deadbeef111111111111111111111111-8080.dstack-prod5.phala.network/api
, the request travels through:
TLS Passthrough Mode
Sometimes you need unmodified TLS all the way to your application. Add thes
suffix to your URL:
- PostgreSQL/MySQL with
sslmode=require
and self managed certificates - Services that verify client certificates
- Custom protocols that manage their own TLS
Network Isolation
Each CVM gets its own isolated network segment. Here’s what that means practically.CVM Network Boundaries
Your CVM has:- A unique WireGuard tunnel with its own keypair
- An isolated IP in the 10.0.0.0/8 range
- No route to other CVMs or the host
Container Networking Inside CVM
Within your CVM, containers communicate normally via Docker’s bridge network:Outbound Connections (Egress)
CVMs have full outbound internet connectivity with privacy protections through TEE isolation. Supported Protocols: Your containers can use any standard internet protocol:- TCP/UDP for basic connectivity
- HTTP/HTTPS for web services and APIs
- WebSocket for real-time communication
- gRPC for modern microservices
- Database protocols (PostgreSQL, MySQL, Redis)
- Email protocols (SMTP, POP3, IMAP)
- File transfer protocols (FTP, SFTP)
- ICMP for ping utility
- Cannot access host’s
127.0.0.1
services - Limited access to host’s local network
- Cannot discover or attack host infrastructure
- Host sees a connection was made but not the content
- Memory contents remain encrypted and isolated
- No data leakage to host or other CVMs
- Application behavior stays private even with network monitoring
How SNI Routing Works
The gateway uses Server Name Indication (SNI) to route traffic without decrypting it.Standard Mode Routing
Fordeadbeef111111111111111111111111-8080.dstack-prod5.phala.network
:
- Client sends TLS ClientHello with SNI
- Gateway extracts
deadbeef111111111111111111111111-8080
from SNI - Looks up which CVM has app-id
deadbeef111111111111111111111111
- Forwards to that CVM’s WireGuard tunnel on port 8080
Passthrough Mode Routing
Fordeadbeef111111111111111111111111-5432s.dstack-prod5.phala.network
:
- Gateway sees the
s
suffix in SNI - Establishes TCP tunnel without TLS termination
- Your container receives the raw TLS stream
Load Balancing and Health Checks
Understanding how the gateway distributes traffic helps you design resilient services.Health-Based Routing
The gateway tracks WireGuard handshake times:- Last handshake < 5 minutes ago = healthy
- No recent handshake = unhealthy
Session Affinity
Currently there’s no sticky sessions. Requests distribute across healthy instances randomly. Design implications:Security Boundaries
Understanding what’s protected and what isn’t helps you make architectural decisions.What the Network Security Provides
Cloud insider attack resilience: All the traffic is end-to-end encrypted by default. Even the cloud provider can’t access your data. CVM isolation: Network segmentation prevents lateral movement between CVMs. Traffic analysis resistance: WireGuard hides packet sizes and timing patterns.What You Still Need to Handle
Application-layer auth: Network security doesn’t replace authentication.Common Patterns and Solutions
Database Connections
For managed databases requiring TLS:Microservice Communication
For service-to-service within the same CVM:WebSocket Connections
WebSockets work over the standard HTTPS endpoint:Debugging Network Issues
Checking Connectivity
From inside your container:TLS Debugging
For passthrough mode issues:Traffic Analysis
You can’t capture WireGuard traffic (it’s encrypted), but you can see container traffic:Advanced Privacy Patterns
Anonymous Hosting with Tor
For maximum privacy, you can combine TEE security with Tor hidden services. This provides both confidential computing and network anonymity:- Deploy a Tor hidden service inside your CVM
- Use internal Docker networking between Tor and your application
- Request TEE attestation based on the
.onion
address - Clients can verify both the Tor anonymity and TEE authenticity