Use the aide_conf Chef InSpec audit resource to test the rules established for the file integrity tool AIDE. Controlled by the aide.conf file typically at /etc/aide.conf.
This resource is distributed along with Chef InSpec itself. You can use it automatically.
This resource first became available in v1.37.6 of InSpec.
An aide_conf resource block can be used to determine if the selection lines contain one (or more) directories whose files should be added to the aide database:
describe aide_conf('path') do
its('selection_lines') { should include '/sbin' }
end
where
'selection_lines' refers to all selection lines found in the aide.conf file('path') is the non-default path to the aide.conf file (optional)should include 'value' is the value that is expectedUse the where clause to match a selection_line to one rule or a particular set of rules found in the aide.conf file:
describe aide_conf.where { selection_line == '/bin' } do
its('rules.flatten') { should include 'r' }
end
describe aide_conf.where { selection_line == '/sbin' } do
its('rules') { should include ['p', 'i', 'l', 'n', 'u', 'g', 'sha512'] }
end
rulesThe rules property returns the list of rules set in the aide.conf file.
its('rules') { should include ['r', 'sha512'] }
all_have_ruleThe all_have_rule property returns the all selected lines from aide.conf file e.g. ‘p’, ‘i’ etc.
aide_conf.all_have_rule('sha512')
selection_linesThe selection_lines property returns the list of lines from aide.conf file.
its('selection_lines') { should include '/sbin' }
The following examples show how to use this Chef InSpec audit resource.
xattr ruledescribe aide_conf.all_have_rule('xattr') do
it { should eq true }
end
describe aide_conf.where { selection_line == '/bin' } do
its('rules.flatten') { should include 'r' }
end
/sbin consists of a particular set of rulesdescribe aide_conf.where { selection_line == '/sbin' } do
its('rules') { should include ['r', 'sha512'] }
end
describe aide_conf.all_have_rule('sha512') do
it { should eq true }
end
For a full list of available matchers, please visit our matchers page.
© Chef Software, Inc.
Licensed under the Creative Commons Attribution 3.0 Unported License.
The Chef™ Mark and Chef Logo are either registered trademarks/service marks or trademarks/servicemarks of Chef, in the United States and other countries and are used with Chef Inc's permission.
We are not affiliated with, endorsed or sponsored by Chef Inc.
https://docs.chef.io/inspec/resources/aide_conf/