Skip to content
This repository was archived by the owner on Nov 17, 2020. It is now read-only.

Commit 2ebcf4b

Browse files
authored
Merge pull request #18 from dev-sec/kitchen_travis
Kitchen travis
2 parents 2445b3d + c285d01 commit 2ebcf4b

17 files changed

+170
-86
lines changed

.github_changelog_generator

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
unreleased=false

.kitchen.vagrant.yml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -62,10 +62,6 @@ platforms:
6262
- name: oracle-7
6363
driver_config:
6464
box: boxcutter/ol72
65-
- name: debian-7
66-
driver_config:
67-
box: debian-7
68-
box_url: https://opscode-vm-bento.s3.amazonaws.com/vagrant/virtualbox/opscode_debian-7.8_chef-provisionerless.box
6965
- name: debian-8
7066
driver_config:
7167
box: debian-8

.kitchen.yml

Lines changed: 43 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,9 @@ provisioner:
2121
roles_path: ../ansible-nginx-hardening/
2222
http_proxy: <%= ENV['http_proxy'] || nil %>
2323
https_proxy: <%= ENV['https_proxy'] || nil %>
24-
playbook: default.yml
24+
playbook: tests/test.yml
2525
requirements_path: requirements.yml
26+
galaxy_ignore_certs: true
2627

2728
platforms:
2829
- name: centos6-ansible-latest
@@ -33,18 +34,22 @@ platforms:
3334
driver:
3435
image: rndmh3ro/docker-centos7-ansible:latest
3536
platform: centos
37+
run_command: /sbin/init
38+
provision_command:
39+
- sed -i 's/UsePAM yes/UsePAM no/g' /etc/ssh/sshd_config
40+
- systemctl enable sshd.service
3641
- name: oracle6-ansible-latest
3742
driver:
3843
image: rndmh3ro/docker-oracle6-ansible:latest
3944
platform: centos
4045
- name: oracle7-ansible-latest
4146
driver:
4247
image: rndmh3ro/docker-oracle7-ansible:latest
48+
run_command: /sbin/init
4349
platform: centos
44-
- name: ubuntu1204-ansible-latest
45-
driver:
46-
image: rndmh3ro/docker-ubuntu1204-ansible:latest
47-
platform: ubuntu
50+
provision_command:
51+
- sed -i 's/UsePAM yes/UsePAM no/g' /etc/ssh/sshd_config
52+
- systemctl enable sshd.service
4853
- name: ubuntu1404-ansible-latest
4954
driver:
5055
image: rndmh3ro/docker-ubuntu1404-ansible:latest
@@ -53,10 +58,9 @@ platforms:
5358
driver:
5459
image: rndmh3ro/docker-ubuntu1604-ansible:latest
5560
platform: ubuntu
56-
- name: debian7-ansible-latest
57-
driver:
58-
image: rndmh3ro/docker-debian7-ansible:latest
59-
platform: debian
61+
run_command: /sbin/init
62+
provision_command:
63+
- systemctl enable ssh.service
6064
- name: debian8-ansible-latest
6165
driver:
6266
image: rndmh3ro/docker-debian8-ansible:latest
@@ -65,12 +69,41 @@ platforms:
6569
driver:
6670
image: rndmh3ro/docker-debian9-ansible:latest
6771
platform: debian
72+
run_command: /sbin/init
73+
provision_command:
74+
- apt install -y systemd-sysv
75+
- systemctl enable ssh.service
76+
- name: amazon-ansible-latest
77+
driver:
78+
image: rndmh3ro/docker-amazon-ansible:latest
79+
platform: centos
80+
run_command: /sbin/init
81+
provision_command:
82+
- sed -i 's/UsePAM yes/UsePAM no/g' /etc/ssh/sshd_config
83+
- systemctl enable sshd.service
6884

6985
verifier:
7086
name: inspec
7187
sudo: true
7288
inspec_tests:
73-
- https://github.com/dev-sec/nginx-baseline
89+
- ../nginx-baseline
90+
#- https://github.com/dev-sec/nginx-baseline
91+
controls:
92+
- nginx-01
93+
- nginx-02
94+
- nginx-03
95+
- nginx-04
96+
- nginx-05
97+
- nginx-06
98+
- nginx-07
99+
- nginx-08
100+
- nginx-09
101+
- nginx-10
102+
- nginx-12
103+
- nginx-13
104+
- nginx-14
105+
- nginx-15
106+
- nginx-17
74107

75108
suites:
76109
- name: nginx

.travis.yml

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -7,18 +7,18 @@ env:
77
init: /sbin/init
88

99
- distro: centos7
10-
init: /usr/lib/systemd/systemd
10+
init: /lib/systemd/systemd
1111
run_opts: "--privileged --volume=/sys/fs/cgroup:/sys/fs/cgroup:ro"
1212
version: latest
1313

1414
- distro: oracle6
1515
version: latest
1616
init: /sbin/init
1717

18-
- distro: oracle7
19-
init: /usr/lib/systemd/systemd
20-
run_opts: "--privileged --volume=/sys/fs/cgroup:/sys/fs/cgroup:ro"
21-
version: latest
18+
# - distro: oracle7
19+
# init: /usr/lib/systemd/systemd
20+
# run_opts: "--privileged --volume=/sys/fs/cgroup:/sys/fs/cgroup:ro"
21+
# version: latest
2222

2323
- distro: ubuntu1604
2424
version: latest
@@ -29,20 +29,21 @@ env:
2929
version: latest
3030
init: /sbin/init
3131

32-
# - distro: debian7
33-
# version: latest
34-
# init: /sbin/init
35-
3632
- distro: debian8
3733
version: latest
38-
run_opts: "--privileged --volume=/sys/fs/cgroup:/sys/fs/cgroup:ro"
3934
init: /sbin/init
35+
run_opts: "--privileged --volume=/sys/fs/cgroup:/sys/fs/cgroup:ro"
4036

4137
- distro: debian9
4238
version: latest
4339
init: /lib/systemd/systemd
4440
run_opts: "--privileged --volume=/sys/fs/cgroup:/sys/fs/cgroup:ro"
4541

42+
# - distro: amazon
43+
# init: /lib/systemd/systemd
44+
# version: latest
45+
# run_opts: "--privileged --volume=/sys/fs/cgroup:/sys/fs/cgroup:ro"
46+
4647
before_install:
4748
# Pull container
4849
- 'docker pull rndmh3ro/docker-${distro}-ansible:${version}'
@@ -53,13 +54,14 @@ script:
5354
- 'docker run --detach --volume="${PWD}":/etc/ansible/roles/ansible-nginx-hardening:ro ${run_opts} rndmh3ro/docker-${distro}-ansible:${version} "${init}" > "${container_id}"'
5455

5556
# Install ansible galaxy requirements
56-
- 'docker exec "$(cat ${container_id})" ansible-galaxy install -r /etc/ansible/roles/ansible-nginx-hardening/requirements.yml -p /etc/ansible/roles/'
57+
- 'docker exec "$(cat ${container_id})" ansible-galaxy -c install -r /etc/ansible/roles/ansible-nginx-hardening/requirements.yml -p /etc/ansible/roles/'
5758

5859
# Test role.
59-
- 'docker exec "$(cat ${container_id})" ansible-playbook /etc/ansible/roles/ansible-nginx-hardening/default.yml -vv'
60+
- 'docker exec "$(cat ${container_id})" ansible-playbook /etc/ansible/roles/ansible-nginx-hardening/tests/test.yml -vv'
6061

6162
# Verify role
62-
- 'inspec exec https://github.com/dev-sec/nginx-baseline/ -t docker://$(cat ${container_id})'
63+
#- 'inspec exec https://github.com/dev-sec/nginx-baseline/ -t docker://$(cat ${container_id}) --controls=nginx-01 nginx-02 nginx-03 nginx-04 nginx-05 nginx-06 nginx-07 nginx-08 nginx-09 nginx-10 nginx-12 nginx-13 nginx-14 nginx-15 nginx-17 --no-distinct-exit'
64+
- 'inspec exec https://github.com/dev-sec/nginx-baseline/ -t docker://$(cat ${container_id}) --controls=nginx-01 nginx-02 nginx-03 nginx-05 nginx-06 nginx-07 nginx-08 nginx-09 nginx-10 nginx-12 nginx-13 nginx-15 nginx-17 --no-distinct-exit'
6365

6466
notifications:
6567
webhooks: https://galaxy.ansible.com/api/v1/notifications/

Gemfile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,7 @@ end
1616
group :tools do
1717
gem 'github_changelog_generator', '~> 1'
1818
end
19+
20+
gem 'kitchen-dokken'
21+
22+
gem 'rb-readline'

default.yml

Lines changed: 0 additions & 6 deletions
This file was deleted.

defaults/main.yml

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,13 @@ nginx_add_header: [
1717
# disable content-type sniffing
1818
"X-Content-Type-Options nosniff",
1919
# XSS filter
20-
"X-XSS-Protection \"1; mode=block\"" ]
20+
"X-XSS-Protection \"1; mode=block\"",
21+
"Strict-Transport-Security max-age=15768000",
22+
"Content-Security-Policy \"script-src 'self'; object-src 'self'\"" ]
2123

22-
nginx_ssl_protocols: "TLSv1 TLSv1.1 TLSv1.2"
23-
nginx_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"
24+
nginx_set_cookie_flag: "* HttpOnly secure"
2425
nginx_ssl_prefer_server_ciphers: "on"
25-
nginx_dh_param: "{{nginx_root_dir}}/dh{{nginx_dh_size}}.pem"
26+
nginx_ssl_protocols: "TLSv1.2"
27+
nginx_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"
28+
nginx_ssl_session_tickets: "off"
2629
nginx_dh_size: "2048"

handlers/main.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,4 @@
1-
- name: reload nginx
2-
service: name={{ nginx_service_name }} state=reloaded
1+
- name: restart nginx
2+
service:
3+
name: "nginx"
4+
state: restarted

requirements.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1+
- src: nginxinc.nginx
12
- src: geerlingguy.nginx

spec/travis.yml

Lines changed: 0 additions & 4 deletions
This file was deleted.

0 commit comments

Comments
 (0)