Sha256: d2c2b3ac673379fe61af9f86d317b76a8fc3b4a35dfdf0fd1d4d4e8d3fbfe649

Contents?: true

Size: 1.02 KB

Versions: 4

Compression:

Stored size: 1.02 KB

Contents

# Fact for SElinux
# Written by immerda admin team (admin(at)immerda.ch)

Facter.add("selinux") do
    confine :kernel => :linux

    setcode do 
        result = "false"
        if FileTest.exists?("/selinux/enforce")
            if FileTest.exists?("/proc/self/attr/current")
                if (File.read("/proc/self/attr/current") != "kernel\0")
                    result = "true"
                end
            end
        end
        result
    end
end

Facter.add("selinux_enforced") do
    confine :selinux => :true

    setcode do
        result = "false"
        if FileTest.exists?("/selinux/enforce") and File.read("/selinux/enforce") =~ /1/i
            result = "true"
        end
        result
    end
end

Facter.add("selinux_policyversion") do
    confine :selinux => :true
    setcode do 
        File.read("/selinux/policyvers")
    end
end

Facter.add("selinux_mode") do
    confine :selinux => :true
    setcode do
        %x{/usr/sbin/sestatus | /bin/grep "Policy from config file:" | awk '{print $5}'}        
    end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
facter-1.5.8 lib/facter/selinux.rb
facter-1.5.7 lib/facter/selinux.rb
facter-1.5.6 lib/facter/selinux.rb
facter-1.5.5 lib/facter/selinux.rb