forked from dev-sec/ansible-collection-hardening
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request dev-sec#18 from dev-sec/kitchen_travis
Kitchen travis
- Loading branch information
Showing
17 changed files
with
170 additions
and
86 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
unreleased=false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,3 +16,7 @@ end | |
group :tools do | ||
gem 'github_changelog_generator', '~> 1' | ||
end | ||
|
||
gem 'kitchen-dokken' | ||
|
||
gem 'rb-readline' |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,4 @@ | ||
- name: reload nginx | ||
service: name={{ nginx_service_name }} state=reloaded | ||
- name: restart nginx | ||
service: | ||
name: "nginx" | ||
state: restarted |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
- src: nginxinc.nginx | ||
- src: geerlingguy.nginx |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,43 +1,80 @@ | ||
--- | ||
- name: add the OS specific variables | ||
include_vars: "{{ ansible_os_family }}.yml" | ||
|
||
- name: config should not be worldwide read- or writeable | ||
file: path="/etc/nginx" mode="o-rw" owner="root" group="root" recurse=yes | ||
file: | ||
path: "/etc/nginx" | ||
mode: "o-rw" | ||
owner: "root" | ||
group: "root" | ||
recurse: yes | ||
|
||
- name: create additional configuration | ||
template: src="hardening.conf.j2" dest="{{nginx_config_conf_dir}}/90.hardening.conf" owner="root" group="root" | ||
notify: reload nginx | ||
template: | ||
src: "hardening.conf.j2" | ||
dest: "/etc/nginx/conf.d/90.hardening.conf" | ||
owner: "root" | ||
group: "root" | ||
notify: restart nginx | ||
|
||
- name: change configuration in main nginx.conf | ||
lineinfile: dest="/etc/nginx/nginx.conf" regexp="^\s*server_tokens" line="server_tokens {{nginx_server_tokens}};" insertafter="http {" | ||
notify: reload nginx | ||
lineinfile: | ||
dest: "/etc/nginx/nginx.conf" | ||
regexp: '^\s*server_tokens' | ||
line: " server_tokens {{ nginx_server_tokens }};" | ||
insertafter: "http {" | ||
notify: restart nginx | ||
|
||
- name: change ssl_protocols in main nginx.conf | ||
lineinfile: dest="/etc/nginx/nginx.conf" regexp="^\s*ssl_protocols" line="ssl_protocols {{nginx_ssl_protocols}};" insertafter="http {" | ||
notify: reload nginx | ||
lineinfile: | ||
dest: "/etc/nginx/nginx.conf" | ||
regexp: '^\s*ssl_protocols' | ||
line: " ssl_protocols {{nginx_ssl_protocols}};" | ||
insertafter: "http {" | ||
notify: restart nginx | ||
|
||
- name: change ssl_prefer_server_ciphers in main nginx.conf | ||
lineinfile: dest="/etc/nginx/nginx.conf" regexp="^\s*ssl_prefer_server_ciphers" line="ssl_prefer_server_ciphers {{nginx_ssl_prefer_server_ciphers}};" insertafter="http {" | ||
notify: reload nginx | ||
lineinfile: | ||
dest: "/etc/nginx/nginx.conf" | ||
regexp: '^\s*ssl_prefer_server_ciphers' | ||
line: " ssl_prefer_server_ciphers {{nginx_ssl_prefer_server_ciphers}};" | ||
insertafter: "http {" | ||
notify: restart nginx | ||
|
||
- name: change client_max_body_size in main nginx.conf | ||
lineinfile: dest="/etc/nginx/nginx.conf" regexp="^\s*client_max_body_size" line="client_max_body_size {{nginx_client_max_body_size}};" insertafter="http {" | ||
notify: reload nginx | ||
lineinfile: | ||
dest: "/etc/nginx/nginx.conf" | ||
regexp: '^\s*client_max_body_size' | ||
line: " client_max_body_size {{ nginx_client_max_body_size }};" | ||
insertafter: "http {" | ||
notify: restart nginx | ||
|
||
- name: change client_body_buffer_size in main nginx.conf | ||
lineinfile: dest="/etc/nginx/nginx.conf" regexp="^\s*client_body_buffer_size" line="client_body_buffer_size {{nginx_client_body_buffer_size}};" insertafter="http {" | ||
notify: reload nginx | ||
lineinfile: | ||
dest: "/etc/nginx/nginx.conf" | ||
regexp: '^\s*client_body_buffer_size' | ||
line: " client_body_buffer_size {{ nginx_client_body_buffer_size }};" | ||
insertafter: "http {" | ||
notify: restart nginx | ||
|
||
- name: change keepalive_timeout in main nginx.conf | ||
lineinfile: dest="/etc/nginx/nginx.conf" regexp="^\s*keepalive_timeout" line="keepalive_timeout {{nginx_keepalive_timeout}};" insertafter="http {" | ||
notify: reload nginx | ||
lineinfile: | ||
dest: "/etc/nginx/nginx.conf" | ||
regexp: '^\s*keepalive_timeout' | ||
line: " keepalive_timeout {{ nginx_keepalive_timeout }};" | ||
insertafter: "http {" | ||
notify: restart nginx | ||
|
||
- name: remove default.conf | ||
file: path="{{nginx_default_conf}}" state=absent | ||
file: | ||
path: "{{ item }}" | ||
state: absent | ||
when: nginx_remove_default_site | ||
notify: reload nginx | ||
notify: restart nginx | ||
loop: | ||
- "/etc/nginx/conf.d/default.conf" | ||
- "/etc/nginx/sites-enabled/default" | ||
|
||
- name: generate dh group | ||
command: openssl dhparam -out {{nginx_dh_param}} {{nginx_dh_size}} creates={{nginx_dh_param}} | ||
notify: reload nginx | ||
command: "openssl dhparam -out /etc/nginx/dh{{nginx_dh_size}}.pem {{ nginx_dh_size }}" | ||
args: | ||
creates: "/etc/nginx/dh{{nginx_dh_size}}.pem" | ||
notify: restart nginx |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,16 @@ | ||
# {{ansible_managed|comment}} | ||
# Additional configuration for Nginx. | ||
|
||
client_header_buffer_size {{nginx_client_header_buffer_size}}; | ||
client_header_buffer_size {{nginx_client_header_buffer_size}}; | ||
large_client_header_buffers {{nginx_large_client_header_buffers}}; | ||
client_body_timeout {{nginx_client_body_timeout}}; | ||
client_header_timeout {{nginx_client_header_timeout}}; | ||
send_timeout {{nginx_send_timeout}}; | ||
limit_conn_zone {{nginx_limit_conn_zone}}; | ||
limit_conn {{nginx_limit_conn}}; | ||
ssl_ciphers {{nginx_ssl_ciphers}}; | ||
ssl_dhparam {{nginx_dh_param}}; | ||
client_body_timeout {{nginx_client_body_timeout}}; | ||
client_header_timeout {{nginx_client_header_timeout}}; | ||
send_timeout {{nginx_send_timeout}}; | ||
limit_conn_zone {{nginx_limit_conn_zone}}; | ||
limit_conn {{nginx_limit_conn}}; | ||
ssl_ciphers '{{nginx_ssl_ciphers}}'; | ||
ssl_session_tickets {{nginx_ssl_session_tickets}}; | ||
ssl_dhparam /etc/nginx/dh{{nginx_dh_size}}.pem; | ||
{% for header in nginx_add_header %} | ||
add_header {{header}}; | ||
add_header {{header}}; | ||
{% endfor %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
--- | ||
- name: wrapper playbook for kitchen testing "ansible-nginx-hardening" with custom settings | ||
hosts: localhost | ||
vars: | ||
- nginx_ppa_use: true | ||
- nginx_ppa_version: stable | ||
pre_tasks: | ||
- apt_repository: | ||
repo: "deb http://ftp.debian.org/debian jessie-backports main" | ||
state: present | ||
when: ansible_distribution == 'Debian' and ansible_distribution_major_version == '8' | ||
- set_fact: | ||
nginx_default_release: "jessie-backports" | ||
when: ansible_distribution == 'Debian' and ansible_distribution_major_version == '8' | ||
- package: name="{{item}}" state=installed | ||
with_items: | ||
- "systemd" | ||
ignore_errors: true | ||
- apt: name="{{item}}" state=installed update_cache=true | ||
with_items: | ||
- "systemd" | ||
ignore_errors: true | ||
roles: | ||
- geerlingguy.nginx | ||
- ansible-nginx-hardening |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
--- |