<def-group>
  <definition class="compliance" id="sshd_allow_only_protocol2" version="1">
    {{{ oval_metadata("The OpenSSH daemon should be running protocol 2.") }}}
    <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" />
        <criteria comment="SSH version is equal or higher than 7.4 or it is configured with protocol 2" operator="OR">
          <extend_definition comment="OpenSSH version 7.4 or higher supports only protocol 2" definition_ref="sshd_version_equal_or_higher_than_74" />
          <criterion comment="Check Protocol in /etc/ssh/sshd_config"
          test_ref="test_sshd_allow_only_protocol2" />
        </criteria>
      </criteria>
    </criteria>
  </definition>
  <ind:textfilecontent54_test check="all" check_existence="all_exist"
  comment="sshd uses protocol 2" id="test_sshd_allow_only_protocol2" version="1">
    <ind:object object_ref="object_sshd_allow_only_protocol2" />
  </ind:textfilecontent54_test>
  <ind:textfilecontent54_object id="object_sshd_allow_only_protocol2" version="3">
    <ind:filepath>/etc/ssh/sshd_config</ind:filepath>
    <ind:pattern operation="pattern match">^[\s]*(?i)Protocol[\s]+2[\s]*(?:|(?:#.*))?$</ind:pattern>
    <ind:instance datatype="int">1</ind:instance>
  </ind:textfilecontent54_object>
</def-group>
