Skip to content

Commit b14233f

Browse files
authored
Implement new NGINX Plus R25 JWT directives (#175)
1 parent 17c44a8 commit b14233f

File tree

6 files changed

+25
-30
lines changed

6 files changed

+25
-30
lines changed

.github/release-drafter.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,6 @@ template: |
9595
## Resources
9696
9797
* Functional configuration examples (check `converge.yml` under each `molecule` scenario) -- [github.com/nginxinc/ansible-role-nginx-config/tree/$RESOLVED_VERSION/molecule](https://github.com/nginxinc/ansible-role-nginx-config/tree/$RESOLVED_VERSION/molecule).
98-
* Ansible Galaxy repository -- [galaxy.ansible.com/nginxinc/nginx](https://galaxy.ansible.com/nginxinc/nginx_config).
98+
* Ansible Galaxy repository -- [galaxy.ansible.com/nginxinc/nginx_config](https://galaxy.ansible.com/nginxinc/nginx_config).
9999
* NGINX Ansible role & collection introductory blog -- [nginx.com/blog/announcing-nginx-core-collection-ansible](https://www.nginx.com/blog/announcing-nginx-core-collection-ansible).
100100
* NGINX: Better with Ansible demo -- [github.com/alessfg/nginx-ansible-demo](https://github.com/alessfg/nginx-ansible-demo).

defaults/main/template.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -558,7 +558,8 @@ nginx_config_http_template:
558558
key_file: /path/to/file
559559
key_request: /path/to/file
560560
leeway: 0s
561-
type: signed # One of 'signed' or 'encrypted'
561+
type: signed # One of 'signed', 'encrypted' or 'nested'
562+
required: $valid_jwt_iss # String or list
562563
api: # Configure NGINX Plus HTTP API
563564
enable: # true # Set to Boolean directly to simply enable the 'api' directive
564565
write: true # Boolean
@@ -575,7 +576,7 @@ nginx_config_http_template:
575576
number: 32 # Required
576577
size: 4k # Required
577578
comp_level: 1
578-
disable: [] # string or list
579+
disable: [] # String or list
579580
http_version: 1.1 # Optional -- One of '1.0' or '1.1'
580581
min_length: 20
581582
proxied: [] # Set to 'false' to set to 'off' -- otherwise, you can specify a string or a list

molecule/common/Dockerfile.j2

Lines changed: 5 additions & 5 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 \
24-
&& dnf --assumeyes install bash iproute /usr/bin/dnf-3 /usr/bin/python3 /usr/bin/python3-config vim \
24+
&& 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 /usr/bin/python /usr/bin/python2-config sudo vim yum-plugin-ovl \
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/plus/converge.yml

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
main:
2525
load_module:
2626
- modules/ngx_http_app_protect_module.so
27-
- modules/ngx_http_app_protect_dos_module.so
27+
# - modules/ngx_http_app_protect_dos_module.so
2828
user: nginx
2929
worker_processes: auto
3030
error_log:
@@ -206,7 +206,8 @@
206206
- variable: $job
207207
name: info
208208
leeway: 0s
209-
type: signed
209+
type: nested
210+
require: jwt
210211
auth_request:
211212
uri: false
212213
set:
@@ -310,13 +311,13 @@
310311
dest: syslog:server=10.1.1.1:514
311312
- path: /etc/app_protect/conf/log_default.json
312313
dest: syslog:server=10.1.1.2:514
313-
app_protect_dos:
314-
enable: true
315-
policy_file: /etc/app_protect/conf/BADOSDefaultPolicy.json
316-
security_log_enable: true
317-
security_log:
318-
path: /etc/app_protect_dos/log-default.json
319-
dest: syslog:server=10.1.1.1:514
314+
# app_protect_dos:
315+
# enable: true
316+
# policy_file: /etc/app_protect/conf/BADOSDefaultPolicy.json
317+
# security_log_enable: true
318+
# security_log:
319+
# path: /etc/app_protect_dos/log-default.json
320+
# dest: syslog:server=10.1.1.1:514
320321
auth_jwt:
321322
enable:
322323
realm: realm

molecule/plus/prepare.yml

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -20,32 +20,22 @@
2020
- name: Install NGINX Plus
2121
hosts: all
2222
tasks:
23-
- name: Set repo if Debian
24-
set_fact:
25-
version: "=24-2~{{ ansible_facts['distribution_release'] }}"
26-
when: ansible_facts['os_family'] == "Debian"
27-
- name: Set repo if Red Hat
28-
set_fact:
29-
version: "-24-2.{{ (ansible_facts['distribution']=='Amazon') | ternary('amzn2', ('el' + ansible_facts['distribution_major_version'] | string)) }}.ngx"
30-
when: ansible_facts['os_family'] == "RedHat"
31-
3223
- name: Install NGINX
3324
include_role:
3425
name: nginxinc.nginx
3526
vars:
3627
nginx_type: plus
37-
nginx_version: "{{ version }}"
3828
nginx_license:
3929
certificate: ../common/files/license/nginx-repo.crt
4030
key: ../common/files/license/nginx-repo.key
4131
nginx_remove_license: false
4232

43-
- name: Install NGINX App Protect WAF and NGINX App Protect DoS
33+
- name: Install NGINX App Protect WAF
4434
include_role:
4535
name: nginxinc.nginx_app_protect
4636
vars:
4737
nginx_app_protect_waf_enable: true
48-
nginx_app_protect_dos_enable: true
38+
nginx_app_protect_dos_enable: false
4939
nginx_app_protect_setup_license: false
5040
nginx_app_protect_remove_license: false
5141
nginx_app_protect_install_signatures: false

templates/http/auth.j2

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,10 @@ auth_jwt_key_request {{ auth_jwt['key_request'] }};
7070
{% if auth_jwt['leeway'] is defined %}
7171
auth_jwt_leeway {{ auth_jwt['leeway'] }};
7272
{% endif %}
73-
{% if auth_jwt['type'] is defined and auth_jwt['type'] in ['signed', 'encrypted'] %}
73+
{% if auth_jwt['type'] is defined and auth_jwt['type'] in ['signed', 'encrypted', 'nested'] %}
7474
auth_jwt_type {{ auth_jwt['type'] }};
7575
{% endif %}
76+
{% if auth_jwt['require'] is defined %}
77+
auth_jwt_require {{ auth_jwt['require'] if auth_jwt['require'] is string else auth_jwt['require'] | join(' ') }};
78+
{% endif %}
7679
{% endmacro %}

0 commit comments

Comments
 (0)