<def-group>
  <definition class="compliance" id="sshd_set_idle_timeout" version="1">
    <metadata>
      <title>Set OpenSSH Idle Timeout Interval</title>
      <affected family="unix">
        <platform>multi_platform_all</platform>
      </affected>
      <description>The SSH idle timeout interval should be set to an
      appropriate value.</description>
      <reference source="JL" ref_id="20140414" ref_url="test_attestation" />
      <!-- Fedora 20: <reference source="JL" ref_id="20140224" ref_url="test_attestation" /> -->
    </metadata>
    <criteria comment="SSH is not being used or conditions are met"
    operator="OR">
      <extend_definition comment="sshd service is disabled"
      definition_ref="service_sshd_disabled" />
      <criterion comment="Check ClientAliveInterval in /etc/ssh/sshd_config"
      test_ref="test_sshd_idle_timeout" />
    </criteria>
  </definition>

  <ind:textfilecontent54_test check="all" check_existence="all_exist"
  comment="timeout is configured" id="test_sshd_idle_timeout" version="1">
    <ind:object object_ref="object_sshd_idle_timeout" />
    <ind:state state_ref="state_timeout_value_upper_bound" />
    <ind:state state_ref="state_timeout_value_lower_bound" />
  </ind:textfilecontent54_test>

  <ind:textfilecontent54_object id="object_sshd_idle_timeout" version="2">
    <ind:filepath>/etc/ssh/sshd_config</ind:filepath>
    <ind:pattern operation="pattern match">^[\s]*(?i)ClientAliveInterval[\s]+(\d+)[\s]*(?:|(?:#.*))?$</ind:pattern>
    <ind:instance datatype="int">1</ind:instance>
  </ind:textfilecontent54_object>

  <ind:textfilecontent54_state comment="upper bound of ClientAliveInterval in seconds"
  id="state_timeout_value_upper_bound" version="1">
    <ind:subexpression datatype="int" operation="less than or equal" var_check="all"
    var_ref="sshd_idle_timeout_value" />
  </ind:textfilecontent54_state>

  <ind:textfilecontent54_state comment="lower bound of ClientAliveInterval in seconds"
  id="state_timeout_value_lower_bound" version="1">
    <ind:subexpression datatype="int" operation="greater than">0</ind:subexpression>
  </ind:textfilecontent54_state>

  <external_variable comment="timeout value" datatype="int"
  id="sshd_idle_timeout_value" version="1" />

</def-group>
