mirror of
https://github.com/roddhjav/apparmor.d.git
synced 2025-01-29 14:25:12 +01:00
feat(full): set systemd profile name on build time.
This commit is contained in:
parent
2143fb03af
commit
6dc990ac02
1 changed files with 13 additions and 0 deletions
|
@ -176,12 +176,25 @@ func SetFlags() error {
|
|||
// Set AppArmor for (experimental) full system policy.
|
||||
// See https://apparmor.pujol.io/development/structure/#full-system-policy
|
||||
func SetFullSystemPolicy() error {
|
||||
// Install full system policy profiles
|
||||
for _, name := range []string{"systemd", "systemd-user"} {
|
||||
err := paths.New("apparmor.d/groups/_full/" + name).CopyTo(RootApparmord.Join(name))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
// Set systemd profile name
|
||||
path := paths.New("apparmor.d/tunables/multiarch.d/apparmor.d")
|
||||
content, err := path.ReadFile()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
res := strings.Replace(string(content), "@{systemd}=unconfined", "@{systemd}=systemd", -1)
|
||||
if err := path.WriteFile([]byte(res)); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
logging.Success("Configure AppArmor for full system policy")
|
||||
return nil
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue