Skip to content

Commit

Permalink
lint fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
ansibleguy committed Dec 27, 2024
1 parent 9754ea5 commit 37d24d8
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 14 deletions.
10 changes: 9 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,10 @@ waf:

- name: 'be_app1'
block: true

- name: 'be_app2'
block: true
response_check: true
```
Then you will need to include the SPOE-backend: `/etc/haproxy/waf-coraza.cfg`
Expand All @@ -76,7 +80,6 @@ And target the SPOE-agents in your HAProxy config: (or use the role [ansibleguy/

### Result

**Config-Directory**:
```bash
tree /etc/coraza-spoa -L 4
> /etc/coraza-spoa
Expand All @@ -86,6 +89,11 @@ tree /etc/coraza-spoa -L 4
> │   │   ├── @crs-setup.conf
> │   │   ├── main.conf
> │   │   └── @owasp_crs
> │   ├── be_app2
> │   │   └── v4.7.0
> │   │   ├── @crs-setup.conf
> │   │   ├── main.conf
> │   │   └── @owasp_crs
> │   ├── default
> │   │   └── v4.7.0
> │   │   ├── @crs-setup.conf
Expand Down
10 changes: 5 additions & 5 deletions handlers/main.yml
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
---

- name: daemon-reload
- name: Daemon-reload
ansible.builtin.systemd:
daemon_reload: true

- name: waf-restart
- name: WAF-restart
ansible.builtin.systemd:
name: 'coraza-spoa.service'
state: restarted

- name: rsyslog-restart
- name: Rsyslog-restart
ansible.builtin.systemd:
name: 'rsyslog.service'
state: restarted

- name: logrotate-restart
- name: Logrotate-restart
ansible.builtin.systemd:
name: 'logrotate.service'
state: restarted

- name: check-failed
- name: Check-failed

Check failure on line 22 in handlers/main.yml

View workflow job for this annotation

GitHub Actions / build

command-instead-of-module

systemctl used in place of systemd module
ansible.builtin.command: 'systemctl is-failed coraza-spoa.service'
register: svc_check
failed_when: not svc_check.failed
Expand Down
8 changes: 5 additions & 3 deletions tasks/debian/app.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
ansible.builtin.file:
path: "{{ waf_app_rules_default_dir }}"
state: directory
mode: 0750
register: waf_crs_dir

- name: "HAProxy WAF | Apps | {{ waf_app_name }} | Download Core-Ruleset {{ waf_app.ruleset_version }}"
Expand All @@ -30,7 +31,8 @@
creates: "{{ crs_dir }}"
vars:
crs_dir: "{{ waf_app_rules_dir }}/@owasp_crs"
notify: ['waf-restart', 'check-failed']
notify: ['WAF-restart', 'Check-failed']
tags: skip_ansible_lint # command-instead-of-module

# todo: rule-overrides

Expand All @@ -41,7 +43,7 @@
owner: 'root'
group: "{{ WAF_HC.user }}"
mode: 0640
notify: ['waf-restart', 'check-failed']
notify: ['WAF-restart', 'Check-failed']
tags: [rules]

- name: "HAProxy WAF | Apps | {{ waf_app_name }} | Create rule-setup config"
Expand All @@ -51,5 +53,5 @@
owner: 'root'
group: "{{ WAF_HC.user }}"
mode: 0640
notify: ['waf-restart', 'check-failed']
notify: ['WAF-restart', 'Check-failed']
tags: [rules]
4 changes: 2 additions & 2 deletions tasks/debian/install.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,14 +57,14 @@
src: 'templates/etc/systemd/system/coraza-spoa.service.d/override.conf.j2'
dest: '/etc/systemd/system/coraza-spoa.service.d/override.conf'
mode: 0644
notify: ['daemon-reload', 'waf-restart', 'check-failed']
notify: ['Daemon-reload', 'WAF-restart', 'Check-failed']

- name: HAProxy WAF | Create service
ansible.builtin.get_url:
url: "{{ WAF_HC.url.service }}"
dest: '/etc/systemd/system/coraza-spoa.service'
mode: 0644
notify: ['daemon-reload', 'waf-restart', 'check-failed']
notify: ['Daemon-reload', 'WAF-restart', 'Check-failed']

- name: HAProxy WAF | Start & Enable Service
ansible.builtin.systemd:
Expand Down
4 changes: 2 additions & 2 deletions tasks/debian/logging.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@
src: "templates/etc/rsyslog.d/coraza-spoa.conf.j2"
dest: '/etc/rsyslog.d/coraza-spoa.conf'
mode: 0644
notify: ['rsyslog-restart']
notify: ['Rsyslog-restart']
tags: ['apps']

- name: HAProxy WAF | Logging | Logrotate Config
ansible.builtin.template:
src: "templates/etc/logrotate.d/coraza-spoa.j2"
dest: '/etc/logrotate.d/coraza-spoa'
mode: 0644
notify: ['logrotate-restart']
notify: ['Logrotate-restart']
2 changes: 1 addition & 1 deletion tasks/debian/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
mode: 0640
owner: 'root'
group: "{{ WAF_HC.user }}"
notify: ['waf-restart', 'check-failed']
notify: ['WAF-restart', 'Check-failed']
tags: [config, apps]

- name: HAProxy WAF | Apps
Expand Down

0 comments on commit 37d24d8

Please sign in to comment.