Skip to content

Commit ce88653

Browse files
authored
Merge pull request #14 from jessegoodier/new_branch
New branch
2 parents 758c32a + 6c2a20b commit ce88653

File tree

8 files changed

+107
-18
lines changed

8 files changed

+107
-18
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,3 +36,6 @@ default.pem
3636

3737
# Scratch Directory
3838
scratch/
39+
40+
# nginx keys
41+
sample-playbook/license/nginx-repo.*

README.md

Lines changed: 11 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -98,11 +98,11 @@ Example Playbook
9898

9999
This is a sample playbook file for using the role to install NGINX App Protect on NGINX Plus and configure it using basic settings to all `wafs` inventory hosts.
100100

101+
A copy of this is in the sample-playbook directory in this repo.
102+
103+
First create a file for all the variables as `nginx-app-protect-vars.yml`
101104
```yaml
102105
---
103-
- hosts: wafs
104-
become: true
105-
vars:
106106
107107
# Specify whether you want to maintain your version of NGINX App Protect, upgrade to the latest version, or remove NGINX App Protect.
108108
# Can be used with `app_protect_version` to achieve fine grained control on which version of NGINX App Protect is installed/used on each playbook execution.
@@ -169,31 +169,24 @@ This is a sample playbook file for using the role to install NGINX App Protect o
169169
certificate: "{{playbook_dir}}/license/nginx-repo.crt"
170170
key: "{{playbook_dir}}/license/nginx-repo.key"
171171

172-
roles:
173-
- role: nginxinc.nginx_app_protect
174172
```
175173

176174
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.
177175

178176
```yaml
179177
---
180-
- hosts: localhost
181-
become: true
178+
- hosts: wafs
179+
remote_user: centos
180+
pre_tasks:
181+
- name: load the vars
182+
include_vars:
183+
file: "{{playbook_dir}}/nginx-app-protect-vars.yml"
182184
roles:
183-
- role: nginxinc.nginx_app_protect
185+
- nginxinc.nginx_app_protect
184186
```
185187
186-
This is a sample playbook file for deploying the Ansible Galaxy NGINX App Protect role to a dynamic inventory containing the `nginx_plus` tag.
187-
188-
```yaml
189-
---
190-
- hosts: tag_nginx_plus
191-
remote_user: root
192-
roles:
193-
- role: nginxinc.nginx_app_protect
194-
```
195188
196-
To run any of the above sample playbooks create a `setup-nginx-app-protect.yml` file and paste the contents. Executing the Ansible Playbook is then as simple as executing `ansible-playbook setup-nginx.yml`.
189+
To run any of the above sample playbooks create a `nginx-app-protect-playbook.yml` file and paste the contents. Executing the Ansible Playbook is then as simple as executing `ansible-playbook nginx-app-protect-playbook.yml -b -i inventory`.
197190

198191
Alternatively, you can also clone this repository instead of installing it from Ansible Galaxy. If you decide to do so, replace the role variable in the previous sample playbooks from `nginxinc.nginx_app_protect` to `ansible-role-nginx-app-protect`.
199192

sample-playbook/README.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# ansible-nap
2+
3+
## Usage
4+
5+
install galaxy role:
6+
7+
`ansible-galaxy install nginxinc.nginx_app_protect`
8+
9+
install app protect
10+
11+
`ansible-playbook nginx-app-protect-ansible-playbook.yml -b -i inventory`

sample-playbook/inventory

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
[wafs]
2+
centos-nap1 ansible_user=centos

sample-playbook/license/add-license-cert-here

Whitespace-only changes.
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
---
2+
- hosts: wafs
3+
remote_user: centos
4+
pre_tasks:
5+
- name: load the vars
6+
include_vars:
7+
file: "{{playbook_dir}}/nginx-app-protect-vars.yml"
8+
roles:
9+
- nginxinc.nginx_app_protect
Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
2+
# Specify whether you want to maintain your version of NGINX App Protect, upgrade to the latest version, or remove NGINX App Protect.
3+
# Can be used with `app_protect_version` to achieve fine grained control on which version of NGINX App Protect is installed/used on each playbook execution.
4+
# Using 'present' will install the latest version (or 'app_protect_version') of NGINX App Protect on a fresh install.
5+
# Using 'latest' will upgrade NGINX App Protect to the latest version (that matches your 'app_protect_version') of NGINX App Protect on every playbook execution.
6+
# Using 'absent' will remove NGINX App Protect from your system.
7+
# Default is present.
8+
app_protect_state: present
9+
10+
# OPTIONAL: Installs a specific version of NGINX App Protect
11+
#app_protect_version: 22
12+
13+
# The installation of NGINX App Protect includes a base signature set, which may be out of date.
14+
# This option installs the latest NGINX App Protect signatures.
15+
app_protect_install_signatures: true
16+
17+
# The installation of NGINX App Protect can include a page of frequently-updated, high-accuracy signatures called Threat Campaigns.
18+
# This option installs the latest NGINX App Protect Threat Campaigns signatures.
19+
app_protect_install_threat_campaigns: true
20+
21+
# Creates basic configuration files and enables NGINX App Protect on the target host
22+
app_protect_configure: true
23+
24+
# Removes the license (certificate and key) for the NGINX App Protect repositories on the target host(s) when playbook run is complete.
25+
app_protect_delete_license: true
26+
27+
# If you have a RHEL subscription, NGINX App Protect's dependencies will use subscription repos.
28+
# Otherwise, it will source packages from CentOS' repositories.
29+
app_protect_use_rhel_subscription_repos: false
30+
31+
# For use with the app_protect_configure option to determine if the default security policy will be written to the target host
32+
# Used when `app_protect_configure: true`.
33+
app_protect_security_policy_template_enable: true
34+
35+
# Default app protect enforcement mode. Values can be `blocking` or `transparent`.
36+
# Used when `app_protect_configure: true` and `app_protect_security_policy_template_enable: true`.
37+
security_policy_enforcement_mode: blocking
38+
39+
# For use with the app_protect_configure option to determine if the default log policy will be written to the target host.
40+
# Used when `app_protect_configure: true`.
41+
app_protect_log_policy_template_enable: true
42+
43+
# Which violation types to log. Possible values: all, illegal, blocked
44+
# Used when `app_protect_configure: true` and `app_protect_log_policy_template_enable: true`.
45+
log_policy_filter_request_type: all
46+
47+
# For use with the app_protect_configure option to determine if the sample nginx.conf will be written to the target host.
48+
# Since this can be dangerous, this value is default to false in the role defaults.
49+
# Used when `app_protect_configure: true`.
50+
nginx_conf_template_enable: true
51+
52+
# For use with the app_protect_configure option to determine the syslog target to be injected
53+
# into the default log policy that will be written to the target host.
54+
# Used when `nginx_conf_template_enable: true`.
55+
log_policy_syslog_target: 10.0.0.2:514
56+
57+
# DEPRECATED: A proxy pass workload used in the sample nginx.conf for demo purposes.
58+
# Will be removed from this role in the future.
59+
# Used when `nginx_conf_template_enable: true`.
60+
nginx_demo_workload: http://10.0.0.3:88
61+
62+
# The location of the certificate and key to be used when downloading the packages onto the host
63+
nginx_license:
64+
certificate: "{{playbook_dir}}/license/nginx-repo.crt"
65+
key: "{{playbook_dir}}/license/nginx-repo.key"
66+
67+
# upstream target:
68+
nginx_demo_workload_protocol: http://
69+
nginx_demo_workload_host: 10.1.1.1:8080

tasks/configure-app-protect.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,15 @@
1717
template:
1818
src: "{{ app_protect_security_policy_template.template_file }}"
1919
dest: "{{ app_protect_security_policy_template.out_file_location }}{{ app_protect_security_policy_template.out_file_name }}"
20+
mode: "0644"
2021
backup: true
2122
when: app_protect_security_policy_template_enable
2223

2324
- name: "Dynamically Generate NGINX App Protect log policy file"
2425
template:
2526
src: "{{ app_protect_log_policy_template.template_file }}"
2627
dest: "{{ app_protect_log_policy_template.out_file_location }}{{ app_protect_log_policy_template.out_file_name }}"
28+
mode: "0644"
2729
backup: true
2830
when: app_protect_log_policy_template_enable
2931

0 commit comments

Comments
 (0)