Blame SOURCES/scap-security-guide-0.1.67-rsyslog_files_rules_remediations-PR_9789.patch

7e8648
From be0ffb00c4911eb6b6478525e27e494809ce44ea Mon Sep 17 00:00:00 2001
7e8648
From: Watson Sato <wsato@redhat.com>
7e8648
Date: Tue, 7 Feb 2023 10:53:17 +0100
7e8648
Subject: [PATCH 2/5] Rsyslog files rules remediations
7e8648
7e8648
Patch-name: scap-security-guide-0.1.67-rsyslog_files_rules_remediations-PR_9789.patch
7e8648
Patch-status: Rsyslog files rules remediations
7e8648
---
7e8648
 controls/cis_sle12.yml                        |   4 +-
7e8648
 controls/cis_sle15.yml                        |   4 +-
7e8648
 .../file_groupowner_logfiles_value.var        |  18 ---
7e8648
 .../oval/shared.xml                           | 116 ---------------
7e8648
 .../rsyslog_files_groupownership/rule.yml     |  39 ++++-
7e8648
 .../tests/IncludeConfig_is_other.fail.sh      |  42 ------
7e8648
 .../tests/IncludeConfig_is_root.pass.sh       |  39 -----
7e8648
 .../tests/include_is_other.fail.sh            |  42 ------
7e8648
 .../tests/include_is_root.pass.sh             |  39 -----
7e8648
 .../tests/include_multiline_is_root.pass.sh   |  41 ------
7e8648
 .../tests/is_other.fail.sh                    |  25 ----
7e8648
 .../tests/is_root.pass.sh                     |  24 ---
7e8648
 .../rsyslog_files_ownership/oval/shared.xml   | 114 ---------------
7e8648
 .../rsyslog_files_ownership/rule.yml          |  44 +++++-
7e8648
 .../ansible/shared.yml                        |  12 ++
7e8648
 .../rsyslog_logging_configured/bash/shared.sh |   7 +
7e8648
 .../oval/shared.xml                           |  41 ++++++
7e8648
 .../rsyslog_logging_configured/rule.yml       |  34 +++++
7e8648
 ...with_everything_logged_to_messages.pass.sh |  13 ++
7e8648
 .../rsyslog_file_with_no_logging.fail.sh      |  12 ++
7e8648
 .../profiles/anssi_np_nt28_average.profile    |   2 -
7e8648
 products/debian10/profiles/standard.profile   |   2 -
7e8648
 .../profiles/anssi_np_nt28_average.profile    |   2 -
7e8648
 products/debian11/profiles/standard.profile   |   2 -
7e8648
 products/rhel7/profiles/rht-ccp.profile       |   2 -
7e8648
 products/rhel8/profiles/rht-ccp.profile       |   2 -
7e8648
 .../profiles/anssi_bp28_intermediary.profile  |   1 +
7e8648
 products/sle15/profiles/standard.profile      |   2 -
7e8648
 .../profiles/anssi_np_nt28_average.profile    |   2 -
7e8648
 products/ubuntu1604/profiles/standard.profile |   2 -
7e8648
 .../profiles/anssi_np_nt28_average.profile    |   2 -
7e8648
 products/ubuntu1804/profiles/standard.profile |   2 -
7e8648
 products/ubuntu2004/profiles/standard.profile |   2 -
7e8648
 products/ubuntu2204/profiles/standard.profile |   2 -
7e8648
 shared/references/cce-sle12-avail.txt         |   1 -
7e8648
 shared/references/cce-sle15-avail.txt         |   1 -
7e8648
 .../ansible.template                          |  68 +++++++++
7e8648
 .../bash.template                             | 110 ++++++++++++++
7e8648
 .../oval.template                             | 137 ++++++++++++++++++
7e8648
 .../template.yml                              |   4 +
7e8648
 .../tests/IncludeConfig_is_other.fail.sh      |  14 +-
7e8648
 .../tests/IncludeConfig_is_root.pass.sh       |  10 +-
7e8648
 .../tests/include_is_other.fail.sh            |  14 +-
7e8648
 ...udeConfig_is_other_RainerLogClause.fail.sh |  37 ++++-
7e8648
 .../tests/include_is_root.pass.sh             |  11 +-
7e8648
 ...ude_is_root_IncludeConfig_is_other.fail.sh |  16 +-
7e8648
 ...lude_is_root_IncludeConfig_is_root.pass.sh |  12 +-
7e8648
 ...ludeConfig_is_root_RainerLogClause.pass.sh |  22 +--
7e8648
 .../tests/include_multiline_is_root.pass.sh   |  10 +-
7e8648
 .../tests/is_other.fail.sh                    |  12 +-
7e8648
 .../tests/is_root.pass.sh                     |   8 +-
7e8648
 51 files changed, 648 insertions(+), 576 deletions(-)
7e8648
 delete mode 100644 linux_os/guide/system/logging/ensure_rsyslog_log_file_configuration/file_groupowner_logfiles_value.var
7e8648
 delete mode 100644 linux_os/guide/system/logging/ensure_rsyslog_log_file_configuration/rsyslog_files_groupownership/oval/shared.xml
7e8648
 delete mode 100755 linux_os/guide/system/logging/ensure_rsyslog_log_file_configuration/rsyslog_files_groupownership/tests/IncludeConfig_is_other.fail.sh
7e8648
 delete mode 100755 linux_os/guide/system/logging/ensure_rsyslog_log_file_configuration/rsyslog_files_groupownership/tests/IncludeConfig_is_root.pass.sh
7e8648
 delete mode 100755 linux_os/guide/system/logging/ensure_rsyslog_log_file_configuration/rsyslog_files_groupownership/tests/include_is_other.fail.sh
7e8648
 delete mode 100755 linux_os/guide/system/logging/ensure_rsyslog_log_file_configuration/rsyslog_files_groupownership/tests/include_is_root.pass.sh
7e8648
 delete mode 100755 linux_os/guide/system/logging/ensure_rsyslog_log_file_configuration/rsyslog_files_groupownership/tests/include_multiline_is_root.pass.sh
7e8648
 delete mode 100755 linux_os/guide/system/logging/ensure_rsyslog_log_file_configuration/rsyslog_files_groupownership/tests/is_other.fail.sh
7e8648
 delete mode 100755 linux_os/guide/system/logging/ensure_rsyslog_log_file_configuration/rsyslog_files_groupownership/tests/is_root.pass.sh
7e8648
 delete mode 100644 linux_os/guide/system/logging/ensure_rsyslog_log_file_configuration/rsyslog_files_ownership/oval/shared.xml
7e8648
 create mode 100644 linux_os/guide/system/logging/ensure_rsyslog_log_file_configuration/rsyslog_logging_configured/ansible/shared.yml
7e8648
 create mode 100644 linux_os/guide/system/logging/ensure_rsyslog_log_file_configuration/rsyslog_logging_configured/bash/shared.sh
7e8648
 create mode 100644 linux_os/guide/system/logging/ensure_rsyslog_log_file_configuration/rsyslog_logging_configured/oval/shared.xml
7e8648
 create mode 100644 linux_os/guide/system/logging/ensure_rsyslog_log_file_configuration/rsyslog_logging_configured/rule.yml
7e8648
 create mode 100644 linux_os/guide/system/logging/ensure_rsyslog_log_file_configuration/rsyslog_logging_configured/tests/rsyslog_file_with_everything_logged_to_messages.pass.sh
7e8648
 create mode 100644 linux_os/guide/system/logging/ensure_rsyslog_log_file_configuration/rsyslog_logging_configured/tests/rsyslog_file_with_no_logging.fail.sh
7e8648
 create mode 100644 shared/templates/rsyslog_logfiles_attributes_modify/ansible.template
7e8648
 create mode 100644 shared/templates/rsyslog_logfiles_attributes_modify/bash.template
7e8648
 create mode 100644 shared/templates/rsyslog_logfiles_attributes_modify/oval.template
7e8648
 create mode 100644 shared/templates/rsyslog_logfiles_attributes_modify/template.yml
7e8648
 rename {linux_os/guide/system/logging/ensure_rsyslog_log_file_configuration/rsyslog_files_ownership => shared/templates/rsyslog_logfiles_attributes_modify}/tests/IncludeConfig_is_other.fail.sh (75%)
7e8648
 rename {linux_os/guide/system/logging/ensure_rsyslog_log_file_configuration/rsyslog_files_ownership => shared/templates/rsyslog_logfiles_attributes_modify}/tests/IncludeConfig_is_root.pass.sh (81%)
7e8648
 rename {linux_os/guide/system/logging/ensure_rsyslog_log_file_configuration/rsyslog_files_ownership => shared/templates/rsyslog_logfiles_attributes_modify}/tests/include_is_other.fail.sh (75%)
7e8648
 rename linux_os/guide/system/logging/ensure_rsyslog_log_file_configuration/rsyslog_files_groupownership/tests/include_is_root_IncludeConfig_is_root.pass.sh => shared/templates/rsyslog_logfiles_attributes_modify/tests/include_is_other_IncludeConfig_is_other_RainerLogClause.fail.sh (50%)
7e8648
 mode change 100755 => 100644
7e8648
 rename {linux_os/guide/system/logging/ensure_rsyslog_log_file_configuration/rsyslog_files_ownership => shared/templates/rsyslog_logfiles_attributes_modify}/tests/include_is_root.pass.sh (81%)
7e8648
 rename {linux_os/guide/system/logging/ensure_rsyslog_log_file_configuration/rsyslog_files_ownership => shared/templates/rsyslog_logfiles_attributes_modify}/tests/include_is_root_IncludeConfig_is_other.fail.sh (77%)
7e8648
 rename {linux_os/guide/system/logging/ensure_rsyslog_log_file_configuration/rsyslog_files_ownership => shared/templates/rsyslog_logfiles_attributes_modify}/tests/include_is_root_IncludeConfig_is_root.pass.sh (82%)
7e8648
 rename linux_os/guide/system/logging/ensure_rsyslog_log_file_configuration/rsyslog_files_groupownership/tests/include_is_root_IncludeConfig_is_other.fail.sh => shared/templates/rsyslog_logfiles_attributes_modify/tests/include_is_root_IncludeConfig_is_root_RainerLogClause.pass.sh (65%)
7e8648
 rename {linux_os/guide/system/logging/ensure_rsyslog_log_file_configuration/rsyslog_files_ownership => shared/templates/rsyslog_logfiles_attributes_modify}/tests/include_multiline_is_root.pass.sh (81%)
7e8648
 rename {linux_os/guide/system/logging/ensure_rsyslog_log_file_configuration/rsyslog_files_ownership => shared/templates/rsyslog_logfiles_attributes_modify}/tests/is_other.fail.sh (70%)
7e8648
 rename {linux_os/guide/system/logging/ensure_rsyslog_log_file_configuration/rsyslog_files_ownership => shared/templates/rsyslog_logfiles_attributes_modify}/tests/is_root.pass.sh (77%)
7e8648
7e8648
diff --git a/controls/cis_sle12.yml b/controls/cis_sle12.yml
7e8648
index 5c464fe556..8576343b9d 100644
7e8648
--- a/controls/cis_sle12.yml
7e8648
+++ b/controls/cis_sle12.yml
7e8648
@@ -1321,7 +1321,9 @@ controls:
7e8648
     levels:
7e8648
     - l1_server
7e8648
     - l1_workstation
7e8648
-    status: manual 
7e8648
+    automated: yes
7e8648
+    rules:
7e8648
+      - rsyslog_logging_configured
7e8648
 
7e8648
   - id: 4.2.1.5
7e8648
     title: Ensure rsyslog is configured to send logs to a remote log host (Automated)
7e8648
diff --git a/controls/cis_sle15.yml b/controls/cis_sle15.yml
7e8648
index 36d7616f90..f82341a038 100644
7e8648
--- a/controls/cis_sle15.yml
7e8648
+++ b/controls/cis_sle15.yml
7e8648
@@ -1469,7 +1469,9 @@ controls:
7e8648
     levels:
7e8648
       - l1_server
7e8648
       - l1_workstation
7e8648
-    status: manual 
7e8648
+    automated: yes
7e8648
+    rules:
7e8648
+      - rsyslog_logging_configured
7e8648
 
7e8648
   - id: 4.2.1.5
7e8648
     title: Ensure rsyslog is configured to send logs to a remote log host (Automated)
7e8648
diff --git a/linux_os/guide/system/logging/ensure_rsyslog_log_file_configuration/file_groupowner_logfiles_value.var b/linux_os/guide/system/logging/ensure_rsyslog_log_file_configuration/file_groupowner_logfiles_value.var
7e8648
deleted file mode 100644
7e8648
index 7ebf8c191a..0000000000
7e8648
--- a/linux_os/guide/system/logging/ensure_rsyslog_log_file_configuration/file_groupowner_logfiles_value.var
7e8648
+++ /dev/null
7e8648
@@ -1,18 +0,0 @@
7e8648
-documentation_complete: true
7e8648
-
7e8648
-title: 'group who owns log files'
7e8648
-
7e8648
-description: |-
7e8648
-    Specify group owner of all logfiles specified in
7e8648
-    <tt>/etc/rsyslog.conf.</tt>
7e8648
-
7e8648
-type: string
7e8648
-
7e8648
-operator: equals
7e8648
-
7e8648
-interactive: false
7e8648
-
7e8648
-options:
7e8648
-    default: root
7e8648
-    adm: adm
7e8648
-    root: root
7e8648
diff --git a/linux_os/guide/system/logging/ensure_rsyslog_log_file_configuration/rsyslog_files_groupownership/oval/shared.xml b/linux_os/guide/system/logging/ensure_rsyslog_log_file_configuration/rsyslog_files_groupownership/oval/shared.xml
7e8648
deleted file mode 100644
7e8648
index 4567f4d411..0000000000
7e8648
--- a/linux_os/guide/system/logging/ensure_rsyslog_log_file_configuration/rsyslog_files_groupownership/oval/shared.xml
7e8648
+++ /dev/null
7e8648
@@ -1,116 +0,0 @@
7e8648
-<def-group oval_version="5.11">
7e8648
-  <definition class="compliance" id="rsyslog_files_groupownership" version="1">
7e8648
-    {{{ oval_metadata("All syslog log files should be owned by the appropriate group.") }}}
7e8648
-
7e8648
-    <criteria operator="AND">
7e8648
-      {{% if product in ["debian10", "debian11", "ubuntu1604"] %}}
7e8648
-      <extend_definition comment="rsyslog daemon is used as local logging daemon" definition_ref="package_rsyslog_installed" />
7e8648
-      {{% endif %}}
7e8648
-      <criterion comment="Check if all system log files are owned by the appropriate group" test_ref="test_rsyslog_files_groupownership" />
7e8648
-    </criteria>
7e8648
-
7e8648
-  </definition>
7e8648
-
7e8648
-  
7e8648
-  <ind:textfilecontent54_object id="object_rfg_rsyslog_include_config_value" comment="rsyslog's $IncludeConfig directive and include() object values" version="1">
7e8648
-    <ind:filepath>/etc/rsyslog.conf</ind:filepath>
7e8648
-    <ind:pattern operation="pattern match">^(?:include\([\n\s]*file="([^\s;]+)".*|\$IncludeConfig[\s]+([^\s;]+))$</ind:pattern>
7e8648
-    <ind:instance datatype="int" operation="greater than or equal">1</ind:instance>
7e8648
-  </ind:textfilecontent54_object>
7e8648
-
7e8648
-  
7e8648
-  <local_variable id="var_rfg_include_config_regex" datatype="string" version="1" comment="$IncludeConfig value converted to regex">
7e8648
-    <unique>
7e8648
-      <glob_to_regex>
7e8648
-        <object_component item_field="subexpression" object_ref="object_rfg_rsyslog_include_config_value" />
7e8648
-      </glob_to_regex>
7e8648
-    </unique>
7e8648
-  </local_variable>
7e8648
-
7e8648
-  
7e8648
-       If the variable has no values, there won't be any objects -->
7e8648
-  <ind:variable_object id="object_var_rfg_include_config_regex" comment="Make variable object from regex variable" version="1">
7e8648
-    <ind:var_ref>var_rfg_include_config_regex</ind:var_ref>
7e8648
-  </ind:variable_object>
7e8648
-
7e8648
-  <local_variable id="var_rfg_syslog_config" datatype="string" version="1" comment="Locations of all rsyslog configuration files as collection">
7e8648
-    <literal_component datatype="string">^/etc/rsyslog.conf$</literal_component>
7e8648
-  </local_variable>
7e8648
-
7e8648
-  <ind:variable_object id="object_var_rfg_syslog_config" comment="Make variable object for use" version="1">
7e8648
-    <ind:var_ref>var_rfg_syslog_config</ind:var_ref>
7e8648
-  </ind:variable_object>
7e8648
-
7e8648
-  
7e8648
-       We do it this way to avoid referencing an empty variable in a state comparison, which
7e8648
-       will cause a test to evaluate to fail. Combining an empty set of objects is fine though -->
7e8648
-  <ind:variable_object id="object_var_rfg_all_log_files" comment="Filter out empty string" version="1">
7e8648
-    <set>
7e8648
-      <object_reference>object_var_rfg_include_config_regex</object_reference>
7e8648
-      <object_reference>object_var_rfg_syslog_config</object_reference>
7e8648
-    </set>
7e8648
-  </ind:variable_object>
7e8648
-
7e8648
-  
7e8648
-       a list of objects won't do. So we make a local_variable from the variable_objects. -->
7e8648
-  <local_variable id="var_rfg_all_log_files" datatype="string" version="1" comment="Locations of all rsyslog configuration files as collection">
7e8648
-    <object_component object_ref="object_var_rfg_all_log_files" item_field="value"/>
7e8648
-  </local_variable>
7e8648
-
7e8648
-  
7e8648
-       that rsyslog's configuration file to select file paths for log files directives
7e8648
-  -->
7e8648
-  <ind:textfilecontent54_object id="object_rfg_log_files_paths" comment="All rsyslog configuration files" version="1">
7e8648
-    <ind:filepath operation="pattern match" var_ref="var_rfg_all_log_files" var_check="at least one" />
7e8648
-    
7e8648
-         to constitute a log file path if all of the following conditions are met:
7e8648
-         * the string represents a regular file on particular file system
7e8648
-           (verified via corresponding file_state below),
7e8648
-         * the chunk of text is in the last column in the row,
7e8648
-           (possibly suffixed by ';' character and rsyslog Template name),
7e8648
-         * contains at least one slash '/' character, and simultaneously
7e8648
-           doesn't contain any of ';', ':' and space characters,
7e8648
-         * the chunk was retrieved from a row not starting with space, '#',
7e8648
-           or '$' characters
7e8648
-    -->
7e8648
-    <ind:pattern operation="pattern match">^[^(\s|#|\$)]+[\s]+.*[\s]+-?(/+[^:;\s]+);*\.*$</ind:pattern>
7e8648
-    <ind:instance datatype="int" operation="greater than or equal">1</ind:instance>
7e8648
-    <filter action="exclude">state_groupownership_ignore_include_paths</filter>
7e8648
-  </ind:textfilecontent54_object>
7e8648
-
7e8648
-  <ind:textfilecontent54_state id="state_groupownership_ignore_include_paths" comment="ignore" version="1">
7e8648
-    
7e8648
-         include() or $IncludeConfig statements.
7e8648
-         These paths are conf files, not log files. Their groupownership don't need to be as
7e8648
-         required for log files, thus, lets exclude them from the list of objects found
7e8648
-    -->
7e8648
-	  <ind:text operation="pattern match">(?:file="[^\s;]+"|\$IncludeConfig[\s]+[^\s;]+|\/dev\/.*)</ind:text>
7e8648
-  </ind:textfilecontent54_state>
7e8648
-
7e8648
-  
7e8648
-       retrieved from the different rsyslog configuration files
7e8648
-  -->
7e8648
-  <local_variable id="var_rfg_log_files_paths" datatype="string" version="1" comment="File paths of all rsyslog configuration files">
7e8648
-    <object_component item_field="subexpression" object_ref="object_rfg_log_files_paths" />
7e8648
-  </local_variable>
7e8648
-
7e8648
-  
7e8648
-  <unix:file_test check="all" check_existence="all_exist" id="test_rsyslog_files_groupownership" version="1" comment="System log files are owned by the appropriate group">
7e8648
-    <unix:object object_ref="object_rsyslog_files_groupownership" />
7e8648
-    <unix:state state_ref="state_rsyslog_files_groupownership" />
7e8648
-  </unix:file_test>
7e8648
-
7e8648
-  <unix:file_object id="object_rsyslog_files_groupownership" comment="Various system log files" version="1">
7e8648
-    <unix:filepath datatype="string" var_ref="var_rfg_log_files_paths" var_check="at least one" />
7e8648
-  </unix:file_object>
7e8648
-
7e8648
-  <unix:file_state id="state_rsyslog_files_groupownership" version="1">
7e8648
-    <unix:type operation="equals">regular</unix:type>
7e8648
-    {{% if product in ["debian10", "debian11", "ubuntu1604", "ubuntu2004", "ubuntu2204"] %}}
7e8648
-    <unix:group_id datatype="int">4</unix:group_id>
7e8648
-    {{% else %}}
7e8648
-    <unix:group_id datatype="int">0</unix:group_id>
7e8648
-    {{% endif %}}
7e8648
-  </unix:file_state>
7e8648
-
7e8648
-</def-group>
7e8648
diff --git a/linux_os/guide/system/logging/ensure_rsyslog_log_file_configuration/rsyslog_files_groupownership/rule.yml b/linux_os/guide/system/logging/ensure_rsyslog_log_file_configuration/rsyslog_files_groupownership/rule.yml
7e8648
index 4f797f4a21..13c89d90c5 100644
7e8648
--- a/linux_os/guide/system/logging/ensure_rsyslog_log_file_configuration/rsyslog_files_groupownership/rule.yml
7e8648
+++ b/linux_os/guide/system/logging/ensure_rsyslog_log_file_configuration/rsyslog_files_groupownership/rule.yml
7e8648
@@ -4,15 +4,30 @@ title: 'Ensure Log Files Are Owned By Appropriate Group'
7e8648
 
7e8648
 description: |-
7e8648
     The group-owner of all log files written by
7e8648
-    <tt>rsyslog</tt> should be <tt>{{{ xccdf_value("file_groupowner_logfiles_value") }}}</tt>.
7e8648
+    <tt>rsyslog</tt> should be
7e8648
+{{% if 'debian' in product or 'ubuntu' in product %}}
7e8648
+    <tt>adm</tt>.
7e8648
+{{% else %}}
7e8648
+    <tt>root</tt>.
7e8648
+{{% endif %}}
7e8648
     These log files are determined by the second part of each Rule line in
7e8648
     <tt>/etc/rsyslog.conf</tt> and typically all appear in <tt>/var/log</tt>.
7e8648
     For each log file LOGFILE referenced in <tt>/etc/rsyslog.conf</tt>,
7e8648
     run the following command to inspect the file's group owner:
7e8648
     
$ ls -l LOGFILE
7e8648
-    If the owner is not <tt>{{{ xccdf_value("file_groupowner_logfiles_value") }}}</tt>, run the following command to
7e8648
+    If the owner is not
7e8648
+    {{% if 'debian' in product or 'ubuntu' in product %}}
7e8648
+    <tt>adm</tt>,
7e8648
+    {{% else %}}
7e8648
+    <tt>root</tt>,
7e8648
+    {{% endif %}}
7e8648
+    run the following command to
7e8648
     correct this:
7e8648
-    
$ sudo chgrp {{{ xccdf_value("file_groupowner_logfiles_value") }}} LOGFILE
7e8648
+{{% if 'debian' in product or 'ubuntu' in product %}}
7e8648
+    
$ sudo chgrp adm LOGFILE
7e8648
+{{% else %}}
7e8648
+    
$ sudo chgrp root LOGFILE
7e8648
+{{% endif %}}
7e8648
 
7e8648
 rationale: |-
7e8648
     The log files generated by rsyslog contain valuable information regarding system
7e8648
@@ -47,8 +62,24 @@ references:
7e8648
 ocil_clause: 'the group-owner is not correct'
7e8648
 
7e8648
 ocil: |-
7e8648
-    The group-owner of all log files written by <tt>rsyslog</tt> should be <tt>{{{ xccdf_value("file_groupowner_logfiles_value") }}}</tt>.
7e8648
+    The group-owner of all log files written by <tt>rsyslog</tt> should be
7e8648
+    {{% if 'debian' in product or 'ubuntu' in product %}}
7e8648
+    <tt>adm</tt>.
7e8648
+    {{% else %}}
7e8648
+    <tt>root</tt>.
7e8648
+    {{% endif %}}
7e8648
     These log files are determined by the second part of each Rule line in
7e8648
     <tt>/etc/rsyslog.conf</tt> and typically all appear in <tt>/var/log</tt>.
7e8648
     To see the group-owner of a given log file, run the following command:
7e8648
     
$ ls -l LOGFILE
7e8648
+
7e8648
+template:
7e8648
+  name: rsyslog_logfiles_attributes_modify
7e8648
+  vars:
7e8648
+    attribute: groupowner
7e8648
+    value: 0
7e8648
+    value@debian10: 4
7e8648
+    value@debian11: 4
7e8648
+    value@ubuntu1604: 4
7e8648
+    value@ubuntu2004: 4
7e8648
+    value@ubuntu2204: 4
7e8648
diff --git a/linux_os/guide/system/logging/ensure_rsyslog_log_file_configuration/rsyslog_files_groupownership/tests/IncludeConfig_is_other.fail.sh b/linux_os/guide/system/logging/ensure_rsyslog_log_file_configuration/rsyslog_files_groupownership/tests/IncludeConfig_is_other.fail.sh
7e8648
deleted file mode 100755
7e8648
index 575530ef2e..0000000000
7e8648
--- a/linux_os/guide/system/logging/ensure_rsyslog_log_file_configuration/rsyslog_files_groupownership/tests/IncludeConfig_is_other.fail.sh
7e8648
+++ /dev/null
7e8648
@@ -1,42 +0,0 @@
7e8648
-#!/bin/bash
7e8648
-# platform = multi_platform_rhel,multi_platform_fedora,multi_platform_ol,multi_platform_sle
7e8648
-
7e8648
-# Check rsyslog.conf with root group-owner log from rules and
7e8648
-# non root group-owner log from $IncludeConfig fails.
7e8648
-
7e8648
-source $SHARED/rsyslog_log_utils.sh
7e8648
-
7e8648
-GROUP_TEST=testssg
7e8648
-groupadd $GROUP_TEST
7e8648
-
7e8648
-GROUP_ROOT=root
7e8648
-
7e8648
-# setup test data
7e8648
-create_rsyslog_test_logs 2
7e8648
-
7e8648
-# setup test log files ownership
7e8648
-chgrp $GROUP_ROOT ${RSYSLOG_TEST_LOGS[0]}
7e8648
-chgrp $GROUP_TEST ${RSYSLOG_TEST_LOGS[1]}
7e8648
-
7e8648
-# create test configuration file
7e8648
-test_conf=${RSYSLOG_TEST_DIR}/test1.conf
7e8648
-cat << EOF > ${test_conf}
7e8648
-# rsyslog configuration file
7e8648
-
7e8648
-#### RULES ####
7e8648
-
7e8648
-*.*     ${RSYSLOG_TEST_LOGS[1]}
7e8648
-EOF
7e8648
-
7e8648
-# create rsyslog.conf configuration file
7e8648
-cat << EOF > $RSYSLOG_CONF
7e8648
-# rsyslog configuration file
7e8648
-
7e8648
-#### RULES ####
7e8648
-
7e8648
-*.*      ${RSYSLOG_TEST_LOGS[0]}
7e8648
-
7e8648
-#### MODULES ####
7e8648
-
7e8648
-\$IncludeConfig ${test_conf}
7e8648
-EOF
7e8648
diff --git a/linux_os/guide/system/logging/ensure_rsyslog_log_file_configuration/rsyslog_files_groupownership/tests/IncludeConfig_is_root.pass.sh b/linux_os/guide/system/logging/ensure_rsyslog_log_file_configuration/rsyslog_files_groupownership/tests/IncludeConfig_is_root.pass.sh
7e8648
deleted file mode 100755
7e8648
index 39efc1a4b7..0000000000
7e8648
--- a/linux_os/guide/system/logging/ensure_rsyslog_log_file_configuration/rsyslog_files_groupownership/tests/IncludeConfig_is_root.pass.sh
7e8648
+++ /dev/null
7e8648
@@ -1,39 +0,0 @@
7e8648
-#!/bin/bash
7e8648
-# platform = multi_platform_rhel,multi_platform_fedora,multi_platform_ol,multi_platform_sle
7e8648
-
7e8648
-# Check rsyslog.conf with root group-owner log from rules and
7e8648
-# root group-owner log from $IncludeConfig passes.
7e8648
-
7e8648
-source $SHARED/rsyslog_log_utils.sh
7e8648
-
7e8648
-GROUP=root
7e8648
-
7e8648
-# setup test data
7e8648
-create_rsyslog_test_logs 2
7e8648
-
7e8648
-# setup test log files ownership
7e8648
-chgrp $GROUP ${RSYSLOG_TEST_LOGS[0]}
7e8648
-chgrp $GROUP ${RSYSLOG_TEST_LOGS[1]}
7e8648
-
7e8648
-# create test configuration file
7e8648
-test_conf=${RSYSLOG_TEST_DIR}/test1.conf
7e8648
-cat << EOF > ${test_conf}
7e8648
-# rsyslog configuration file
7e8648
-
7e8648
-#### RULES ####
7e8648
-
7e8648
-*.*     ${RSYSLOG_TEST_LOGS[1]}
7e8648
-EOF
7e8648
-
7e8648
-# create rsyslog.conf configuration file
7e8648
-cat << EOF > $RSYSLOG_CONF
7e8648
-# rsyslog configuration file
7e8648
-
7e8648
-#### RULES ####
7e8648
-
7e8648
-*.*     ${RSYSLOG_TEST_LOGS[0]}
7e8648
-
7e8648
-#### MODULES ####
7e8648
-
7e8648
-\$IncludeConfig ${test_conf}
7e8648
-EOF
7e8648
diff --git a/linux_os/guide/system/logging/ensure_rsyslog_log_file_configuration/rsyslog_files_groupownership/tests/include_is_other.fail.sh b/linux_os/guide/system/logging/ensure_rsyslog_log_file_configuration/rsyslog_files_groupownership/tests/include_is_other.fail.sh
7e8648
deleted file mode 100755
7e8648
index c0db7056b4..0000000000
7e8648
--- a/linux_os/guide/system/logging/ensure_rsyslog_log_file_configuration/rsyslog_files_groupownership/tests/include_is_other.fail.sh
7e8648
+++ /dev/null
7e8648
@@ -1,42 +0,0 @@
7e8648
-#!/bin/bash
7e8648
-# platform = Red Hat Enterprise Linux 8,multi_platform_fedora,Oracle Linux 8,multi_platform_sle
7e8648
-
7e8648
-# Check rsyslog.conf with root group-owner log from rules and
7e8648
-# non root group-owner log from include() fails.
7e8648
-
7e8648
-source $SHARED/rsyslog_log_utils.sh
7e8648
-
7e8648
-GROUP_TEST=testssg
7e8648
-groupadd $GROUP_TEST
7e8648
-
7e8648
-GROUP_ROOT=root
7e8648
-
7e8648
-# setup test data
7e8648
-create_rsyslog_test_logs 2
7e8648
-
7e8648
-# setup test log files ownership
7e8648
-chgrp $GROUP_ROOT ${RSYSLOG_TEST_LOGS[0]}
7e8648
-chgrp $GROUP_TEST ${RSYSLOG_TEST_LOGS[1]}
7e8648
-
7e8648
-# create test configuration file
7e8648
-test_conf=${RSYSLOG_TEST_DIR}/test1.conf
7e8648
-cat << EOF > ${test_conf}
7e8648
-# rsyslog configuration file
7e8648
-
7e8648
-#### RULES ####
7e8648
-
7e8648
-*.*     ${RSYSLOG_TEST_LOGS[1]}
7e8648
-EOF
7e8648
-
7e8648
-# create rsyslog.conf configuration file
7e8648
-cat << EOF > $RSYSLOG_CONF
7e8648
-# rsyslog configuration file
7e8648
-
7e8648
-#### RULES ####
7e8648
-
7e8648
-*.*      ${RSYSLOG_TEST_LOGS[0]}
7e8648
-
7e8648
-#### MODULES ####
7e8648
-
7e8648
-include(file="${test_conf}")
7e8648
-EOF
7e8648
diff --git a/linux_os/guide/system/logging/ensure_rsyslog_log_file_configuration/rsyslog_files_groupownership/tests/include_is_root.pass.sh b/linux_os/guide/system/logging/ensure_rsyslog_log_file_configuration/rsyslog_files_groupownership/tests/include_is_root.pass.sh
7e8648
deleted file mode 100755
7e8648
index 1feaf762fc..0000000000
7e8648
--- a/linux_os/guide/system/logging/ensure_rsyslog_log_file_configuration/rsyslog_files_groupownership/tests/include_is_root.pass.sh
7e8648
+++ /dev/null
7e8648
@@ -1,39 +0,0 @@
7e8648
-#!/bin/bash
7e8648
-# platform = Red Hat Enterprise Linux 8,multi_platform_fedora,Oracle Linux 8,multi_platform_sle
7e8648
-
7e8648
-# Check rsyslog.conf with root group-owner log from rules and
7e8648
-# root group-owner log from include() passes.
7e8648
-
7e8648
-source $SHARED/rsyslog_log_utils.sh
7e8648
-
7e8648
-GROUP=root
7e8648
-
7e8648
-# setup test data
7e8648
-create_rsyslog_test_logs 2
7e8648
-
7e8648
-# setup test log files ownership
7e8648
-chgrp $GROUP ${RSYSLOG_TEST_LOGS[0]}
7e8648
-chgrp $GROUP ${RSYSLOG_TEST_LOGS[1]}
7e8648
-
7e8648
-# create test configuration file
7e8648
-test_conf=${RSYSLOG_TEST_DIR}/test1.conf
7e8648
-cat << EOF > ${test_conf}
7e8648
-# rsyslog configuration file
7e8648
-
7e8648
-#### RULES ####
7e8648
-
7e8648
-*.*     ${RSYSLOG_TEST_LOGS[1]}
7e8648
-EOF
7e8648
-
7e8648
-# create rsyslog.conf configuration file
7e8648
-cat << EOF > $RSYSLOG_CONF
7e8648
-# rsyslog configuration file
7e8648
-
7e8648
-#### RULES ####
7e8648
-
7e8648
-*.*     ${RSYSLOG_TEST_LOGS[0]}
7e8648
-
7e8648
-#### MODULES ####
7e8648
-
7e8648
-include(file="${test_conf}")
7e8648
-EOF
7e8648
diff --git a/linux_os/guide/system/logging/ensure_rsyslog_log_file_configuration/rsyslog_files_groupownership/tests/include_multiline_is_root.pass.sh b/linux_os/guide/system/logging/ensure_rsyslog_log_file_configuration/rsyslog_files_groupownership/tests/include_multiline_is_root.pass.sh
7e8648
deleted file mode 100755
7e8648
index 5a357d029b..0000000000
7e8648
--- a/linux_os/guide/system/logging/ensure_rsyslog_log_file_configuration/rsyslog_files_groupownership/tests/include_multiline_is_root.pass.sh
7e8648
+++ /dev/null
7e8648
@@ -1,41 +0,0 @@
7e8648
-#!/bin/bash
7e8648
-# platform = Red Hat Enterprise Linux 8,multi_platform_fedora,Oracle Linux 8,multi_platform_sle
7e8648
-
7e8648
-# Check rsyslog.conf with root group-owner log from rules and
7e8648
-# root group-owner log from multiline include() passes.
7e8648
-
7e8648
-source $SHARED/rsyslog_log_utils.sh
7e8648
-
7e8648
-GROUP=root
7e8648
-
7e8648
-# setup test data
7e8648
-create_rsyslog_test_logs 2
7e8648
-
7e8648
-# setup test log files ownership
7e8648
-chgrp $GROUP ${RSYSLOG_TEST_LOGS[0]}
7e8648
-chgrp $GROUP ${RSYSLOG_TEST_LOGS[1]}
7e8648
-
7e8648
-# create test configuration file
7e8648
-test_conf=${RSYSLOG_TEST_DIR}/test1.conf
7e8648
-cat << EOF > ${test_conf}
7e8648
-# rsyslog configuration file
7e8648
-
7e8648
-#### RULES ####
7e8648
-
7e8648
-*.*     ${RSYSLOG_TEST_LOGS[1]}
7e8648
-EOF
7e8648
-
7e8648
-# create rsyslog.conf configuration file
7e8648
-cat << EOF > $RSYSLOG_CONF
7e8648
-# rsyslog configuration file
7e8648
-
7e8648
-#### RULES ####
7e8648
-
7e8648
-*.*     ${RSYSLOG_TEST_LOGS[0]}
7e8648
-
7e8648
-#### MODULES ####
7e8648
-
7e8648
-include(
7e8648
-   file="${test_conf}"
7e8648
-)
7e8648
-EOF
7e8648
diff --git a/linux_os/guide/system/logging/ensure_rsyslog_log_file_configuration/rsyslog_files_groupownership/tests/is_other.fail.sh b/linux_os/guide/system/logging/ensure_rsyslog_log_file_configuration/rsyslog_files_groupownership/tests/is_other.fail.sh
7e8648
deleted file mode 100755
7e8648
index c7c01132f2..0000000000
7e8648
--- a/linux_os/guide/system/logging/ensure_rsyslog_log_file_configuration/rsyslog_files_groupownership/tests/is_other.fail.sh
7e8648
+++ /dev/null
7e8648
@@ -1,25 +0,0 @@
7e8648
-#!/bin/bash
7e8648
-# platform = multi_platform_rhel,multi_platform_fedora,multi_platform_ol,multi_platform_sle
7e8648
-
7e8648
-# Check if log file with non root group-owner in rsyslog.conf fails.
7e8648
-
7e8648
-source $SHARED/rsyslog_log_utils.sh
7e8648
-
7e8648
-GROUP=testssg
7e8648
-
7e8648
-groupadd $GROUP
7e8648
-
7e8648
-# setup test data
7e8648
-create_rsyslog_test_logs 1
7e8648
-
7e8648
-# setup test log file ownership
7e8648
-chgrp $GROUP ${RSYSLOG_TEST_LOGS[0]}
7e8648
-
7e8648
-# add rule with non-root group owned log file
7e8648
-cat << EOF > $RSYSLOG_CONF
7e8648
-# rsyslog configuration file
7e8648
-
7e8648
-#### RULES ####
7e8648
-
7e8648
-*.*     ${RSYSLOG_TEST_LOGS[0]}
7e8648
-EOF
7e8648
diff --git a/linux_os/guide/system/logging/ensure_rsyslog_log_file_configuration/rsyslog_files_groupownership/tests/is_root.pass.sh b/linux_os/guide/system/logging/ensure_rsyslog_log_file_configuration/rsyslog_files_groupownership/tests/is_root.pass.sh
7e8648
deleted file mode 100755
7e8648
index 0ecbb35bd1..0000000000
7e8648
--- a/linux_os/guide/system/logging/ensure_rsyslog_log_file_configuration/rsyslog_files_groupownership/tests/is_root.pass.sh
7e8648
+++ /dev/null
7e8648
@@ -1,24 +0,0 @@
7e8648
-#!/bin/bash
7e8648
-# platform = multi_platform_rhel,multi_platform_fedora,multi_platform_ol,multi_platform_sle
7e8648
-
7e8648
-# Check if log file with root group-owner in rsyslog.conf passes.
7e8648
-
7e8648
-source $SHARED/rsyslog_log_utils.sh
7e8648
-
7e8648
-GROUP=root
7e8648
-
7e8648
-# setup test data
7e8648
-create_rsyslog_test_logs 1
7e8648
-
7e8648
-# setup test log file ownership
7e8648
-chgrp $GROUP ${RSYSLOG_TEST_LOGS[0]}
7e8648
-
7e8648
-# add rule with root group owned log file
7e8648
-cat << EOF > $RSYSLOG_CONF
7e8648
-# rsyslog configuration file
7e8648
-
7e8648
-#### RULES ####
7e8648
-
7e8648
-*.*        ${RSYSLOG_TEST_LOGS[0]}
7e8648
-
7e8648
-EOF
7e8648
diff --git a/linux_os/guide/system/logging/ensure_rsyslog_log_file_configuration/rsyslog_files_ownership/oval/shared.xml b/linux_os/guide/system/logging/ensure_rsyslog_log_file_configuration/rsyslog_files_ownership/oval/shared.xml
7e8648
deleted file mode 100644
7e8648
index 8e3f68db26..0000000000
7e8648
--- a/linux_os/guide/system/logging/ensure_rsyslog_log_file_configuration/rsyslog_files_ownership/oval/shared.xml
7e8648
+++ /dev/null
7e8648
@@ -1,114 +0,0 @@
7e8648
-<def-group oval_version="5.11">
7e8648
-  <definition class="compliance" id="rsyslog_files_ownership" version="1">
7e8648
-    {{{ oval_metadata("All syslog log files should be owned by the appropriate user.") }}}
7e8648
-
7e8648
-    <criteria>
7e8648
-      <criterion comment="Check if all system log files are owned by appropriate user" test_ref="test_rsyslog_files_ownership" />
7e8648
-    </criteria>
7e8648
-
7e8648
-  </definition>
7e8648
-
7e8648
-  
7e8648
-  <ind:textfilecontent54_object id="object_rfo_rsyslog_include_config_value" comment="rsyslog's $IncludeConfig directive and include() object values" version="1">
7e8648
-    <ind:filepath>/etc/rsyslog.conf</ind:filepath>
7e8648
-    <ind:pattern operation="pattern match">^(?:include\([\n\s]*file="([^\s;]+)".*|\$IncludeConfig[\s]+([^\s;]+))$</ind:pattern>
7e8648
-    <ind:instance datatype="int" operation="greater than or equal">1</ind:instance>
7e8648
-  </ind:textfilecontent54_object>
7e8648
-
7e8648
-  
7e8648
-  <local_variable id="var_rfo_include_config_regex" datatype="string" version="1" comment="$IncludeConfig value converted to regex">
7e8648
-    <unique>
7e8648
-      <glob_to_regex>
7e8648
-        <object_component item_field="subexpression" object_ref="object_rfo_rsyslog_include_config_value" />
7e8648
-      </glob_to_regex>
7e8648
-    </unique>
7e8648
-  </local_variable>
7e8648
-
7e8648
-  
7e8648
-       If the variable has no values, there won't be any objects -->
7e8648
-  <ind:variable_object id="object_var_rfo_include_config_regex" comment="Make variable object from regex variable" version="1">
7e8648
-    <ind:var_ref>var_rfo_include_config_regex</ind:var_ref>
7e8648
-  </ind:variable_object>
7e8648
-
7e8648
-  <local_variable id="var_rfo_syslog_config" datatype="string" version="1" comment="Locations of all rsyslog configuration files as collection">
7e8648
-    <literal_component datatype="string">^/etc/rsyslog.conf$</literal_component>
7e8648
-  </local_variable>
7e8648
-
7e8648
-  <ind:variable_object id="object_var_rfo_syslog_config" comment="Make variable object for use" version="1">
7e8648
-    <ind:var_ref>var_rfo_syslog_config</ind:var_ref>
7e8648
-  </ind:variable_object>
7e8648
-
7e8648
-  
7e8648
-       We do it this way to avoid referencing an empty variable in a state comparison, which
7e8648
-       will cause a test to evaluate to fail. Combining an empty set of objects is fine though -->
7e8648
-  <ind:variable_object id="object_var_rfo_all_log_files" comment="Filter out empty string" version="1">
7e8648
-    <set>
7e8648
-      <object_reference>object_var_rfo_include_config_regex</object_reference>
7e8648
-      <object_reference>object_var_rfo_syslog_config</object_reference>
7e8648
-    </set>
7e8648
-  </ind:variable_object>
7e8648
-
7e8648
-  
7e8648
-       a list of objects won't do. So we make a local_variable from the variable_objects. -->
7e8648
-  <local_variable id="var_rfo_all_log_files" datatype="string" version="1" comment="Locations of all rsyslog configuration files as collection">
7e8648
-    <object_component object_ref="object_var_rfo_all_log_files" item_field="value"/>
7e8648
-  </local_variable>
7e8648
-
7e8648
-  
7e8648
-       that rsyslog's configuration file to select file paths for log files directives
7e8648
-  -->
7e8648
-  <ind:textfilecontent54_object id="object_rfo_log_files_paths" comment="All rsyslog configuration files" version="1">
7e8648
-    <ind:filepath operation="pattern match" var_ref="var_rfo_all_log_files" var_check="at least one" />
7e8648
-    
7e8648
-         to constitute a log file path if all of the following conditions are met:
7e8648
-         * the string represents a regular file on particular file system
7e8648
-           (verified via corresponding file_state below),
7e8648
-         * the chunk of text is in the last column in the row,
7e8648
-           (possibly suffixed by ';' character and rsyslog Template name),
7e8648
-         * contains at least one slash '/' character, and simultaneously
7e8648
-           doesn't contain any of ';', ':' and space characters,
7e8648
-         * the chunk was retrieved from a row not starting with space, '#',
7e8648
-           or '$' characters
7e8648
-    -->
7e8648
-    <ind:pattern operation="pattern match">^[^(#|\$)]+[\s]+.*[\s]+-?(/+[^:;\s]+);*\.*$</ind:pattern>
7e8648
-    <ind:instance datatype="int" operation="greater than or equal">1</ind:instance>
7e8648
-    <filter action="exclude">state_owner_ignore_include_paths</filter>
7e8648
-  </ind:textfilecontent54_object>
7e8648
-
7e8648
-  <ind:textfilecontent54_state id="state_owner_ignore_include_paths" comment="ignore" version="1">
7e8648
-    
7e8648
-         include() or $IncludeConfig statements.
7e8648
-         These paths are conf files, not log files. Their owner don't need to be as
7e8648
-         required for log files, thus, lets exclude them from the list of objects found
7e8648
-    -->
7e8648
-    <ind:text operation="pattern match">(?:file="[^\s;]+"|\$IncludeConfig[\s]+[^\s;]+|\/dev\/.*)</ind:text>
7e8648
-  </ind:textfilecontent54_state>
7e8648
-
7e8648
-  
7e8648
-       retrieved from the different rsyslog configuration files
7e8648
-  -->
7e8648
-  <local_variable id="var_rfo_log_files_paths" datatype="string" version="1" comment="File paths of all rsyslog configuration files">
7e8648
-    <object_component item_field="subexpression" object_ref="object_rfo_log_files_paths" />
7e8648
-  </local_variable>
7e8648
-
7e8648
-  
7e8648
-  <unix:file_test check="all" check_existence="all_exist" id="test_rsyslog_files_ownership" version="1" comment="System log files are owned by the appropriate user">
7e8648
-    <unix:object object_ref="object_rsyslog_files_ownership" />
7e8648
-    <unix:state state_ref="state_rsyslog_files_ownership" />
7e8648
-  </unix:file_test>
7e8648
-
7e8648
-  <unix:file_object id="object_rsyslog_files_ownership" comment="Various system log files" version="1">
7e8648
-    <unix:filepath datatype="string" var_ref="var_rfo_log_files_paths" var_check="at least one" />
7e8648
-  </unix:file_object>
7e8648
-
7e8648
-  <unix:file_state id="state_rsyslog_files_ownership" version="1">
7e8648
-    <unix:type operation="equals">regular</unix:type>
7e8648
-
7e8648
-    {{% if product in ["ubuntu2004", "ubuntu2204"] %}}
7e8648
-    <unix:user_id datatype="int">104</unix:user_id>
7e8648
-    {{% else %}}
7e8648
-    <unix:user_id datatype="int">0</unix:user_id>
7e8648
-    {{% endif %}}
7e8648
-  </unix:file_state>
7e8648
-
7e8648
-</def-group>
7e8648
diff --git a/linux_os/guide/system/logging/ensure_rsyslog_log_file_configuration/rsyslog_files_ownership/rule.yml b/linux_os/guide/system/logging/ensure_rsyslog_log_file_configuration/rsyslog_files_ownership/rule.yml
7e8648
index 37c87b07cd..0d9bf40f4b 100644
7e8648
--- a/linux_os/guide/system/logging/ensure_rsyslog_log_file_configuration/rsyslog_files_ownership/rule.yml
7e8648
+++ b/linux_os/guide/system/logging/ensure_rsyslog_log_file_configuration/rsyslog_files_ownership/rule.yml
7e8648
@@ -4,15 +4,36 @@ title: 'Ensure Log Files Are Owned By Appropriate User'
7e8648
 
7e8648
 description: |-
7e8648
     The owner of all log files written by
7e8648
-    <tt>rsyslog</tt> should be <tt>{{{ xccdf_value("file_owner_logfiles_value") }}}</tt>.
7e8648
+    <tt>rsyslog</tt> should be
7e8648
+    {{% if product in ['ubuntu2204','ubuntu2004'] %}}
7e8648
+    <tt>syslog</tt>.
7e8648
+    {{% elif 'debian' in product or 'ubuntu' in product %}}
7e8648
+    <tt>adm</tt>.
7e8648
+    {{% else %}}
7e8648
+    <tt>root</tt>.
7e8648
+    {{% endif %}}
7e8648
     These log files are determined by the second part of each Rule line in
7e8648
     <tt>/etc/rsyslog.conf</tt> and typically all appear in <tt>/var/log</tt>.
7e8648
     For each log file LOGFILE referenced in <tt>/etc/rsyslog.conf</tt>,
7e8648
     run the following command to inspect the file's owner:
7e8648
     
$ ls -l LOGFILE
7e8648
-    If the owner is not <tt>{{{ xccdf_value("file_owner_logfiles_value") }}}</tt>, run the following command to
7e8648
+    If the owner is not
7e8648
+    {{% if product in ['ubuntu2204','ubuntu2004'] %}}
7e8648
+    <tt>syslog</tt>,
7e8648
+    {{% elif 'debian' in product or 'ubuntu' in product %}}
7e8648
+    <tt>adm</tt>,
7e8648
+    {{% else %}}
7e8648
+    <tt>root</tt>,
7e8648
+    {{% endif %}}
7e8648
+    run the following command to
7e8648
     correct this:
7e8648
-    
$ sudo chown {{{ xccdf_value("file_owner_logfiles_value") }}} LOGFILE
7e8648
+    {{% if product in ['ubuntu2204','ubuntu2004'] %}}
7e8648
+    
$ sudo chown syslog LOGFILE
7e8648
+    {{% elif 'debian' in product or 'ubuntu' in product %}}
7e8648
+    
$ sudo chown adm LOGFILE
7e8648
+    {{% else %}}
7e8648
+    
$ sudo chown root LOGFILE
7e8648
+    {{% endif %}}
7e8648
 
7e8648
 rationale: |-
7e8648
     The log files generated by rsyslog contain valuable information regarding system
7e8648
@@ -47,8 +68,23 @@ references:
7e8648
 ocil_clause: 'the owner is not correct'
7e8648
 
7e8648
 ocil: |-
7e8648
-    The owner of all log files written by <tt>rsyslog</tt> should be <tt>{{{ xccdf_value("file_owner_logfiles_value") }}}</tt>.
7e8648
+    The owner of all log files written by <tt>rsyslog</tt> should be
7e8648
+    {{% if product in ['ubuntu2204','ubuntu2004'] %}}
7e8648
+    <tt>syslog</tt>.
7e8648
+    {{% elif 'debian' in product or 'ubuntu' in product %}}
7e8648
+    <tt>adm</tt>.
7e8648
+    {{% else %}}
7e8648
+    <tt>root</tt>.
7e8648
+    {{% endif %}}
7e8648
     These log files are determined by the second part of each Rule line in
7e8648
     <tt>/etc/rsyslog.conf</tt> and typically all appear in <tt>/var/log</tt>.
7e8648
     To see the owner of a given log file, run the following command:
7e8648
     
$ ls -l LOGFILE
7e8648
+
7e8648
+template:
7e8648
+  name: rsyslog_logfiles_attributes_modify
7e8648
+  vars:
7e8648
+    attribute: owner
7e8648
+    value: 0
7e8648
+    value@ubuntu2004: 104
7e8648
+    value@ubuntu2204: 104
7e8648
diff --git a/linux_os/guide/system/logging/ensure_rsyslog_log_file_configuration/rsyslog_logging_configured/ansible/shared.yml b/linux_os/guide/system/logging/ensure_rsyslog_log_file_configuration/rsyslog_logging_configured/ansible/shared.yml
7e8648
new file mode 100644
7e8648
index 0000000000..041e263155
7e8648
--- /dev/null
7e8648
+++ b/linux_os/guide/system/logging/ensure_rsyslog_log_file_configuration/rsyslog_logging_configured/ansible/shared.yml
7e8648
@@ -0,0 +1,12 @@
7e8648
+# platform = multi_platform_sle
7e8648
+# reboot = false
7e8648
+# strategy = restrict
7e8648
+# complexity = low
7e8648
+# disruption = low
7e8648
+
7e8648
+- name: "Set rsyslog remote loghost"
7e8648
+  lineinfile:
7e8648
+    dest: /etc/rsyslog.conf
7e8648
+    regexp: "^\\*\\.\\*"
7e8648
+    line: "*.* /var/log/messages"
7e8648
+    create: yes
7e8648
diff --git a/linux_os/guide/system/logging/ensure_rsyslog_log_file_configuration/rsyslog_logging_configured/bash/shared.sh b/linux_os/guide/system/logging/ensure_rsyslog_log_file_configuration/rsyslog_logging_configured/bash/shared.sh
7e8648
new file mode 100644
7e8648
index 0000000000..d634610225
7e8648
--- /dev/null
7e8648
+++ b/linux_os/guide/system/logging/ensure_rsyslog_log_file_configuration/rsyslog_logging_configured/bash/shared.sh
7e8648
@@ -0,0 +1,7 @@
7e8648
+# platform = multi_platform_sle
7e8648
+# reboot = false
7e8648
+# strategy = restrict
7e8648
+# complexity = low
7e8648
+# disruption = low
7e8648
+
7e8648
+{{{ bash_replace_or_append('/etc/rsyslog.conf', '^\*\.\*', "/var/log/messages", '%s %s') }}}
7e8648
diff --git a/linux_os/guide/system/logging/ensure_rsyslog_log_file_configuration/rsyslog_logging_configured/oval/shared.xml b/linux_os/guide/system/logging/ensure_rsyslog_log_file_configuration/rsyslog_logging_configured/oval/shared.xml
7e8648
new file mode 100644
7e8648
index 0000000000..89e1e7616e
7e8648
--- /dev/null
7e8648
+++ b/linux_os/guide/system/logging/ensure_rsyslog_log_file_configuration/rsyslog_logging_configured/oval/shared.xml
7e8648
@@ -0,0 +1,41 @@
7e8648
+<def-group>
7e8648
+  <definition class="compliance" id="rsyslog_logging_configured" version="1">
7e8648
+    {{{ oval_metadata("Syslog logs should be configured") }}}
7e8648
+
7e8648
+    <criteria operator="AND">
7e8648
+      {{% if product in ["debian10", "debian11", "ubuntu1604", "ubuntu1804"] %}}
7e8648
+      <extend_definition comment="rsyslog daemon is used as local logging daemon" definition_ref="package_rsyslog_installed" />
7e8648
+      {{% endif %}}
7e8648
+      <criteria operator="OR">
7e8648
+        <criterion comment="Logging configured within /etc/rsyslog.conf" test_ref="test_logging_configured_rsyslog_conf" />
7e8648
+        <criterion comment="Remote logging set within /etc/rsyslog.d" test_ref="test_logging_configured_rsyslog_d" />
7e8648
+      </criteria>
7e8648
+    </criteria>
7e8648
+  </definition>
7e8648
+
7e8648
+  
7e8648
+  comment="Ensures system logging configured in main conf file"
7e8648
+  id="test_logging_configured_rsyslog_conf" version="1">
7e8648
+    <ind:object object_ref="object_logging_configured_rsyslog_conf" />
7e8648
+  </ind:textfilecontent54_test>
7e8648
+
7e8648
+  
7e8648
+  comment="Ensures system logging_configured in .d files"
7e8648
+  id="test_logging_configured_rsyslog_d" version="1">
7e8648
+    <ind:object object_ref="object_logging_configured_rsyslog_d" />
7e8648
+  </ind:textfilecontent54_test>
7e8648
+
7e8648
+  <ind:textfilecontent54_object id="object_logging_configured_rsyslog_conf" version="1">
7e8648
+    <ind:filepath>/etc/rsyslog.conf</ind:filepath>
7e8648
+    <ind:pattern operation="pattern match">^[^(\s|#|\$)]+[\s]+.*[\s]+(\:\w+\:\S*|-?(\/+[^:;\s]+);*\.*)$</ind:pattern>
7e8648
+    <ind:instance datatype="int">1</ind:instance>
7e8648
+  </ind:textfilecontent54_object>
7e8648
+
7e8648
+  <ind:textfilecontent54_object id="object_logging_configured_rsyslog_d" version="1">
7e8648
+    <ind:path>/etc/rsyslog.d</ind:path>
7e8648
+    <ind:filename operation="pattern match">^.+\.conf$</ind:filename>
7e8648
+    <ind:pattern operation="pattern match">^[^(\s|#|\$)]+[\s]+.*[\s]+(\:\w+\:\S*|-?(\/+[^:;\s]+);*\.*)$</ind:pattern>
7e8648
+    <ind:instance datatype="int">1</ind:instance>
7e8648
+  </ind:textfilecontent54_object>
7e8648
+
7e8648
+</def-group>
7e8648
diff --git a/linux_os/guide/system/logging/ensure_rsyslog_log_file_configuration/rsyslog_logging_configured/rule.yml b/linux_os/guide/system/logging/ensure_rsyslog_log_file_configuration/rsyslog_logging_configured/rule.yml
7e8648
new file mode 100644
7e8648
index 0000000000..f9477de9e9
7e8648
--- /dev/null
7e8648
+++ b/linux_os/guide/system/logging/ensure_rsyslog_log_file_configuration/rsyslog_logging_configured/rule.yml
7e8648
@@ -0,0 +1,34 @@
7e8648
+documentation_complete: true
7e8648
+
7e8648
+title: 'Ensure logging is configured'
7e8648
+
7e8648
+description: |-
7e8648
+    The <tt>/etc/rsyslog.conf</tt> and <tt>/etc/rsyslog.d/*.conf</tt> files
7e8648
+    specifies rules for logging and which files are to be used to log certain
7e8648
+    classes of messages.
7e8648
+
7e8648
+rationale: |-
7e8648
+    A great deal of important security-related information is sent via
7e8648
+    rsyslog (e.g., successful and failed su attempts, failed login attempts,
7e8648
+    root login attempts, etc.).
7e8648
+
7e8648
+severity: medium
7e8648
+
7e8648
+identifiers:
7e8648
+    cce@sle12: CCE-92379-7
7e8648
+    cce@sle15: CCE-92497-7
7e8648
+
7e8648
+references:
7e8648
+    cis@sle12: 4.2.1.4
7e8648
+    cis@sle15: 4.2.1.4
7e8648
+
7e8648
+ocil_clause: 'no logging is configured'
7e8648
+
7e8648
+ocil: |-
7e8648
+    Review the contents of the <tt>/etc/rsyslog.conf</tt> and <tt>/etc/rsyslog.d/*.conf</tt>
7e8648
+    files to ensure appropriate logging is set. In addition, run the following command:
7e8648
+    
ls -l /var/log/
7e8648
+    and verify that the log files are logging information
7e8648
+
7e8648
+fixtext: |-
7e8648
+    Configure logging with selectors covering each priority
7e8648
diff --git a/linux_os/guide/system/logging/ensure_rsyslog_log_file_configuration/rsyslog_logging_configured/tests/rsyslog_file_with_everything_logged_to_messages.pass.sh b/linux_os/guide/system/logging/ensure_rsyslog_log_file_configuration/rsyslog_logging_configured/tests/rsyslog_file_with_everything_logged_to_messages.pass.sh
7e8648
new file mode 100644
7e8648
index 0000000000..a4fb1cf07a
7e8648
--- /dev/null
7e8648
+++ b/linux_os/guide/system/logging/ensure_rsyslog_log_file_configuration/rsyslog_logging_configured/tests/rsyslog_file_with_everything_logged_to_messages.pass.sh
7e8648
@@ -0,0 +1,13 @@
7e8648
+#!/bin/bash
7e8648
+# platform = multi_platform_sle
7e8648
+
7e8648
+# Check rsyslog.conf with no includes and all loggging facility/priority configured to go to /var/log/messages
7e8648
+
7e8648
+source $SHARED/rsyslog_log_utils.sh
7e8648
+cat << EOF > ${RSYSLOG_CONF}
7e8648
+# rsyslog configuration file
7e8648
+
7e8648
+#### RULES ####
7e8648
+
7e8648
+*.*       /var/log/messages
7e8648
+EOF
7e8648
diff --git a/linux_os/guide/system/logging/ensure_rsyslog_log_file_configuration/rsyslog_logging_configured/tests/rsyslog_file_with_no_logging.fail.sh b/linux_os/guide/system/logging/ensure_rsyslog_log_file_configuration/rsyslog_logging_configured/tests/rsyslog_file_with_no_logging.fail.sh
7e8648
new file mode 100644
7e8648
index 0000000000..158cf4c98d
7e8648
--- /dev/null
7e8648
+++ b/linux_os/guide/system/logging/ensure_rsyslog_log_file_configuration/rsyslog_logging_configured/tests/rsyslog_file_with_no_logging.fail.sh
7e8648
@@ -0,0 +1,12 @@
7e8648
+#!/bin/bash
7e8648
+# platform = multi_platform_sle
7e8648
+
7e8648
+# Check rsyslog.conf with no includes and no loggging facility/priority configured
7e8648
+
7e8648
+source $SHARED/rsyslog_log_utils.sh
7e8648
+cat << EOF > ${RSYSLOG_CONF}
7e8648
+# rsyslog configuration file
7e8648
+
7e8648
+#### RULES ####
7e8648
+
7e8648
+EOF
7e8648
diff --git a/products/debian10/profiles/anssi_np_nt28_average.profile b/products/debian10/profiles/anssi_np_nt28_average.profile
7e8648
index 600f1a6f71..4c42814719 100644
7e8648
--- a/products/debian10/profiles/anssi_np_nt28_average.profile
7e8648
+++ b/products/debian10/profiles/anssi_np_nt28_average.profile
7e8648
@@ -22,9 +22,7 @@ selections:
7e8648
     - sshd_allow_only_protocol2
7e8648
     - var_sshd_set_keepalive=0
7e8648
     - sshd_set_keepalive_0
7e8648
-    - file_owner_logfiles_value=adm
7e8648
     - rsyslog_files_ownership
7e8648
-    - file_groupowner_logfiles_value=adm
7e8648
     - rsyslog_files_groupownership
7e8648
     - rsyslog_files_permissions
7e8648
     - "!rsyslog_remote_loghost"
7e8648
diff --git a/products/debian10/profiles/standard.profile b/products/debian10/profiles/standard.profile
7e8648
index 3784182fa1..446f5aca1d 100644
7e8648
--- a/products/debian10/profiles/standard.profile
7e8648
+++ b/products/debian10/profiles/standard.profile
7e8648
@@ -33,9 +33,7 @@ selections:
7e8648
     - sshd_allow_only_protocol2
7e8648
     - var_sshd_set_keepalive=0
7e8648
     - sshd_set_keepalive_0
7e8648
-    - file_owner_logfiles_value=adm
7e8648
     - rsyslog_files_ownership
7e8648
-    - file_groupowner_logfiles_value=adm
7e8648
     - rsyslog_files_groupownership
7e8648
     - rsyslog_files_permissions
7e8648
     - "!rsyslog_remote_loghost"
7e8648
diff --git a/products/debian11/profiles/anssi_np_nt28_average.profile b/products/debian11/profiles/anssi_np_nt28_average.profile
7e8648
index 600f1a6f71..4c42814719 100644
7e8648
--- a/products/debian11/profiles/anssi_np_nt28_average.profile
7e8648
+++ b/products/debian11/profiles/anssi_np_nt28_average.profile
7e8648
@@ -22,9 +22,7 @@ selections:
7e8648
     - sshd_allow_only_protocol2
7e8648
     - var_sshd_set_keepalive=0
7e8648
     - sshd_set_keepalive_0
7e8648
-    - file_owner_logfiles_value=adm
7e8648
     - rsyslog_files_ownership
7e8648
-    - file_groupowner_logfiles_value=adm
7e8648
     - rsyslog_files_groupownership
7e8648
     - rsyslog_files_permissions
7e8648
     - "!rsyslog_remote_loghost"
7e8648
diff --git a/products/debian11/profiles/standard.profile b/products/debian11/profiles/standard.profile
7e8648
index e1b2c718df..c21f8d592b 100644
7e8648
--- a/products/debian11/profiles/standard.profile
7e8648
+++ b/products/debian11/profiles/standard.profile
7e8648
@@ -33,9 +33,7 @@ selections:
7e8648
     - sshd_allow_only_protocol2
7e8648
     - var_sshd_set_keepalive=0
7e8648
     - sshd_set_keepalive_0
7e8648
-    - file_owner_logfiles_value=adm
7e8648
     - rsyslog_files_ownership
7e8648
-    - file_groupowner_logfiles_value=adm
7e8648
     - rsyslog_files_groupownership
7e8648
     - rsyslog_files_permissions
7e8648
     - "!rsyslog_remote_loghost"
7e8648
diff --git a/products/rhel7/profiles/rht-ccp.profile b/products/rhel7/profiles/rht-ccp.profile
7e8648
index 12a3a25013..a246d5a094 100644
7e8648
--- a/products/rhel7/profiles/rht-ccp.profile
7e8648
+++ b/products/rhel7/profiles/rht-ccp.profile
7e8648
@@ -11,8 +11,6 @@ description: |-
7e8648
 selections:
7e8648
     - var_selinux_state=enforcing
7e8648
     - var_selinux_policy_name=targeted
7e8648
-    - file_owner_logfiles_value=root
7e8648
-    - file_groupowner_logfiles_value=root
7e8648
     - sshd_idle_timeout_value=5_minutes
7e8648
     - var_accounts_minimum_age_login_defs=7
7e8648
     - var_accounts_passwords_pam_faillock_deny=5
7e8648
diff --git a/products/rhel8/profiles/rht-ccp.profile b/products/rhel8/profiles/rht-ccp.profile
7e8648
index ae1e7d5a15..0a00d2f46b 100644
7e8648
--- a/products/rhel8/profiles/rht-ccp.profile
7e8648
+++ b/products/rhel8/profiles/rht-ccp.profile
7e8648
@@ -11,8 +11,6 @@ description: |-
7e8648
 selections:
7e8648
     - var_selinux_state=enforcing
7e8648
     - var_selinux_policy_name=targeted
7e8648
-    - file_owner_logfiles_value=root
7e8648
-    - file_groupowner_logfiles_value=root
7e8648
     - sshd_idle_timeout_value=5_minutes
7e8648
     - var_logind_session_timeout=5_minutes
7e8648
     - var_accounts_minimum_age_login_defs=7
7e8648
diff --git a/products/sle12/profiles/anssi_bp28_intermediary.profile b/products/sle12/profiles/anssi_bp28_intermediary.profile
7e8648
index 24a98fd824..22498b6b6f 100644
7e8648
--- a/products/sle12/profiles/anssi_bp28_intermediary.profile
7e8648
+++ b/products/sle12/profiles/anssi_bp28_intermediary.profile
7e8648
@@ -23,3 +23,4 @@ description: |-
7e8648
 
7e8648
 selections:
7e8648
   - anssi:all:intermediary
7e8648
+
7e8648
diff --git a/products/sle15/profiles/standard.profile b/products/sle15/profiles/standard.profile
7e8648
index 204804c2ee..1af0a865ef 100644
7e8648
--- a/products/sle15/profiles/standard.profile
7e8648
+++ b/products/sle15/profiles/standard.profile
7e8648
@@ -29,9 +29,7 @@ selections:
7e8648
     - service_cron_enabled
7e8648
     - service_ntp_enabled
7e8648
     - service_rsyslog_enabled
7e8648
-    - file_owner_logfiles_value=adm
7e8648
     - rsyslog_files_ownership
7e8648
-    - file_groupowner_logfiles_value=adm
7e8648
     - rsyslog_files_groupownership
7e8648
     - rsyslog_files_permissions
7e8648
     - ensure_logrotate_activated
7e8648
diff --git a/products/ubuntu1604/profiles/anssi_np_nt28_average.profile b/products/ubuntu1604/profiles/anssi_np_nt28_average.profile
7e8648
index 600f1a6f71..4c42814719 100644
7e8648
--- a/products/ubuntu1604/profiles/anssi_np_nt28_average.profile
7e8648
+++ b/products/ubuntu1604/profiles/anssi_np_nt28_average.profile
7e8648
@@ -22,9 +22,7 @@ selections:
7e8648
     - sshd_allow_only_protocol2
7e8648
     - var_sshd_set_keepalive=0
7e8648
     - sshd_set_keepalive_0
7e8648
-    - file_owner_logfiles_value=adm
7e8648
     - rsyslog_files_ownership
7e8648
-    - file_groupowner_logfiles_value=adm
7e8648
     - rsyslog_files_groupownership
7e8648
     - rsyslog_files_permissions
7e8648
     - "!rsyslog_remote_loghost"
7e8648
diff --git a/products/ubuntu1604/profiles/standard.profile b/products/ubuntu1604/profiles/standard.profile
7e8648
index 6fd70f0da6..93001f3bfe 100644
7e8648
--- a/products/ubuntu1604/profiles/standard.profile
7e8648
+++ b/products/ubuntu1604/profiles/standard.profile
7e8648
@@ -34,9 +34,7 @@ selections:
7e8648
     - sshd_allow_only_protocol2
7e8648
     - var_sshd_set_keepalive=0
7e8648
     - sshd_set_keepalive_0
7e8648
-    - file_owner_logfiles_value=adm
7e8648
     - rsyslog_files_ownership
7e8648
-    - file_groupowner_logfiles_value=adm
7e8648
     - rsyslog_files_groupownership
7e8648
     - rsyslog_files_permissions
7e8648
     - "!rsyslog_remote_loghost"
7e8648
diff --git a/products/ubuntu1804/profiles/anssi_np_nt28_average.profile b/products/ubuntu1804/profiles/anssi_np_nt28_average.profile
7e8648
index 600f1a6f71..4c42814719 100644
7e8648
--- a/products/ubuntu1804/profiles/anssi_np_nt28_average.profile
7e8648
+++ b/products/ubuntu1804/profiles/anssi_np_nt28_average.profile
7e8648
@@ -22,9 +22,7 @@ selections:
7e8648
     - sshd_allow_only_protocol2
7e8648
     - var_sshd_set_keepalive=0
7e8648
     - sshd_set_keepalive_0
7e8648
-    - file_owner_logfiles_value=adm
7e8648
     - rsyslog_files_ownership
7e8648
-    - file_groupowner_logfiles_value=adm
7e8648
     - rsyslog_files_groupownership
7e8648
     - rsyslog_files_permissions
7e8648
     - "!rsyslog_remote_loghost"
7e8648
diff --git a/products/ubuntu1804/profiles/standard.profile b/products/ubuntu1804/profiles/standard.profile
7e8648
index d587d499d8..a17117818e 100644
7e8648
--- a/products/ubuntu1804/profiles/standard.profile
7e8648
+++ b/products/ubuntu1804/profiles/standard.profile
7e8648
@@ -32,9 +32,7 @@ selections:
7e8648
     - sshd_allow_only_protocol2
7e8648
     - var_sshd_set_keepalive=0
7e8648
     - sshd_set_keepalive_0
7e8648
-    - file_owner_logfiles_value=adm
7e8648
     - rsyslog_files_ownership
7e8648
-    - file_groupowner_logfiles_value=adm
7e8648
     - rsyslog_files_groupownership
7e8648
     - rsyslog_files_permissions
7e8648
     - "!rsyslog_remote_loghost"
7e8648
diff --git a/products/ubuntu2004/profiles/standard.profile b/products/ubuntu2004/profiles/standard.profile
7e8648
index 823a69a5d9..6ed27aa16d 100644
7e8648
--- a/products/ubuntu2004/profiles/standard.profile
7e8648
+++ b/products/ubuntu2004/profiles/standard.profile
7e8648
@@ -31,9 +31,7 @@ selections:
7e8648
     - sshd_disable_empty_passwords
7e8648
     - var_sshd_set_keepalive=0
7e8648
     - sshd_set_keepalive
7e8648
-    - file_owner_logfiles_value=syslog
7e8648
     - rsyslog_files_ownership
7e8648
-    - file_groupowner_logfiles_value=adm
7e8648
     - rsyslog_files_groupownership
7e8648
     - rsyslog_files_permissions
7e8648
     - "!rsyslog_remote_loghost"
7e8648
diff --git a/products/ubuntu2204/profiles/standard.profile b/products/ubuntu2204/profiles/standard.profile
7e8648
index c8bc5369c9..1bb9f43e7d 100644
7e8648
--- a/products/ubuntu2204/profiles/standard.profile
7e8648
+++ b/products/ubuntu2204/profiles/standard.profile
7e8648
@@ -31,9 +31,7 @@ selections:
7e8648
     - sshd_disable_empty_passwords
7e8648
     - var_sshd_set_keepalive=0
7e8648
     - sshd_set_keepalive
7e8648
-    - file_owner_logfiles_value=syslog
7e8648
     - rsyslog_files_ownership
7e8648
-    - file_groupowner_logfiles_value=adm
7e8648
     - rsyslog_files_groupownership
7e8648
     - rsyslog_files_permissions
7e8648
     - "!rsyslog_remote_loghost"
7e8648
diff --git a/shared/references/cce-sle12-avail.txt b/shared/references/cce-sle12-avail.txt
7e8648
index c119834759..4e0a76f8de 100644
7e8648
--- a/shared/references/cce-sle12-avail.txt
7e8648
+++ b/shared/references/cce-sle12-avail.txt
7e8648
@@ -54,7 +54,6 @@ CCE-92375-5
7e8648
 CCE-92376-3
7e8648
 CCE-92377-1
7e8648
 CCE-92378-9
7e8648
-CCE-92379-7
7e8648
 CCE-92380-5
7e8648
 CCE-92381-3
7e8648
 CCE-92382-1
7e8648
diff --git a/shared/references/cce-sle15-avail.txt b/shared/references/cce-sle15-avail.txt
7e8648
index d04c40d31f..e39dae033e 100644
7e8648
--- a/shared/references/cce-sle15-avail.txt
7e8648
+++ b/shared/references/cce-sle15-avail.txt
7e8648
@@ -17,7 +17,6 @@ CCE-92492-8
7e8648
 CCE-92493-6
7e8648
 CCE-92495-1
7e8648
 CCE-92496-9
7e8648
-CCE-92497-7
7e8648
 CCE-92498-5
7e8648
 CCE-92499-3
7e8648
 CCE-92500-8
7e8648
diff --git a/shared/templates/rsyslog_logfiles_attributes_modify/ansible.template b/shared/templates/rsyslog_logfiles_attributes_modify/ansible.template
7e8648
new file mode 100644
7e8648
index 0000000000..fc9e8844b6
7e8648
--- /dev/null
7e8648
+++ b/shared/templates/rsyslog_logfiles_attributes_modify/ansible.template
7e8648
@@ -0,0 +1,68 @@
7e8648
+# platform = multi_platform_all
7e8648
+# reboot = false
7e8648
+# strategy = configure
7e8648
+# complexity = low
7e8648
+# disruption = medium
7e8648
+
7e8648
+- name: '{{{ rule_title }}} - Set rsyslog logfile configuration facts'
7e8648
+  ansible.builtin.set_fact:
7e8648
+    rsyslog_etc_config: "/etc/rsyslog.conf"
7e8648
+
7e8648
+# * And also the log file paths listed after rsyslog's $IncludeConfig directive
7e8648
+#   (store the result into array for the case there's shell glob used as value of IncludeConfig)
7e8648
+- name: '{{{ rule_title }}} - Get IncludeConfig directive'
7e8648
+  ansible.builtin.shell: |
7e8648
+    set -o pipefail
7e8648
+    grep -e '$IncludeConfig' {{ rsyslog_etc_config }} | cut -d ' ' -f 2 || true
7e8648
+  register: rsyslog_old_inc
7e8648
+  changed_when: False
7e8648
+
7e8648
+- name: '{{{ rule_title }}} - Get include files directives'
7e8648
+  ansible.builtin.shell: |
7e8648
+    set -o pipefail
7e8648
+    grep -oP '^\s*include\s*\(\s*file.*' {{ rsyslog_etc_config }} |cut  -d"\"" -f 2 || true
7e8648
+  register: rsyslog_new_inc
7e8648
+  changed_when: False
7e8648
+
7e8648
+- name: '{{{ rule_title }}} - Aggregate rsyslog includes'
7e8648
+  ansible.builtin.set_fact:
7e8648
+    include_config_output: "{{ rsyslog_old_inc.stdout_lines + rsyslog_new_inc.stdout_lines }}"
7e8648
+
7e8648
+- name: '{{{ rule_title }}} - List all config files'
7e8648
+  ansible.builtin.find:
7e8648
+    paths: "{{ include_config_output | list | map('dirname') }}"
7e8648
+    patterns: "{{ include_config_output | list | map('basename') }}"
7e8648
+    hidden: no
7e8648
+    follow: yes
7e8648
+  register: rsyslog_config_files
7e8648
+  failed_when: False
7e8648
+  changed_when: False
7e8648
+
7e8648
+- name: '{{{ rule_title }}} - Extract log files old format'
7e8648
+  ansible.builtin.shell: |
7e8648
+    set -o pipefail
7e8648
+    grep -oP '^[^(\s|#|\$)]+[\s]+.*[\s]+-?(/+[^:;\s]+);*\.*$' {{ item }}  |awk '{print $NF}'|sed -e 's/^-//' || true
7e8648
+  loop: "{{ rsyslog_config_files.files|map(attribute='path')|list|flatten|unique + [ rsyslog_etc_config ] }}"
7e8648
+  register: log_files_old
7e8648
+  changed_when: False
7e8648
+
7e8648
+- name: '{{{ rule_title }}} - Extract log files new format'
7e8648
+  ansible.builtin.shell: |
7e8648
+    set -o pipefail
7e8648
+    grep -ozP "action\s*\(\s*type\s*=\s*\"omfile\"[^\)]*\)" {{ item }} | grep -aoP "File\s*=\s*\"([/[:alnum:][:punct:]]*)\"\s*\)"|grep -oE "\"([/[:alnum:][:punct:]]*)\"" |tr -d "\""|| true
7e8648
+  loop: "{{ rsyslog_config_files.files|map(attribute='path')|list|flatten|unique + [ rsyslog_etc_config ] }}"
7e8648
+  register: log_files_new
7e8648
+  changed_when: False
7e8648
+
7e8648
+- name: '{{{ rule_title }}} - Sum all log files found'
7e8648
+  ansible.builtin.set_fact:
7e8648
+    log_files: "{{ log_files_new.results|map(attribute='stdout_lines')|list|flatten|unique + log_files_old.results|map(attribute='stdout_lines')|list|flatten|unique  }}"
7e8648
+
7e8648
+- name: '{{{ rule_title }}} -Setup log files attribute'
7e8648
+  ansible.builtin.file:
7e8648
+    path: "{{ item }}"
7e8648
+    owner: '{{ ( "{{{ ATTRIBUTE }}}" is match("owner")) | ternary({{{ VALUE }}}, omit) }}'
7e8648
+    group: '{{ ( "{{{ ATTRIBUTE }}}" is match("groupowner")) | ternary({{{ VALUE }}} , omit) }}'
7e8648
+    state: file
7e8648
+  loop: "{{ log_files | list | flatten | unique }}"
7e8648
+  failed_when: false
7e8648
diff --git a/shared/templates/rsyslog_logfiles_attributes_modify/bash.template b/shared/templates/rsyslog_logfiles_attributes_modify/bash.template
7e8648
new file mode 100644
7e8648
index 0000000000..ab4a563dc5
7e8648
--- /dev/null
7e8648
+++ b/shared/templates/rsyslog_logfiles_attributes_modify/bash.template
7e8648
@@ -0,0 +1,110 @@
7e8648
+# platform = multi_platform_all
7e8648
+
7e8648
+# List of log file paths to be inspected for correct permissions
7e8648
+# * Primarily inspect log file paths listed in /etc/rsyslog.conf
7e8648
+RSYSLOG_ETC_CONFIG="/etc/rsyslog.conf"
7e8648
+# * And also the log file paths listed after rsyslog's $IncludeConfig directive
7e8648
+#   (store the result into array for the case there's shell glob used as value of IncludeConfig)
7e8648
+readarray -t OLD_INC < <(grep -e "\$IncludeConfig[[:space:]]\+[^[:space:];]\+" /etc/rsyslog.conf | cut -d ' ' -f 2)
7e8648
+readarray -t RSYSLOG_INCLUDE_CONFIG < <(for INCPATH in "${OLD_INC[@]}"; do eval printf '%s\\n' "${INCPATH}"; done)
7e8648
+readarray -t NEW_INC < <(awk '/)/{f=0} /include\(/{f=1} f{nf=gensub("^(include\\(|\\s*)file=\"(\\S+)\".*","\\2",1); if($0!=nf){print nf}}' /etc/rsyslog.conf)
7e8648
+readarray -t RSYSLOG_INCLUDE < <(for INCPATH in "${NEW_INC[@]}"; do eval printf '%s\\n' "${INCPATH}"; done)
7e8648
+
7e8648
+# Declare an array to hold the final list of different log file paths
7e8648
+declare -a LOG_FILE_PATHS
7e8648
+
7e8648
+# Array to hold all rsyslog config entries
7e8648
+RSYSLOG_CONFIGS=()
7e8648
+RSYSLOG_CONFIGS=("${RSYSLOG_ETC_CONFIG}" "${RSYSLOG_INCLUDE_CONFIG[@]}" "${RSYSLOG_INCLUDE[@]}")
7e8648
+
7e8648
+# Get full list of files to be checked
7e8648
+# RSYSLOG_CONFIGS may contain globs such as
7e8648
+# /etc/rsyslog.d/*.conf /etc/rsyslog.d/*.frule
7e8648
+# So, loop over the entries in RSYSLOG_CONFIGS and use find to get the list of included files.
7e8648
+RSYSLOG_CONFIG_FILES=()
7e8648
+for ENTRY in "${RSYSLOG_CONFIGS[@]}"
7e8648
+do
7e8648
+	# If directory, rsyslog will search for config files in recursively.
7e8648
+	# However, files in hidden sub-directories or hidden files will be ignored.
7e8648
+	if [ -d "${ENTRY}" ]
7e8648
+	then
7e8648
+		readarray -t FINDOUT < <(find "${ENTRY}" -not -path '*/.*' -type f)
7e8648
+		RSYSLOG_CONFIG_FILES+=("${FINDOUT[@]}")
7e8648
+	elif [ -f "${ENTRY}" ]
7e8648
+	then
7e8648
+		RSYSLOG_CONFIG_FILES+=("${ENTRY}")
7e8648
+	else
7e8648
+		echo "Invalid include object: ${ENTRY}"
7e8648
+	fi
7e8648
+done
7e8648
+
7e8648
+# Browse each file selected above as containing paths of log files
7e8648
+# ('/etc/rsyslog.conf' and '/etc/rsyslog.d/*.conf' in the default configuration)
7e8648
+for LOG_FILE in "${RSYSLOG_CONFIG_FILES[@]}"
7e8648
+do
7e8648
+	# From each of these files extract just particular log file path(s), thus:
7e8648
+	# * Ignore lines starting with space (' '), comment ('#"), or variable syntax ('$') characters,
7e8648
+	# * Ignore empty lines,
7e8648
+	# * Strip quotes and closing brackets from paths.
7e8648
+	# * Ignore paths that match /dev|/etc.*\.conf, as those are paths, but likely not log files
7e8648
+	# * From the remaining valid rows select only fields constituting a log file path
7e8648
+	# Text file column is understood to represent a log file path if and only if all of the following are met:
7e8648
+	# * it contains at least one slash '/' character,
7e8648
+	# * it is preceded by space
7e8648
+	# * it doesn't contain space (' '), colon (':'), and semicolon (';') characters
7e8648
+	# Search log file for path(s) only in case it exists!
7e8648
+	if [[ -f "${LOG_FILE}" ]]
7e8648
+	then
7e8648
+		NORMALIZED_CONFIG_FILE_LINES=$(sed -e "/^[#|$]/d" "${LOG_FILE}")
7e8648
+		LINES_WITH_PATHS=$(grep '[^/]*\s\+\S*/\S\+$' <<< "${NORMALIZED_CONFIG_FILE_LINES}")
7e8648
+		FILTERED_PATHS=$(awk '{if(NF>=2&&($NF~/^\//||$NF~/^-\//)){sub(/^-\//,"/",$NF);print $NF}}' <<< "${LINES_WITH_PATHS}")
7e8648
+		CLEANED_PATHS=$(sed -e "s/[\"')]//g; /\\/etc.*\.conf/d; /\\/dev\\//d" <<< "${FILTERED_PATHS}")
7e8648
+		MATCHED_ITEMS=$(sed -e "/^$/d" <<< "${CLEANED_PATHS}")
7e8648
+		# Since above sed command might return more than one item (delimited by newline), split the particular
7e8648
+		# matches entries into new array specific for this log file
7e8648
+		readarray -t ARRAY_FOR_LOG_FILE <<< "$MATCHED_ITEMS"
7e8648
+		# Concatenate the two arrays - previous content of $LOG_FILE_PATHS array with
7e8648
+		# items from newly created array for this log file
7e8648
+		LOG_FILE_PATHS+=("${ARRAY_FOR_LOG_FILE[@]}")
7e8648
+		# Delete the temporary array
7e8648
+		unset ARRAY_FOR_LOG_FILE
7e8648
+	fi
7e8648
+done
7e8648
+
7e8648
+# Check for RainerScript action log format which might be also multiline so grep regex is a bit curly
7e8648
+# extract possibly multiline action omfile expressions
7e8648
+# extract File="logfile" expression
7e8648
+# match only "logfile" expression
7e8648
+for LOG_FILE in "${RSYSLOG_CONFIG_FILES[@]}"
7e8648
+do
7e8648
+	ACTION_OMFILE_LINES=$(grep -ozP "action\s*\(\s*type\s*=\s*\"omfile\"[^\)]*\)" "${LOG_FILE}")
7e8648
+	OMFILE_LINES=$(echo "${ACTION_OMFILE_LINES}"| grep -aoP "File\s*=\s*\"([/[:alnum:][:punct:]]*)\"\s*\)")
7e8648
+	LOG_FILE_PATHS+=("$(echo "${OMFILE_LINES}"| grep -oE "\"([/[:alnum:][:punct:]]*)\""|tr -d "\"")")
7e8648
+done
7e8648
+
7e8648
+FILE_PARAM="{{{ ATTRIBUTE }}}"
7e8648
+FILE_CMD=""
7e8648
+case "$FILE_PARAM" in
7e8648
+     "groupowner")
7e8648
+        FILE_CMD=$(which chgrp)
7e8648
+        ;;
7e8648
+     "owner")
7e8648
+        FILE_CMD=$(which chown)
7e8648
+        ;;
7e8648
+      *)
7e8648
+        echo -n "Not supported file attribute! "
7e8648
+        exit 1
7e8648
+      ;;
7e8648
+esac
7e8648
+
7e8648
+# Correct the form o
7e8648
+for LOG_FILE_PATH in "${LOG_FILE_PATHS[@]}"
7e8648
+do
7e8648
+	# Sanity check - if particular $LOG_FILE_PATH is empty string, skip it from further processing
7e8648
+	if [ -z "$LOG_FILE_PATH" ]
7e8648
+	then
7e8648
+		continue
7e8648
+	fi
7e8648
+
7e8648
+	$FILE_CMD "+{{{ VALUE }}}" "$LOG_FILE_PATH"
7e8648
+done
7e8648
diff --git a/shared/templates/rsyslog_logfiles_attributes_modify/oval.template b/shared/templates/rsyslog_logfiles_attributes_modify/oval.template
7e8648
new file mode 100644
7e8648
index 0000000000..4f288df1c9
7e8648
--- /dev/null
7e8648
+++ b/shared/templates/rsyslog_logfiles_attributes_modify/oval.template
7e8648
@@ -0,0 +1,137 @@
7e8648
+<def-group oval_version="5.11">
7e8648
+  <definition class="compliance" id="{{{_RULE_ID }}}" version="1">
7e8648
+    {{{ oval_metadata("All syslog log files should have appropriate ownership.") }}}
7e8648
+    <criteria operator="AND">
7e8648
+      {{% if product in ["debian10", "debian11", "ubuntu1604"] %}}
7e8648
+      
7e8648
+      definition_ref="package_rsyslog_installed" />
7e8648
+      {{% endif %}}
7e8648
+      
7e8648
+      {{{ ATTRIBUTE  }}}" test_ref="test_{{{ _RULE_ID }}}" />
7e8648
+    </criteria>
7e8648
+
7e8648
+  </definition>
7e8648
+
7e8648
+  
7e8648
+  v8.33.0) values.  -->
7e8648
+  
7e8648
+  
7e8648
+       comment="rsyslog's $IncludeConfig directive and include() object values" version="1">
7e8648
+    <ind:filepath>/etc/rsyslog.conf</ind:filepath>
7e8648
+    
7e8648
+    operation="pattern match">^(?:include\([\n\s]*file="([^\s;]+)".*|\$IncludeConfig[\s]+([^\s;]+))$</ind:pattern>
7e8648
+    <ind:instance datatype="int" operation="greater than or equal">1</ind:instance>
7e8648
+  </ind:textfilecontent54_object>
7e8648
+
7e8648
+  
7e8648
+  
7e8648
+  comment="$IncludeConfig value converted to regex">
7e8648
+    <unique>
7e8648
+      <glob_to_regex>
7e8648
+        
7e8648
+                          object_ref="object_{{{ _RULE_ID }}}_include_config_value" />
7e8648
+      </glob_to_regex>
7e8648
+    </unique>
7e8648
+  </local_variable>
7e8648
+
7e8648
+  
7e8648
+       If the variable has no values, there won't be any objects -->
7e8648
+  
7e8648
+                       comment="Make variable object from regex variable" version="1">
7e8648
+    <ind:var_ref>var_{{{ _RULE_ID }}}_include_config_regex</ind:var_ref>
7e8648
+  </ind:variable_object>
7e8648
+
7e8648
+  
7e8648
+                  version="1" comment="Locations of all rsyslog configuration files as collection">
7e8648
+    <literal_component datatype="string">^/etc/rsyslog.conf$</literal_component>
7e8648
+  </local_variable>
7e8648
+
7e8648
+  
7e8648
+                       comment="Make variable object for use" version="1">
7e8648
+    <ind:var_ref>var_{{{ _RULE_ID }}}_syslog_config</ind:var_ref>
7e8648
+  </ind:variable_object>
7e8648
+
7e8648
+  
7e8648
+       We do it this way to avoid referencing an empty variable in a state comparison, which
7e8648
+       will cause a test to evaluate to fail. Combining an empty set of objects is fine though -->
7e8648
+  
7e8648
+                       comment="Filter out empty string" version="1">
7e8648
+    <set>
7e8648
+      <object_reference>object_var_{{{ _RULE_ID }}}_include_config_regex</object_reference>
7e8648
+      <object_reference>object_var_{{{ _RULE_ID }}}_syslog_config</object_reference>
7e8648
+    </set>
7e8648
+  </ind:variable_object>
7e8648
+
7e8648
+  
7e8648
+       a list of objects won't do. So we make a local_variable from the variable_objects. -->
7e8648
+  
7e8648
+                  comment="Locations of all rsyslog configuration files as collection">
7e8648
+    <object_component object_ref="object_var_{{{ _RULE_ID }}}_all_log_files" item_field="value"/>
7e8648
+  </local_variable>
7e8648
+
7e8648
+  
7e8648
+       that rsyslog's configuration file to select file paths for log files directives
7e8648
+  -->
7e8648
+  
7e8648
+                                comment="All rsyslog configuration files" version="1">
7e8648
+    
7e8648
+                  var_check="at least one" />
7e8648
+    
7e8648
+         to constitute a log file path if all of the following conditions are met:
7e8648
+         * the string represents a regular file on particular file system
7e8648
+           (verified via corresponding file_state below),
7e8648
+         * the chunk of text is in the last column in the row,
7e8648
+           (possibly suffixed by ';' character and rsyslog Template name),
7e8648
+         * contains at least one slash '/' character, and simultaneously
7e8648
+           doesn't contain any of ';', ':' and space characters,
7e8648
+         * the chunk was retrieved from a row not starting with space, '#',
7e8648
+           or '$' characters
7e8648
+    -->
7e8648
+    
7e8648
+     operation="pattern match">^\s*[^(\s|#|\$)]+\s+-?[\w\(="\s]*(\/[^:;\s"]+)+.*$</ind:pattern>
7e8648
+    <ind:instance datatype="int" operation="greater than or equal">1</ind:instance>
7e8648
+    <filter action="exclude">state_{{{ _RULE_ID }}}_ownership_ignore_include_paths</filter>
7e8648
+  </ind:textfilecontent54_object>
7e8648
+
7e8648
+  
7e8648
+                               comment="ignore" version="1">
7e8648
+    
7e8648
+         include() or $IncludeConfig statements.
7e8648
+         These paths are conf files, not log files. Their groupownership don't need to be as
7e8648
+         required for log files, thus, lets exclude them from the list of objects found
7e8648
+    -->
7e8648
+    
7e8648
+    operation="pattern match">(?:file="[^\s;]+"|\$IncludeConfig[\s]+[^\s;]+|\/dev\/.*)</ind:text>
7e8648
+  </ind:textfilecontent54_state>
7e8648
+
7e8648
+  
7e8648
+       retrieved from the different rsyslog configuration files
7e8648
+  -->
7e8648
+  
7e8648
+                  comment="File paths of all rsyslog configuration files">
7e8648
+    <object_component item_field="subexpression" object_ref="object_{{{ _RULE_ID }}}_log_files_paths" />
7e8648
+  </local_variable>
7e8648
+
7e8648
+  
7e8648
+  
7e8648
+                  comment="System log files are owned by the appropriate group">
7e8648
+    <unix:object object_ref="object_rsyslog_files_{{{ _RULE_ID }}}_ownership" />
7e8648
+    <unix:state state_ref="state_{{{ _RULE_ID }}}" />
7e8648
+  </unix:file_test>
7e8648
+
7e8648
+  
7e8648
+                    comment="Various system log files" version="1">
7e8648
+    
7e8648
+                   var_check="at least one" />
7e8648
+  </unix:file_object>
7e8648
+
7e8648
+  <unix:file_state id="state_{{{ _RULE_ID }}}" version="1">
7e8648
+    <unix:type operation="equals">regular</unix:type>
7e8648
+    {{% if ATTRIBUTE == "groupowner" %}}
7e8648
+    <unix:group_id datatype="int">{{{ VALUE }}}</unix:group_id>
7e8648
+    {{% else %}}
7e8648
+    <unix:user_id datatype="int">{{{ VALUE }}}</unix:user_id>
7e8648
+   {{% endif %}}
7e8648
+  </unix:file_state>
7e8648
+
7e8648
+</def-group>
7e8648
diff --git a/shared/templates/rsyslog_logfiles_attributes_modify/template.yml b/shared/templates/rsyslog_logfiles_attributes_modify/template.yml
7e8648
new file mode 100644
7e8648
index 0000000000..b57de6fbb6
7e8648
--- /dev/null
7e8648
+++ b/shared/templates/rsyslog_logfiles_attributes_modify/template.yml
7e8648
@@ -0,0 +1,4 @@
7e8648
+supported_languages:
7e8648
+  - ansible
7e8648
+  - bash
7e8648
+  - oval
7e8648
diff --git a/linux_os/guide/system/logging/ensure_rsyslog_log_file_configuration/rsyslog_files_ownership/tests/IncludeConfig_is_other.fail.sh b/shared/templates/rsyslog_logfiles_attributes_modify/tests/IncludeConfig_is_other.fail.sh
7e8648
similarity index 75%
7e8648
rename from linux_os/guide/system/logging/ensure_rsyslog_log_file_configuration/rsyslog_files_ownership/tests/IncludeConfig_is_other.fail.sh
7e8648
rename to shared/templates/rsyslog_logfiles_attributes_modify/tests/IncludeConfig_is_other.fail.sh
7e8648
index 6c82a1942f..db7e5261eb 100755
7e8648
--- a/linux_os/guide/system/logging/ensure_rsyslog_log_file_configuration/rsyslog_files_ownership/tests/IncludeConfig_is_other.fail.sh
7e8648
+++ b/shared/templates/rsyslog_logfiles_attributes_modify/tests/IncludeConfig_is_other.fail.sh
7e8648
@@ -6,8 +6,16 @@
7e8648
 
7e8648
 source $SHARED/rsyslog_log_utils.sh
7e8648
 
7e8648
+{{% if ATTRIBUTE == "owner" %}}
7e8648
+ADDCOMMAND="useradd"
7e8648
+CHATTR="chown"
7e8648
+{{% else %}}
7e8648
+ADDCOMMAND="groupadd"
7e8648
+CHATTR="chgrp"
7e8648
+{{% endif %}}
7e8648
+
7e8648
 USER_TEST=testssg
7e8648
-useradd $USER_TEST
7e8648
+$ADDCOMMAND $USER_TEST
7e8648
 
7e8648
 USER_ROOT=root
7e8648
 
7e8648
@@ -15,8 +23,8 @@ USER_ROOT=root
7e8648
 create_rsyslog_test_logs 2
7e8648
 
7e8648
 # setup test log files ownership
7e8648
-chown $USER_ROOT ${RSYSLOG_TEST_LOGS[0]}
7e8648
-chown $USER_TEST ${RSYSLOG_TEST_LOGS[1]}
7e8648
+$CHATTR $USER_ROOT ${RSYSLOG_TEST_LOGS[0]}
7e8648
+$CHATTR $USER_TEST ${RSYSLOG_TEST_LOGS[1]}
7e8648
 
7e8648
 # create test configuration file
7e8648
 test_conf=${RSYSLOG_TEST_DIR}/test1.conf
7e8648
diff --git a/linux_os/guide/system/logging/ensure_rsyslog_log_file_configuration/rsyslog_files_ownership/tests/IncludeConfig_is_root.pass.sh b/shared/templates/rsyslog_logfiles_attributes_modify/tests/IncludeConfig_is_root.pass.sh
7e8648
similarity index 81%
7e8648
rename from linux_os/guide/system/logging/ensure_rsyslog_log_file_configuration/rsyslog_files_ownership/tests/IncludeConfig_is_root.pass.sh
7e8648
rename to shared/templates/rsyslog_logfiles_attributes_modify/tests/IncludeConfig_is_root.pass.sh
7e8648
index b24e5e1699..b03268fe3e 100755
7e8648
--- a/linux_os/guide/system/logging/ensure_rsyslog_log_file_configuration/rsyslog_files_ownership/tests/IncludeConfig_is_root.pass.sh
7e8648
+++ b/shared/templates/rsyslog_logfiles_attributes_modify/tests/IncludeConfig_is_root.pass.sh
7e8648
@@ -6,14 +6,20 @@
7e8648
 
7e8648
 source $SHARED/rsyslog_log_utils.sh
7e8648
 
7e8648
+{{% if ATTRIBUTE == "owner" %}}
7e8648
+CHATTR="chown"
7e8648
+{{% else %}}
7e8648
+CHATTR="chgrp"
7e8648
+{{% endif %}}
7e8648
+
7e8648
 USER=root
7e8648
 
7e8648
 # setup test data
7e8648
 create_rsyslog_test_logs 2
7e8648
 
7e8648
 # setup test log files ownership
7e8648
-chown $USER ${RSYSLOG_TEST_LOGS[0]}
7e8648
-chown $USER ${RSYSLOG_TEST_LOGS[1]}
7e8648
+$CHATTR $USER ${RSYSLOG_TEST_LOGS[0]}
7e8648
+$CHATTR $USER ${RSYSLOG_TEST_LOGS[1]}
7e8648
 
7e8648
 # create test configuration file
7e8648
 test_conf=${RSYSLOG_TEST_DIR}/test1.conf
7e8648
diff --git a/linux_os/guide/system/logging/ensure_rsyslog_log_file_configuration/rsyslog_files_ownership/tests/include_is_other.fail.sh b/shared/templates/rsyslog_logfiles_attributes_modify/tests/include_is_other.fail.sh
7e8648
similarity index 75%
7e8648
rename from linux_os/guide/system/logging/ensure_rsyslog_log_file_configuration/rsyslog_files_ownership/tests/include_is_other.fail.sh
7e8648
rename to shared/templates/rsyslog_logfiles_attributes_modify/tests/include_is_other.fail.sh
7e8648
index 18f43c6927..d79ae23cfc 100755
7e8648
--- a/linux_os/guide/system/logging/ensure_rsyslog_log_file_configuration/rsyslog_files_ownership/tests/include_is_other.fail.sh
7e8648
+++ b/shared/templates/rsyslog_logfiles_attributes_modify/tests/include_is_other.fail.sh
7e8648
@@ -6,8 +6,16 @@
7e8648
 
7e8648
 source $SHARED/rsyslog_log_utils.sh
7e8648
 
7e8648
+{{% if ATTRIBUTE == "owner" %}}
7e8648
+ADDCOMMAND="useradd"
7e8648
+CHATTR="chown"
7e8648
+{{% else %}}
7e8648
+ADDCOMMAND="groupadd"
7e8648
+CHATTR="chgrp"
7e8648
+{{% endif %}}
7e8648
+
7e8648
 USER_TEST=testssg
7e8648
-useradd $USER_TEST
7e8648
+$ADDCOMMAND $USER_TEST
7e8648
 
7e8648
 USER_ROOT=root
7e8648
 
7e8648
@@ -15,8 +23,8 @@ USER_ROOT=root
7e8648
 create_rsyslog_test_logs 2
7e8648
 
7e8648
 # setup test log files ownership
7e8648
-chown $USER_ROOT ${RSYSLOG_TEST_LOGS[0]}
7e8648
-chown $USER_TEST ${RSYSLOG_TEST_LOGS[1]}
7e8648
+$CHATTR $USER_ROOT ${RSYSLOG_TEST_LOGS[0]}
7e8648
+$CHATTR $USER_TEST ${RSYSLOG_TEST_LOGS[1]}
7e8648
 
7e8648
 # create test configuration file
7e8648
 test_conf=${RSYSLOG_TEST_DIR}/test1.conf
7e8648
diff --git a/linux_os/guide/system/logging/ensure_rsyslog_log_file_configuration/rsyslog_files_groupownership/tests/include_is_root_IncludeConfig_is_root.pass.sh b/shared/templates/rsyslog_logfiles_attributes_modify/tests/include_is_other_IncludeConfig_is_other_RainerLogClause.fail.sh
7e8648
old mode 100755
7e8648
new mode 100644
7e8648
similarity index 50%
7e8648
rename from linux_os/guide/system/logging/ensure_rsyslog_log_file_configuration/rsyslog_files_groupownership/tests/include_is_root_IncludeConfig_is_root.pass.sh
7e8648
rename to shared/templates/rsyslog_logfiles_attributes_modify/tests/include_is_other_IncludeConfig_is_other_RainerLogClause.fail.sh
7e8648
index 05dd50ed24..7869a180a8
7e8648
--- a/linux_os/guide/system/logging/ensure_rsyslog_log_file_configuration/rsyslog_files_groupownership/tests/include_is_root_IncludeConfig_is_root.pass.sh
7e8648
+++ b/shared/templates/rsyslog_logfiles_attributes_modify/tests/include_is_other_IncludeConfig_is_other_RainerLogClause.fail.sh
7e8648
@@ -1,20 +1,31 @@
7e8648
 #!/bin/bash
7e8648
 # platform = Red Hat Enterprise Linux 8,multi_platform_fedora,Oracle Linux 8,multi_platform_sle
7e8648
 
7e8648
-# Check rsyslog.conf with root group-owner log from rules and
7e8648
-# root group-owner log from include() passes.
7e8648
+# Check rsyslog.conf with root user log from rules and
7e8648
+# root user log from include() passes.
7e8648
 
7e8648
 source $SHARED/rsyslog_log_utils.sh
7e8648
 
7e8648
-GROUP=root
7e8648
+{{% if ATTRIBUTE == "owner" %}}
7e8648
+ADDCOMMAND="useradd"
7e8648
+CHATTR="chown"
7e8648
+{{% else %}}
7e8648
+ADDCOMMAND="groupadd"
7e8648
+CHATTR="chgrp"
7e8648
+{{% endif %}}
7e8648
+
7e8648
+USER_TEST=testssg
7e8648
+$ADDCOMMAND $USER_TEST
7e8648
+
7e8648
+USER=root
7e8648
 
7e8648
 # setup test data
7e8648
 create_rsyslog_test_logs 3
7e8648
 
7e8648
 # setup test log files ownership
7e8648
-chgrp $GROUP ${RSYSLOG_TEST_LOGS[0]}
7e8648
-chgrp $GROUP ${RSYSLOG_TEST_LOGS[1]}
7e8648
-chgrp $GROUP ${RSYSLOG_TEST_LOGS[2]}
7e8648
+$CHATTR $USER_TEST ${RSYSLOG_TEST_LOGS[0]}
7e8648
+$CHATTR $USER_TEST ${RSYSLOG_TEST_LOGS[1]}
7e8648
+$CHATTR $USER_TEST ${RSYSLOG_TEST_LOGS[2]}
7e8648
 
7e8648
 # create test configuration file
7e8648
 test_conf=${RSYSLOG_TEST_DIR}/test1.conf
7e8648
@@ -28,13 +39,25 @@ EOF
7e8648
 
7e8648
 # create test2 configuration file
7e8648
 test_conf2=${RSYSLOG_TEST_DIR}/test2.conf
7e8648
+{{% if ATTRIBUTE == "owner" %}}
7e8648
+cat << EOF > ${test_conf2}
7e8648
+# rsyslog configuration file
7e8648
+
7e8648
+#### RULES ####
7e8648
+
7e8648
+
7e8648
+*.*     action(type="omfile" FileCreateMode="0640" fileOwner="$USER_TEST" fileGroup="root" File="${RSYSLOG_TEST_LOGS[2]}")
7e8648
+EOF
7e8648
+{{% else %}}
7e8648
 cat << EOF > ${test_conf2}
7e8648
 # rsyslog configuration file
7e8648
 
7e8648
 #### RULES ####
7e8648
 
7e8648
-*.*     ${RSYSLOG_TEST_LOGS[2]}
7e8648
+
7e8648
+*.*     action(type="omfile" FileCreateMode="0640" fileOwner="root" fileGroup="$USER_TEST" File="${RSYSLOG_TEST_LOGS[2]}")
7e8648
 EOF
7e8648
+{{% endif %}}
7e8648
 
7e8648
 # create rsyslog.conf configuration file
7e8648
 cat << EOF > $RSYSLOG_CONF
7e8648
diff --git a/linux_os/guide/system/logging/ensure_rsyslog_log_file_configuration/rsyslog_files_ownership/tests/include_is_root.pass.sh b/shared/templates/rsyslog_logfiles_attributes_modify/tests/include_is_root.pass.sh
7e8648
similarity index 81%
7e8648
rename from linux_os/guide/system/logging/ensure_rsyslog_log_file_configuration/rsyslog_files_ownership/tests/include_is_root.pass.sh
7e8648
rename to shared/templates/rsyslog_logfiles_attributes_modify/tests/include_is_root.pass.sh
7e8648
index 69dead5135..e80395ca99 100755
7e8648
--- a/linux_os/guide/system/logging/ensure_rsyslog_log_file_configuration/rsyslog_files_ownership/tests/include_is_root.pass.sh
7e8648
+++ b/shared/templates/rsyslog_logfiles_attributes_modify/tests/include_is_root.pass.sh
7e8648
@@ -6,14 +6,21 @@
7e8648
 
7e8648
 source $SHARED/rsyslog_log_utils.sh
7e8648
 
7e8648
+
7e8648
+{{% if ATTRIBUTE == "owner" %}}
7e8648
+CHATTR="chown"
7e8648
+{{% else %}}
7e8648
+CHATTR="chgrp"
7e8648
+{{% endif %}}
7e8648
+
7e8648
 USER=root
7e8648
 
7e8648
 # setup test data
7e8648
 create_rsyslog_test_logs 2
7e8648
 
7e8648
 # setup test log files ownership
7e8648
-chown $USER ${RSYSLOG_TEST_LOGS[0]}
7e8648
-chown $USER ${RSYSLOG_TEST_LOGS[1]}
7e8648
+$CHATTR $USER ${RSYSLOG_TEST_LOGS[0]}
7e8648
+$CHATTR $USER ${RSYSLOG_TEST_LOGS[1]}
7e8648
 
7e8648
 # create test configuration file
7e8648
 test_conf=${RSYSLOG_TEST_DIR}/test1.conf
7e8648
diff --git a/linux_os/guide/system/logging/ensure_rsyslog_log_file_configuration/rsyslog_files_ownership/tests/include_is_root_IncludeConfig_is_other.fail.sh b/shared/templates/rsyslog_logfiles_attributes_modify/tests/include_is_root_IncludeConfig_is_other.fail.sh
7e8648
similarity index 77%
7e8648
rename from linux_os/guide/system/logging/ensure_rsyslog_log_file_configuration/rsyslog_files_ownership/tests/include_is_root_IncludeConfig_is_other.fail.sh
7e8648
rename to shared/templates/rsyslog_logfiles_attributes_modify/tests/include_is_root_IncludeConfig_is_other.fail.sh
7e8648
index e725fb4d54..e7b4905dc5 100755
7e8648
--- a/linux_os/guide/system/logging/ensure_rsyslog_log_file_configuration/rsyslog_files_ownership/tests/include_is_root_IncludeConfig_is_other.fail.sh
7e8648
+++ b/shared/templates/rsyslog_logfiles_attributes_modify/tests/include_is_root_IncludeConfig_is_other.fail.sh
7e8648
@@ -6,18 +6,26 @@
7e8648
 
7e8648
 source $SHARED/rsyslog_log_utils.sh
7e8648
 
7e8648
+{{% if ATTRIBUTE == "owner" %}}
7e8648
+ADDCOMMAND="useradd"
7e8648
+CHATTR="chown"
7e8648
+{{% else %}}
7e8648
+ADDCOMMAND="groupadd"
7e8648
+CHATTR="chgrp"
7e8648
+{{% endif %}}
7e8648
+
7e8648
 USER_ROOT=root
7e8648
 
7e8648
 USER_TEST=testssg
7e8648
-useradd $USER_TEST
7e8648
+$ADDCOMMAND $USER_TEST
7e8648
 
7e8648
 # setup test data
7e8648
 create_rsyslog_test_logs 3
7e8648
 
7e8648
 # setup test log files ownership
7e8648
-chown $USER_ROOT ${RSYSLOG_TEST_LOGS[0]}
7e8648
-chown $USER_ROOT ${RSYSLOG_TEST_LOGS[1]}
7e8648
-chown $USER_TEST ${RSYSLOG_TEST_LOGS[2]}
7e8648
+$CHATTR $USER_ROOT ${RSYSLOG_TEST_LOGS[0]}
7e8648
+$CHATTR $USER_ROOT ${RSYSLOG_TEST_LOGS[1]}
7e8648
+$CHATTR $USER_TEST ${RSYSLOG_TEST_LOGS[2]}
7e8648
 
7e8648
 # create test configuration file
7e8648
 test_conf=${RSYSLOG_TEST_DIR}/test1.conf
7e8648
diff --git a/linux_os/guide/system/logging/ensure_rsyslog_log_file_configuration/rsyslog_files_ownership/tests/include_is_root_IncludeConfig_is_root.pass.sh b/shared/templates/rsyslog_logfiles_attributes_modify/tests/include_is_root_IncludeConfig_is_root.pass.sh
7e8648
similarity index 82%
7e8648
rename from linux_os/guide/system/logging/ensure_rsyslog_log_file_configuration/rsyslog_files_ownership/tests/include_is_root_IncludeConfig_is_root.pass.sh
7e8648
rename to shared/templates/rsyslog_logfiles_attributes_modify/tests/include_is_root_IncludeConfig_is_root.pass.sh
7e8648
index ca47d453c1..6389e6ea3b 100755
7e8648
--- a/linux_os/guide/system/logging/ensure_rsyslog_log_file_configuration/rsyslog_files_ownership/tests/include_is_root_IncludeConfig_is_root.pass.sh
7e8648
+++ b/shared/templates/rsyslog_logfiles_attributes_modify/tests/include_is_root_IncludeConfig_is_root.pass.sh
7e8648
@@ -6,15 +6,21 @@
7e8648
 
7e8648
 source $SHARED/rsyslog_log_utils.sh
7e8648
 
7e8648
+{{% if ATTRIBUTE == "owner" %}}
7e8648
+CHATTR="chown"
7e8648
+{{% else %}}
7e8648
+CHATTR="chgrp"
7e8648
+{{% endif %}}
7e8648
+
7e8648
 USER=root
7e8648
 
7e8648
 # setup test data
7e8648
 create_rsyslog_test_logs 3
7e8648
 
7e8648
 # setup test log files ownership
7e8648
-chown $USER ${RSYSLOG_TEST_LOGS[0]}
7e8648
-chown $USER ${RSYSLOG_TEST_LOGS[1]}
7e8648
-chown $USER ${RSYSLOG_TEST_LOGS[2]}
7e8648
+$CHATTR $USER ${RSYSLOG_TEST_LOGS[0]}
7e8648
+$CHATTR $USER ${RSYSLOG_TEST_LOGS[1]}
7e8648
+$CHATTR $USER ${RSYSLOG_TEST_LOGS[2]}
7e8648
 
7e8648
 # create test configuration file
7e8648
 test_conf=${RSYSLOG_TEST_DIR}/test1.conf
7e8648
diff --git a/linux_os/guide/system/logging/ensure_rsyslog_log_file_configuration/rsyslog_files_groupownership/tests/include_is_root_IncludeConfig_is_other.fail.sh b/shared/templates/rsyslog_logfiles_attributes_modify/tests/include_is_root_IncludeConfig_is_root_RainerLogClause.pass.sh
7e8648
similarity index 65%
7e8648
rename from linux_os/guide/system/logging/ensure_rsyslog_log_file_configuration/rsyslog_files_groupownership/tests/include_is_root_IncludeConfig_is_other.fail.sh
7e8648
rename to shared/templates/rsyslog_logfiles_attributes_modify/tests/include_is_root_IncludeConfig_is_root_RainerLogClause.pass.sh
7e8648
index 9747e0b28b..6b81a77c2f 100755
7e8648
--- a/linux_os/guide/system/logging/ensure_rsyslog_log_file_configuration/rsyslog_files_groupownership/tests/include_is_root_IncludeConfig_is_other.fail.sh
7e8648
+++ b/shared/templates/rsyslog_logfiles_attributes_modify/tests/include_is_root_IncludeConfig_is_root_RainerLogClause.pass.sh
7e8648
@@ -1,23 +1,26 @@
7e8648
 #!/bin/bash
7e8648
 # platform = Red Hat Enterprise Linux 8,multi_platform_fedora,Oracle Linux 8,multi_platform_sle
7e8648
 
7e8648
-# Check rsyslog.conf with root group-owner log from rules and
7e8648
-# non root group-owner log from include() fails.
7e8648
+# Check rsyslog.conf with root user log from rules and
7e8648
+# root user log from include() passes.
7e8648
 
7e8648
 source $SHARED/rsyslog_log_utils.sh
7e8648
 
7e8648
-GROUP_ROOT=root
7e8648
+{{% if ATTRIBUTE == "owner" %}}
7e8648
+CHATTR="chown"
7e8648
+{{% else %}}
7e8648
+CHATTR="chgrp"
7e8648
+{{% endif %}}
7e8648
 
7e8648
-GROUP_TEST=testssg
7e8648
-groupadd $GROUP_TEST
7e8648
+USER=root
7e8648
 
7e8648
 # setup test data
7e8648
 create_rsyslog_test_logs 3
7e8648
 
7e8648
 # setup test log files ownership
7e8648
-chgrp $GROUP_ROOT ${RSYSLOG_TEST_LOGS[0]}
7e8648
-chgrp $GROUP_ROOT ${RSYSLOG_TEST_LOGS[1]}
7e8648
-chgrp $GROUP_TEST ${RSYSLOG_TEST_LOGS[2]}
7e8648
+$CHATTR $USER ${RSYSLOG_TEST_LOGS[0]}
7e8648
+$CHATTR $USER ${RSYSLOG_TEST_LOGS[1]}
7e8648
+$CHATTR $USER ${RSYSLOG_TEST_LOGS[2]}
7e8648
 
7e8648
 # create test configuration file
7e8648
 test_conf=${RSYSLOG_TEST_DIR}/test1.conf
7e8648
@@ -36,7 +39,8 @@ cat << EOF > ${test_conf2}
7e8648
 
7e8648
 #### RULES ####
7e8648
 
7e8648
-*.*     ${RSYSLOG_TEST_LOGS[2]}
7e8648
+
7e8648
+*.*     action(type="omfile" FileCreateMode="0640" fileOwner="root" fileGroup="root" File="${RSYSLOG_TEST_LOGS[2]}")
7e8648
 EOF
7e8648
 
7e8648
 # create rsyslog.conf configuration file
7e8648
diff --git a/linux_os/guide/system/logging/ensure_rsyslog_log_file_configuration/rsyslog_files_ownership/tests/include_multiline_is_root.pass.sh b/shared/templates/rsyslog_logfiles_attributes_modify/tests/include_multiline_is_root.pass.sh
7e8648
similarity index 81%
7e8648
rename from linux_os/guide/system/logging/ensure_rsyslog_log_file_configuration/rsyslog_files_ownership/tests/include_multiline_is_root.pass.sh
7e8648
rename to shared/templates/rsyslog_logfiles_attributes_modify/tests/include_multiline_is_root.pass.sh
7e8648
index d68cc2e67d..78b105abf3 100755
7e8648
--- a/linux_os/guide/system/logging/ensure_rsyslog_log_file_configuration/rsyslog_files_ownership/tests/include_multiline_is_root.pass.sh
7e8648
+++ b/shared/templates/rsyslog_logfiles_attributes_modify/tests/include_multiline_is_root.pass.sh
7e8648
@@ -6,14 +6,20 @@
7e8648
 
7e8648
 source $SHARED/rsyslog_log_utils.sh
7e8648
 
7e8648
+{{% if ATTRIBUTE == "owner" %}}
7e8648
+CHATTR="chown"
7e8648
+{{% else %}}
7e8648
+CHATTR="chgrp"
7e8648
+{{% endif %}}
7e8648
+
7e8648
 USER=root
7e8648
 
7e8648
 # setup test data
7e8648
 create_rsyslog_test_logs 2
7e8648
 
7e8648
 # setup test log files ownership
7e8648
-chown $USER ${RSYSLOG_TEST_LOGS[0]}
7e8648
-chown $USER ${RSYSLOG_TEST_LOGS[1]}
7e8648
+$CHATTR $USER ${RSYSLOG_TEST_LOGS[0]}
7e8648
+$CHATTR $USER ${RSYSLOG_TEST_LOGS[1]}
7e8648
 
7e8648
 # create test configuration file
7e8648
 test_conf=${RSYSLOG_TEST_DIR}/test1.conf
7e8648
diff --git a/linux_os/guide/system/logging/ensure_rsyslog_log_file_configuration/rsyslog_files_ownership/tests/is_other.fail.sh b/shared/templates/rsyslog_logfiles_attributes_modify/tests/is_other.fail.sh
7e8648
similarity index 70%
7e8648
rename from linux_os/guide/system/logging/ensure_rsyslog_log_file_configuration/rsyslog_files_ownership/tests/is_other.fail.sh
7e8648
rename to shared/templates/rsyslog_logfiles_attributes_modify/tests/is_other.fail.sh
7e8648
index 7edbb17ea1..1afe20823c 100755
7e8648
--- a/linux_os/guide/system/logging/ensure_rsyslog_log_file_configuration/rsyslog_files_ownership/tests/is_other.fail.sh
7e8648
+++ b/shared/templates/rsyslog_logfiles_attributes_modify/tests/is_other.fail.sh
7e8648
@@ -5,15 +5,23 @@
7e8648
 
7e8648
 source $SHARED/rsyslog_log_utils.sh
7e8648
 
7e8648
+{{% if ATTRIBUTE == "owner" %}}
7e8648
+ADDCOMMAND="useradd"
7e8648
+CHATTR="chown"
7e8648
+{{% else %}}
7e8648
+ADDCOMMAND="groupadd"
7e8648
+CHATTR="chgrp"
7e8648
+{{% endif %}}
7e8648
+
7e8648
 USER=testssg
7e8648
 
7e8648
-useradd $USER
7e8648
+$ADDCOMMAND $USER
7e8648
 
7e8648
 # setup test data
7e8648
 create_rsyslog_test_logs 1
7e8648
 
7e8648
 # setup test log file ownership
7e8648
-chown $USER ${RSYSLOG_TEST_LOGS[0]}
7e8648
+$CHATTR $USER ${RSYSLOG_TEST_LOGS[0]}
7e8648
 
7e8648
 # add rule with non-root user owned log file
7e8648
 cat << EOF > $RSYSLOG_CONF
7e8648
diff --git a/linux_os/guide/system/logging/ensure_rsyslog_log_file_configuration/rsyslog_files_ownership/tests/is_root.pass.sh b/shared/templates/rsyslog_logfiles_attributes_modify/tests/is_root.pass.sh
7e8648
similarity index 77%
7e8648
rename from linux_os/guide/system/logging/ensure_rsyslog_log_file_configuration/rsyslog_files_ownership/tests/is_root.pass.sh
7e8648
rename to shared/templates/rsyslog_logfiles_attributes_modify/tests/is_root.pass.sh
7e8648
index e0e518bc50..afce21fa27 100755
7e8648
--- a/linux_os/guide/system/logging/ensure_rsyslog_log_file_configuration/rsyslog_files_ownership/tests/is_root.pass.sh
7e8648
+++ b/shared/templates/rsyslog_logfiles_attributes_modify/tests/is_root.pass.sh
7e8648
@@ -5,13 +5,19 @@
7e8648
 
7e8648
 source $SHARED/rsyslog_log_utils.sh
7e8648
 
7e8648
+{{% if ATTRIBUTE == "owner" %}}
7e8648
+CHATTR="chown"
7e8648
+{{% else %}}
7e8648
+CHATTR="chgrp"
7e8648
+{{% endif %}}
7e8648
+
7e8648
 USER=root
7e8648
 
7e8648
 # setup test data
7e8648
 create_rsyslog_test_logs 1
7e8648
 
7e8648
 # setup test log file ownership
7e8648
-chown $USER ${RSYSLOG_TEST_LOGS[0]}
7e8648
+$CHATTR $USER ${RSYSLOG_TEST_LOGS[0]}
7e8648
 
7e8648
 # add rule with root user owned log file
7e8648
 cat << EOF > $RSYSLOG_CONF
7e8648
-- 
7e8648
2.39.1
7e8648