Giter VIP home page Giter VIP logo

Comments (7)

talisto avatar talisto commented on September 26, 2024

I've determined that this is probably an issue with Facter on RHEL7/CentOS7. The module class is using the fact ::selinux_config_policy in the path to check if the module exists or not, but in RHEL7/CentOS 7, that fact returns unknown:

[root@host ~]# facter selinux_config_policy
unknown

I see there's already a bug report in the Facter issues here: https://tickets.puppetlabs.com/browse/FACT-756

..so I'm assuming this may be an issue with Facter, not your module, but perhaps some workaround could be implemented? Maybe a way to override that variable as a parameter?

from puppet-selinux.

talisto avatar talisto commented on September 26, 2024

i fixed this on my own system by editing module.pp and changing the class definition to:

define selinux::module(
  $source,
  $ensure         = 'present',
  $use_makefile   = false,
  $makefile       = '/usr/share/selinux/devel/Makefile',
  $policy         = $::selinux_config_policy
) {

and changed the checkloaded exec to:

  exec { "${name}-checkloaded":
    refreshonly => false,
    creates     => "/etc/selinux/${policy}/modules/active/modules/${name}.pp",
    command     => 'true',
    notify      => Exec["${name}-buildmod"],
  }

and then changed my selinux rules to specify the policy:

selinux::module { 'varnish_ownership':
    source   => 'puppet:///modules/varnish/selinux/varnish_ownership.te',
    policy   => 'targeted'
}

from puppet-selinux.

batman1007 avatar batman1007 commented on September 26, 2024

Actually the lib/facter code for us had several issues:

  • Missing require 'facter'
  • Confine ... selinux => true missing single quotes, i.e. selinux => 'true'
  • Facter::Core::Execution.exec didn't work

So our facter selinux_custom_policy.rb now looks like this:
require 'facter'

Facter.add(:selinux_custom_policy) do
confine :kernel => 'Linux', :osfamily => 'RedHat', :operatingsystemmajrelease => '7', :selinux => 'true'
setcode {Facter::Util::Resolution.exec('sestatus | grep "Loaded policy name" | awk '{print $4}'') }
end

from puppet-selinux.

belminf avatar belminf commented on September 26, 2024

@batman1007 confirmed issue on my servers as well. Submitted PR #45.

from puppet-selinux.

belminf avatar belminf commented on September 26, 2024

Resubmitted after noticing I missed the confine issue + escaping for awk. PR #46

from puppet-selinux.

batman1007 avatar batman1007 commented on September 26, 2024

As mentioned above, I think that we are seeing an issue with facter 'selinux' returning a string rather than a boolean, hence why we had to quote true in the facter code - it didn't confine correctly otherwise.

We're on facter version 1.7.5 and I notice this:
rodjek/puppet-lint#197

Thanks,
Dan.

from puppet-selinux.

belminf avatar belminf commented on September 26, 2024

@batman1007 agreed, that's why I added a quoted value in the confine.

from puppet-selinux.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.