Defined Type: selinux::fcontext
- Defined in:
- manifests/fcontext.pp
Overview
For fcontext equivalences, see selinux::fcontext::equivalence
34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 |
# File 'manifests/fcontext.pp', line 34
define selinux::fcontext (
String $pathspec = $title,
Enum['absent', 'present'] $ensure = 'present',
Optional[String] $seltype = undef,
Optional[String] $seluser = undef,
String[1] $filetype = 'a',
) {
include selinux
if $ensure == 'present' {
Anchor['selinux::module post']
-> Selinux::Fcontext[$title]
-> Anchor['selinux::end']
} else {
Anchor['selinux::start']
-> Selinux::Fcontext[$title]
-> Anchor['selinux::module pre']
}
if $filetype !~ /^(?:a|f|d|c|b|s|l|p)$/ {
fail('"filetype" must be one of: a,f,d,c,b,s,l,p - see "man semanage-fcontext"')
}
# Do nothing unless SELinux is enabled
if $facts['os']['selinux']['enabled'] {
# make sure the title is correct or the provider will misbehave
selinux_fcontext { "${pathspec}_${filetype}":
ensure => $ensure,
pathspec => $pathspec,
seltype => $seltype,
file_type => $filetype,
seluser => $seluser,
}
}
}
|