1
0
mirror of https://github.com/rancher/os.git synced 2025-09-01 14:48:55 +00:00

Enable SELinux

This commit is contained in:
Josh Curl
2016-02-19 16:11:32 -08:00
parent 90c8de9c0a
commit f28d463504
12 changed files with 71 additions and 2 deletions

32
init/selinux.go Normal file
View File

@@ -0,0 +1,32 @@
// +build linux
package init
import (
log "github.com/Sirupsen/logrus"
"github.com/rancher/os/config"
"github.com/rancher/os/selinux"
"io/ioutil"
)
func initializeSelinux(c *config.CloudConfig) (*config.CloudConfig, error) {
ret, _ := selinux.InitializeSelinux()
if ret != 0 {
log.Debug("Unable to initialize SELinux")
return c, nil
}
// Set allow_execstack boolean to true
if err := ioutil.WriteFile("/sys/fs/selinux/booleans/allow_execstack", []byte("1"), 0644); err != nil {
log.Debug(err)
return c, nil
}
if err := ioutil.WriteFile("/sys/fs/selinux/commit_pending_bools", []byte("1"), 0644); err != nil {
log.Debug(err)
return c, nil
}
return c, nil
}