From 213029577e2f61de96d701fbb811a9ae09297317 Mon Sep 17 00:00:00 2001 From: Disassembler Date: Mon, 26 Jun 2017 15:17:55 +0200 Subject: [PATCH] Strengthen nginx SSL config - DH 2048, HSTS, lower SSL cache to 1MB --- basic.sh | 4 ++++ basic/etc/nginx/sites-available/default | 4 +++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/basic.sh b/basic.sh index f6b666a..e3076c2 100644 --- a/basic.sh +++ b/basic.sh @@ -59,6 +59,10 @@ apt-get -y --no-install-recommends install nginx-light uwsgi uwsgi-plugin-python openssl req -x509 -new -out /etc/ssl/certs/services.pem -keyout /etc/ssl/private/services.key -nodes -days 3654 -subj "/C=CZ/CN=$(hostname -f)" chmod 640 /etc/ssl/private/services.key +# Create Diffie-Hellman param +openssl dhparam -out /etc/ssl/dhparam.pem 2048 +chmod 640 /etc/ssl/dhparam.pem + # Modify default nginx site mkdir /etc/nginx/apps-available /etc/nginx/apps-enabled mkdir /srv/portal diff --git a/basic/etc/nginx/sites-available/default b/basic/etc/nginx/sites-available/default index ed85897..c26e69c 100644 --- a/basic/etc/nginx/sites-available/default +++ b/basic/etc/nginx/sites-available/default @@ -12,10 +12,12 @@ server { ssl_certificate_key /etc/ssl/private/services.key; ssl_protocols TLSv1.2; ssl_ciphers 'ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES256-SHA384:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA:ECDHE-RSA-AES256-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA:DHE-RSA-AES256-SHA256:DHE-RSA-AES256-SHA:ECDHE-ECDSA-DES-CBC3-SHA:ECDHE-RSA-DES-CBC3-SHA:EDH-RSA-DES-CBC3-SHA:AES128-GCM-SHA256:AES256-GCM-SHA384:AES128-SHA256:AES256-SHA256:AES128-SHA:AES256-SHA:DES-CBC3-SHA:!DSS'; + ssl_dhparam /etc/ssl/dhparam.pem; ssl_prefer_server_ciphers on; - ssl_session_cache shared:SSL:30m; + ssl_session_cache shared:SSL:1m; ssl_session_timeout 1d; ssl_session_tickets off; + add_header Strict-Transport-Security "max-age=31536000;"; root /srv/portal; index index.html;