Use nginx's official repo and improve TLS configuration

These packagea are newer than the 15.04 we had. We can enable HTTP2
This commit is contained in:
Greg Karékinian 2017-04-07 18:16:51 +02:00
parent 8ad690cedb
commit d5d3fb60c1
3 changed files with 33 additions and 1 deletions

View File

@ -0,0 +1,14 @@
# Improve performance
ssl_session_timeout 1d;
ssl_session_cache shared:SSL:50m;
ssl_session_tickets off;
# Disable insecure cyphers
ssl_protocols TLSv1.2;
ssl_prefer_server_ciphers on;
# From https://mozilla.github.io/server-side-tls/ssl-config-generator/
# Oldest compatible clients: Firefox 27, Chrome 30, IE 11 on Windows 7, Edge, Opera 17, Safari 9, Android 5.0, and Java 8
# We don't have a lot of those cyphers (using Ubuntu 15.04), but CBC is insecure:
# https://blog.cloudflare.com/yet-another-padding-oracle-in-openssl-cbc-ciphersuites/
ssl_ciphers 'ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA256';
# Unique DH Group, see https://weakdh.org/sysadmin.html
ssl_dhparam /etc/ssl/private/dhparams.pem;

View File

@ -8,3 +8,4 @@ version '0.1.0'
depends 'nginx'
depends 'firewall'
depends 'openssl'

View File

@ -22,9 +22,26 @@ node.override['nginx']['log_formats']['json'] = <<-EOF
'"ua":"$http_user_agent"}'
EOF
node.override['nginx']['repo_source'] = 'nginx' # Install from official repo
node.override['nginx']['upstream_repository'] = "http://nginx.org/packages/mainline/#{node['platform']}"
include_recipe 'nginx'
# Generate Strong Diffie-Hellman Group (increases security)
# https://weakdh.org/sysadmin.html
openssl_dhparam "/etc/ssl/private/dhparams.pem" do
key_length 2048
mode 0600
owner 'www-data'
end
cookbook_file "#{node['nginx']['dir']}/conf.d/tls_config.conf" do
source 'nginx_tls_config.conf'
owner 'root'
group 'root'
mode '0644'
notifies :restart, 'service[nginx]'
end
unless node.chef_environment == "development"
include_recipe 'kosmos-base::firewall'