[PATCH 08/13] OVAL + remediation
Shawn Wells
shawn.d.wells at gmail.com
Sat Sep 7 19:23:14 UTC 2013
-------------- next part --------------
>From b0ab8e6238ccf2ffa5b5c5fec4fc3ca5e26b0e74 Mon Sep 17 00:00:00 2001
From: Shawn Wells <shawn at redhat.com>
Date: Sat, 7 Sep 2013 12:13:50 -0400
Subject: [PATCH 08/13] OVAL + remediation: disable_host_auth
- Updated OVAL ID and filename to match XCCDF
- filename --> filepath
- Added remediation
Remediation Testing:
[root at rhel6 checks]# grep HostbasedAuth /etc/ssh/sshd_config
HostbasedAuthentication yes
[root at rhel6 checks]# ./testcheck.py disable_host_auth.xml
Evaluating with OVAL tempfile : /tmp/disable_host_auth0BR3Ka.xml
Writing results to : /tmp/disable_host_auth0BR3Ka.xml-results
Definition oval:scap-security-guide.testing:def:162: false
Definition oval:scap-security-guide.testing:def:127: false
Definition oval:scap-security-guide.testing:def:125: false
Evaluation done.
[root at rhel6 checks]# bash ../fixes/bash/disable_host_auth.sh
[root at rhel6 checks]# ./testcheck.py disable_host_auth.xml
Evaluating with OVAL tempfile : /tmp/disable_host_authkL3s3y.xml
Writing results to : /tmp/disable_host_authkL3s3y.xml-results
Definition oval:scap-security-guide.testing:def:162: true
Definition oval:scap-security-guide.testing:def:127: false
Definition oval:scap-security-guide.testing:def:125: false
Evaluation done.
[root at rhel6 checks]#
---
RHEL6/input/checks/disable_host_auth.xml | 29 +++++++++++++++++++
.../input/checks/sshd_hostbasedauthentication.xml | 30 --------------------
RHEL6/input/fixes/bash/disable_host_auth.sh | 5 +++
RHEL6/input/services/ssh.xml | 2 +-
4 files changed, 35 insertions(+), 31 deletions(-)
create mode 100644 RHEL6/input/checks/disable_host_auth.xml
delete mode 100644 RHEL6/input/checks/sshd_hostbasedauthentication.xml
create mode 100644 RHEL6/input/fixes/bash/disable_host_auth.sh
diff --git a/RHEL6/input/checks/disable_host_auth.xml b/RHEL6/input/checks/disable_host_auth.xml
new file mode 100644
index 0000000..37b01c4
--- /dev/null
+++ b/RHEL6/input/checks/disable_host_auth.xml
@@ -0,0 +1,29 @@
+<def-group>
+ <definition class="compliance" id="disable_host_auth" version="2">
+ <metadata>
+ <title>Disable Host-Based Authentication</title>
+ <affected family="unix">
+ <platform>Red Hat Enterprise Linux 6</platform>
+ </affected>
+ <description>SSH host-based authentication should be disabled.</description>
+ <reference source="MED" ref_id="20130813" 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 HostbasedAuthentication in /etc/ssh/sshd_config"
+ test_ref="test_sshd_hostbasedauthentication" />
+ </criteria>
+ </definition>
+ <ind:textfilecontent54_test check="all" check_existence="none_exist"
+ comment="sshd HostbasedAuthentication" id="test_sshd_hostbasedauthentication"
+ version="1">
+ <ind:object object_ref="object_sshd_hostbasedauthentication" />
+ </ind:textfilecontent54_test>
+ <ind:textfilecontent54_object id="object_sshd_hostbasedauthentication" version="1">
+ <ind:filepath>/etc/ssh/sshd_config</ind:filepath>
+ <ind:pattern operation="pattern match">^[\s]*(?i)HostbasedAuthentication[\s]+yes[\s]*$</ind:pattern>
+ <ind:instance datatype="int">1</ind:instance>
+ </ind:textfilecontent54_object>
+</def-group>
diff --git a/RHEL6/input/checks/sshd_hostbasedauthentication.xml b/RHEL6/input/checks/sshd_hostbasedauthentication.xml
deleted file mode 100644
index f3143e7..0000000
--- a/RHEL6/input/checks/sshd_hostbasedauthentication.xml
+++ /dev/null
@@ -1,30 +0,0 @@
-<def-group>
- <definition class="compliance" id="sshd_hostbasedauthentication" version="2">
- <metadata>
- <title>Disable Host-Based Authentication</title>
- <affected family="unix">
- <platform>Red Hat Enterprise Linux 6</platform>
- </affected>
- <description>SSH host-based authentication should be disabled.</description>
- <reference source="MED" ref_id="20130813" 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 HostbasedAuthentication in /etc/ssh/sshd_config"
- test_ref="test_sshd_hostbasedauthentication" />
- </criteria>
- </definition>
- <ind:textfilecontent54_test check="all" check_existence="none_exist"
- comment="sshd HostbasedAuthentication" id="test_sshd_hostbasedauthentication"
- version="1">
- <ind:object object_ref="object_sshd_hostbasedauthentication" />
- </ind:textfilecontent54_test>
- <ind:textfilecontent54_object id="object_sshd_hostbasedauthentication" version="1">
- <ind:path>/etc/ssh</ind:path>
- <ind:filename>sshd_config</ind:filename>
- <ind:pattern operation="pattern match">^[\s]*(?i)HostbasedAuthentication[\s]+yes[\s]*$</ind:pattern>
- <ind:instance datatype="int">1</ind:instance>
- </ind:textfilecontent54_object>
-</def-group>
diff --git a/RHEL6/input/fixes/bash/disable_host_auth.sh b/RHEL6/input/fixes/bash/disable_host_auth.sh
new file mode 100644
index 0000000..a7f041b
--- /dev/null
+++ b/RHEL6/input/fixes/bash/disable_host_auth.sh
@@ -0,0 +1,5 @@
+grep -q ^HostbasedAuthentication /etc/ssh/sshd_config && \
+ sed -i "s/HostbasedAuthentication.*/HostbasedAuthentication no/g" /etc/ssh/sshd_config
+if ! [ $? -eq 0 ]; then
+ echo "HostbasedAuthentication no" >> /etc/ssh/sshd_config
+fi
diff --git a/RHEL6/input/services/ssh.xml b/RHEL6/input/services/ssh.xml
index a67ddd1..cb6459b 100644
--- a/RHEL6/input/services/ssh.xml
+++ b/RHEL6/input/services/ssh.xml
@@ -240,7 +240,7 @@ SSH trust relationships mean a compromise on one host
can allow an attacker to move trivially to other hosts.
</rationale>
<ident cce="27091-8" />
-<oval id="sshd_hostbasedauthentication" />
+<oval id="disable_host_auth" />
<ref disa="765,766"/>
<tested by="DS" on="20121024"/>
</Rule>
--
1.7.1
More information about the scap-security-guide
mailing list