<def-group>
  <definition class="compliance" id="sshd_use_approved_ciphers_ordered_stig" version="1">
    {{{ oval_metadata("Limit the ciphers to those which are FIPS-approved.") }}}
    <criteria operator="AND">
      <extend_definition comment="Installed OS is FIPS certified" definition_ref="installed_OS_is_FIPS_certified" />
      <criteria comment="SSH is configured correctly or is not installed"
      operator="OR">
        <criteria comment="sshd is not installed" operator="AND">
          <extend_definition comment="sshd is not required or requirement is unset"
          definition_ref="sshd_not_required_or_unset" />
          <extend_definition comment="rpm package openssh-server removed"
          definition_ref="package_openssh-server_removed" />
        </criteria>
        <criteria comment="sshd is installed and configured" operator="AND">
          <extend_definition comment="sshd is required or requirement is unset"
          definition_ref="sshd_required_or_unset" />
          <extend_definition comment="rpm package openssh-server installed"
          definition_ref="package_openssh-server_installed" />
          <criterion comment="Check the Cipers list in /etc/ssh/sshd_config"
          test_ref="test_sshd_use_approved_ciphers_ordered_stig" />
        </criteria>
      </criteria>
    </criteria>
  </definition>

  <ind:textfilecontent54_test check="all" check_existence="all_exist"
  comment="tests the value of Ciphers setting in the /etc/ssh/sshd_config file"
  id="test_sshd_use_approved_ciphers_ordered_stig" version="1">
    <ind:object object_ref="obj_sshd_use_approved_ciphers_ordered_stig" />
  </ind:textfilecontent54_test>

  <ind:textfilecontent54_object id="obj_sshd_use_approved_ciphers_ordered_stig" version="1">
    <ind:filepath>/etc/ssh/sshd_config</ind:filepath>
    <ind:pattern operation="pattern match">^[\s]*(?i)Ciphers(?-i)[\s]+(?=[\w]+)(aes256-ctr(?=[\w,]+|$),?)?(aes192-ctr(?=[\w,]+|$),?)?(aes128-ctr)?[\s]*(?:#.*)?$</ind:pattern>
    <ind:instance datatype="int">1</ind:instance>
  </ind:textfilecontent54_object>

</def-group>
