Blame SOURCES/scap-security-guide-0.1.58-add_missing_unit_test_playbook-PR_7431.patch

362bfa
From 86dad83f4e6c5b823882ec736d27410570f5b69a Mon Sep 17 00:00:00 2001
362bfa
From: Watson Sato <wsato@redhat.com>
362bfa
Date: Fri, 20 Aug 2021 16:03:33 +0200
362bfa
Subject: [PATCH] Add missing unit test playbook
362bfa
362bfa
The playbook is used on
362bfa
test-function-check_playbook_file_removed_and_added
362bfa
---
362bfa
 .../file_block_removed_and_not_added.yml      | 62 +++++++++++++++++++
362bfa
 1 file changed, 62 insertions(+)
362bfa
 create mode 100644 tests/ansible_file_removed_and_added/file_block_removed_and_not_added.yml
362bfa
362bfa
diff --git a/tests/ansible_file_removed_and_added/file_block_removed_and_not_added.yml b/tests/ansible_file_removed_and_added/file_block_removed_and_not_added.yml
362bfa
new file mode 100644
362bfa
index 0000000000..8391d1bc99
362bfa
--- /dev/null
362bfa
+++ b/tests/ansible_file_removed_and_added/file_block_removed_and_not_added.yml
362bfa
@@ -0,0 +1,62 @@
362bfa
+---
362bfa
+
362bfa
+- hosts: all
362bfa
+  vars:
362bfa
+    var_system_crypto_policy: !!str FUTURE
362bfa
+    var_sudo_logfile: !!str /var/log/sudo.log
362bfa
+
362bfa
+  tasks:
362bfa
+    - name: Modify the System Login Banner - add correct banner
362bfa
+      lineinfile:
362bfa
+        dest: /etc/issue
362bfa
+        line: '{{ login_banner_text | regex_replace("^\^(.*)\$$", "\1") | regex_replace("^\((.*)\|.*\)$",
362bfa
+          "\1") | regex_replace("\[\\s\\n\]\+"," ") | regex_replace("\(\?:\[\\n\]\+\|\(\?:\\\\n\)\+\)",
362bfa
+          "\n") | regex_replace("\\", "") | wordwrap() }}'
362bfa
+        create: true
362bfa
+      when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"]
362bfa
+      tags:
362bfa
+        - banner_etc_issue
362bfa
+        - low_complexity
362bfa
+        - medium_disruption
362bfa
+        - medium_severity
362bfa
+        - no_reboot_needed
362bfa
+        - unknown_strategy
362bfa
+
362bfa
+    - name: Test for existence /etc/issue
362bfa
+      stat:
362bfa
+        path: /etc/issue
362bfa
+      register: file_exists
362bfa
+      tags:
362bfa
+        - configure_strategy
362bfa
+        - file_permissions_etc_issue
362bfa
+        - low_complexity
362bfa
+        - low_disruption
362bfa
+        - medium_severity
362bfa
+        - no_reboot_needed
362bfa
+
362bfa
+    - name: Ensure permission 0644 on /etc/issue
362bfa
+      file:
362bfa
+        path: /etc/issue
362bfa
+        mode: '0644'
362bfa
+      when: file_exists.stat is defined and file_exists.stat.exists
362bfa
+      tags:
362bfa
+        - configure_strategy
362bfa
+        - file_permissions_etc_issue
362bfa
+        - low_complexity
362bfa
+        - low_disruption
362bfa
+        - medium_severity
362bfa
+        - no_reboot_needed
362bfa
+
362bfa
+    - block:
362bfa
+        - name: Remove Rsh Trust Files
362bfa
+          file:
362bfa
+            path: '/root/shosts.equiv'
362bfa
+            state: absent
362bfa
+      tags:
362bfa
+        - high_severity
362bfa
+        - low_complexity
362bfa
+        - low_disruption
362bfa
+        - no_reboot_needed
362bfa
+        - no_rsh_trust_files
362bfa
+        - restrict_strategy
362bfa
+