1
0
mirror of https://github.com/rancher/os.git synced 2025-06-23 13:37:03 +00:00
os/init/selinux.go
Sven Dowideit 4df962d4b6 make ros log to dmesg
Signed-off-by: Sven Dowideit <SvenDowideit@home.org.au>
2016-11-30 10:51:30 +10:00

33 lines
683 B
Go

// +build linux
package init
import (
"github.com/rancher/os/config"
"github.com/rancher/os/log"
"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
}