-
Notifications
You must be signed in to change notification settings - Fork 104
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add auditd filtering tasks/vars (#207)
* add auditd filtering tasks/vars
- Loading branch information
1 parent
c507480
commit b29fae9
Showing
5 changed files
with
51 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
--- | ||
- name: "get {{ splunk_nix_user }} user uid" | ||
getent: | ||
database: passwd | ||
key: "{{ splunk_nix_user }}" | ||
|
||
- name: auditd - set 20-splunk.rules | ||
become: true | ||
template: | ||
src: 20-splunk.rules.j2 | ||
dest: /etc/audit/rules.d/20-splunk.rules | ||
mode: 0600 | ||
owner: root | ||
group: root | ||
register: splunk_rule | ||
|
||
- name: Get auditd enabled level | ||
become: true | ||
shell: auditctl -s | grep enabled | cut -d" " -f2 | ||
changed_when: false | ||
check_mode: false | ||
register: auditctl_enabled | ||
|
||
# restart auditd if not immutable | ||
- name: restart auditd if not immutable | ||
become: true | ||
service: | ||
name: auditd | ||
state: restarted | ||
use: service | ||
when: | ||
- splunk_rule is changed | ||
- auditctl_enabled.stdout != '2' | ||
tags: molecule-notest | ||
|
||
# if immutable output "auditd immutable - OS REBOOT REQUIRED" | ||
- name: auditd immutable # noqa no-handler | ||
debug: | ||
msg: "auditd immutable - OS REBOOT REQUIRED" | ||
when: | ||
- splunk_rule is changed | ||
- auditctl_enabled.stdout == '2' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
-a never,exit -F path={{ splunk_home }}/bin/splunkd -F uid={{ ansible_facts.getent_passwd[splunk_user][1] }} | ||
-a never,exit -F path={{ splunk_home }}/var/run/splunk -F uid={{ ansible_facts.getent_passwd[splunk_user][1] }} |