From b8419800dd27abad20a5f631ea71944ceb43664f Mon Sep 17 00:00:00 2001
From: Jan Lieskovsky <jlieskov@redhat.com>
Date: Mon, 24 Feb 2014 17:52:03 +0100
Subject: [PATCH] [shared] sshd_set_idle_timeout - when doing the check be sure
 to check also the lower bound of ClientAliveInterval value.

Signed-off-by: Jan Lieskovsky <jlieskov@redhat.com>
---
 Fedora/input/checks/sshd_set_idle_timeout.xml | 34 +--------------------------
 shared/oval/sshd_set_idle_timeout.xml         | 19 ++++++++++++---
 2 files changed, 17 insertions(+), 36 deletions(-)
 mode change 100644 => 120000 Fedora/input/checks/sshd_set_idle_timeout.xml

diff --git a/Fedora/input/checks/sshd_set_idle_timeout.xml b/Fedora/input/checks/sshd_set_idle_timeout.xml
deleted file mode 100644
index df3336a..0000000
--- a/Fedora/input/checks/sshd_set_idle_timeout.xml
+++ /dev/null
@@ -1,33 +0,0 @@
-<def-group>
-  <definition class="compliance" id="sshd_set_idle_timeout" version="1">
-    <metadata>
-      <title>Set OpenSSH Idle Timeout Interval</title>
-      <affected family="unix">
-        <platform>Fedora 19</platform>
-      </affected>
-      <description>The SSH idle timeout interval should be set to an appropriate value.</description>
-    </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" />
-  </ind:textfilecontent54_test>
-
-  <ind:textfilecontent54_object id="object_sshd_idle_timeout" version="1">
-    <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="ClientAliveInterval in seconds" id="state_timeout_value" version="1">
-    <ind:subexpression datatype="int" operation="less than or equal" var_check="all" var_ref="sshd_idle_timeout_value" />
-  </ind:textfilecontent54_state>
-
-  <external_variable comment="timeout value" datatype="int" id="sshd_idle_timeout_value" version="1" />
-
-</def-group>
diff --git a/Fedora/input/checks/sshd_set_idle_timeout.xml b/Fedora/input/checks/sshd_set_idle_timeout.xml
new file mode 120000
index 0000000..2fd18f6
--- /dev/null
+++ b/Fedora/input/checks/sshd_set_idle_timeout.xml
@@ -0,0 +1 @@
+../../../shared/oval/sshd_set_idle_timeout.xml
\ No newline at end of file
diff --git a/shared/oval/sshd_set_idle_timeout.xml b/shared/oval/sshd_set_idle_timeout.xml
index ad63830..f891e65 100644
--- a/shared/oval/sshd_set_idle_timeout.xml
+++ b/shared/oval/sshd_set_idle_timeout.xml
@@ -5,10 +5,12 @@
       <affected family="unix">
         <platform>Red Hat Enterprise Linux 6</platform>
         <platform>Red Hat Enterprise Linux 7</platform>
+        <platform>Fedora 20</platform>
       </affected>
       <description>The SSH idle timeout interval should be set to an
       appropriate value.</description>
       <reference source="MED" ref_id="20130813" 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">
@@ -18,21 +20,32 @@
       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" />
+    <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="1">
     <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="ClientAliveInterval in seconds"
-  id="state_timeout_value" version="1">
+
+  <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>
-- 
1.8.3.1

