1
0
mirror of https://github.com/rancher/os.git synced 2025-09-02 15:24:32 +00:00
Files
os/pkg/init/selinux/selinux.go

35 lines
708 B
Go
Raw Normal View History

//go:build linux
2016-02-19 16:11:32 -08:00
// +build linux
2018-09-15 21:55:26 -07:00
package selinux
2016-02-19 16:11:32 -08:00
import (
"io/ioutil"
2018-09-15 21:55:26 -07:00
"github.com/burmilla/os/config"
"github.com/burmilla/os/pkg/log"
"github.com/burmilla/os/pkg/selinux"
2016-02-19 16:11:32 -08:00
)
2018-09-15 21:55:26 -07:00
func Initialize(c *config.CloudConfig) (*config.CloudConfig, error) {
2016-02-19 16:11:32 -08:00
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
}