Skip to content

Instantly share code, notes, and snippets.

@rodjek
Created July 12, 2010 04:00
Show Gist options
  • Save rodjek/472123 to your computer and use it in GitHub Desktop.
Save rodjek/472123 to your computer and use it in GitHub Desktop.
define selinux_login($identity, $ensure="present") {
if $ensure == "present" {
exec { "Mapping ${name} to the ${identity} SELinux identity":
command => "semanage login -a -S targeted -s ${identity} -r s0 ${name}",
unless => "semanage login -l | grep \"${name}\" | grep \"${identity}\"",
}
} else {
exec { "Removing ${name} from the ${identity} SELinux identity":
command => "semanage login -d ${name}",
onlyif => "semanage login -l | grep \"${name}\" | grep \"${identity}\"",
}
}
}
selinux_login { "fenris02":
indentity => "user_u",
ensure => present,
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment