<def-group>
  <definition class="compliance" id="set_password_hashing_algorithm_systemauth" version="1">
    {{{ oval_metadata("The password hashing algorithm should be set correctly in /etc/pam.d/system-auth.") }}}
    <criteria operator="AND">
      <criterion test_ref="test_pam_unix_sha512" />
      {{%- if product == "rhel7" %}}
      <extend_definition comment="check /etc/pam.d/password-auth for correct settings" definition_ref="set_password_hashing_algorithm_passwordauth" />
      {{%- endif %}}
    </criteria>
  </definition>

  <ind:textfilecontent54_test check="all" check_existence="at_least_one_exists" comment="check /etc/pam.d/system-auth for correct settings" id="test_pam_unix_sha512" version="1">
    <ind:object object_ref="object_pam_unix_sha512" />
  </ind:textfilecontent54_test>

  <ind:textfilecontent54_object comment="check /etc/pam.d/system-auth for correct settings" id="object_pam_unix_sha512" version="1">
    {{% if product in ['sle12', 'sle15'] %}}
      <ind:filepath>/etc/pam.d/common-password</ind:filepath>
      <ind:pattern operation="pattern match">^[\s]*password[\s]+(?:(?:required))[\s]+pam_unix\.so[\s]+.*sha512.*$</ind:pattern>
    {{% else %}}
      <ind:filepath>/etc/pam.d/system-auth</ind:filepath>
      <ind:pattern operation="pattern match">^[\s]*password[\s]+(?:(?:required)|(?:sufficient))[\s]+pam_unix\.so[\s]+.*sha512.*$</ind:pattern>
    {{% endif %}}
    <ind:instance datatype="int">1</ind:instance>
  </ind:textfilecontent54_object>

</def-group>
