<?xml version='1.0' encoding='utf-8'?>
<oval-def:oval_definitions xmlns:ind="http://oval.mitre.org/XMLSchema/oval-definitions-5#independent" xmlns:oval="http://oval.mitre.org/XMLSchema/oval-common-5" xmlns:oval-def="http://oval.mitre.org/XMLSchema/oval-definitions-5" xmlns:unix="http://oval.mitre.org/XMLSchema/oval-definitions-5#unix" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://oval.mitre.org/XMLSchema/oval-common-5 oval-common-schema.xsd  http://oval.mitre.org/XMLSchema/oval-definitions-5 oval-definitions-schema.xsd  http://oval.mitre.org/XMLSchema/oval-definitions-5#independent independent-definitions-schema.xsd  http://oval.mitre.org/XMLSchema/oval-definitions-5#unix unix-definitions-schema.xsd  http://oval.mitre.org/XMLSchema/oval-definitions-5#linux linux-definitions-schema.xsd">
  <oval-def:generator>
    <oval:product_name>OVALFileLinker from SCAP Security Guide</oval:product_name>
    <oval:product_version>ssg: [0, 1, 80], python: 3.10.12</oval:product_version>
    <oval:schema_version>5.11.2</oval:schema_version>
    <oval:timestamp>2025-11-24T17:59:05</oval:timestamp>
  </oval-def:generator>
  <oval-def:definitions>
    <oval-def:definition id="oval:ssg-file_groupownerships_var_log:def:1" version="1" class="compliance">
      <oval-def:metadata>
        <oval-def:title>Verify ownership of log files</oval-def:title>
        <oval-def:affected family="unix">
          <oval-def:platform>Ubuntu 22.04</oval-def:platform>
        </oval-def:affected>
        <oval-def:reference ref_id="file_groupownerships_var_log" source="ssg" />
        <oval-def:description>Group owner of /var/log/* should be root or adm.</oval-def:description>
      </oval-def:metadata>
      <oval-def:criteria comment="Check group ownership of /var/log/*" operator="AND">
        <oval-def:criterion test_ref="oval:ssg-test_group_ownership_var_log:tst:1" />
      </oval-def:criteria>
    </oval-def:definition>
  </oval-def:definitions>
  <oval-def:tests>
    <unix:file_test id="oval:ssg-test_group_ownership_var_log:tst:1" version="1" check="all" comment="/var/log/* group owner is root|adm" state_operator="OR">
      <unix:object object_ref="oval:ssg-object_group_ownership_var_log:obj:1" />
      <unix:state state_ref="oval:ssg-state_group_ownership_adm_var_log_auth_log:ste:1" />
      <unix:state state_ref="oval:ssg-state_group_ownership_root_var_log_auth_log:ste:1" />
      <unix:state state_ref="oval:ssg-file_groupownerships_var_log_group_only_has_sys_uids:ste:1" />
    </unix:file_test>
  </oval-def:tests>
  <oval-def:objects>
    <ind:textfilecontent54_object id="oval:ssg-object_adm_gid:obj:1" version="1" comment="gid of the dedicated adm group">
      <ind:filepath>/etc/group</ind:filepath>
      <ind:pattern operation="pattern match">^adm:\w+:(\w+):.*</ind:pattern>
      <ind:instance datatype="int" operation="equals">1</ind:instance>
    </ind:textfilecontent54_object>
    <unix:file_object id="oval:ssg-object_group_ownership_var_log:obj:1" version="1" comment="/var/log/*">
      <unix:behaviors recurse="directories" recurse_direction="down" max_depth="-1" recurse_file_system="all" />
      <unix:path>/var/log</unix:path>
      <unix:filename operation="pattern match">.*</unix:filename>
      <oval-def:filter action="exclude">oval:ssg-file_groupownerships_var_log_exclude_symlinks:ste:1</oval-def:filter>
      <oval-def:filter action="exclude">oval:ssg-file_groupownerships_var_log_exclude_files_apt:ste:1</oval-def:filter>
      <oval-def:filter action="exclude">oval:ssg-file_groupownerships_var_log_exclude_files_auth_log:ste:1</oval-def:filter>
      <oval-def:filter action="exclude">oval:ssg-file_groupownerships_var_log_exclude_files_bwtmp:ste:1</oval-def:filter>
      <oval-def:filter action="exclude">oval:ssg-file_groupownerships_var_log_exclude_files_cloudinit:ste:1</oval-def:filter>
      <oval-def:filter action="exclude">oval:ssg-file_groupownerships_var_log_exclude_files_gdm:ste:1</oval-def:filter>
      <oval-def:filter action="exclude">oval:ssg-file_groupownerships_var_log_exclude_files_journal:ste:1</oval-def:filter>
      <oval-def:filter action="exclude">oval:ssg-file_groupownerships_var_log_exclude_files_landscape:ste:1</oval-def:filter>
      <oval-def:filter action="exclude">oval:ssg-file_groupownerships_var_log_exclude_files_lastlog:ste:1</oval-def:filter>
      <oval-def:filter action="exclude">oval:ssg-file_groupownerships_var_log_exclude_files_localmessages:ste:1</oval-def:filter>
      <oval-def:filter action="exclude">oval:ssg-file_groupownerships_var_log_exclude_files_messages:ste:1</oval-def:filter>
      <oval-def:filter action="exclude">oval:ssg-file_groupownerships_var_log_exclude_files_secure:ste:1</oval-def:filter>
      <oval-def:filter action="exclude">oval:ssg-file_groupownerships_var_log_exclude_files_sssd:ste:1</oval-def:filter>
      <oval-def:filter action="exclude">oval:ssg-file_groupownerships_var_log_exclude_files_syslog:ste:1</oval-def:filter>
      <oval-def:filter action="exclude">oval:ssg-file_groupownerships_var_log_exclude_files_waagent:ste:1</oval-def:filter>
    </unix:file_object>
    <ind:textfilecontent54_object id="oval:ssg-empty_members_in_etc_group:obj:1" version="1" comment="Groups with no members">
      <ind:filepath>/etc/group</ind:filepath>
      <ind:pattern operation="pattern match" var_ref="oval:ssg-variable_file_groupownerships_var_log_group_regex:var:1" var_check="at least one" />
      <ind:instance datatype="int" operation="greater than or equal">1</ind:instance>
    </ind:textfilecontent54_object>
    <ind:textfilecontent54_object id="oval:ssg-obj_file_groupownerships_var_log_gids_with_only_sys_uids:obj:1" version="1">
      <ind:filepath>/etc/passwd</ind:filepath>
      <ind:pattern operation="pattern match" var_ref="oval:ssg-variable_file_groupownerships_var_log_regex:var:1" var_check="at least one" />
      <ind:instance datatype="int" operation="greater than or equal">1</ind:instance>
    </ind:textfilecontent54_object>
    <ind:textfilecontent54_object id="oval:ssg-obj_file_groupownerships_var_log_sys_uid:obj:1" version="1">
      <ind:filepath>/etc/passwd</ind:filepath>
      <ind:pattern operation="pattern match">^[^:]+:[^:]*:(\d\d?\d?):.*$</ind:pattern>
      <ind:instance datatype="int" operation="greater than or equal">1</ind:instance>
    </ind:textfilecontent54_object>
  </oval-def:objects>
  <oval-def:states>
    <unix:file_state id="oval:ssg-file_groupownerships_var_log_exclude_symlinks:ste:1" version="1" operator="AND">
      <unix:type operation="equals">symbolic link</unix:type>
    </unix:file_state>
    <unix:file_state id="oval:ssg-state_group_ownership_adm_var_log_auth_log:ste:1" version="1" operator="AND">
      <unix:group_id datatype="int" operation="equals" var_ref="oval:ssg-var_adm_gid:var:1" />
    </unix:file_state>
    <unix:file_state id="oval:ssg-state_group_ownership_root_var_log_auth_log:ste:1" version="1" operator="AND">
      <unix:group_id datatype="int" operation="equals">0</unix:group_id>
    </unix:file_state>
    <unix:file_state id="oval:ssg-file_groupownerships_var_log_exclude_files_apt:ste:1" version="1" operator="AND">
      <unix:filepath operation="pattern match">^/var/log/apt/.*</unix:filepath>
    </unix:file_state>
    <unix:file_state id="oval:ssg-file_groupownerships_var_log_exclude_files_landscape:ste:1" version="1" operator="AND">
      <unix:filepath operation="pattern match">^/var/log/landscape/.*</unix:filepath>
    </unix:file_state>
    <unix:file_state id="oval:ssg-file_groupownerships_var_log_exclude_files_auth_log:ste:1" version="1" operator="AND">
      <unix:filename>auth.log</unix:filename>
    </unix:file_state>
    <unix:file_state id="oval:ssg-file_groupownerships_var_log_exclude_files_bwtmp:ste:1" version="1" operator="AND">
      <unix:filename operation="pattern match">^[bw]tmp((\.|-).*)?$</unix:filename>
    </unix:file_state>
    <unix:file_state id="oval:ssg-file_groupownerships_var_log_exclude_files_cloudinit:ste:1" version="1" operator="AND">
      <unix:filename operation="pattern match">^cloud-init\.log.*</unix:filename>
    </unix:file_state>
    <unix:file_state id="oval:ssg-file_groupownerships_var_log_exclude_files_gdm:ste:1" version="1" operator="AND">
      <unix:filepath operation="pattern match">^/var/log/(gdm|gdm3)/.*$</unix:filepath>
    </unix:file_state>
    <unix:file_state id="oval:ssg-file_groupownerships_var_log_exclude_files_journal:ste:1" version="1" operator="AND">
      <unix:filename operation="pattern match">^.*\.journal.*$</unix:filename>
    </unix:file_state>
    <unix:file_state id="oval:ssg-file_groupownerships_var_log_exclude_files_lastlog:ste:1" version="1" operator="AND">
      <unix:filename operation="pattern match">^lastlog.*$</unix:filename>
    </unix:file_state>
    <unix:file_state id="oval:ssg-file_groupownerships_var_log_exclude_files_localmessages:ste:1" version="1" operator="AND">
      <unix:filename operation="pattern match">^localmessages.*$</unix:filename>
    </unix:file_state>
    <unix:file_state id="oval:ssg-file_groupownerships_var_log_exclude_files_messages:ste:1" version="1" operator="AND">
      <unix:filename>messages</unix:filename>
    </unix:file_state>
    <unix:file_state id="oval:ssg-file_groupownerships_var_log_exclude_files_secure:ste:1" version="1" operator="AND">
      <unix:filename operation="pattern match">^secure.*$</unix:filename>
    </unix:file_state>
    <unix:file_state id="oval:ssg-file_groupownerships_var_log_exclude_files_sssd:ste:1" version="1" operator="AND">
      <unix:filepath operation="pattern match">^/var/log/sssd/.*$</unix:filepath>
    </unix:file_state>
    <unix:file_state id="oval:ssg-file_groupownerships_var_log_exclude_files_syslog:ste:1" version="1" operator="AND">
      <unix:filename>syslog</unix:filename>
    </unix:file_state>
    <unix:file_state id="oval:ssg-file_groupownerships_var_log_exclude_files_waagent:ste:1" version="1" operator="AND">
      <unix:filename operation="pattern match">^waagent\.log.*$</unix:filename>
    </unix:file_state>
    <unix:file_state id="oval:ssg-file_groupownerships_var_log_group_only_has_sys_uids:ste:1" version="1" operator="AND">
      <unix:group_id datatype="int" var_ref="oval:ssg-empty_group_ids:var:1" var_check="at least one" />
    </unix:file_state>
  </oval-def:states>
  <oval-def:variables>
    <oval-def:local_variable id="oval:ssg-var_adm_gid:var:1" version="1" datatype="int" comment="Retrieve the gid of adm group">
      <oval-def:object_component item_field="subexpression" object_ref="oval:ssg-object_adm_gid:obj:1" />
    </oval-def:local_variable>
    <oval-def:local_variable id="oval:ssg-empty_group_ids:var:1" version="1" datatype="int" comment="Group IDs with no members">
      <oval-def:object_component item_field="subexpression" object_ref="oval:ssg-empty_members_in_etc_group:obj:1" />
    </oval-def:local_variable>
    <oval-def:local_variable id="oval:ssg-variable_file_groupownerships_var_log_group_regex:var:1" version="1" datatype="string" comment="gid rows retrieved from /etc/passwd">
      <oval-def:concat>
        <oval-def:literal_component>^[^:]+:[^:]*:(</oval-def:literal_component>
        <oval-def:object_component item_field="subexpression" object_ref="oval:ssg-obj_file_groupownerships_var_log_gids_with_only_sys_uids:obj:1" />
        <oval-def:literal_component>):$</oval-def:literal_component>
      </oval-def:concat>
    </oval-def:local_variable>
    <oval-def:local_variable id="oval:ssg-variable_file_groupownerships_var_log_regex:var:1" version="1" datatype="string" comment="uid rows retrieved from /etc/passwd">
      <oval-def:concat>
        <oval-def:literal_component>^[^:]*:[^:]*:</oval-def:literal_component>
        <oval-def:object_component item_field="subexpression" object_ref="oval:ssg-obj_file_groupownerships_var_log_sys_uid:obj:1" />
        <oval-def:literal_component>:(\d+):.*$</oval-def:literal_component>
      </oval-def:concat>
    </oval-def:local_variable>
  </oval-def:variables>
</oval-def:oval_definitions>