Skip to content

Commit 0bc4c54

Browse files
authored
Always update NAP dependencies to the latest available version (#133)
1 parent 04d417d commit 0bc4c54

File tree

9 files changed

+71
-63
lines changed

9 files changed

+71
-63
lines changed

CHANGELOG.md

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

3+
## 0.6.2 (Unreleased)
4+
5+
ENHANCEMENTS:
6+
7+
Move non NGINX App Protect specific dependencies from the role into the Molecule Dockerfile.
8+
9+
BUG FIXES:
10+
11+
Always update NGINX App Protect dependencies to the latest available version to avoid outdated dependency issues (e.g. outdated CA certificates).
12+
313
## 0.6.1 (September 30, 2021)
414

515
KNOWN ISSUES:

molecule/Dockerfile.j2

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,15 @@ ENV {{ var }} {{ value }}
1717
RUN \
1818
if [ $(command -v apt-get) ]; then \
1919
apt-get update \
20-
&& DEBIAN_FRONTEND=noninteractive apt-get install -y aptitude bash ca-certificates curl iproute2 python-apt python3 python3-apt procps sudo systemd systemd-sysv vim \
20+
&& DEBIAN_FRONTEND=noninteractive apt-get install -y aptitude bash curl dirmngr iproute2 python3 python3-apt procps sudo systemd systemd-sysv vim \
2121
&& apt-get clean; \
2222
elif [ $(command -v dnf) ]; then \
2323
dnf makecache \
2424
&& dnf --assumeyes install bash iproute sudo /usr/bin/dnf-3 /usr/bin/python3 /usr/bin/python3-config vim \
2525
&& dnf clean all; \
2626
elif [ $(command -v yum) ]; then \
2727
yum makecache fast \
28-
&& yum install -y bash iproute sudo /usr/bin/python /usr/bin/python2-config vim yum-plugin-ovl initscripts \
28+
&& yum install -y bash iproute initscripts sudo /usr/bin/python /usr/bin/python2-config vim yum-plugin-ovl \
2929
&& sed -i 's/plugins=0/plugins=1/g' /etc/yum.conf \
3030
&& yum clean all; \
3131
elif [ $(command -v zypper) ]; then \
@@ -34,10 +34,10 @@ RUN \
3434
&& zypper clean -a; \
3535
elif [ $(command -v apk) ]; then \
3636
apk update \
37-
&& apk add --no-cache bash ca-certificates curl openrc python3 sudo vim; \
37+
&& apk add --no-cache bash curl openrc python3 sudo vim; \
3838
echo 'rc_provide="loopback net"' >> /etc/rc.conf; \
3939
elif [ $(command -v xbps-install) ]; then \
4040
xbps-install -Syu \
41-
&& xbps-install -y bash ca-certificates iproute2 python3 sudo vim \
41+
&& xbps-install -y bash iproute2 python3 sudo vim \
4242
&& xbps-remove -O; \
4343
fi

molecule/advanced/requirements.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
roles:
33
- name: nginxinc.nginx
4-
version: 0.21.1
4+
version: 0.21.2
55
- name: robertdebock.rsyslog
66
version: 3.2.0

molecule/default/requirements.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
---
22
roles:
33
- name: nginxinc.nginx
4-
version: 0.21.1
4+
version: 0.21.2

molecule/dos/molecule.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,34 @@ lint: |
1010
yamllint .
1111
ansible-lint --force-color
1212
platforms:
13+
- name: centos-7
14+
image: centos:7
15+
dockerfile: ../Dockerfile.j2
16+
privileged: true
17+
volumes:
18+
- "/sys/fs/cgroup:/sys/fs/cgroup:rw"
19+
command: "/usr/sbin/init"
1320
- name: debian-buster
1421
image: debian:buster-slim
1522
dockerfile: ../Dockerfile.j2
1623
privileged: true
1724
volumes:
1825
- "/sys/fs/cgroup:/sys/fs/cgroup:rw"
1926
command: "/sbin/init"
27+
- name: ubuntu-bionic
28+
image: ubuntu:bionic
29+
dockerfile: ../Dockerfile.j2
30+
privileged: true
31+
volumes:
32+
- "/sys/fs/cgroup:/sys/fs/cgroup:rw"
33+
command: "/sbin/init"
34+
- name: ubuntu-focal
35+
image: ubuntu:focal
36+
dockerfile: ../Dockerfile.j2
37+
privileged: true
38+
volumes:
39+
- "/sys/fs/cgroup:/sys/fs/cgroup:rw"
40+
command: "/sbin/init"
2041
provisioner:
2142
name: ansible
2243
playbooks:

molecule/dos/requirements.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
---
22
roles:
33
- name: nginxinc.nginx
4-
version: 0.21.1
4+
version: 0.21.2
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
---
22
roles:
33
- name: nginxinc.nginx
4-
version: 0.21.1
4+
version: 0.21.2

tasks/common/prerequisites/install-dependencies.yml

Lines changed: 16 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -3,27 +3,26 @@
33
apk:
44
name: "{{ nginx_app_protect_alpine_dependencies }}"
55
update_cache: true
6-
ignore_errors: "{{ ansible_check_mode }}"
6+
state: latest # noqa package-latest
77
when: ansible_os_family == "Alpine"
88

99
- name: (Debian/Ubuntu) Install package dependencies
1010
apt:
1111
name: "{{ nginx_app_protect_debian_dependencies }}"
1212
update_cache: true
13+
state: latest # noqa package-latest
1314
when: ansible_os_family == "Debian"
1415

15-
- name: (CentOS) Install package dependencies
16+
- name: (Amazon Linux/CentOS/RHEL) Install package dependencies
1617
yum:
17-
name: "{{ nginx_app_protect_centos_dependencies }}"
18-
when: ansible_distribution == "CentOS"
18+
name: "{{ nginx_app_protect_redhat_dependencies }}"
19+
update_cache: true
20+
state: latest # noqa package-latest
21+
when: ansible_os_family == "RedHat"
1922

20-
- name: (RHEL) Install dependencies
23+
- name: (RHEL) Set up RHEL specific repositories
2124
block:
22-
- name: (RHEL) Install package dependencies
23-
yum:
24-
name: "{{ nginx_app_protect_rhel_dependencies }}"
25-
26-
- name: (RHEL) Set up RHEL repository
25+
- name: (RHEL) Install extended dependencies from CentOS repositories
2726
yum_repository:
2827
name: CentOS-7
2928
baseurl: "http://ftp.heanet.ie/pub/centos/{{ ansible_distribution_major_version }}/os/$basearch/"
@@ -35,28 +34,16 @@
3534
state: "{{ nginx_app_protect_license_status | default ('present') }}"
3635
when: not nginx_app_protect_use_rhel_subscription_repos | bool
3736

38-
- name: (RHEL) Install package dependencies from your RHEL subscription
39-
yum:
37+
- name: (RHEL) Install extended dependencies from RHEL subscription repositories
38+
rhsm_repository:
4039
name:
41-
- rhel-7-server-optional-rpms
4240
- rhel-7-server-rpms
41+
- rhel-7-server-optional-rpms
4342
when: nginx_app_protect_use_rhel_subscription_repos | bool
4443
when: ansible_distribution == "RedHat"
4544

46-
- name: (Amazon Linux) Install dependencies
47-
block:
48-
- name: (Amazon Linux) Enable amazon-linux-extras packages
49-
command: "amazon-linux-extras enable {{ item }}"
50-
changed_when: false
51-
loop: "{{ nginx_app_protect_amazon_extras_packages }}"
52-
53-
- name: (Amazon Linux) Clean Yum Metadata
54-
command: yum clean metadata
55-
changed_when: false
56-
args:
57-
warn: false
58-
59-
- name: (Amazon Linux) Install package dependencies
60-
yum:
61-
name: "{{ nginx_app_protect_amazon_dependencies }}"
45+
- name: (Amazon Linux) Set up Amazon Linux Extras repositories
46+
command: "amazon-linux-extras enable {{ item }}"
47+
changed_when: false
48+
loop: "{{ nginx_app_protect_amazon_extras }}"
6249
when: ansible_distribution == "Amazon"

vars/main.yml

Lines changed: 16 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -2,64 +2,54 @@
22
# NGINX App Protect WAF platform matrix. Populate this dictionary of lists with appropriate values from ansible_distribution and ansible_distribution_version facts
33
nginx_app_protect_waf_linux_families:
44
alpine: [
5-
"3.10",
5+
'3.10',
66
]
77
amazon: [
8-
"2",
8+
'2',
99
]
1010
debian: [
11-
"10",
11+
'10',
1212
]
1313
centos: [
14-
"7.4", "7.5", "7.6", "7.7", "7.8", "7.9",
14+
'7.4', '7.5', '7.6', '7.7', '7.8', '7.9',
1515
]
1616
redhat: [
17-
"7.4", "7.5", "7.6", "7.7", "7.8", "7.9",
17+
'7.4', '7.5', '7.6', '7.7', '7.8', '7.9',
1818
]
1919
ubuntu: [
20-
"18.04", "20.04",
20+
'18.04', '20.04',
2121
]
2222

2323
# NGINX App Protect DoS platform matrix. Populate this dictionary of lists with appropriate values from ansible_distribution and ansible_distribution_version facts
2424
nginx_app_protect_dos_linux_families:
2525
centos: [
26-
"7.4", "7.5", "7.6", "7.7", "7.8", "7.9",
26+
'7.4', '7.5', '7.6', '7.7', '7.8', '7.9',
2727
]
2828
debian: [
29-
"10",
29+
'10',
3030
]
3131
ubuntu: [
32-
"18.04", "20.04",
32+
'18.04', '20.04',
3333
]
3434

3535
# Alpine Linux dependencies
3636
nginx_app_protect_alpine_dependencies: [
37-
"python3",
37+
'ca-certificates',
3838
]
3939

4040
# Debian dependencies
4141
nginx_app_protect_debian_dependencies: [
42-
"apt-transport-https", "ca-certificates", "dirmngr",
42+
'apt-transport-https', 'ca-certificates',
4343
]
4444

45-
# CentOS dependencies
46-
nginx_app_protect_centos_dependencies: [
47-
"ca-certificates", "epel-release", "openssl",
48-
]
49-
50-
# RHEL dependencies
51-
nginx_app_protect_rhel_dependencies: [
52-
"ca-certificates", "https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm", "openssl",
53-
]
54-
55-
# Amazon Linux 2 dependencies
56-
nginx_app_protect_amazon_dependencies: [
57-
"ca-certificates", "epel-release",
45+
# Red Hat dependencies
46+
nginx_app_protect_redhat_dependencies: [
47+
'ca-certificates', 'https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm',
5848
]
5949

6050
# Amazon Linux 2 extras
61-
nginx_app_protect_amazon_extras_packages: [
62-
"epel", "selinux-ng",
51+
nginx_app_protect_amazon_extras: [
52+
'selinux-ng',
6353
]
6454

6555
# Choose where to fetch the NGINX App Protect and Security Updates signing keys from.

0 commit comments

Comments
 (0)