<html>
  <head>
    <meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <div class="moz-cite-prefix">On 8/5/13 4:24 PM, Kordell, Luke T
      wrote:<br>
    </div>
    <blockquote
      cite="mid:EBDE6A904AEF60448F36706839FFB5250B7F0A38@HVXDSP21.us.lmco.com"
      type="cite">
      <pre wrap="">Hello. 

       I am new to SCAP and trying to determine how to modify a rule. I have downloaded the source code and have located an OVAL test I would like to change to suite my purposes. The file is selinux_policytype.xml. I have chosen this file because I am trying to make the SELinux enforcement rule pass for an MLS enforcement rather than targeted. My questions are as follows: 

     The OVAL document references an object, test, state and variable but does not define them (as far as I can tell) within the OVAL file. Rather, it appears to be calling them from somewhere else. 

In particular I am referring to these lines. 

13 test_ref = "test_selinux_policy" 

21 object object_ref = obj_selinux_policy

22 state state_ref = state_selinux_policy</pre>
    </blockquote>
    <br>
    Sooo...... yeaahh. OVAL can be a hot mess. Welcome to the project
    though!<br>
    <br>
    The first part of the OVAL check is the &lt;definition&gt;, giving
    various metadata fields such as the OVAL ID name, affected
    platforms, etc. Of note you'll see the &lt;criteria&gt; tag, which
    defines "what rule must be ran for this OVAL id?"<br>
    <br>
    <blockquote type="cite">
      <meta charset="utf-8">
      <pre style="margin: 0px; padding: 0px; color: rgb(0, 0, 0); font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 19px; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(255, 255, 255);"><code style="background-color: rgba(0, 0, 0, 0.0980392); padding: 1px; background-position: initial initial; background-repeat: initial initial;">  &lt;definition class="compliance"
  id="selinux_policytype" version="1"&gt;
    &lt;metadata&gt;
      &lt;title&gt;Enable SELinux&lt;/title&gt;
      &lt;affected family="unix"&gt;
        &lt;platform&gt;Red Hat Enterprise Linux 6&lt;/platform&gt;
      &lt;/affected&gt;
      &lt;description&gt;The SELinux policy should be set
      appropriately.&lt;/description&gt;
    &lt;/metadata&gt;
<b><font color="#ff0000">    &lt;criteria&gt;
      &lt;criterion test_ref="test_selinux_policy" /&gt;
    &lt;/criteria&gt;</font></b>
  &lt;/definition&gt;</code></pre>
    </blockquote>
    <br>
    <br>
    The actual test, "test_selinux_policy," calls out an object to
    perform a command upon ("obj_selinux_policy") and the state/value of
    which it should be set to ("state_selinux_policy"):<br>
    <br>
    <blockquote type="cite">
      <meta charset="utf-8">
      <pre style="margin: 0px; padding: 0px; color: rgb(0, 0, 0); font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 19px; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(255, 255, 255);"><code style="background-color: rgba(0, 0, 0, 0.0980392); padding: 1px; background-position: initial initial; background-repeat: initial initial;">  &lt;ind:textfilecontent54_test check="all"
  check_existence="all_exist"
  comment="Tests the value of the ^[\s]*SELINUXTYPE[\s]*=[\s]*([^#]*) expression in the /etc/selinux/config file"
  id="test_selinux_policy" version="1"&gt;
    <font color="#ff0000"><b>&lt;ind:object object_ref="obj_selinux_policy" /&gt;
    &lt;ind:state state_ref="state_selinux_policy" /&gt;</b></font>
  &lt;/ind:textfilecontent54_test&gt;</code></pre>
    </blockquote>
    <code></code><br>
    The obj_selinux_policy is a regex pattern against
    /etc/selinux/config:<br>
    <blockquote type="cite">
      <meta charset="utf-8">
      <pre style="margin: 0px; padding: 0px; color: rgb(0, 0, 0); font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 19px; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(255, 255, 255);"><code style="background-color: rgba(0, 0, 0, 0.0980392); padding: 1px; background-position: initial initial; background-repeat: initial initial;">  &lt;ind:textfilecontent54_object id="obj_selinux_policy"
  version="1"&gt;
    &lt;ind:path&gt;/etc/selinux&lt;/ind:path&gt;
    &lt;ind:filename&gt;config&lt;/ind:filename&gt;
    &lt;ind:pattern operation="pattern match"&gt;^[\s]*SELINUXTYPE[\s]*=[\s]*([^#\s]*)&lt;/ind:pattern&gt;
    &lt;ind:instance datatype="int"&gt;1&lt;/ind:instance&gt;
  &lt;/ind:textfilecontent54_object&gt;</code></pre>
    </blockquote>
    <br>
    And that pattern must match the value of state_selinux_policy:<br>
    <blockquote type="cite">
      <meta charset="utf-8">
      <pre style="margin: 0px; padding: 0px; color: rgb(0, 0, 0); font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 19px; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(255, 255, 255);"><code style="background-color: rgba(0, 0, 0, 0.0980392); padding: 1px; background-position: initial initial; background-repeat: initial initial;">  &lt;ind:textfilecontent54_state id="state_selinux_policy" version="1"&gt;
    &lt;ind:subexpression operation="equals" var_check="all"
    var_ref="var_selinux_policy_name" /&gt;
  &lt;/ind:textfilecontent54_state&gt;
</code></pre>
    </blockquote>
    <br>
    As you can see, that state calls out a var_ref of
    "var_selinux_policy_name" which leads us to your questions:<br>
    <br>
    <blockquote
      cite="mid:EBDE6A904AEF60448F36706839FFB5250B7F0A38@HVXDSP21.us.lmco.com"
      type="cite">
      <pre wrap="">Finally I think this is the variable I am going to need to change. 

var_ref = var_selinux_policy_name 

My question are: 

1) where are these objects defined, and if it is possible how can I modify them?</pre>
    </blockquote>
    <br>
    Because each baseline (STIG, FISMA, etc) may have different
    requirements of SELinux, those variable definitions are found within
    XCCDF profiles, such as "CS2" and "stig-rhel6-server." For example,
    within the common profile (which is inherited by the STIG) you'll
    find the lines:<br>
    <blockquote type="cite">
      <pre style="margin: 0px; padding: 0px; color: rgb(0, 0, 0); font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 19px; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(255, 255, 255);"><code style="background-color: rgba(0, 0, 0, 0.0980392); padding: 1px; background-position: initial initial; background-repeat: initial initial;">&lt;!-- SELinux state --&gt;
&lt;refine-value idref="var_selinux_policy_name" selector="targeted"/&gt;</code></pre>
    </blockquote>
    <code>(ref line 262/263:<br>
<a class="moz-txt-link-freetext" href="https://git.fedorahosted.org/cgit/scap-security-guide.git/tree/RHEL6/input/profiles/common.xml">https://git.fedorahosted.org/cgit/scap-security-guide.git/tree/RHEL6/input/profiles/common.xml</a>)<br>
      <br>
    </code>
    <br>
    In your case, you'd want to change "targeted" to "mls"<br>
    <br>
    <blockquote
      cite="mid:EBDE6A904AEF60448F36706839FFB5250B7F0A38@HVXDSP21.us.lmco.com"
      type="cite">
      <pre wrap="">2) Other than the OVAL website are there any other resources anyone can recommend that can help me learn this material? 
</pre>
    </blockquote>
    The OVAL specification is online here:<br>
    <a class="moz-txt-link-freetext" href="https://oval.mitre.org/language/version5.10.1/">https://oval.mitre.org/language/version5.10.1/</a><br>
    <br>
    Personally, I had to jump in and ask a bunch of questions. And get a
    ton of patches nacked for silly mistakes (.... and of course I no
    longer make *any* mistakes...). We've started on a "into to SSG"
    workbook, which you can find on the wiki page:<br>
    <a class="moz-txt-link-freetext" href="https://fedorahosted.org/scap-security-guide/">https://fedorahosted.org/scap-security-guide/</a><br>
    <br>
    The workbook mostly focuses on your first scan, and very basic
    familiarity with the code. It'd be great to receive patches to the
    workbook, or just ideas on how to make it better! SCAP content
    authoring is still fairly new... if you do find good resources,
    please share URLs and perhaps we can create a "getting started with
    SCAP" link list off the wiki.<br>
  </body>
</html>