mirror of
https://github.com/rancher/os.git
synced 2025-09-13 13:39:53 +00:00
Move around code for better clarity
This commit is contained in:
committed by
niusmallnan
parent
2f50b7b178
commit
1f50386828
33
pkg/init/selinux/selinux.go
Normal file
33
pkg/init/selinux/selinux.go
Normal file
@@ -0,0 +1,33 @@
|
||||
// +build linux
|
||||
|
||||
package selinux
|
||||
|
||||
import (
|
||||
"io/ioutil"
|
||||
|
||||
"github.com/rancher/os/config"
|
||||
"github.com/rancher/os/pkg/log"
|
||||
"github.com/rancher/os/pkg/selinux"
|
||||
)
|
||||
|
||||
func Initialize(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
|
||||
}
|
Reference in New Issue
Block a user