|
1 |
| -# from https://gist.github.com/konklone/6532544 and https://mozilla.github.io/server-side-tls/ssl-config-generator/ |
2 |
| -################################################################################################################### |
3 |
| - |
4 |
| -# Basically the nginx configuration I use at konklone.com. |
5 |
| -# I check it using https://www.ssllabs.com/ssltest/analyze.html?d=konklone.com |
6 |
| -# |
7 |
| -# To provide feedback, please tweet at @konklone or email [email protected]. |
8 |
| -# Comments on gists don't notify the author. |
9 |
| -# |
10 |
| -# Thanks to WubTheCaptain (https://wubthecaptain.eu) for his help and ciphersuites. |
11 |
| -# Thanks to Ilya Grigorik (https://www.igvita.com) for constant inspiration. |
12 |
| - |
13 |
| -# Path to certificate and private key. |
14 |
| -# The .crt may omit the root CA cert, if it's a standard CA that ships with clients. |
15 |
| -#ssl_certificate /path/to/unified.crt; |
16 |
| -#ssl_certificate_key /path/to/my-private-decrypted.key; |
17 |
| - |
18 |
| -# Tell browsers to require SSL (warning: difficult to change your mind) |
19 |
| -# Handled by the management daemon because we can toggle this version or a |
20 |
| -# preload version. |
21 |
| -#add_header Strict-Transport-Security max-age=31536000; |
22 |
| - |
23 |
| -# Prefer certain ciphersuites, to enforce Forward Secrecy and avoid known vulnerabilities. |
24 |
| -# |
25 |
| -# Forces forward secrecy in all browsers and clients that can use TLS, |
26 |
| -# but with a small exception (DES-CBC3-SHA) for IE8/XP users. |
27 |
| -# |
28 |
| -# Reference client: https://www.ssllabs.com/ssltest/analyze.html |
29 |
| -ssl_prefer_server_ciphers on; |
30 |
| -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'; |
31 |
| - |
32 |
| -# Cut out (the old, broken) SSLv3 entirely. |
33 |
| -# This **excludes IE6 users** and (apparently) Yandexbot. |
34 |
| -# Just comment out if you need to support IE6, bless your soul. |
| 1 | +# We track the Mozilla "intermediate" compatibility TLS recommendations. |
| 2 | +# Note that these settings are repeated in the SMTP and IMAP configuration. |
35 | 3 | ssl_protocols TLSv1.2 TLSv1.1 TLSv1;
|
| 4 | +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'; |
| 5 | +ssl_dhparam STORAGE_ROOT/ssl/dh2048.pem; |
36 | 6 |
|
37 |
| -# Turn on session resumption, using a cache shared across nginx processes, |
38 | 7 | # as recommended by http://nginx.org/en/docs/http/configuring_https_servers.html
|
39 | 8 | ssl_session_cache shared:SSL:50m;
|
40 | 9 | ssl_session_timeout 1d;
|
41 |
| -#keepalive_timeout 70; # in Ubuntu 14.04/nginx 1.4.6 the default is 65, so plenty good |
42 | 10 |
|
43 | 11 | # Buffer size of 1400 bytes fits in one MTU.
|
44 | 12 | # nginx 1.5.9+ ONLY
|
45 |
| -#ssl_buffer_size 1400; |
46 |
| - |
47 |
| -# SPDY header compression (0 for none, 9 for slow/heavy compression). Preferred is 6. |
48 |
| -# |
49 |
| -# BUT: header compression is flawed and vulnerable in SPDY versions 1 - 3. |
50 |
| -# Disable with 0, until using a version of nginx with SPDY 4. |
51 |
| -spdy_headers_comp 0; |
52 |
| - |
53 |
| -# Now let's really get fancy, and pre-generate a 2048 bit random parameter |
54 |
| -# for DH elliptic curves. If not created and specified, default is only 1024 bits. |
55 |
| -# |
56 |
| -# Generated by OpenSSL with the following command: |
57 |
| -# openssl dhparam -outform pem -out dhparam2048.pem 2048 |
58 |
| -# |
59 |
| -# Note: raising the bits to 2048 excludes Java 6 clients. Comment out if a problem. |
60 |
| -ssl_dhparam STORAGE_ROOT/ssl/dh2048.pem; |
61 |
| - |
| 13 | +ssl_buffer_size 1400; |
62 | 14 |
|
63 |
| -# OCSP stapling - means nginx will poll the CA for signed OCSP responses, |
64 |
| -# and send them to clients so clients don't make their own OCSP calls. |
65 |
| -# http://en.wikipedia.org/wiki/OCSP_stapling |
66 |
| -# |
67 |
| -# while the ssl_certificate above may omit the root cert if the CA is trusted, |
68 |
| -# ssl_trusted_certificate below must point to a chain of **all** certs |
69 |
| -# in the trust path - (your cert, intermediary certs, root cert) |
70 |
| -# |
71 |
| -# 8.8.8.8 and 8.8.4.4 below are Google's public IPv4 DNS servers. |
72 |
| -# nginx will use them to talk to the CA. |
73 | 15 | ssl_stapling on;
|
74 | 16 | ssl_stapling_verify on;
|
75 | 17 | resolver 127.0.0.1 valid=86400;
|
76 | 18 | resolver_timeout 10;
|
| 19 | + |
| 20 | +# h/t https://gist.github.com/konklone/6532544 |
0 commit comments