Skip to content

Commit ccc6620

Browse files
aknot242alessfg
andauthored
Add support for NGINX App Protect DoS module (#111)
Co-authored-by: alessfg <[email protected]>
1 parent 2fa307d commit ccc6620

33 files changed

+389
-114
lines changed

.github/workflows/molecule.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ jobs:
2222
- advanced
2323
- default
2424
- specific-version
25+
- dos
2526
steps:
2627
- name: Check out the codebase
2728
if: github.event.pull_request.head.repo.full_name == github.repository

CHANGELOG.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
# Changelog
22

3-
## 0.5.1 (Unreleased)
3+
## 0.6.0 (Unreleased)
44

55
FEATURES:
66

7-
Add a `nginx_app_protect_manage_repo` feature flag which can be used to disable NGINX App Protect repo management by this role.
7+
* 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.
8+
* Add a `nginx_app_protect_manage_repo` feature flag which can be used to disable NGINX App Protect repo management by this role.
89

910
ENHANCEMENTS:
1011

README.md

Lines changed: 28 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,11 @@
44

55
# 👾 *Help make the NGINX App Protect Ansible role better by participating in our [survey](https://forms.office.com/Pages/ResponsePage.aspx?id=L_093Ttq0UCb4L-DJ9gcUKLQ7uTJaE1PitM_37KR881UM0NCWkY5UlE5MUYyWU1aTUcxV0NRUllJSC4u)!* 👾
66

7-
# NGINX App Protect Ansible Role <img src="images/nap-logo.png" width="30">
7+
# NGINX App Protect WAF and DoS Ansible Role <img src="images/nap-logo.png" width="30">
88

9-
This role installs and configures NGINX App Protect (WAF) for NGINX Plus on your target host.
9+
This role installs and configures NGINX App Protect WAF or DoS for NGINX Plus on your target host.
10+
11+
**Note:** By default, this role will install NGINX App Protect WAF. To install NGINX App Protect DoS, you need to set the `nginx_app_protect_dos_enable` variable to `true`.
1012

1113
**Note:** This role is still in active development. There may be unidentified issues and the role variables may change as development continues.
1214

@@ -56,22 +58,44 @@ Use `git clone https://github.com/nginxinc/ansible-role-nginx-app-protect.git` t
5658

5759
## Platforms
5860

59-
The NGINX App Protect Ansible role supports all platforms supported by [NGINX Plus](https://www.nginx.com/products/technical-specs/) that intersect with the following list:
61+
### NGINX App Protect WAF
62+
63+
The NGINX App Protect Ansible role supports all platforms supported by [NGINX Plus](https://www.nginx.com/products/technical-specs/) that intersect with the following list of distributions of App Protect WAF:
6064

6165
```yaml
66+
Alpine:
67+
- 3.10
68+
name: Amazon Linux 2
69+
- any
6270
CentOS:
6371
- 7.4+
6472
RHEL:
6573
- 7.4+
6674
Debian:
6775
- 9
76+
- 10
6877
Ubuntu:
6978
- 18.04
7079
- 20.04
7180
```
7281

7382
**Note:** Due to a packaging limitation in NGINX App Protect on Alpine, it may be required to explicitly install NGINX Plus on the instance **before** using the NGINX App Protect role if a hotfix version of NGINX Plus has been published. It is recommended to use the [NGINX Core](https://galaxy.ansible.com/nginxinc/nginx_core) Ansible role for this purpose.
7483

84+
85+
### NGINX App Protect DoS
86+
87+
The NGINX App Protect Ansible role supports all platforms supported by [NGINX Plus](https://www.nginx.com/products/technical-specs/) that intersect with the following list of distributions of App Protect DoS:
88+
89+
```yaml
90+
CentOS:
91+
- 7.4+
92+
Debian:
93+
- 10
94+
Ubuntu:
95+
- 18.04
96+
- 20.04
97+
```
98+
7599
## Role Variables
76100

77101
This role has multiple variables. The descriptions and defaults for all these variables can be found in the **[`defaults/`](https://github.com/nginxinc/ansible-role-nginx-app-protect/blob/main/defaults/)** folder in the following files:
@@ -100,7 +124,7 @@ A working functional playbook example can be found in the **`molecule/default/`*
100124

101125
## Other NGINX Ansible Collections and Roles
102126

103-
You can find the Ansible NGINX Core collection of roles to install and configure NGINX Open Source, NGINX Plus, and NGINX App Protect [here](https://github.com/nginxinc/ansible-collection-nginx).
127+
You can find the Ansible NGINX Core collection of roles to install and configure NGINX Open Source, NGINX Plus, and NGINX App Protect WAF and DoS products [here](https://github.com/nginxinc/ansible-collection-nginx).
104128

105129
You can find the Ansible NGINX role to install NGINX [here](https://github.com/nginxinc/ansible-role-nginx).
106130

defaults/main.yml

Lines changed: 30 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,44 @@
11
---
2-
# Specify whether you want to maintain your version of NGINX App Protect, upgrade to the latest version, or remove NGINX App Protect.
3-
# Using 'present' will install the latest version of NGINX App Protect on a fresh install.
4-
# Using 'latest' will upgrade NGINX App Protect to the latest version on every playbook execution.
5-
# Using 'absent' will remove NGINX App Protect from your system.
2+
# Specify whether or not this role should install the NGINX App Protect WAF product.
3+
nginx_app_protect_waf_enable: true
4+
5+
# Specify whether or not this role should install the NGINX App Protect DoS product.
6+
nginx_app_protect_dos_enable: false
7+
8+
# Specify whether you want to maintain your version of NGINX App Protect WAF, upgrade to the latest version, or remove NGINX App Protect WAF.
9+
# Using 'present' will install the latest version of NGINX App Protect WAF on a fresh install.
10+
# Using 'latest' will upgrade NGINX App Protect WAF to the latest version on every playbook execution.
11+
# Using 'absent' will remove NGINX App Protect WAF from your system.
12+
# Default is present.
13+
nginx_app_protect_waf_state: present
14+
15+
# Specify whether you want to maintain your version of NGINX App Protect DoS, upgrade to the latest version, or remove NGINX App Protect DoS.
16+
# Using 'present' will install the latest version of NGINX App Protect DoS on a fresh install.
17+
# Using 'latest' will upgrade NGINX App Protect DoS to the latest version on every playbook execution.
18+
# Using 'absent' will remove NGINX App Protect DoS from your system.
619
# Default is present.
7-
nginx_app_protect_state: present
20+
nginx_app_protect_dos_state: present
821

9-
# If you have a RHEL subscription, NGINX App Protect's dependencies will use subscription repos.
22+
# If you have a RHEL subscription, NGINX App Protect WAF's dependencies will use subscription repos.
1023
# Otherwise, it will source packages from CentOS' repositories.
1124
# Default is false.
1225
nginx_app_protect_use_rhel_subscription_repos: false
1326

14-
# The installation of NGINX App Protect includes a base signature set, which may be out of date.
27+
# The installation of NGINX App Protect WAF includes a base signature set, which may be out of date.
1528
# This option installs the latest NGINX App Protect signatures.
1629
# Default is true.
1730
nginx_app_protect_install_signatures: true
1831

19-
# (Optional) Installs a specific version of the NGINX App Protect attack signatures package
32+
# (Optional) Installs a specific version of the NGINX App Protect WAF attack signatures package
2033
# Default is to install the latest release.
2134
# nginx_app_protect_signatures_version: "=2019.07.16-1" # <- Example value for Debian/Ubuntu
2235

23-
# The installation of NGINX App Protect can include a page of frequently-updated, high-accuracy signatures called "threat campaigns".
24-
# This option installs the latest NGINX App Protect threat campaigns signatures.
36+
# The installation of NGINX App Protect WAF can include a page of frequently-updated, high-accuracy signatures called "threat campaigns".
37+
# This option installs the latest NGINX App Protect WAF threat campaigns signatures.
2538
# Default is true.
2639
nginx_app_protect_install_threat_campaigns: true
2740

28-
# (Optional) Installs a specific version of the NGINX App Protect threat campaigns package
41+
# (Optional) Installs a specific version of the NGINX App Protect WAF threat campaigns package
2942
# Default is to install the latest release.
3043
# nginx_app_protect_threat_campaigns_version: "=2020.08.20-1" # <- Example value for Debian/Ubuntu
3144

@@ -76,11 +89,11 @@ nginx_app_protect_start: true
7689
nginx_app_protect_service_modify: true
7790
nginx_app_protect_timeout: 180
7891

79-
# Creates basic configuration files and enables NGINX App Protect on the target host
92+
# Creates basic configuration files and enables NGINX App Protect WAF on the target host
8093
nginx_app_protect_configure: false
8194

8295
## DEPRECATED -- Use nginx_app_protect_security_policy_enable and nginx_app_protect_security_policy_file_* variables instead
83-
# Create a basic NGINX App Protect security policy file based on a template
96+
# Create a basic NGINX App Protect WAF security policy file based on a template
8497
nginx_app_protect_security_policy_template_enable: true
8598
nginx_app_protect_security_policy_template:
8699
template_file: app-protect-security-policy.j2
@@ -90,7 +103,7 @@ nginx_app_protect_security_policy_template:
90103
nginx_app_protect_security_policy_enforcement_mode: transparent
91104

92105
## DEPRECATED -- Use nginx_app_protect_log_policy_file_enable and nginx_app_protect_log_policy_file_* variables instead
93-
# Create a basic NGINX App Protect log policy file based on a template
106+
# Create a basic NGINX App Protect WAF log policy file based on a template
94107
nginx_app_protect_log_policy_template_enable: true
95108
nginx_app_protect_log_policy_template:
96109
template_file: app-protect-log-policy.j2
@@ -100,7 +113,7 @@ nginx_app_protect_log_policy_template:
100113
nginx_app_protect_log_policy_filter_request_type: all
101114

102115
## DEPRECATED -- Use nginxinc.nginx_config role instead (https://github.com/nginxinc/ansible-role-nginx-config)
103-
# Create a basic NGINX App Protect config file
116+
# Create a basic NGINX App Protect WAF config file
104117
nginx_app_protect_conf_template_enable: false
105118
nginx_app_protect_conf_template:
106119
template_file: nginx.conf.j2
@@ -111,12 +124,12 @@ nginx_app_protect_demo_workload_host: 10.1.1.1:8080
111124
nginx_app_protect_log_policy_syslog_target: 127.0.0.1:514 # DEPRECATED -- use nginx_app_protect_log_policy_target instead
112125
nginx_app_protect_log_policy_target: "syslog:server={{ nginx_app_protect_log_policy_syslog_target }}"
113126

114-
# Copy local NGINX App Protect security policy to host
127+
# Copy local NGINX App Protect WAF security policy to host
115128
nginx_app_protect_security_policy_file_enable: false
116129
nginx_app_protect_security_policy_file_src: files/config/security-policy.json
117130
nginx_app_protect_security_policy_file_dest: /etc/app_protect/conf/security-policy.json
118131

119-
# Copy local NGINX App Protect log policy to host
132+
# Copy local NGINX App Protect WAF log policy to host
120133
nginx_app_protect_log_policy_file_enable: false
121134
nginx_app_protect_log_policy_file_src: files/config/log-policy.json
122135
nginx_app_protect_log_policy_file_dest: /etc/app_protect/conf/log-policy.json

meta/main.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
galaxy_info:
33
author: Daniel Edgar
4-
description: Official Ansible role for NGINX App Protect
4+
description: Official Ansible role for NGINX App Protect WAF and DoS
55
role_name: nginx_app_protect
66
namespace: nginxinc
77
company: F5 Networks, Inc.
@@ -14,6 +14,9 @@ galaxy_info:
1414
- name: Alpine
1515
versions:
1616
- any
17+
- name: Amazon Linux 2
18+
versions:
19+
- any
1720
- name: EL
1821
versions:
1922
- 7
@@ -34,5 +37,6 @@ galaxy_info:
3437
- web
3538
- server
3639
- development
40+
- dos
3741

3842
dependencies: []

molecule/advanced/converge.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
- name: Converge
33
hosts: nap
44
tasks:
5-
- name: Install NGINX App Protect
5+
- name: Install NGINX App Protect WAF
66
include_role:
77
name: ansible-role-nginx-app-protect
88
vars:

molecule/advanced/verify.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,23 +11,23 @@
1111
failed_when: (install is changed) or (install is failed)
1212
when: ansible_os_family != "Alpine"
1313

14-
- name: Check if NGINX App Protect is installed
14+
- name: Check if NGINX App Protect WAF is installed
1515
package:
1616
name: app-protect
1717
state: present
1818
check_mode: true
1919
register: install
2020
failed_when: (install is changed) or (install is failed)
2121

22-
- name: Check if NGINX App Protect signatures is installed
22+
- name: Check if NGINX App Protect WAF signatures is installed
2323
package:
2424
name: app-protect-attack-signatures
2525
state: present
2626
check_mode: true
2727
register: install
2828
failed_when: (install is changed) or (install is failed)
2929

30-
- name: Check if NGINX App Protect threat campaigns is installed
30+
- name: Check if NGINX App Protect WAF threat campaigns is installed
3131
package:
3232
name: app-protect-threat-campaigns
3333
state: present

molecule/default/converge.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
- name: Converge
33
hosts: all
44
tasks:
5-
- name: Install NGINX App Protect
5+
- name: Install NGINX App Protect WAF
66
include_role:
77
name: ansible-role-nginx-app-protect
88
vars:

molecule/default/verify.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,23 +11,23 @@
1111
failed_when: (install is changed) or (install is failed)
1212
when: ansible_os_family != "Alpine"
1313

14-
- name: Check if NGINX App Protect is installed
14+
- name: Check if NGINX App Protect WAF is installed
1515
package:
1616
name: app-protect
1717
state: present
1818
check_mode: true
1919
register: install
2020
failed_when: (install is changed) or (install is failed)
2121

22-
- name: Check if NGINX App Protect signatures is installed
22+
- name: Check if NGINX App Protect WAF signatures is installed
2323
package:
2424
name: app-protect-attack-signatures
2525
state: present
2626
check_mode: true
2727
register: install
2828
failed_when: (install is changed) or (install is failed)
2929

30-
- name: Check if NGINX App Protect threat campaigns is installed
30+
- name: Check if NGINX App Protect WAF threat campaigns is installed
3131
package:
3232
name: app-protect-threat-campaigns
3333
state: present

molecule/dos/converge.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
---
2+
- name: Converge
3+
hosts: all
4+
tasks:
5+
- name: Install NGINX App Protect DoS
6+
include_role:
7+
name: ansible-role-nginx-app-protect
8+
vars:
9+
nginx_app_protect_waf_enable: false
10+
nginx_app_protect_dos_enable: true
11+
nginx_app_protect_license:
12+
certificate: license/nginx-repo.crt
13+
key: license/nginx-repo.key
14+
nginx_app_protect_remove_license: false

0 commit comments

Comments
 (0)