voxpupuli / puppet-selinux

Puppet Module to manage SELinux on RHEL machines
https://forge.puppet.com/puppet/selinux
Apache License 2.0
48 stars 147 forks source link
amazon-puppet-module centos-puppet-module debian-puppet-module fedora-puppet-module hacktoberfest linux-puppet-module puppet redhat-puppet-module

SELinux module for Puppet

Build Status Code Coverage Puppet Forge Puppet Forge - downloads Puppet Forge - endorsement Puppet Forge - scores

Table of Contents

  1. Overview
  2. Module Description - What the module does and why it is useful
  3. Usage - Configuration options and additional functionality
  4. Reference - An under-the-hood peek at what the module is doing and how
  5. Defined Types
  6. Development - Guide for contributing to the module
  7. Authors

Overview

This class manages SELinux.

Requirements

Module Description

This module will configure SELinux and/or deploy SELinux based modules to running system.

Get in touch

Upgrading from puppet-selinux 0.8.x

Known problems / limitations

Usage

Generated puppet strings documentation with examples is available in the REFERENCE.md

It's also included in the docs/ folder as simple html pages.

Reference

Basic usage

include selinux

This will include the module and allow you to use the provided defined types, but will not modify existing SELinux settings on the system.

More advanced usage

class { selinux:
  mode => 'enforcing',
  type => 'targeted',
}

This will include the module and manage the SELinux mode (possible values are enforcing, permissive, and disabled) and enforcement type (possible values are targeted, minimum, and mls). Note that disabling SELinux requires a reboot to fully take effect. It will run in permissive mode until then.

Deploy a custom module using the refpolicy framework

selinux::module { 'resnet-puppet':
  ensure    => 'present',
  source_te => 'puppet:///modules/site_puppet/site-puppet.te',
  source_fc => 'puppet:///modules/site_puppet/site-puppet.fc',
  source_if => 'puppet:///modules/site_puppet/site-puppet.if',
  builder   => 'refpolicy'
}

Using pre-compiled policy packages

selinux::module { 'resnet-puppet':
  ensure    => 'present',
  source_pp => 'puppet:///modules/site_puppet/site-puppet.pp',
}

Note that pre-compiled policy packages may not work reliably across all RHEL / CentOS releases. It's up to you as the user to test that your packages load properly.

Set a boolean value

selinux::boolean { 'puppetagent_manage_all_files': }

Defined Types

Development

Things to remember

Facter facts

The fact values might be unexpected while in disabled mode. One could expect the config_mode to be set, but only the boolean enabled is set.

The most important facts:

Fact Mode: disabled Mode: permissive Mode: enforcing
$facts['os']['selinux']['enabled'] false true true
$facts['os']['selinux']['config_mode'] undef Value of SELINUX in /etc/selinux/config Value of SELINUX in /etc/selinux/config
$facts['os']['selinux']['current_mode'] undef Value of getenforce downcased Value of getenforce downcased

Authors