Skip to content

Commit 10371ca

Browse files
authored
Remove deprecated variables (#114)
1 parent 21fdc53 commit 10371ca

File tree

10 files changed

+5
-196
lines changed

10 files changed

+5
-196
lines changed

CHANGELOG.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22

33
## 0.6.0 (Unreleased)
44

5+
BREAKING CHANGES:
6+
7+
Remove deprecated variables mentioned in the `0.5.0` release. These involve templating variables for both NGINX App Protect configs and policy/security files. Please instead use the [NGINX config role](https://github.com/nginxinc/ansible-role-nginx-config) for this (and much more) functionality.
8+
59
FEATURES:
610

711
* Add support for NGINX App Protect DoS (Denial of Service) product. The `nginx_app_protect_dos_enable` variable must be set to `true` in order to install NGINX App Protect DoS.
@@ -24,7 +28,7 @@ The NGINX App Protect repository has been updated. This might cause some issues
2428

2529
DEPRECATION WARNINGS:
2630

27-
* **The ability to create an NGINX config including some basic App Protect directives will be removed in the upcoming `0.6.0` release at some stage after June 2021.** Please instead use the [NGINX config role](https://github.com/nginxinc/ansible-role-nginx-config) for this (and much more) functionality. This will include the removal of the following variables: `nginx_app_protect_conf_template_enable`, `nginx_app_protect_conf_template`, `nginx_app_protect_demo_workload_protocol`, `nginx_app_protect_demo_workload_host`, `nginx_app_protect_log_policy_syslog_target`, `nginx_app_protect_log_policy_target`.
31+
* **The ability to create an NGINX config including some basic App Protect directives will be removed in the upcoming `0.6.0` release at some stage after June 2021.** Please use the [NGINX config role](https://github.com/nginxinc/ansible-role-nginx-config) instead for this (and much more) functionality. This will include the removal of the following variables: `nginx_app_protect_conf_template_enable`, `nginx_app_protect_conf_template`, `nginx_app_protect_demo_workload_protocol`, `nginx_app_protect_demo_workload_host`, `nginx_app_protect_log_policy_syslog_target`, `nginx_app_protect_log_policy_target`.
2832

2933
* **The ability to dynamically create App Protect security and log policies via Jinja2 templates will be removed in the `0.6.0` release at some stage after June 2021 due to relative inflexibility.** The `nginx_app_protect_security_policy_file_enable`, `nginx_app_protect_security_policy_file_*`, `nginx_app_protect_log_policy_file_enable` and `nginx_app_protect_log_policy_file_*` variables should be used instead of the following variables which are to be removed: `nginx_app_protect_security_policy_template_enable`, `nginx_app_protect_security_policy_template`, `nginx_app_protect_security_policy_enforcement_mode`, `nginx_app_protect_log_policy_template_enable`, `nginx_app_protect_log_policy_template`, `nginx_app_protect_log_policy_filter_request_type`.
3034

defaults/main.yml

Lines changed: 0 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -92,38 +92,6 @@ nginx_app_protect_timeout: 180
9292
# Creates basic configuration files and enables NGINX App Protect WAF on the target host
9393
nginx_app_protect_configure: false
9494

95-
## DEPRECATED -- Use nginx_app_protect_security_policy_enable and nginx_app_protect_security_policy_file_* variables instead
96-
# Create a basic NGINX App Protect WAF security policy file based on a template
97-
nginx_app_protect_security_policy_template_enable: true
98-
nginx_app_protect_security_policy_template:
99-
template_file: app-protect-security-policy.j2
100-
out_file_name: app-protect-security-policy.json
101-
out_file_location: /etc/app_protect/conf/
102-
# possible values: transparent, blocking
103-
nginx_app_protect_security_policy_enforcement_mode: transparent
104-
105-
## DEPRECATED -- Use nginx_app_protect_log_policy_file_enable and nginx_app_protect_log_policy_file_* variables instead
106-
# Create a basic NGINX App Protect WAF log policy file based on a template
107-
nginx_app_protect_log_policy_template_enable: true
108-
nginx_app_protect_log_policy_template:
109-
template_file: app-protect-log-policy.j2
110-
out_file_name: app-protect-log-policy.json
111-
out_file_location: /etc/app_protect/conf/
112-
# possible values: all, illegal, blocked
113-
nginx_app_protect_log_policy_filter_request_type: all
114-
115-
## DEPRECATED -- Use nginxinc.nginx_config role instead (https://github.com/nginxinc/ansible-role-nginx-config)
116-
# Create a basic NGINX App Protect WAF config file
117-
nginx_app_protect_conf_template_enable: false
118-
nginx_app_protect_conf_template:
119-
template_file: nginx.conf.j2
120-
out_file_name: nginx.conf
121-
out_file_location: /etc/nginx/
122-
nginx_app_protect_demo_workload_protocol: http://
123-
nginx_app_protect_demo_workload_host: 10.1.1.1:8080
124-
nginx_app_protect_log_policy_syslog_target: 127.0.0.1:514 # DEPRECATED -- use nginx_app_protect_log_policy_target instead
125-
nginx_app_protect_log_policy_target: "syslog:server={{ nginx_app_protect_log_policy_syslog_target }}"
126-
12795
# Copy local NGINX App Protect WAF security policy to host
12896
nginx_app_protect_security_policy_file_enable: false
12997
nginx_app_protect_security_policy_file_src: files/config/security-policy.json

molecule/advanced/verify.yml

Lines changed: 0 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -34,35 +34,3 @@
3434
check_mode: true
3535
register: install
3636
failed_when: (install is changed) or (install is failed)
37-
38-
- name: Functional tests
39-
block:
40-
- name: Check if NGINX service is running
41-
service:
42-
name: nginx
43-
state: started
44-
enabled: true
45-
check_mode: true
46-
register: service
47-
failed_when: (service is changed) or (service is failed)
48-
49-
- name: Check that a page returns a status 200 and fail if the words Hello World are not in the page contents
50-
uri:
51-
url: "http://localhost"
52-
return_content: true
53-
register: this
54-
failed_when: "'Hello World' not in this.content"
55-
56-
- name: Check that a page returns a status 200 and fail if the words Request Rejected are not in the page contents
57-
uri:
58-
url: "http://localhost/?v=<script>"
59-
return_content: true
60-
register: this
61-
failed_when: "'Request Rejected' not in this.content"
62-
63-
- name: Ensure /var/log/messages contains block event from above test
64-
shell: grep -c "Non-browser Client,Abuse of Functionality,Cross Site Scripting (XSS)" /var/log/messages || true
65-
register: event
66-
changed_when: false
67-
failed_when: event.stdout == "0"
68-
when: ansible_os_family != "Alpine"

molecule/default/verify.yml

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -43,15 +43,3 @@
4343
register: service
4444
failed_when: (service is changed) or (service is failed)
4545
when: ansible_os_family != "Alpine"
46-
47-
- name: Check that the security policy exists
48-
stat:
49-
path: /etc/app_protect/conf/app-protect-security-policy.json
50-
register: stat_result
51-
failed_when: not stat_result.stat.exists
52-
53-
- name: Check that the log policy exists
54-
stat:
55-
path: /etc/app_protect/conf/app-protect-log-policy.json
56-
register: stat_result
57-
failed_when: not stat_result.stat.exists

tasks/dos/install/install-redhat.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
gpgcheck: true
2222
state: "{{ nginx_app_protect_license_status | default ('present') }}"
2323

24-
2524
- name: (CentOS/RHEL) Install NGINX App Protect DoS
2625
yum:
2726
name: "app-protect-dos"
Lines changed: 0 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,4 @@
11
---
2-
- name: Ensure NGINX main directory exists
3-
file:
4-
path: "{{ nginx_app_protect_conf_template.out_file_location }}"
5-
state: directory
6-
mode: 0755
7-
when: nginx_app_protect_security_policy_template_enable | bool
8-
or nginx_app_protect_log_policy_template_enable | bool
9-
or nginx_app_protect_conf_template_enable | bool
10-
112
- name: Copy NGINX App Protect WAF security policy file
123
copy:
134
src: "{{ nginx_app_protect_security_policy_file_src }}"
@@ -21,56 +12,3 @@
2112
dest: "{{ nginx_app_protect_log_policy_file_dst }}"
2213
mode: 0644
2314
when: nginx_app_protect_log_policy_file_enable | bool
24-
25-
- name: Dynamically generate NGINX App Protect WAF security policy file
26-
template:
27-
src: "{{ nginx_app_protect_security_policy_template.template_file }}"
28-
dest: "{{ nginx_app_protect_security_policy_template.out_file_location }}{{ nginx_app_protect_security_policy_template.out_file_name }}"
29-
mode: 0644
30-
backup: true
31-
when: nginx_app_protect_security_policy_template_enable | bool
32-
notify: (Handler - NGINX App Protect) Run NGINX
33-
34-
- name: Dynamically generate NGINX App Protect WAF log policy file
35-
template:
36-
src: "{{ nginx_app_protect_log_policy_template.template_file }}"
37-
dest: "{{ nginx_app_protect_log_policy_template.out_file_location }}{{ nginx_app_protect_log_policy_template.out_file_name }}"
38-
mode: 0644
39-
backup: true
40-
when: nginx_app_protect_log_policy_template_enable | bool
41-
notify: (Handler - NGINX App Protect) Run NGINX
42-
43-
- name: (DEPRECATED) Backup existing nginx.conf
44-
copy:
45-
src: "{{ nginx_app_protect_conf_template.out_file_location }}{{ nginx_app_protect_conf_template.out_file_name }}"
46-
dest: "{{ nginx_app_protect_conf_template.out_file_location }}{{ nginx_app_protect_conf_template.out_file_name }}.orig"
47-
remote_src: true
48-
mode: 0644
49-
when: nginx_app_protect_conf_template_enable | bool
50-
changed_when: false
51-
52-
- name: (DEPRECATED) Dynamically generate nginx.conf file
53-
template:
54-
src: "{{ nginx_app_protect_conf_template.template_file }}"
55-
dest: "{{ nginx_app_protect_conf_template.out_file_location }}{{ nginx_app_protect_conf_template.out_file_name }}"
56-
mode: 0644
57-
when:
58-
- nginx_app_protect_conf_template_enable | bool
59-
- nginx_app_protect_waf_state != "absent"
60-
notify: (Handler - NGINX App Protect) Run NGINX
61-
62-
- name: (DEPRECATED) Remove NGINX App Protect WAF
63-
block:
64-
- name: (DEPRECATED) Comment out NGINX App Protect module reference in nginx.conf
65-
replace:
66-
path: /etc/nginx/nginx.conf
67-
regexp: '^([ \t]*load_module.*ngx_http_app_protect_module.so;)'
68-
replace: '# \1'
69-
70-
- name: (DEPRECATED) Comment out NGINX App Protect WAF directives in nginx.conf
71-
replace:
72-
path: /etc/nginx/nginx.conf
73-
regexp: '^([ \t]*app_protect_)'
74-
replace: '# \1'
75-
notify: (Handler - NGINX App Protect) Run NGINX
76-
when: nginx_app_protect_waf_state == "absent"

tasks/waf/install/install-debian.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
---
2-
32
- name: (Debian/Ubuntu) {{ nginx_app_protect_license_status is defined | ternary('Remove', 'Configure') }} NGINX Plus license
43
blockinfile:
54
path: /etc/apt/apt.conf.d/90nginx

templates/app-protect-log-policy.j2

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

templates/app-protect-security-policy.j2

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

templates/nginx.conf.j2

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

0 commit comments

Comments
 (0)