OP#563 inital commit after fork
This commit is contained in:
@@ -1,8 +1,8 @@
|
||||
## cd_selinux::init.pp
|
||||
# Module name: cd_selinux
|
||||
# Author: Arne Teuke (arne_teuke@confdroid.com)
|
||||
# @summary Class initializes the cd_selinux Module.
|
||||
## confdroid_selinux::init.pp
|
||||
# Module name: confdroid_selinux
|
||||
# Author: 12ww1160 (12ww1160@confdroid.com)
|
||||
# @summary Class initializes the confdroid_selinux Module.
|
||||
##############################################################################
|
||||
class cd_selinux {
|
||||
include cd_selinux::params
|
||||
class confdroid_selinux {
|
||||
include confdroid_selinux::params
|
||||
}
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
## cd_selinux::main::config.pp
|
||||
# Module name: cd_selinux
|
||||
# Author: Arne Teuke (arne_teuke@ConfDroid.com)
|
||||
# @summary Class manages the module logic for cd_selinux.
|
||||
## confdroid_selinux::main::config.pp
|
||||
# Module name: confdroid_selinux
|
||||
# Author: 12ww1160 (12ww1160@ConfDroid.com)
|
||||
# @summary Class manages the module logic for confdroid_selinux.
|
||||
##############################################################################
|
||||
class cd_selinux::main::config (
|
||||
class confdroid_selinux::main::config (
|
||||
|
||||
) inherits cd_selinux::params {
|
||||
include cd_selinux::main::files
|
||||
) inherits confdroid_selinux::params {
|
||||
include confdroid_selinux::main::files
|
||||
|
||||
if $sx_selinux_status == 'enforcing' {
|
||||
exec { 'set_selinux_status':
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
## cd_selinux::main::dirs.pp
|
||||
# Module name: cd_selinux
|
||||
# Author: Arne Teuke (arne_teuke@ConfDroid.com)
|
||||
# @summary Class manages all directories required for cd_selinux.
|
||||
## confdroid_selinux::main::dirs.pp
|
||||
# Module name: confdroid_selinux
|
||||
# Author: 12ww1160 (12ww1160@ConfDroid.com)
|
||||
# @summary Class manages all directories required for confdroid_selinux.
|
||||
###############################################################################
|
||||
class cd_selinux::main::dirs (
|
||||
class confdroid_selinux::main::dirs (
|
||||
|
||||
) inherits cd_selinux::params {
|
||||
require cd_selinux::main::install
|
||||
) inherits confdroid_selinux::params {
|
||||
require confdroid_selinux::main::install
|
||||
|
||||
file { $sx_main_dir:
|
||||
ensure => directory,
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
## cd_selinux::main::files.pp
|
||||
# Module name: cd_selinux
|
||||
# Author: Arne Teuke (arne_teuke@ConfDroid.com)
|
||||
# @summary Class manages all configuration files required for cd_selinux.
|
||||
## confdroid_selinux::main::files.pp
|
||||
# Module name: confdroid_selinux
|
||||
# Author: 12ww1160 (12ww1160@ConfDroid.com)
|
||||
# @summary Class manages all configuration files required for confdroid_selinux.
|
||||
##############################################################################
|
||||
class cd_selinux::main::files (
|
||||
class confdroid_selinux::main::files (
|
||||
|
||||
) inherits cd_selinux::params {
|
||||
require cd_selinux::main::dirs
|
||||
) inherits confdroid_selinux::params {
|
||||
require confdroid_selinux::main::dirs
|
||||
|
||||
file { $sx_main_file:
|
||||
ensure => file,
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
## cd_selinux::main::install.pp
|
||||
# Module name: cd_selinux
|
||||
# Author: Arne Teuke (arne_teuke@ConfDroid.com)
|
||||
## confdroid_selinux::main::install.pp
|
||||
# Module name: confdroid_selinux
|
||||
# Author: 12ww1160 (12ww1160@ConfDroid.com)
|
||||
# @summary Class manage all aspects of installing binaries required for
|
||||
# cd_selinux
|
||||
# confdroid_selinux
|
||||
###############################################################################
|
||||
class cd_selinux::main::install (
|
||||
class confdroid_selinux::main::install (
|
||||
|
||||
) inherits cd_selinux::params {
|
||||
) inherits confdroid_selinux::params {
|
||||
require cd_resources
|
||||
|
||||
package { $reqpackages_main:
|
||||
|
||||
@@ -1,13 +1,15 @@
|
||||
## cd_selinux::params.pp
|
||||
# Module name: cd_selinux
|
||||
# Author: Arne Teuke (arne_teuke@ConfDroid.com)
|
||||
# @summary Class holds all parameters for the cd_selinux module and is
|
||||
## confdroid_selinux::params.pp
|
||||
# Module name: confdroid_selinux
|
||||
# Author: 12ww1160 (12ww1160@ConfDroid.com)
|
||||
# @summary Class holds all parameters for the confdroid_selinux module and is
|
||||
# inherited by all classes except defines.
|
||||
# @param [String] pkg_ensure
|
||||
# @param [String] sx_pkg_ensure
|
||||
# which [package type](https://confdroid.com/2017/05/puppet-type-package/)
|
||||
# to choose, i.e. `latest` or `present`.
|
||||
# @param [Boolean] sx_install_setools Whether to install additional selinux
|
||||
# tools, i.e. for troubleshooting.
|
||||
# @param [Array[String]] sx_reqpackages
|
||||
# List of packages required for selinux management. The default list includes
|
||||
# the following packages: `selinux-policy`, `policycoreutils`,
|
||||
# `setroubleshoot-server`, `policycoreutils-python`.
|
||||
# @param [String] sx_selinux_status The desired selinux status. Used for both
|
||||
# managing the configuration file as well as the command line (setenforce).
|
||||
# Valid values are `enforcing` and `permissive`. While the configuration file
|
||||
@@ -15,34 +17,31 @@
|
||||
# commandline. Note that changing the active selinux status from `disabled`
|
||||
# to any the other types requires a manual reboot to re-label the file system.
|
||||
# This module does not do that for you to avoid unexpected outages.
|
||||
# @param [String] sx_selinux_type The desired selinux type. Valid options are
|
||||
# @param [String] sx_selinux_type The desired selinux type. Valid options are
|
||||
# `targeted`, `minimum` and `mls`.
|
||||
##############################################################################
|
||||
class cd_selinux::params (
|
||||
class confdroid_selinux::params (
|
||||
|
||||
String $pkg_ensure = 'latest',
|
||||
|
||||
Boolean $sx_install_setools = false,
|
||||
String $sx_selinux_status = 'enforcing',
|
||||
String $sx_selinux_type = 'targeted',
|
||||
Array[String] $sx_reqpackages = ['selinux-policy','policycoreutils','setroubleshoot-server','policycoreutils-python'],
|
||||
String $sx_pkg_ensure = 'latest',
|
||||
String $sx_selinux_status = 'enforcing',
|
||||
String $sx_selinux_type = 'targeted',
|
||||
|
||||
) {
|
||||
# installation section
|
||||
$reqpackages_main = $::operatingsystem ? {
|
||||
/(?i-mx:centos|fedora|redhat)/ => ['selinux-policy','policycoreutils'],
|
||||
}
|
||||
|
||||
$reqpackages_tools = $::operatingsystem ? {
|
||||
/(?i-mx:centos|fedora|redhat)/ => ['setroubleshoot-server','policycoreutils-python'],
|
||||
}
|
||||
# default facts
|
||||
$fqdn = $facts['networking']['fqdn']
|
||||
$hostname = $facts['networking']['hostname']
|
||||
$domain = $facts['networking']['domain']
|
||||
$os_name = $facts['os']['name']
|
||||
$os_release = $facts['os']['release']['major']
|
||||
|
||||
# directories
|
||||
$sx_main_dir = '/etc/selinux'
|
||||
|
||||
# files
|
||||
$sx_main_file = "${sx_main_dir}/config"
|
||||
$sx_main_file_erb = 'cd_selinux/main/selinux_config.erb'
|
||||
$sx_main_file_erb = 'confdroid_selinux/main/selinux_config.erb'
|
||||
|
||||
# includes must be last
|
||||
include cd_selinux::main::config
|
||||
include confdroid_selinux::main::config
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user