<def-group>
  <definition class="compliance" id="{{{ rule_id }}}" version="1">
    {{{ oval_metadata("Elevate The SELinux Context When An Administrator Calls The Sudo Command") }}}
    <criteria comment="Sudo elevate the SELinux type and role to sysadm_t and sysadm_r"
    operator="AND" >
      <criterion comment="check configuration in /etc/sudoers and /etc/sudoers.d/*"
      test_ref="test_sudo_selinux_elevation_type" />
      <criterion comment="check configuration in /etc/sudoers and /etc/sudoers.d/*"
      test_ref="test_sudo_selinux_elevation_role" />
    </criteria>
  </definition>

  <ind:textfilecontent54_test check="all" check_existence="all_exist"
  comment="check correct configuration in /etc/sudoers and /etc/sudoers.d/*"
  id="test_sudo_selinux_elevation_type" version="1">
    <ind:object object_ref="obj_sudo_selinux_elevation_type"/>
    <ind:state state_ref="state_sudo_selinux_elevation_type" />
  </ind:textfilecontent54_test>

  <ind:textfilecontent54_test check="all" check_existence="all_exist"
  comment="check correct configuration in /etc/sudoers and /etc/sudoers.d/*"
  id="test_sudo_selinux_elevation_role" version="1">
    <ind:object object_ref="obj_sudo_selinux_elevation_role"/>
    <ind:state state_ref="state_sudo_selinux_elevation_role" />
  </ind:textfilecontent54_test>

  <ind:textfilecontent54_object id="obj_sudo_selinux_elevation_type" version="1">
    <ind:filepath operation="pattern match">^/etc/sudoers(\.d/.*)?$</ind:filepath>
    <ind:pattern operation="pattern match">^\s*%\w+.*TYPE=(\w+).*$</ind:pattern>
    <ind:instance datatype="int" operation="greater than or equal">1</ind:instance>
  </ind:textfilecontent54_object>

  <ind:textfilecontent54_object id="obj_sudo_selinux_elevation_role" version="1">
    <ind:filepath operation="pattern match">^/etc/sudoers(\.d/.*)?$</ind:filepath>
    <ind:pattern operation="pattern match">^\s*%\w+.*ROLE=(\w+).*$</ind:pattern>
    <ind:instance datatype="int" operation="greater than or equal">1</ind:instance>
  </ind:textfilecontent54_object>

  <ind:textfilecontent54_state id="state_sudo_selinux_elevation_type"
  version="1">
    <ind:subexpression operation="equals">sysadm_t</ind:subexpression>
  </ind:textfilecontent54_state>

  <ind:textfilecontent54_state id="state_sudo_selinux_elevation_role"
  version="1">
    <ind:subexpression operation="equals">sysadm_r</ind:subexpression>
  </ind:textfilecontent54_state>
</def-group>
