<html>
  <head>
    <meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    Just an aside, I did some poking around, and it is possible to
    eliminate directories from the search. I looked at the USGCB stuffs
    and here's what I put together for file_permissions_unowned.xml in
    OVAL to eliminate /proc. I can do the same for the group id version.
    To add more exclusions, add an '|' after proc, and type in another
    directory path. It doesn't seem to care if you escape the forward
    slashes, but I left that in just in case the behavior changes later.<br>
    <br>
    If anyone does figure out how to query PAM or nslcd/nscd for network
    user ids, I think you can add it as an extra filter option to the
    file_permissions_unowned_object.<br>
    <br>
    Please note, I have not gotten a single failure with this check
    against /proc. I get thousands of failures on my workstation, since
    I have large git repositories checked out to directories owned by my
    network account on the root hard drive.<br>
    <br>
    <code>&lt;def-group&gt;</code><code><br>
    </code><code>  &lt;definition class="compliance"
      id="file_permissions_unowned" version="1"&gt;</code><code><br>
    </code><code>    &lt;metadata&gt;</code><code><br>
    </code><code>      &lt;title&gt;Find files unowned by a
      user&lt;/title&gt;</code><code><br>
    </code><code>      &lt;affected family="unix"&gt;</code><code><br>
    </code><code>        &lt;platform&gt;Red Hat Enterprise Linux
      6&lt;/platform&gt;</code><code><br>
    </code><code>      &lt;/affected&gt;</code><code><br>
    </code><code>      &lt;description&gt;All files should be owned by a
      user&lt;/description&gt;</code><code><br>
    </code><code>    &lt;/metadata&gt;</code><code><br>
    </code><code>    &lt;criteria&gt;</code><code><br>
    </code><code>      &lt;criterion comment="Check all files and make
      sure they are owned by a user"
      test_ref="file_permissions_unowned_test" /&gt;</code><code><br>
    </code><code>    &lt;/criteria&gt;</code><code><br>
    </code><code>  &lt;/definition&gt;</code><code><br>
    </code><code><br>
    </code><code>  &lt;unix:file_state
      id="file_permissions_unowned_userid_list_match" version="1"&gt;</code><code><br>
    </code><code>    &lt;unix:user_id var_check="at least one"
      var_ref="file_permissions_unowned_userid_list" datatype="int"
      /&gt;</code><code><br>
    </code><code>  &lt;/unix:file_state&gt;</code><code><br>
    </code><code><br>
    </code><code>  &lt;local_variable
      id="file_permissions_unowned_userid_list" comment="List of valid
      user ids" datatype="int" version="1"&gt;</code><code><br>
    </code><code>    &lt;object_component item_field="subexpression"
      object_ref="file_permissions_unowned_userid_list_object" /&gt;</code><code><br>
    </code><code>  &lt;/local_variable&gt;</code><code><br>
    </code><code><br>
    </code><code>  &lt;ind:textfilecontent54_object
      id="file_permissions_unowned_userid_list_object" version="1"&gt;</code><code><br>
    </code><code>   
      &lt;ind:filepath&gt;/etc/passwd&lt;/ind:filepath&gt;</code><code><br>
    </code><code>    &lt;ind:pattern operation="pattern
match"&gt;^[^:]+:[^:]+:([\d]+):[\d]+:[^:]*:[^:]+:[^:]*$&lt;/ind:pattern&gt;</code><code><br>
    </code><code>    &lt;ind:instance operation="greater than or equal"
      datatype="int"&gt;1&lt;/ind:instance&gt;</code><code><br>
    </code><code>  &lt;/ind:textfilecontent54_object&gt;</code><code><br>
    </code><code><br>
    </code><code>  &lt;unix:file_object comment="all local files"
      id="file_permissions_unowned_object" version="1"&gt;</code><code><br>
    </code><code>    &lt;unix:behaviors recurse="symlinks and
      directories" recurse_direction="down" recurse_file_system="local"
      /&gt;</code><code><br>
    </code><code>    &lt;unix:filepath operation="pattern
      match"&gt;^(?!\/proc)/&lt;/unix:filepath&gt;</code><code><br>
    </code><code>    &lt;filter
action="exclude"&gt;file_permissions_unowned_userid_list_match&lt;/filter&gt;</code><code><br>
    </code><code>  &lt;/unix:file_object&gt;</code><code><br>
    </code><code><br>
    </code><code>  &lt;unix:file_test check="all"
      check_existence="none_exist" comment="Check user ids on all files
      on the system" id="file_permissions_unowned_test" version="1"&gt;</code><code><br>
    </code><code>    &lt;unix:object
      object_ref="file_permissions_unowned_object" /&gt;</code><code><br>
    </code><code>  &lt;/unix:file_test&gt;</code><code><br>
    </code><code>&lt;/def-group&gt;</code><br>
    <br>
    - Maura Dailey<br>
  </body>
</html>