File: shared.yml

package info (click to toggle)
scap-security-guide 0.1.76-1
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 110,644 kB
  • sloc: xml: 241,883; sh: 73,777; python: 32,527; makefile: 27
file content (52 lines) | stat: -rw-r--r-- 1,979 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
# platform = multi_platform_all
# reboot = false
# strategy = configure
# complexity = low
# disruption = low

- name: "{{{ rule_title }}} - Search for $FileCreateMode Parameter in rsyslog Main Config File"
  ansible.builtin.find:
    paths: "/etc"
    pattern: "rsyslog.conf"
    contains: '^\s*\$FileCreateMode\s*\d+'
  register: rsyslog_main_file_with_filecreatemode

- name: "{{{ rule_title }}} - Search for $FileCreateMode Parameter in rsyslog Include Files"
  ansible.builtin.find:
    paths: "/etc/rsyslog.d/"
    pattern: "*.conf"
    contains: '^\s*\$FileCreateMode\s*\d+'
  register: rsyslog_includes_with_filecreatemode

- name: "{{{ rule_title }}} - Assemble List of rsyslog Configuration Files with $FileCreateMode Parameter"
  ansible.builtin.set_fact:
    rsyslog_filecreatemode_files: "{{ rsyslog_main_file_with_filecreatemode.files | map(attribute='path') | list
      + rsyslog_includes_with_filecreatemode.files | map(attribute='path') | list }}"

- name: "{{{ rule_title }}} - Remove $FileCreateMode Parameter from Multiple Files to Avoid Conflicts"
  ansible.builtin.lineinfile:
    path: "{{ item }}"
    regexp: '\$FileCreateMode.*'
    state: absent
  register: result_rsyslog_filecreatemode_removed
  loop: "{{ rsyslog_filecreatemode_files }}"
  when:
    - rsyslog_filecreatemode_files | length > 1

- name: "{{{ rule_title }}} - Add $FileCreateMode Parameter and Expected Value"
  ansible.builtin.lineinfile:
    path: /etc/rsyslog.d/99-rsyslog_filecreatemode.conf
    line: '$FileCreateMode 0640'
    mode: 0640
    create: true
  when:
    - rsyslog_filecreatemode_files | length == 0 or result_rsyslog_filecreatemode_removed is not skipped

- name: "{{{ rule_title }}} - Ensure Correct Value of Existing $FileCreateMode Parameter"
  ansible.builtin.lineinfile:
    path: "{{ item }}"
    regexp: '^\$FileCreateMode'
    line: $FileCreateMode 0640
  loop: "{{ rsyslog_filecreatemode_files }}"
  when:
    - rsyslog_filecreatemode_files | length == 1