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

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