dstack-gateway Operational Features
The dstack-gateway component includes comprehensive operational capabilities designed to maintain robust security, automatic cleanup, and enhanced observability within dstack deployments. For automated cleanup and maintenance, the gateway continuously monitors WireGuard handshake activity to efficiently remove stale CVM instances, ensuring optimal resource usage. It proactively manages gateway node cleanup to maintain seamless synchronization across distributed clusters. WireGuard configurations are automatically updated, providing stable networking without manual intervention, and connections are systematically recycled every five minutes, enforcing a maximum timeout limit of 10 hours to preserve both security and system efficiency. Security and authorization within the gateway are rigorously enforced. It mandates remote attestation verification for CVM registration, verifying the integrity and identity of each confidential VM instance at launch. Additionally, integration with the KmsAuth contract strengthens application authorization cryptographically, guaranteeing that only legitimate deployments receive necessary keys and credentials. Active TLS certificate transparency monitoring prevents unauthorized certificate issuance, while the management of CAA records restricts certificate authorities, significantly mitigating risks associated with unauthorized or compromised certificates. For effective monitoring and observability, the gateway provides real-time tracking of connection statistics, offering immediate insights into network health and usage patterns. CVM instance health is assessed through regular WireGuard handshake checks, enabling rapid identification and resolution of potential connectivity issues. Additionally, the system monitors certificate expiration closely, issuing proactive alerts to avoid service disruptions due to expired certificates. Continuous monitoring of cluster synchronization status further ensures that distributed deployments remain reliable, coordinated, and resilient across diverse operational scenarios.dstack-gateway Implementation
The dstack-gateway is a reverse proxy and networking component that handles TLS termination, WireGuard VPN connections, and traffic routing between external clients and Confidential Virtual Machines (CVMs). 5Advanced Routing Configuration
The gateway uses sophisticated domain-based routing with the following patterns: 6Pattern | Routing Logic | TLS Mode | Default Port |
---|---|---|---|
<app-id>.domain.com | Direct app routing | TLS Termination | 80 |
<app-id>-<port>.domain.com | Custom port routing | TLS Termination | Specified port |
<app-id>s.domain.com | TLS passthrough | TLS Passthrough | 443 |
<app-id>-<port>s.domain.com | Custom port with TLS passthrough | TLS Passthrough | Specified port |
custom.domain.com | DNS TXT lookup: _dstack-app-address | TLS Passthrough | From TXT record |
Gateway Confirguation — Detailed Example
Next Steps
Now that you understand Gateway networking and TLS management, continue learning about dstack’s core components:Related Topics
- Networking - Deep dive into dstack’s network architecture
- Security Model - Understand TLS and WireGuard security