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

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