Skip to content

Commit bb22334

Browse files
authored
Merge pull request #46 from atomic111/master
add headers and cleaning
2 parents de8f902 + 1328fd4 commit bb22334

File tree

8 files changed

+41
-40
lines changed

8 files changed

+41
-40
lines changed

.kitchen.yml

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -53,13 +53,6 @@ platforms:
5353
intermediate_instructions:
5454
- RUN dnf -y install yum which systemd-sysv initscripts
5555

56-
- name: ubuntu-12.04
57-
driver:
58-
image: ubuntu-upstart:12.04
59-
pid_one_command: /sbin/init
60-
intermediate_instructions:
61-
- RUN /usr/bin/apt-get update
62-
6356
- name: ubuntu-14.04
6457
driver:
6558
image: ubuntu-upstart:14.04
@@ -88,7 +81,6 @@ platforms:
8881
intermediate_instructions:
8982
- RUN zypper --non-interactive install aaa_base perl-Getopt-Long-Descriptive which
9083

91-
9284
suites:
9385
- name: default
9486
run_list:
@@ -98,4 +90,4 @@ suites:
9890
- recipe[nginx-hardening]
9991
verifier:
10092
inspec_tests:
101-
- https://github.com/dev-sec/tests-nginx-hardening
93+
- path: test/integration/default

.travis.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ services: docker
2020

2121
env:
2222
matrix:
23-
- INSTANCE=default-ubuntu-1204
2423
- INSTANCE=default-ubuntu-1404
2524
- INSTANCE=default-ubuntu-1604
2625
- INSTANCE=default-centos-6
@@ -32,7 +31,7 @@ before_script:
3231
- /opt/chefdk/embedded/bin/chef --version
3332
- /opt/chefdk/embedded/bin/cookstyle --version
3433
- /opt/chefdk/embedded/bin/foodcritic --version
35-
- /opt/chefdk/embedded/bin/chef gem install coveralls # needed for chefspecs
34+
- /opt/chefdk/embedded/bin/chef gem install coveralls -v 0.8.19 # needed for chefspecs
3635

3736
script: KITCHEN_LOCAL_YAML=.kitchen.docker.yml /opt/chefdk/embedded/bin/kitchen verify ${INSTANCE}
3837

Gemfile

Lines changed: 12 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -2,45 +2,38 @@
22

33
source 'https://rubygems.org'
44

5-
gem 'berkshelf', '~> 5.0'
6-
gem 'chef', '>= 12.0'
7-
8-
# pin dependency for Ruby 1.9.3 since bundler is not
9-
# detecting that net-ssh 3 does not work with 1.9.3
10-
if Gem::Version.new(RUBY_VERSION) < Gem::Version.new('2.2.2')
11-
gem 'listen', '~> 3.0.0'
12-
gem 'ruby_dep', '~> 1.3.0'
13-
gem 'rack', '< 2.0'
14-
end
5+
gem 'berkshelf', '~> 6.1'
6+
gem 'chef', '~> 12.5' # chefspec builds get stucked with 13.1
157

168
group :test do
179
gem 'rake'
18-
gem 'chefspec', '~> 5.3'
19-
gem 'foodcritic', '~> 8.0'
10+
gem 'chefspec', '~> 7.1.0'
11+
gem 'foodcritic', '~> 11.1'
12+
gem 'thor', '~> 0.19.1'
2013
gem 'thor-foodcritic'
2114
gem 'cookstyle'
2215
gem 'coveralls', require: false
23-
gem 'minitest', '~> 5.5'
16+
gem 'minitest', '~> 5.10.2'
17+
gem 'rubocop', '~> 0.49.0'
2418
gem 'simplecov', '~> 0.10'
2519
end
2620

2721
group :development do
2822
gem 'guard'
2923
gem 'guard-rspec'
24+
gem 'guard-foodcritic', '~> 3.0'
3025
gem 'guard-kitchen'
3126
gem 'guard-rubocop'
32-
# gem 'guard-foodcritic' # disabled until a new release comes out that removes the pin
3327
end
3428

3529
group :integration do
36-
gem 'test-kitchen', '~> 1.0'
30+
gem 'test-kitchen', '~> 1.16.0'
3731
gem 'kitchen-vagrant'
38-
gem 'kitchen-inspec'
39-
gem 'kitchen-sharedtests', '~> 0.2.0'
40-
gem 'concurrent-ruby', '~> 0.9'
4132
gem 'kitchen-dokken'
33+
gem 'kitchen-inspec'
34+
gem 'concurrent-ruby', '~> 1.0.5'
4235
end
4336

4437
group :tools do
45-
gem 'github_changelog_generator', '~> 1.14.0'
38+
gem 'github_changelog_generator', '~> 1.14'
4639
end

README.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ This cookbook provides a secure overlay for nginx configuration.
1313
### Platform
1414

1515
- Debian 7, 8
16-
- Ubuntu 12.04, 14.04, 16.04
16+
- Ubuntu 14.04, 16.04
1717
- CentOS 6, 7
1818
- OracleLinux 6.6, 6.7, 7.1
1919

@@ -26,8 +26,8 @@ This cookbook provides a secure overlay for nginx configuration.
2626
- `['nginx']['server_tokens']` - `off` to disable disables emitting nginx version in error messages and in the "Server" response header field. Set to `on` to enable the nginx version in error messages and "Server" response header.
2727
- `['nginx-hardening']['source']['http_autoindex_module']` - `false` to disable the HTTP Autoindex module. Set to `true` to enable http_autoindex_module.
2828
- `['nginx-hardening']['source']['http_ssi_module']` - `false` to disable the HTTP SSI module. Set to `true` to enable http_ssi_module.
29-
- `['nginx-hardening']['options']['ssl_protocols']` - `'TLSv1 TLSv1.1 TLSv1.2'` to specify the SSL protocol which should be used.
30-
- `['nginx-hardening']['options']['ssl_ciphers']` - `'ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:DHE-DSS-AES128-GCM-SHA256:kEDH+AESGCM:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA:ECDHE-ECDSA-AES256-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA:DHE-DSS-AES128-SHA256:DHE-RSA-AES256-SHA256:DHE-DSS-AES256-SHA:DHE-RSA-AES256-SHA:AES128-GCM-SHA256:AES256-GCM-SHA384:AES128-SHA256:AES256-SHA256:AES128-SHA:AES256-SHA:AES:CAMELLIA:DES-CBC3-SHA:!aNULL:!eNULL:!EXPORT:!DES:!RC4:!MD5:!PSK:!aECDH:!EDH-DSS-DES-CBC3-SHA:!EDH-RSA-DES-CBC3-SHA:!KRB5-DES-CBC3-SHA'` to specify the TLS ciphers which should be used.
29+
- `['nginx-hardening']['options']['ssl_protocols']` - `'TLSv1.2'` to specify the SSL protocol which should be used.
30+
- `['nginx-hardening']['options']['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'` to specify the TLS ciphers which should be used.
3131
- `['nginx-hardening']['options']['ssl_prefer_server_ciphers']` - `'on'` Specifies that server ciphers should be preferred over client ciphers when using the TLS protocols. Set to `false` to disable it.
3232
- `['nginx-hardening']['dh-size']` - `2048` Specifies the length of DH parameters for EDH ciphers.
3333

@@ -65,15 +65,15 @@ bundle install
6565
bundle exec rake lint
6666

6767
# fast test on one machine
68-
bundle exec kitchen test default-ubuntu-1204
68+
bundle exec kitchen test default-ubuntu-1404
6969

7070
# test on all machines
7171
bundle exec kitchen test
7272

7373
# for development
74-
bundle exec kitchen create default-ubuntu-1204
75-
bundle exec kitchen converge default-ubuntu-1204
76-
bundle exec kitchen verify default-ubuntu-1204
74+
bundle exec kitchen create default-ubuntu-1404
75+
bundle exec kitchen converge default-ubuntu-1404
76+
bundle exec kitchen verify default-ubuntu-1404
7777
```
7878

7979
## Contributors + Kudos

attributes/hardening.rb

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,12 @@
6868

6969
# XSS filter
7070
'X-XSS-Protection "1; mode=block"',
71+
72+
# HSTS Header
73+
'Strict-Transport-Security max-age=15768000',
74+
75+
# Content Security Header
76+
'Content-Security-Policy "script-src \'self\'; object-src \'self\'"',
7177
],
7278

7379
}
@@ -87,7 +93,8 @@
8793
flags.push '--without-http_ssi_module' unless node['nginx-hardening']['source']['http_ssi_module']
8894

8995
default['nginx']['source']['default_configure_flags'] = flags
90-
default['nginx-hardening']['options']['ssl_protocols'] = 'TLSv1 TLSv1.1 TLSv1.2'
91-
default['nginx-hardening']['options']['ssl_ciphers'] = "'ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:DHE-DSS-AES128-GCM-SHA256:kEDH+AESGCM:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA:ECDHE-ECDSA-AES256-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA:DHE-DSS-AES128-SHA256:DHE-RSA-AES256-SHA256:DHE-DSS-AES256-SHA:DHE-RSA-AES256-SHA:AES128-GCM-SHA256:AES256-GCM-SHA384:AES128-SHA256:AES256-SHA256:AES128-SHA:AES256-SHA:AES:CAMELLIA:DES-CBC3-SHA:!aNULL:!eNULL:!EXPORT:!DES:!RC4:!MD5:!PSK:!aECDH:!EDH-DSS-DES-CBC3-SHA:!EDH-RSA-DES-CBC3-SHA:!KRB5-DES-CBC3-SHA'"
96+
default['nginx-hardening']['options']['ssl_protocols'] = 'TLSv1.2'
97+
default['nginx-hardening']['options']['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'"
9298
default['nginx-hardening']['options']['ssl_prefer_server_ciphers'] = 'on'
99+
default['nginx-hardening']['options']['ssl_session_tickets'] = 'off'
93100
default['nginx-hardening']['dh-size'] = 2048

metadata.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
name 'nginx-hardening'
1919
maintainer 'Dominik Richter'
2020
maintainer_email 'dominik.richter@googlemail.com'
21-
license 'Apache 2.0'
21+
license 'Apache-2.0'
2222
description 'Configures nginx hardening'
2323
long_description IO.read(File.join(File.dirname(__FILE__), 'README.md'))
2424

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
include_controls 'nginx-baseline' do
2+
# skip http method control
3+
skip_control 'nginx-14'
4+
# skip HTTPOnly and secure cookie control
5+
skip_control 'nginx-16'
6+
end
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
name: nginx-hardening-integration-tests
2+
depends:
3+
- name: nginx-baseline
4+
url: https://github.com/dev-sec/nginx-baseline

0 commit comments

Comments
 (0)