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

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