zoukankan      html  css  js  c++  java
  • OVAL学习笔记

                很多其它好文章:http://blog.csdn.net/aap159951/article/details/51131937

           OVAL由MITRE公司开发。是一种用来定义检查项、脆弱点等技术细节的一种描写叙述语言。OVAL相同使用标准的XML格式组织其内容。

    它提供了足够的灵活性,可以用于分析Windows、Linux、Unix以及各种嵌入式操作系统的系统状态、漏洞、配置、补丁等情况,并且还能用于描写叙述測试报告。

    OVAL可以清晰地对与安全相关的检查点作出描写叙述,并且这样的描写叙述是机器可读的。可以直接应用到自己主动化的安全扫描中。OVAL的核心是“公开”(Open)。这就意味着不论什么人都可以为OVAL的发展作出自己的贡献,共享知识和经验,避免反复劳动。

    实际上XCCDF设计的目标是可以支持与多种基础配置检查技术交互。

    当中推荐的。默认的检查技术是MITRE公司的OVAL。

    在实际的SCAP应用中。XCCDF和OVAL往往是成对出现,XCCDF定义检查单。而OVAL定义每一个检查项的详细实施细节。


    OVAL以XML格式描写叙述。包括例如以下几种XML格式(Schema):OVAL定义格式(OVAL Definition Schema),OVAL系统特性格式(OVAL System Characteristics Schema)与OVAL结果格式(OVAL Result Schema)。OVAL系统特性格式用于描写叙述系统信息快照。该快照可用于和OVAL定义文件进行匹配以得出评估结果,OVAL结果格式用于描写叙述评估结果。

    在三种OVAL格式中,OVAL定义格式占有较为重要的位置,OVAL定义格式提供了一种机器可读的对系统进行安全评估的操作指南,它可用来描写叙述系统的配置信息、分析系统的安全状态、报告评估结果等。典型的OVAL定义格式的XML文档由定义(Definition)、測试(Test)、对象(Object)、状态(State)和变量(Variable)等要素构成,其结构比較简单。主要是将各个要素以枚举的方式列出。例如以下图所看到的。 

    “定义”是最重要的构成元素,它会引用一个或多个“測试”,依据“測试”的结果综合判定总体的结果,“測试”使用“对象”和“状态”与系统交互并得出检查结果,“状态”能够使用固定值或引用“变量”中的值。OVAL各组成要素之间的逻辑关系例如以下图。

    在下图中,Definition1包括两个“測试”Test1和Test2,假设其判定标准为AND的逻辑关系,那么假设两个Test均为True,整个Definition1结果为True。举例来说,假设Test1測试结果为True,Test2測试结果为False,依据Definition1中的判定条件Test1=True AND Test2=True,整个Definition的測试结果为False。

     

    OVAL定义

    “定义”(Definition)用于描写叙述怎样对某一特定安全问题进行检查。通常一个OVAL文档中包括多个“定义”。主要有四类定义,各自是漏洞(Vulnerability):描写叙述怎样依据系统状态判定系统中是否存在某个特定漏洞;补丁(Patch):与漏洞定义类似。但它更关注怎样判定系统中是否安装了某个特定补丁。软件(Inventory):描写叙述怎样对系统中是否安装了某个特定的软件进行判定;合规(Compliance):描写叙述怎样对系统是否满足某个特定的配置要求进行判定。表1是一个OVAL定义的演示样例数据。

    规则字段 释义 演示样例数据
    id Definition的标识。必须是全局唯一的 oval:gov.nist.usgcb.winseven:def:7
    version Definition的版本号 2
    class 指定Definition的类别(漏洞、补丁、软件、合规等) Compliance
    metadata(元标记):
    title Definition的标题 Minimum Password Length
    affected 会受到影响的操作系统或应用程序名称及版本号 Microsoft Windows 7
    references 此Definition与其他检查单或文档的映射关系 NIST SP800-68 Appendix A,1.4b
    http://cce.mitre.org
    CCE-9357-5
    description Definition的描写叙述 Minimum Password Length
    Criteria(判定标准):
    extend_definition definition_ref 还有一个Definition的标识(当此Definition须要协同使用还有一个Definition时) oval:gov.nist.cpe.oval:def:1
    extend_definition comment 一般用于指出协同使用上述Definition的原因,本例中是用于判定目标操作系统是否符合要求 Windows 7 is installed
    criterion test_ref 此Definition所使用的Test的标识 oval:gov.nist.usgcb.winseven:tst:36
    criterion comment 一般是一段人工可读的语言用于描写叙述出上述Test的检測行为 Minimum Password Length is greater than or equal to the prescribed value

    OVAL測试

    “測试”(Test)通过定义一组OVAL对象(Object)和OVAL状态(State)运行。OVAL 測试的数据结构如表2所看到的。而图2则较为清晰地表达了OVAL測试中OVAL对象与OVAL状态是怎样相互配合运行測试。

    规则字段 释义 演示样例数据
    測试类型 通过不同的节点名字表达不同的測试类型,如文件、注冊表、策略等 passwordpolicy_test
    id 此Test的唯一标识 oval:gov.nist.usgcb.winsseven:tst:36
    version Test的版本号 2
    check_existence 是否要求必需存在(如注冊表键值) at_least_one_exists
    object_ref 此Test使用的Object的id oval:gov.nist.usgcb.winseven:obj:27
    state_ref 此Test使用的State的id oval:gov.nist.usgcb.winseven:ste:33

    OVAL对象

    “对象”(Object)用来描写叙述測试主体,因为測试主体类别众多(如注冊表、组策略、文件、软件包等),因此Object的类型也非常多,且每种类型的数据结构各不同样。以下是一个passworkpolicy_object的定义,能够看出系统策略类的OVAL对象仅仅须要指明一个id就可以被解释器识别:

    <passwordpolicy_object id="oval:gov.nist.usgcb.windowsseven:obj:27" version="2"/>

    以下是一个registry_object的定义。能够看到注冊表类OVAL对象须要指明注冊表Hive、注冊表键和注冊表项的名称:

    <registry_object id="oval:gov.nist.usgcb.winseven:obj:16" version="2">
    <hive>HKEY_LOCAL_MACHINE</hive>
    <key>SOFTWAREPoliciesMicrosoftPCHealthErrorReportingDW</key>
    <name>DWAllowHeadless</name>
    </registry_object>

    OVAL状态

    “状态”(State)用来描写叙述測试主体的參考状态值。同OVAL对象类似,State也分为多种类型,每种类型的数据结构不同样,以下是一个passwordpolicy_state的定义:

    <passwordpolicy_state id="oval:gov.nist.usgcb.winseven:ste:33" version="2">
    <min_passwd_len operation="greater than or equal" datatype="int" var_ref="oval:gov.nist.usgcb.winseven:var:22"/>
    </passwordpolicy_state>

    能够在Value中使用正則表達式以更好的完毕字符串匹配工作。以下是一个registry_state的定义,用来识别注冊表中获取的值能与字符串“Windows 7”相匹配。

    <registry_state id="oval:org.mitre.oval:ste:5027" version="4" comment="Matches with Windows 7">
    <value operation="pattern match">
    ^[a-zA-Z0-9()s]*[Ww][Ii][Nn][Dd][Oo][Ww][Ss] 7[a-zA-Z0-9()s]*$
    </value></registry_state>

    能够看出,OVAL状态中能够使用var_ref引用一个OVAL变量表示OVAL状态的值。或者直接将值写入到value节点中。

    OVAL变量

    “变量”(Variable)定义了执行測试时State所需的值,其有三种类型:常量(constant_variable)、本地变量(local_variable)和外部变量(external_variable)。常量定义一个不能在执行时改变的值,本地变量定义在OVAL中直接使用的值。而外部变量通经常使用于将XCCDF的Value值传递到OVAL中。以下是一个外部变量的定义:

    <external_variable comment="Minimum Password Length is greater than or equal to the prescribed value" datatype="int" id="oval:gov.nist.usgcb.winseven:var:22" version="2"></external_variable>
    以下是小弟自己写的验证系统是否为win10的oval:
    <?

    xml version="1.0" encoding="UTF-8"?> -<oval_definitions xsi:schemaLocation="http://oval.mitre.org/XMLSchema/oval-definitions-5 oval-definitions-schema.xsd http://oval.mitre.org/XMLSchema/oval-definitions-5#windows windows-definitions-schema.xsd http://oval.mitre.org/XMLSchema/oval-definitions-5#independent independent-definitions-schema.xsd http://oval.mitre.org/XMLSchema/oval-common-5 oval-common-schema.xsd" xmlns="http://oval.mitre.org/XMLSchema/oval-definitions-5" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:oval="http://oval.mitre.org/XMLSchema/oval-common-5" xmlns:oval-def="http://oval.mitre.org/XMLSchema/oval-definitions-5"> <generator> <oval:product_name>The OVAL Repository</oval:product_name> <oval:schema_version>5.10.1</oval:schema_version> <oval:timestamp>2015-07-24T02:18:25.200-04:00</oval:timestamp> </generator> <definitions> <definition xmlns="http://oval.mitre.org/XMLSchema/oval-definitions-5" class="inventory" version="3" id="oval:org.mitre.oval:def:28779"> <metadata> <title>Microsoft Windows 10 Insider Preview is installed</title> <affected family="windows"> <platform>Microsoft Windows 10 Insider Preview</platform> </affected> <reference ref_id="microsoft_windows_10_insider_preview" source="ICM"/> <description>The operating system installed on the system is Microsoft Windows 10 Insider Preview.</description> <oval_repository> <dates> <submitted date="2015-05-07T08:31:03"> <contributor organization="ALTX-SOFT">Maria Mikhno</contributor> </submitted> <status_change date="2015-05-12T14:33:42.950-04:00">DRAFT</status_change> <status_change date="2015-06-01T04:00:20.683-04:00">INTERIM</status_change> <status_change date="2015-06-22T04:00:44.312-04:00">ACCEPTED</status_change> </dates> <status>ACCEPTED</status> </oval_repository> </metadata> <criteria> <criterion test_ref="oval:org.mitre.oval:tst:99" comment="the installed operating system is part of the Microsoft Windows family"/> <criterion test_ref="oval:org.mitre.oval:tst:138532" comment="Check if Microsoft Windows 10 Insider Preview is installed"/> </criteria> </definition> </definitions> <tests> <family_test xmlns="http://oval.mitre.org/XMLSchema/oval-definitions-5#independent" version="1" id="oval:org.mitre.oval:tst:99" comment="the installed operating system is part of the Microsoft Windows family" check="only one" check_existence="at_least_one_exists"> <object object_ref="oval:org.mitre.oval:obj:99"/> <state state_ref="oval:org.mitre.oval:ste:99"/> </family_test> <registry_test xmlns="http://oval.mitre.org/XMLSchema/oval-definitions-5#windows" version="1" id="oval:org.mitre.oval:tst:138532" comment="Check if Microsoft Windows 10 Insider Preview is installed" check="all" check_existence="at_least_one_exists"> <object object_ref="oval:org.mitre.oval:obj:5590"/> <state state_ref="oval:org.mitre.oval:ste:38384"/> </registry_test> </tests> <objects> <family_object xmlns="http://oval.mitre.org/XMLSchema/oval-definitions-5#independent" version="1" id="oval:org.mitre.oval:obj:99" comment="This is the default family object. Only one family object should exist."/> <registry_object xmlns="http://oval.mitre.org/XMLSchema/oval-definitions-5#windows" version="1" id="oval:org.mitre.oval:obj:5590" comment="This registry key identifies the Windows ProductName"> <hive datatype="string">HKEY_LOCAL_MACHINE</hive> <key datatype="string">SOFTWAREMicrosoftWindows NTCurrentVersion</key> <name datatype="string">ProductName</name> </registry_object> </objects> <states> <family_state xmlns="http://oval.mitre.org/XMLSchema/oval-definitions-5#independent" version="2" id="oval:org.mitre.oval:ste:99" comment="Microsoft Windows family"> <family operation="case insensitive equals">windows</family> </family_state> <registry_state xmlns="http://oval.mitre.org/XMLSchema/oval-definitions-5#windows" version="1" id="oval:org.mitre.oval:ste:38384" comment="The registry key matches with Windows 10 Insider Preview"> <value operation="pattern match">^.*Windows.*10.*Insider.*Preview.*$</value> </registry_state> </states> </oval_definitions>


  • 相关阅读:
    js变量声明提前
    03通讯录(Block传值)
    03-Block
    03通讯录(搭建编辑界面)
    03通讯录(代理解耦)
    03通讯录(逆传)
    03通讯录
    源码0604-06-掌握-大文件断点下载(断点下载)
    源码0604-05-程序不死
    源码0604-02-了解-网页开发
  • 原文地址:https://www.cnblogs.com/yangykaifa/p/7360085.html
Copyright © 2011-2022 走看看