Skip to content

Commit

Permalink
Require acl package. Fix logrotate and auditd (#160)
Browse files Browse the repository at this point in the history
* Require acl package for setting permissions

* Added platform specific logrotate file

* Fixed auditd restart for RedHat

* added prereqs.yml to main.yml task
  • Loading branch information
jewnix authored Dec 21, 2022
1 parent e6d5ab3 commit b8ed688
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 3 deletions.
4 changes: 3 additions & 1 deletion roles/splunk/handlers/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,9 @@
when: not start_splunk_handler_fired

- name: restart redhat auditd service
command: service auditd condrestart
shell: |
service auditd stop
service auditd start
become: true
when: ansible_os_family == 'RedHat'

Expand Down
4 changes: 2 additions & 2 deletions roles/splunk/tasks/configure_facl.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@

- name: Add setfacl to logrotate script
lineinfile:
path: /etc/logrotate.d/syslog
insertbefore: ' endscript'
path: "{{ logrotate_file }}"
insertbefore: 'endscript'
line: ' /usr/bin/setfacl -Rm u:{{ splunk_nix_user }}:rx /var/log'
become: True

Expand Down
3 changes: 3 additions & 0 deletions roles/splunk/tasks/install_splunk.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
---
# This task should be used for fresh installations of Splunk, refer to upgrade_splunk.yml for upgrades
- name: Install Required Packages
include_tasks: prereqs.yml

- name: Block for non-root splunk user setup
block:
- name: Add nix splunk group
Expand Down
3 changes: 3 additions & 0 deletions roles/splunk/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@
- "{{ ansible_os_family }}{{ ansible_distribution_major_version }}.yml"
- "{{ ansible_os_family }}.yml"

- name: Include prerequisites
include_tasks: prereqs.yml

- name: Reset value of start_splunk_handler_fired and configure_boot_start
tags: always
set_fact:
Expand Down
6 changes: 6 additions & 0 deletions roles/splunk/tasks/prereqs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
- name: install acl package
ansible.builtin.package:
name: acl
state: present
become: True
1 change: 1 addition & 0 deletions roles/splunk/vars/Debian.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,4 @@ linux_packages:
- gdb
- dnsutils
firewall_service: ufw
logrotate_file: /etc/logrotate.d/rsyslog
1 change: 1 addition & 0 deletions roles/splunk/vars/RedHat.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,4 @@ linux_packages:
- gdb
- bind-utils
firewall_service: firewalld
logrotate_file: /etc/logrotate.d/syslog

0 comments on commit b8ed688

Please sign in to comment.