1
0
mirror of https://github.com/mail-in-a-box/mailinabox.git synced 2024-11-26 02:57:04 +00:00

update to @konklone's latest nginx SSL configuration recommendations

This commit is contained in:
Joshua Tauberer 2014-04-17 20:27:52 -04:00
parent 04d97a11e9
commit 6fd768d6ee
3 changed files with 48 additions and 9 deletions

46
conf/nginx-ssl.conf Normal file
View File

@ -0,0 +1,46 @@
# https://gist.github.com/konklone/6532544
##########################################
# required: path to certificate and private key
# the .crt may omit the root CA cert, if it's a standard CA that ships with clients.
#ssl_certificate /path/to/unified.crt;
#ssl_certificate_key /path/to/my-private-decrypted.key;
# optional: tell browsers to require SSL (warning: difficult to change your mind)
#add_header Strict-Transport-Security max-age=31536000;
# optional: prefer certain ciphersuites, to enforce Perfect Forward Secrecy and avoid known vulnerabilities.
# done in consultation with:
# http://ggramaize.wordpress.com/2013/08/02/tls-perfect-forward-secrecy-support-with-apache/
# https://www.ssllabs.com/ssltest/analyze.html
ssl_prefer_server_ciphers on;
ssl_ciphers ECDHE-RSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-SHA384:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-SHA256:ECDHE-RSA-RC4-SHA:ECDHE-RSA-AES256-SHA:RC4-SHA:AES256-GCM-SHA384:AES256-SHA256:CAMELLIA256-SHA:ECDHE-RSA-AES128-SHA:AES128-GCM-SHA256:AES128-SHA256:AES128-SHA:CAMELLIA128-SHA;
# optional: turn on session resumption, using a 10 min cache shared across nginx processes
# as recommended by http://nginx.org/en/docs/http/configuring_https_servers.html
ssl_session_cache shared:SSL:10m;
ssl_session_timeout 10m;
keepalive_timeout 70;
# nginx 1.5.9+ ONLY
#ssl_buffer_size 1400; # 1400 bytes to fit in one MTU
# SPDY header compression (0 for none, 1 for fast/less compression, 9 for slow/heavy compression)
spdy_headers_comp 6;
# OCSP stapling - means nginx will poll the CA for signed OCSP responses,
# and send them to clients so clients don't make their own OCSP calls.
# http://en.wikipedia.org/wiki/OCSP_stapling
#
# while the ssl_certificate above may omit the root cert if the CA is trusted,
# ssl_trusted_certificate below must point to a chain of all certs
# in the trust path - (your cert, intermediary certs, root cert)
#
# 8.8.8.8 below is Google's public DNS server. nginx will use it to talk to the CA.
#
# If the issuer certificate is not found (e.g. the certificate is self-signed),
# nginx will skip this with the warning: '"ssl_stapling" ignored, issuer certificate not found'.
ssl_stapling on;
ssl_stapling_verify on;
resolver 8.8.8.8;
#ssl_trusted_certificate /path/to/all-certs-in-chain.crt;

View File

@ -29,15 +29,7 @@ server {
ssl_certificate $STORAGE_ROOT/ssl/ssl_certificate.pem; ssl_certificate $STORAGE_ROOT/ssl/ssl_certificate.pem;
ssl_certificate_key $STORAGE_ROOT/ssl/ssl_private_key.pem; ssl_certificate_key $STORAGE_ROOT/ssl/ssl_private_key.pem;
include /etc/nginx/nginx-ssl.conf;
# SSL configuration by @konklone at https://gist.github.com/konklone/6532544
# 1) prefer certain ciphersuites, to enforce Perfect Forward Secrecy and avoid known vulnerabilities. http://ggramaize.wordpress.com/2013/08/02/tls-perfect-forward-secrecy-support-with-apache/ and https://www.ssllabs.com/ssltest/analyze.html
ssl_prefer_server_ciphers on;
ssl_ciphers ECDHE-RSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-SHA384:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-SHA256:ECDHE-RSA-RC4-SHA:ECDHE-RSA-AES256-SHA:DHE-RSA-AES256-GCM-SHA384:DHE-RSA-AES256-SHA256:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES128-SHA256:DHE-RSA-AES256-SHA:DHE-RSA-AES128-SHA:RC4-SHA:AES256-GCM-SHA384:AES256-SHA256:CAMELLIA256-SHA:ECDHE-RSA-AES128-SHA:AES128-GCM-SHA256:AES128-SHA256:AES128-SHA:CAMELLIA128-SHA;
# 2) turn on session resumption, using a 10 min cache shared across nginx processes, as recommended by http://nginx.org/en/docs/http/configuring_https_servers.html
ssl_session_cache shared:SSL:10m;
ssl_session_timeout 10m;
keepalive_timeout 70;
# We'll expose the same static directory under https. # We'll expose the same static directory under https.
root $STORAGE_ROOT/www/static; root $STORAGE_ROOT/www/static;

View File

@ -15,6 +15,7 @@ cat conf/nginx.conf \
| sed "s/\$STORAGE_ROOT/$STORAGE_ROOT_ESC/g" \ | sed "s/\$STORAGE_ROOT/$STORAGE_ROOT_ESC/g" \
| sed "s/\$PUBLIC_HOSTNAME/$PUBLIC_HOSTNAME_ESC/g" \ | sed "s/\$PUBLIC_HOSTNAME/$PUBLIC_HOSTNAME_ESC/g" \
> /etc/nginx/conf.d/local.conf > /etc/nginx/conf.d/local.conf
cp conf/nginx-ssl.conf /etc/nginx/nginx-ssl.conf
# make a default homepage # make a default homepage
mkdir -p $STORAGE_ROOT/www/static mkdir -p $STORAGE_ROOT/www/static