Skip to content

Commit dcdf151

Browse files
committed
feat: hardened dstack-ingress
1 parent 13c5325 commit dcdf151

2 files changed

Lines changed: 37 additions & 1 deletion

File tree

custom-domain/dstack-ingress/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ This project enables you to run dstack applications with your own custom domain,
1010
- Cloudflare DNS configuration for CNAME, TXT, and CAA records
1111
- Nginx reverse proxy to route traffic to your application
1212
- Certificate evidence generation for verification
13+
- Strong SSL/TLS configuration with modern cipher suites (AES-GCM and ChaCha20-Poly1305)
1314

1415
## How It Works
1516

custom-domain/dstack-ingress/scripts/entrypoint.sh

Lines changed: 36 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,49 @@ setup_py_env() {
1515
setup_nginx_conf() {
1616
cat <<EOF > /etc/nginx/conf.d/default.conf
1717
server {
18-
listen ${PORT} ssl;
18+
listen ${PORT} ssl http2;
1919
server_name ${DOMAIN};
2020
21+
# SSL certificate configuration
2122
ssl_certificate /etc/letsencrypt/live/${DOMAIN}/fullchain.pem;
2223
ssl_certificate_key /etc/letsencrypt/live/${DOMAIN}/privkey.pem;
2324
25+
# Modern SSL configuration - TLS 1.2 and 1.3 only
26+
ssl_protocols TLSv1.2 TLSv1.3;
27+
28+
# Strong cipher suites - Only AES-GCM and ChaCha20-Poly1305
29+
ssl_ciphers 'TLS_AES_128_GCM_SHA256:TLS_AES_256_GCM_SHA384:TLS_CHACHA20_POLY1305_SHA256:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305';
30+
31+
# Prefer server cipher suites
32+
ssl_prefer_server_ciphers on;
33+
34+
# ECDH curve for ECDHE ciphers
35+
ssl_ecdh_curve secp384r1;
36+
37+
# Enable OCSP stapling
38+
ssl_stapling on;
39+
ssl_stapling_verify on;
40+
ssl_trusted_certificate /etc/letsencrypt/live/${DOMAIN}/chain.pem;
41+
resolver 8.8.8.8 8.8.4.4 valid=300s;
42+
resolver_timeout 5s;
43+
44+
# SSL session configuration
45+
ssl_session_timeout 1d;
46+
ssl_session_cache shared:SSL:50m;
47+
ssl_session_tickets off;
48+
49+
# SSL buffer size (optimized for TLS 1.3)
50+
ssl_buffer_size 4k;
51+
52+
# Disable SSL renegotiation
53+
ssl_early_data off;
54+
2455
location / {
2556
proxy_pass ${TARGET_ENDPOINT};
57+
proxy_set_header Host \$host;
58+
proxy_set_header X-Real-IP \$remote_addr;
59+
proxy_set_header X-Forwarded-For \$proxy_add_x_forwarded_for;
60+
proxy_set_header X-Forwarded-Proto \$scheme;
2661
}
2762
2863
location /evidences/ {

0 commit comments

Comments
 (0)