<def-group>
  <definition class="compliance" id="sshd_users_groups" version="1">
    <metadata>
      <title>Ensure SSH Displays Last Login Details</title>
      <affected family="unix">
        <platform>CentOS 4</platform>
		<platform>CentOS 5</platform>
		<platform>Red Hat Enterprise Linux 4</platform>
		<platform>Red Hat Enterprise Linux 5</platform>
      </affected>
      <description>The system must display the date and time of the last successful account login upon login.</description>
    </metadata>
    <criteria comment="SSH is not being used or conditions are met" operator="OR">
      <extend_definition comment="rpm package openssh-server removed"
      definition_ref="package_openssh-server_removed" />
      <criterion comment="Check pam_access in /etc/pam.d/sshd"
      test_ref="test_sshd_pam_access" />
      <criterion comment="Check AllowGroups or AllowUsers in /etc/ssh/sshd_config"
      test_ref="test_sshd_users_groups" />
    </criteria>
  </definition>

  <ind:textfilecontent54_test check="all" check_existence="all_exist"
  comment="pam_access exists and does not include the silent option" id="test_sshd_pam_access" version="1">
    <ind:object object_ref="object_sshd_pam_access" />
  </ind:textfilecontent54_test>
  <ind:textfilecontent54_object id="object_sshd_pam_access" version="2">
    <ind:path>/etc/pam.d</ind:path>
    <ind:filename>sshd</ind:filename>
    <ind:pattern operation="pattern match">^[\s]*account[\s]+required[\s]+pam_access\.so</ind:pattern>
    <ind:instance datatype="int">1</ind:instance>
  </ind:textfilecontent54_object>

  <ind:textfilecontent54_test check="all" check_existence="all_exist"
  comment="AllowGroups or AllowUsers exist" id="test_sshd_users_groups" version="1">
    <ind:object object_ref="object_sshd_users_groups" />
  </ind:textfilecontent54_test>
  <ind:textfilecontent54_object id="object_sshd_users_groups" version="2">
    <ind:path>/etc/ssh</ind:path>
    <ind:filename>sshd_config</ind:filename>
    <ind:pattern operation="pattern match">^[\s]*(?i)(AllowGroups|AllowUsers)[\s]*</ind:pattern>
    <ind:instance operation="greater than or equal" datatype="int">1</ind:instance>
  </ind:textfilecontent54_object>

</def-group>
