Skip to content

Commit bec7734

Browse files
Merge pull request #11248 from teacup-on-rockingchair/sle15_fix_ansible_stig_remediations
fix ansible SLES stig remediations in check mode
2 parents cdda807 + 81add9c commit bec7734

18 files changed

Lines changed: 33 additions & 18 deletions

File tree

linux_os/guide/system/accounts/accounts-restrictions/password_expiration/accounts_password_set_max_life_existing/ansible/shared.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@
1414
{{% if product in ["rhel7", "ol7"] %}}
1515
ansible.builtin.command:
1616
cmd: chage -M {{ var_accounts_maximum_age_login_defs }} {{ item }}
17-
{{% elif product in ["sle12","sle15"] %}}
17+
{{% elif product in ["sle12","sle15"] %}}
1818
ansible.builtin.command:
1919
cmd: passwd -q -x {{ var_accounts_maximum_age_login_defs }} {{ item }}
20-
{{% else %}}
20+
{{% else %}}
2121
ansible.builtin.user:
2222
user: '{{ item }}'
2323
password_expire_max: '{{ var_accounts_maximum_age_login_defs }}'

linux_os/guide/system/accounts/accounts-restrictions/password_expiration/accounts_password_set_min_life_existing/ansible/shared.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,6 @@
1818
{{% else %}}
1919
command: >
2020
chage -m {{ var_accounts_minimum_age_login_defs }} {{ item }}
21-
{{% endif %}}
21+
{{% endif %}}
2222
with_items: "{{ user_names.stdout_lines }}"
2323
when: user_names.stdout_lines | length > 0

linux_os/guide/system/accounts/accounts-restrictions/password_storage/no_empty_passwords_etc_shadow/ansible/shared.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,4 @@
1313
command: >
1414
passwd -l {{ item }}
1515
with_items: "{{ users_nopasswd.stdout_lines }}"
16-
when: users_nopasswd.stdout_lines | length > 0
17-
16+
when: users_nopasswd is not skipped and users_nopasswd.stdout_lines | length > 0

linux_os/guide/system/accounts/accounts-session/accounts_tmout/ansible/sle12.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,4 @@
1313
file:
1414
path: /etc/profile.d/autologout.sh
1515
mode: '0755'
16+
when: lookup('ansible.builtin.file', '/etc/profile.d/autologout.sh', errors='warn')

linux_os/guide/system/accounts/accounts-session/accounts_tmout/ansible/sle15.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,4 @@
1313
file:
1414
path: /etc/profile.d/autologout.sh
1515
mode: '0755'
16+
when: lookup('ansible.builtin.file', '/etc/profile.d/autologout.sh', errors='warn')

linux_os/guide/system/auditing/auditd_configure_rules/audit_rules_suid_privilege_function/ansible/shared.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@
5050
register: augenrules_audit_rules_privilege_function_update_result
5151
with_items: "{{ suid_audit_rules }}"
5252

53-
- name: Update Update /etc/audit/audit.rules to audit privileged functions
53+
- name: Update /etc/audit/audit.rules to audit privileged functions
5454
ansible.builtin.lineinfile:
5555
path: /etc/audit/audit.rules
5656
line: "{{ item.rule }}"

linux_os/guide/system/logging/ensure_rtc_utc_configuration/ansible/shared.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
timedatectl status | grep -i 'Time zone'| grep -iv 'UTC\|GMT' || true
66
register: check_tz
77
failed_when: "check_tz.rc not in [ 0 , 1 ]"
8-
8+
99
- name: Configure OS to use 'UTC' timezone
10-
command: timedatectl set-timezone UTC
10+
command: timedatectl set-timezone UTC
1111
become: yes
1212
when: check_tz.rc == 0

linux_os/guide/system/network/network_sniffer_disabled/ansible/shared.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,5 @@
1313
ansible.builtin.command:
1414
cmd: ip link set dev {{ item.split(':')[1] }} multicast off promisc off
1515
loop: "{{ network_interfaces.stdout_lines }}"
16-
when: "item.split(':')"
16+
when: network_interfaces.stdout_lines is defined and "item.split(':') | length == 3"
17+

linux_os/guide/system/software/integrity/software-integrity/aide/aide_check_audit_tools/ansible/shared.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,12 @@
33
# strategy = restrict
44
# complexity = low
55
# disruption = low
6+
- name: "{{{ rule_title }}} - Gather List of Packages"
7+
tags:
8+
- aide_check_audit_tools
9+
ansible.builtin.package_facts:
10+
manager: auto
11+
612

713
- name: Ensure aide is installed
814
package:
@@ -35,6 +41,7 @@
3541
line: "{{ item }} {{{ aide_string() }}}"
3642
with_items: "{{ audit_tools }}"
3743

44+
3845
- name: Configure AIDE to properly protect audit tools
3946
lineinfile:
4047
path: {{{ aide_conf_path }}}

linux_os/guide/system/software/integrity/software-integrity/aide/aide_verify_acls/ansible/shared.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,5 +20,5 @@
2020
path: /etc/aide.conf
2121
regexp: (^\s*{{ item }}\s*=\s*)(?!.*acl)([^\s]*)
2222
replace: \g<1>\g<2>+acl
23-
when: "'aide' in ansible_facts.packages"
23+
when: find_rules_groups_results is not skipped and "'aide' in ansible_facts.packages"
2424
with_items: "{{ find_rules_groups_results.stdout_lines | map('trim') | list }}"

0 commit comments

Comments
 (0)