Class: Inspec::Resources::AuditdRulesLegacy
- Inherits:
-
Object
- Object
- Inspec::Resources::AuditdRulesLegacy
show all
- Defined in:
- lib/resources/auditd_rules.rb
Instance Method Summary
collapse
Constructor Details
Returns a new instance of AuditdRulesLegacy.
11
12
13
14
15
16
17
|
# File 'lib/resources/auditd_rules.rb', line 11
def initialize(content)
@content = content
@opts = {
assignment_regex: /^\s*([^:]*?)\s*:\s*(.*?)\s*$/,
multiple_values: true,
}
end
|
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(name) ⇒ Object
23
24
25
|
# File 'lib/resources/auditd_rules.rb', line 23
def method_missing(name)
params[name.to_s]
end
|
Instance Method Details
#params ⇒ Object
19
20
21
|
# File 'lib/resources/auditd_rules.rb', line 19
def params
@params ||= SimpleConfig.new(@content, @opts).params
end
|
#status(name) ⇒ Object
27
28
29
30
31
32
33
34
35
36
37
38
39
40
|
# File 'lib/resources/auditd_rules.rb', line 27
def status(name)
@status_opts = {
assignment_regex: /^\s*([^:]*?)\s*:\s*(.*?)\s*$/,
multiple_values: false,
}
@status_content ||= inspec.command('/sbin/auditctl -s').stdout.chomp
@status_params = SimpleConfig.new(@status_content, @status_opts).params
status = @status_params['AUDIT_STATUS']
return nil if status.nil?
items = Hash[status.scan(/([^=]+)=(\w*)\s*/)]
items[name]
end
|
#to_s ⇒ Object
42
43
44
|
# File 'lib/resources/auditd_rules.rb', line 42
def to_s
'Audit Daemon Rules (for auditd version < 2.3)'
end
|