Understanding the Nessus Audit policy and its customization

The Nessus Audit files consist of custom XML-based rules which are needed to perform configuration audit for various platforms. These files allow the user to perform value and regex-based comparisons of the current configuration and determine the gaps present. In general, it is expected that these audit files are prepared in line with the industry standard baselines so that the actual compliance gaps are shown and the administration team can work on hardening and compliance at the same time. A custom audit file is to be saved with the extension .audit.

The following is a generic syntax of a check in the audit files:

<item>
name : " "
description : " "
info : " "
value : " "
</item>

We will look at some of the standard checks for windows so that we can learn about various generic and custom checks. All the default checks start with <item> and all the custom checks start with <custom_item>:

info: "Password policy check"

The preceding keywords can be used to define file permissions for a specific user in the following associated types. These categories of permissions might have different changes for different keywords:

These keywords have different sets of permissions for folders. The following is the syntax in which file_acl can be used:

<file_acl: ["name"]>
<user: ["user_name"]>
acl_inheritance: ["value"]
acl_apply: ["value"]
</user>
</acl>

A similar syntax can be used for all the other keywords by just replacing file_acl with the respective keyword.

<item>
name: ["predefined_entry"]
value: [value]
</item>

The value can be defined by the user, but the name needs to match the name which is listed in the predefined policies. The following are a few of the keywords and tags we will use in this recipe to create a custom Windows and Unix audit file.

<check_type:"Windows" version:" ">
name: "max_password_age"
type: PASSWORD_POLICY
description: " Maximum password age"
info: "Maximum password age of 60 days is being checked."
Value: "8"
cmd : "cat /etc/login.defs | grep -v ^# | grep PASS_WARN_AGE | awk {'print $2'}"
regex: "^[\\s]*PASS_WARN_AGE\\s+"
expect: "14"
value_type: POLICY_TEXT
'DQAKACIAMQAwACADFSIGHSAPFIUGHPSAIUFHVPSAIUVHAIPUVAPAUIVHAPIVdAA7AA0ACgA='
ps_encoded_args: YES

In this recipe, we will look at creating a windows audit file to check free disk space in the system partition.