Initial version of apparmor fact.
This commit is contained in:
parent
eb423748ee
commit
00d5c08f8a
1 changed files with 20 additions and 0 deletions
20
apparmor/lib/facter/apparmor.rb
Normal file
20
apparmor/lib/facter/apparmor.rb
Normal file
|
@ -0,0 +1,20 @@
|
|||
|
||||
Facter.add("apparmor") do
|
||||
setcode do
|
||||
result = false
|
||||
if File.exists?("/sys/module/apparmor")
|
||||
begin
|
||||
f = File.new("/proc/mounts")
|
||||
while (line = f.gets)
|
||||
if line.split()[2] == "securityfs"
|
||||
if File.exists?(File.join(line.split()[1], "apparmor"))
|
||||
result = true
|
||||
end
|
||||
end
|
||||
end
|
||||
rescue
|
||||
end
|
||||
end
|
||||
result
|
||||
end
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue