Defined Type: selinux::fcontext
- Defined in:
- manifests/fcontext.pp
Overview
selinux::fcontext
This define can be used to manage custom SELinux fcontexts. For fcontext equivalences, see selinux::fcontext::equivalence
33 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 |
# File 'manifests/fcontext.pp', line 33
define selinux::fcontext(
String $pathspec = $title,
Enum['absent', 'present'] $ensure = 'present',
Optional[String] $seltype = undef,
Optional[String] $seluser = undef,
Optional[String] $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"')
}
# 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,
}
}
|