Skip to content

Commit 758c32a

Browse files
authored
Merge pull request #13 from nginxinc/staging
merge Staging to master
2 parents 447c032 + 9ee3d3c commit 758c32a

13 files changed

+128
-282
lines changed

README.md

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,16 @@ CentOS:
5050
- 8.0
5151
- 8.1
5252
- 8.2
53+
RHEL:
54+
versions:
55+
- 7.4
56+
- 7.5
57+
- 7.6
58+
- 7.7
59+
- 7.8
60+
- 8.0
61+
- 8.1
62+
- 8.2
5363
Debian:
5464
versions:
5565
- 9.0
@@ -78,7 +88,9 @@ Dependencies
7888

7989
- Since this role uses the [package_facts](https://docs.ansible.com/ansible/latest/modules/package_facts_module.html) module, on debian-based systems the `python-apt` package must be installed on targeted hosts.
8090

81-
- NGINX+ R19-R21 must already be installed on the target system
91+
- If NGINX+ is *not* already installed on the system, this role will install the version of NGINX+ that is dependent on the version of NGINX App Protect set with the `app_protect_version` variable. If none is specified, the latest version of NGINX+ and NGINX App Protect will be installed.
92+
93+
- When using the `app_protect_version` variable, a specific version of NGINX+ must already be installed on the target system.
8294

8395
Example Playbook
8496
----------------
@@ -101,11 +113,7 @@ This is a sample playbook file for using the role to install NGINX App Protect o
101113
app_protect_state: present
102114

103115
# OPTIONAL: Installs a specific version of NGINX App Protect
104-
app_protect_version: 21
105-
106-
# Enable enforcing selinux (you may need to open ports on your own)
107-
# WARNING: If this is set to false and you are installing NGINX Protect on a system with SELinux enforced, NGINX App Protect may fail to load.
108-
app_protect_selinux: false
116+
app_protect_version: 22
109117

110118
# The installation of NGINX App Protect includes a base signature set, which may be out of date.
111119
# This option installs the latest NGINX App Protect signatures.
@@ -121,6 +129,10 @@ This is a sample playbook file for using the role to install NGINX App Protect o
121129
# Removes the license (certificate and key) for the NGINX App Protect repositories on the target host(s) when playbook run is complete.
122130
app_protect_delete_license: true
123131

132+
# If you have a RHEL subscription, NGINX App Protect's dependencies will use subscription repos.
133+
# Otherwise, it will source packages from CentOS' repositories.
134+
app_protect_use_rhel_subscription_repos: false
135+
124136
# For use with the app_protect_configure option to determine if the default security policy will be written to the target host
125137
# Used when `app_protect_configure: true`.
126138
app_protect_security_policy_template_enable: true
@@ -158,7 +170,7 @@ This is a sample playbook file for using the role to install NGINX App Protect o
158170
key: "{{playbook_dir}}/license/nginx-repo.key"
159171

160172
roles:
161-
- role: ansible-role-nginx-app-protect
173+
- role: nginxinc.nginx_app_protect
162174
```
163175
164176
This is a sample playbook file for deploying the Ansible Galaxy NGINX App Protect role in a localhost and installing NGINX App Protect on NGINX Plus.

defaults/main.yml

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,7 @@
1010
app_protect_state: present
1111

1212
# # OPTIONAL: Installs a specific version of NGINX App Protect
13-
# app_protect_version: 20
14-
15-
# Enable enforcing selinux (you may need to open ports on your own)
16-
app_protect_selinux: false
17-
18-
# Enable enforcing mode if true. Permissive if false (audit only, no enforcing) globally (only works with app_protect_selinux: true)
19-
app_protect_selinux_enforcing: true
13+
# app_protect_version: 22
2014

2115
# The installation of NGINX App Protect includes a base signature set, which may be out of date.
2216
# This option installs the latest NGINX App Protect signatures.
@@ -32,6 +26,10 @@ app_protect_configure: false
3226
# Removes the license (certificate and key) for the NGINX App Protect repositories on the target host(s) when playbook run is complete.
3327
app_protect_delete_license: true
3428

29+
# If you have a RHEL subscription, NGINX App Protect's dependencies will use subscription repos.
30+
# Otherwise, it will source packages from CentOS' repositories.
31+
app_protect_use_rhel_subscription_repos: false
32+
3533
# Start/Restart NGINX service when App Protect related changes are complete.
3634
# Default is true.
3735
nginx_start: true
@@ -42,11 +40,15 @@ nginx_timeout: 180
4240
# App Protect Temporary Directory to use (Default: /tmp)
4341
app_protect_tempdir: /tmp
4442

43+
# Choose where to fetch the NGINX signing key from.
44+
# Default is the official NGINX signing key host.
45+
# nginx_signing_key: https://cs.nginx.com/static/keys/nginx_signing.key
46+
4547
# Choose where to fetch the NGINX App Protect signing key from.
4648
# Default is the official NGINX App Protect signing key host.
4749
# app_protect_signing_key: https://cs.nginx.com/static/keys/app-protect.key
4850

49-
# populate this dictionary of lists with appropriate values from the ansible_os_family and ansible_distribution_version facts
51+
# populate this dictionary of lists with appropriate values from the ansible_distribution and ansible_distribution_version facts
5052
app_protect_linux_families:
5153
CentOS:
5254
- 7.4
@@ -57,6 +59,15 @@ app_protect_linux_families:
5759
- 8.0
5860
- 8.1
5961
- 8.2
62+
RedHat:
63+
- 7.4
64+
- 7.5
65+
- 7.6
66+
- 7.7
67+
- 7.8
68+
- 8.0
69+
- 8.1
70+
- 8.2
6071
Debian:
6172
- 9.0
6273
- 9.1

tasks/configure-selinux.yml

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

tasks/install-app-protect.yml

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,21 +5,16 @@
55
nginx_plus_version: "{{ ansible_facts.packages['nginx-plus'] | map(attribute='version') | list | first | regex_search('^(\\d{1,3})') }}"
66
when: "'nginx-plus' in ansible_facts.packages"
77

8-
- name: Debug nginx plus version
9-
debug:
10-
msg: "nginx_plus_version {{ nginx_plus_version }}"
11-
verbosity: 2
12-
13-
- name: Fail if NGINX+ version preconditions fail
8+
- name: Fail if existing NGINX+ version preconditions fail
149
assert:
1510
that:
16-
- nginx_plus_version is defined
1711
- nginx_plus_version | int >= 19
1812
fail_msg: >
1913
"'nginx_plus_version' release version must be a minimum of 19 for App Protect.
2014
Actual: {{ (nginx_plus_version is defined) | ternary(nginx_plus_version, 'NONE') }}"
2115
success_msg: "'nginx_plus_version' is {{ (nginx_plus_version is defined) | ternary(nginx_plus_version, 'NONE') }}"
2216
quiet: true
17+
when: nginx_plus_version is defined
2318

2419
- name: "(Install: Linux) Create override for NGINX Plus service"
2520
file:

tasks/install-signatures.yml

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,21 +5,16 @@
55
nginx_plus_version: "{{ ansible_facts.packages['nginx-plus'] | map(attribute='version') | list | first | regex_search('^(\\d{1,3})') }}"
66
when: "'nginx-plus' in ansible_facts.packages"
77

8-
- name: Debug nginx plus version
9-
debug:
10-
msg: "nginx_plus_version {{ nginx_plus_version }}"
11-
verbosity: 2
12-
138
- name: Fail if NGINX+ version preconditions fail
149
assert:
1510
that:
16-
- nginx_plus_version is defined
1711
- nginx_plus_version | int >= 19
1812
fail_msg: >
1913
"'nginx_plus_version' release version must be a minimum of 19 for App Protect.
2014
Actual: {{ (nginx_plus_version is defined) | ternary(nginx_plus_version, 'NONE') }}"
2115
success_msg: "'nginx_plus_version' is {{ (nginx_plus_version is defined) | ternary(nginx_plus_version, 'NONE') }}"
2216
quiet: true
17+
when: nginx_plus_version is defined
2318

2419
- name: "(Install: Linux) Install Latest NGINX App Protect Signatures"
2520
package:

tasks/install-threat-campaigns.yml

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,21 +5,16 @@
55
nginx_plus_version: "{{ ansible_facts.packages['nginx-plus'] | map(attribute='version') | list | first | regex_search('^(\\d{1,3})') }}"
66
when: "'nginx-plus' in ansible_facts.packages"
77

8-
- name: Debug nginx plus version
9-
debug:
10-
msg: "nginx_plus_version {{ nginx_plus_version }}"
11-
verbosity: 2
12-
138
- name: Fail if NGINX+ version preconditions fail
149
assert:
1510
that:
16-
- nginx_plus_version is defined
1711
- nginx_plus_version | int >= 19
1812
fail_msg: >
1913
"'nginx_plus_version' release version must be a minimum of 19 for App Protect.
2014
Actual: {{ (nginx_plus_version is defined) | ternary(nginx_plus_version, 'NONE') }}"
2115
success_msg: "'nginx_plus_version' is {{ (nginx_plus_version is defined) | ternary(nginx_plus_version, 'NONE') }}"
2216
quiet: true
17+
when: nginx_plus_version is defined
2318

2419
- name: "(Install: Linux) Install Latest NGINX App Protect Threat Campaigns"
2520
package:

tasks/keys/apt-key.yml

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,18 @@
11
---
2-
- name: "(Install: APT OSs) Set Default APT NGINX App Protect Signing Key URL"
2+
- name: "(Install: APT OSs) Set APT NGINX Signing Key URL"
33
set_fact:
44
key_value: "" # appeasing the linter
5-
default_keysite: "https://cs.nginx.com/static/keys/app-protect.key"
5+
nginx_keysite: "{{ nginx_signing_key | default('https://cs.nginx.com/static/keys/nginx_signing.key') }}"
66

77
- name: "(Install: APT OSs) Set APT NGINX App Protect Signing Key URL"
88
set_fact:
99
key_value: "" # appeasing the linter
10-
keysite: "{{ app_protect_signing_key | default(default_keysite) }}"
10+
app_protect_keysite: "{{ app_protect_signing_key | default('https://cs.nginx.com/static/keys/app-protect.key') }}"
11+
12+
- name: "(Install: APT OSs) Add APT NGINX Signing Key"
13+
apt_key:
14+
url: "{{ nginx_keysite }}"
1115

1216
- name: "(Install: APT OSs) Add APT NGINX App Protect Signing Key"
1317
apt_key:
14-
url: "{{ keysite }}"
18+
url: "{{ app_protect_keysite }}"

tasks/keys/rpm-key.yml

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,18 @@
11
---
2-
- name: "(Install: RPM OSs) Set Default RPM NGINX App Protect Signing Key"
2+
- name: "(Install: RPM OSs) Set Default RPM NGINX Signing Key"
33
set_fact:
44
key_value: "" # appeasing the linter
5-
default_keysite: "https://cs.nginx.com/static/keys/app-protect.key"
5+
nginx_keysite: "{{ nginx_signing_key | default('https://cs.nginx.com/static/keys/nginx_signing.key') }}"
66

7-
- name: "(Install: RPM OSs) Set RPM NGINX App Protect Signing Key URL"
7+
- name: "(Install: RPM OSs) Set Default RPM NGINX App Protect Signing Key"
88
set_fact:
99
key_value: "" # appeasing the linter
10-
keysite: "{{ app_protect_signing_key | default(default_keysite) }}"
10+
app_protect_keysite: "{{ app_protect_signing_key | default('https://cs.nginx.com/static/keys/app-protect.key') }}"
11+
12+
- name: "(Install: RPM OSs) Add RPM NGINX Signing Key"
13+
rpm_key:
14+
key: "{{ nginx_keysite }}"
1115

1216
- name: "(Install: RPM OSs) Add RPM NGINX App Protect Signing Key"
1317
rpm_key:
14-
key: "{{ keysite }}"
18+
key: "{{ app_protect_keysite }}"

tasks/main.yml

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323

2424
- name: Debug app_protect_state
2525
debug:
26-
msg: "app_protect_state {{ app_protect_state }}"
26+
msg: "Desired app_protect_state {{ app_protect_state }}"
2727

2828
- name: Abort if the OS/version combination is not supported
2929
fail:
@@ -83,11 +83,6 @@
8383

8484
when: app_protect_state != "absent"
8585

86-
- name: "(Install: CentOS) Setup SELinux"
87-
include_tasks: "{{ role_path }}/tasks/configure-selinux.yml"
88-
when:
89-
- app_protect_selinux
90-
- ansible_os_family == "RedHat"
9186

9287
- name: "Remove NGINX App Protect"
9388
block:

0 commit comments

Comments
 (0)