From e8383499bda93faf360e8e546d25de1e75541fa6 Mon Sep 17 00:00:00 2001 From: Zolfa Date: Wed, 27 May 2020 15:35:25 +0200 Subject: [PATCH] roles/nginx: add tls 1.2 support --- roles/nginx/defaults/main.yml | 1 + roles/nginx/templates/base.j2 | 5 ++++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/roles/nginx/defaults/main.yml b/roles/nginx/defaults/main.yml index 3ac2116..a8f9f67 100644 --- a/roles/nginx/defaults/main.yml +++ b/roles/nginx/defaults/main.yml @@ -4,4 +4,5 @@ monitoring_vhosts: [] nginx_site_fqdn: '{{ ansible_hostname }}.{{ domain }}' nginx_site_alternate_fqdns: [] nginx_proxy_protocol: true +nginx_tls_1_2: false ... diff --git a/roles/nginx/templates/base.j2 b/roles/nginx/templates/base.j2 index ecf1c1a..e0b3158 100644 --- a/roles/nginx/templates/base.j2 +++ b/roles/nginx/templates/base.j2 @@ -27,7 +27,10 @@ server { ssl_session_cache shared:MozSSL:10m; ssl_session_tickets off; # modern configuration - ssl_protocols TLSv1.3; + ssl_protocols TLSv1.3 {{ 'TLSv1.2' if nginx_tls_1_2 }}; + {% if nginx_tls_1_2 %} + ssl_ciphers 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:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384; + {% endif %} ssl_prefer_server_ciphers off; # HSTS (2 years, no preloading) add_header Strict-Transport-Security "max-age=63072000" always;