Skip to content

Commit e1ed588

Browse files
aknot242alessfg
andauthored
Add RHEL support for NAP DoS 2.1 release (#159)
Co-authored-by: Alessandro Fael Garcia <[email protected]>
1 parent 3a37ac4 commit e1ed588

26 files changed

+276
-116
lines changed

.github/workflows/molecule.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,3 +51,5 @@ jobs:
5151
ANSIBLE_FORCE_COLOR: 1
5252
NGINX_CRT: ${{ secrets.NGINX_CRT }}
5353
NGINX_KEY: ${{ secrets.NGINX_KEY }}
54+
RHEL_USERNAME: ${{ secrets.RHEL_USERNAME }}
55+
RHEL_PASSWORD: ${{ secrets.RHEL_PASSWORD }}

CHANGELOG.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,14 @@ BREAKING CHANGES:
66

77
* Rename `nginx_app_protect_<waf/dos>_state` parameter to `nginx_app_protect_<waf/dos>_setup` parameters.
88
* Rename multiple `nginx_app_protect_*` parameters and tags to `nginx_app_protect_waf_*` to aid in disambiguation.
9-
* Cleanup remaining Alpine Linux tasks.
9+
* Cleanup deprecated Alpine Linux tasks.
1010
* Remove `nginx_app_protect_configure` parameter since it has limited functionality given the `nginx_app_protect_*_policy_file_enable` parameters.
1111

1212
ENHANCEMENTS:
1313

14-
New molecule tests for NGINX App Protect WAF and DoS removal scenarios.
14+
* Add support of RHEL 8.1+ for NGINX App Protect WAF 3.8.
15+
* Add support of RHEL 7.4+ and 8.x for NGINX App Protect DoS 2.1.
16+
* New molecule tests for RHEL 7/8 and for NGINX App Protect WAF/DoS removal scenarios.
1517

1618
BUG FIXES:
1719

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ Debian:
8181
- buster (10)
8282
RHEL:
8383
- 7.4+
84+
- 8.1+
8485
Ubuntu:
8586
- bionic (18.04)
8687
- focal (20.04)
@@ -97,6 +98,9 @@ CentOS:
9798
- 7.4+
9899
Debian:
99100
- buster (10)
101+
RHEL:
102+
- 7.4+
103+
- 8.0+
100104
Ubuntu:
101105
- bionic (18.04)
102106
- focal (20.04)

defaults/main.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ nginx_app_protect_waf_setup: install
1919
# Default is install.
2020
nginx_app_protect_dos_setup: install
2121

22-
# If you have a RHEL subscription, NGINX App Protect WAF's dependencies will use subscription repos.
22+
# If you have a RHEL subscription, NGINX App Protect WAF and DoS's dependencies will use subscription repos.
2323
# Otherwise, it will source packages from CentOS' repositories.
2424
# Default is false.
2525
nginx_app_protect_use_rhel_subscription_repos: false

meta/main.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ galaxy_info:
1717
- name: EL
1818
versions:
1919
- 7
20+
- 8
2021
- name: Debian
2122
versions:
2223
- buster

molecule/advanced/molecule.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ platforms:
1919
- name: molecule-test
2020
- name: centos-7
2121
image: centos:7
22-
dockerfile: ../Dockerfile.j2
22+
dockerfile: ../common/Dockerfile.j2
2323
privileged: true
2424
volumes:
2525
- "/sys/fs/cgroup:/sys/fs/cgroup:rw"
@@ -30,7 +30,7 @@ platforms:
3030
- name: molecule-test
3131
- name: debian-buster
3232
image: debian:buster-slim
33-
dockerfile: ../Dockerfile.j2
33+
dockerfile: ../common/Dockerfile.j2
3434
privileged: true
3535
volumes:
3636
- "/sys/fs/cgroup:/sys/fs/cgroup:rw"
@@ -41,7 +41,7 @@ platforms:
4141
- name: molecule-test
4242
- name: ubuntu-bionic
4343
image: ubuntu:bionic
44-
dockerfile: ../Dockerfile.j2
44+
dockerfile: ../common/Dockerfile.j2
4545
privileged: true
4646
volumes:
4747
- "/sys/fs/cgroup:/sys/fs/cgroup:rw"
@@ -52,7 +52,7 @@ platforms:
5252
- name: molecule-test
5353
- name: ubuntu-focal
5454
image: ubuntu:focal
55-
dockerfile: ../Dockerfile.j2
55+
dockerfile: ../common/Dockerfile.j2
5656
privileged: true
5757
volumes:
5858
- "/sys/fs/cgroup:/sys/fs/cgroup:rw"
File renamed without changes.

molecule/common/cleanup.yml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
---
2+
- name: Cleanup
3+
hosts: all
4+
gather_facts: false
5+
tasks:
6+
- name: Block
7+
block:
8+
- name: Wait for containers to be up
9+
wait_for_connection:
10+
delay: 1
11+
timeout: 2
12+
register: connection
13+
ignore_errors: true
14+
15+
- name: Containers are not up, quit from here
16+
fail:
17+
when: connection.failed
18+
19+
- name: Gather facts
20+
setup:
21+
gather_subset:
22+
- "!all"
23+
- "!any"
24+
- distribution
25+
26+
- name: (RHEL) Unregister system from RHEL subscription manager
27+
redhat_subscription:
28+
state: absent
29+
when: ansible_distribution == "RedHat"
30+
rescue:
31+
- name: It's ok we're at startup
32+
meta: noop

molecule/default/prepare.yml renamed to molecule/common/prepare.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,14 @@
55
tasks:
66
- name: Create ephemeral license certificate file from b64 decoded env var
77
copy:
8-
content: "{{ lookup('env','NGINX_CRT') | b64decode }}"
8+
content: "{{ lookup('env', 'NGINX_CRT') | b64decode }}"
99
dest: ../../files/license/nginx-repo.crt
1010
force: false
1111
mode: 0444
1212

1313
- name: Create ephemeral license key file from b64 decoded env var
1414
copy:
15-
content: "{{ lookup('env','NGINX_KEY') | b64decode }}"
15+
content: "{{ lookup('env', 'NGINX_KEY') | b64decode }}"
1616
dest: ../../files/license/nginx-repo.key
1717
force: false
1818
mode: 0444

molecule/default/converge.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,23 @@
11
---
22
- name: Converge
33
hosts: all
4+
vars:
5+
rhel_subscription: false
6+
pre_tasks:
7+
- name: (RHEL) Check if there is a valid RHEL subscription
8+
set_fact:
9+
rhel_subscription: true
10+
when:
11+
- lookup('env', 'RHEL_USERNAME') | length > 0
12+
- lookup('env', 'RHEL_PASSWORD') | length > 0
13+
14+
- name: (RHEL) Register system into RHEL subscription manager
15+
redhat_subscription:
16+
username: "{{ lookup('env', 'RHEL_USERNAME') }}"
17+
password: "{{ lookup('env', 'RHEL_PASSWORD') }}"
18+
when:
19+
- ansible_distribution == "RedHat"
20+
- rhel_subscription| bool
421
tasks:
522
- name: Install NGINX App Protect WAF
623
include_role:
@@ -9,6 +26,7 @@
926
nginx_app_protect_license:
1027
certificate: license/nginx-repo.crt
1128
key: license/nginx-repo.key
29+
nginx_app_protect_use_rhel_subscription_repos: "{{ rhel_subscription }}"
1230
nginx_app_protect_remove_license: false
1331
nginx_app_protect_install_signatures: true
1432
nginx_app_protect_install_threat_campaigns: true

0 commit comments

Comments
 (0)