File tree Expand file tree Collapse file tree 8 files changed +88
-13
lines changed
Expand file tree Collapse file tree 8 files changed +88
-13
lines changed Original file line number Diff line number Diff line change 1+ ---
2+ - name : Restart auditd
3+ ansible.builtin.service :
4+ name : auditd
5+ state : restarted
Original file line number Diff line number Diff line change 4545 register : logrotate_config
4646 failed_when : not logrotate_config.stat.exists
4747
48+ - name : Check auditship main configuration exists
49+ ansible.builtin.stat :
50+ path : /etc/auditship.conf
51+ register : auditship_main_config
52+ failed_when : not auditship_main_config.stat.exists
53+
54+ - name : Verify auditship main configuration content
55+ ansible.builtin.slurp :
56+ src : /etc/auditship.conf
57+ register : main_config_content
58+
59+ - name : Validate main configuration contains expected values
60+ ansible.builtin.assert :
61+ that :
62+ - " 'tag: auditd' in main_config_decoded"
63+ - " 'outputs:' in main_config_decoded"
64+ - " 'fluent://localhost:24224' in main_config_decoded"
65+ - " '/var/log/auditship.json' in main_config_decoded"
66+ fail_msg : " Auditship main configuration is missing required values"
67+ vars :
68+ main_config_decoded : " {{ main_config_content.content | b64decode }}"
69+
4870 - name : Test auditship binary can run (version check)
4971 ansible.builtin.command : /usr/local/bin/auditship -version
5072 register : version_output
Original file line number Diff line number Diff line change 1+ - name : Add auditd plugin config
2+ ansible.builtin.template :
3+ # https://gitlab.com/devopsworks/tools/auditship/-/raw/master/auditship.plugin.conf?ref_type=heads
4+ src : auditship.plugin.conf.j2
5+ dest : /etc/audit/plugins.d/auditship.conf
6+ owner : root
7+ group : root
8+ mode : ' 0640'
9+ notify :
10+ - Restart auditd
11+
12+ - name : Add auditship plugin config
13+ ansible.builtin.template :
14+ # https://gitlab.com/devopsworks/tools/auditship/-/raw/master/auditship.plugin.conf?ref_type=heads
15+ src : auditship.conf.j2
16+ dest : /etc/auditship.conf
17+ owner : root
18+ group : root
19+ mode : ' 0640'
20+ notify :
21+ - Restart auditd
22+
23+ - name : Add logrotate config
24+ ansible.builtin.get_url :
25+ url : https://gitlab.com/devopsworks/tools/auditship/-/raw/master/auditship.logrotate.conf?ref_type=heads
26+ dest : /etc/logrotate.d/auditship
27+ owner : root
28+ group : root
29+ mode : ' 0644'
Original file line number Diff line number Diff line change 1717 https://gitlab.com/api/v4/projects/71363433/packages/generic/auditship/{{ __auditship_latest_num_version }}/auditship-linux-amd64-{{ __auditship_latest_version }}.gz
1818 dest : /tmp/auditship.gz
1919 mode : ' 0644'
20+ notify :
21+ - Restart auditd
2022
2123- name : Fetch & unarchive auditship
2224 # can not use unarchive, does not support gz
2325 ansible.builtin.shell : gunzip -cd /tmp/auditship.gz > /usr/local/bin/auditship && chmod 755 /usr/local/bin/auditship
2426 changed_when : true
2527
26- - name : Add auditd plugin config
28+ - name : Install logrotate template for auditship
2729 ansible.builtin.template :
28- # https://gitlab.com/devopsworks/tools/auditship/-/raw/master/auditship.plugin.conf?ref_type=heads
29- src : auditship.plugin.conf.j2
30- dest : /etc/audit/plugins.d/auditship.conf
31- owner : root
32- group : root
33- mode : ' 0640'
34-
35- - name : Add logrotate config
36- ansible.builtin.get_url :
37- url : https://gitlab.com/devopsworks/tools/auditship/-/raw/master/auditship.logrotate.conf?ref_type=heads
30+ src : auditship.logrotate.j2
3831 dest : /etc/logrotate.d/auditship
3932 owner : root
4033 group : root
Original file line number Diff line number Diff line change 77
88- name : Include auditship installation tasks
99 ansible.builtin.include_tasks :
10- file : auditship .yml
10+ file : install .yml
1111 apply :
1212 tags :
1313 - auditship
1414 when : __auditship is defined and (not __auditship.stat.exists or auditship_force_install)
1515 tags :
1616 - always
17+
18+ - name : Configure auditship
19+ ansible.builtin.include_tasks :
20+ file : configure.yml
21+ apply :
22+ tags :
23+ - auditship
24+ tags :
25+ - always
Original file line number Diff line number Diff line change 1+ tag: auditd
2+ outputs:
3+ - "-"
4+ - "/var/log/auditship.json"
5+ - "fluent://localhost:24224"
Original file line number Diff line number Diff line change 1+ # when used with file output, we have to rotate the log file
2+ /var/log/auditship.json {
3+ daily
4+ dateext
5+ dateyesterday
6+ missingok
7+ rotate 5
8+ compress
9+ copytruncate
10+ create 0640 root root
11+ }
Original file line number Diff line number Diff line change @@ -2,7 +2,8 @@ active = yes
22direction = out
33path = /usr/local/bin/auditship
44# use one of the following lines to set the output
5- args = -out {{ auditship_fluent_url | default("fluent://127.0.0.1:24224") }}
5+ # args = -out {{ auditship_fluent_url | default("fluent://127.0.0.1:24224") }}
66# args = -out /var/log/auditship.json
7+ args = -config /etc/auditship.conf
78type = always
89format = string
You can’t perform that action at this time.
0 commit comments