Class: Inspec::Resources::AideConf
- Inherits:
-
Object
- Object
- Inspec::Resources::AideConf
- Includes:
- FileReader, Utils::CommentParser
- Defined in:
- lib/inspec/resources/aide_conf.rb
Instance Attribute Summary collapse
-
#params ⇒ Object
readonly
Returns the value of attribute params.
Instance Method Summary collapse
- #all_have_rule(rule) ⇒ Object
-
#initialize(aide_conf_path = nil) ⇒ AideConf
constructor
A new instance of AideConf.
- #resource_id ⇒ Object
- #to_s ⇒ Object
Methods included from FileReader
Methods included from Utils::CommentParser
Constructor Details
#initialize(aide_conf_path = nil) ⇒ AideConf
Returns a new instance of AideConf.
30 31 32 33 34 35 |
# File 'lib/inspec/resources/aide_conf.rb', line 30 def initialize(aide_conf_path = nil) @conf_path = aide_conf_path || "/etc/aide.conf" @content = nil @rules = nil read_content end |
Instance Attribute Details
#params ⇒ Object (readonly)
Returns the value of attribute params.
25 26 27 |
# File 'lib/inspec/resources/aide_conf.rb', line 25 def params @params end |
Instance Method Details
#all_have_rule(rule) ⇒ Object
37 38 39 40 41 42 43 |
# File 'lib/inspec/resources/aide_conf.rb', line 37 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 |
#resource_id ⇒ Object
51 52 53 |
# File 'lib/inspec/resources/aide_conf.rb', line 51 def resource_id @conf_path || "aide_conf" end |
#to_s ⇒ Object
55 56 57 |
# File 'lib/inspec/resources/aide_conf.rb', line 55 def to_s "AIDE Config" end |