Class: Inspec::Resources::AideConf

Inherits:
Object
  • Object
show all
Includes:
CommentParser, FileReader
Defined in:
lib/resources/aide_conf.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from FileReader

#read_file_content

Methods included from CommentParser

#parse_comment_line

Constructor Details

#initialize(aide_conf_path = nil) ⇒ AideConf

Returns a new instance of AideConf.



31
32
33
34
35
36
# File 'lib/resources/aide_conf.rb', line 31

def initialize(aide_conf_path = nil)
  @conf_path = aide_conf_path || '/etc/aide.conf'
  @content = nil
  @rules = nil
  read_content
end

Instance Attribute Details

#paramsObject (readonly)

Returns the value of attribute params.



26
27
28
# File 'lib/resources/aide_conf.rb', line 26

def params
  @params
end

Instance Method Details

#all_have_rule(rule) ⇒ Object



38
39
40
41
42
43
44
# File 'lib/resources/aide_conf.rb', line 38

def all_have_rule(rule)
  # Case when file didn't exist or perms didn't allow an open
  return false if @content.nil?

  lines = @params.reject { |line| line['rules'].include? rule }
  lines.empty?
end