Skip to content

Commit

Permalink
Make AppArmor message applicabel to SELinux too
Browse files Browse the repository at this point in the history
  • Loading branch information
arthurbarr committed Jun 26, 2018
1 parent 9624d7e commit 4ad8f26
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions cmd/runmqserver/mqconfig.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,9 +95,18 @@ func logSeccomp() error {
return nil
}

func logAppArmor() error {
s := container.AppArmorProfile()
log.Printf("AppArmor profile: %v", s)
// logSecurityAttributes logs the security attributes of the current process.
// The security attributes indicate whether AppArmor or SELinux are being used,
// and what the level of confinement is.
func logSecurityAttributes() error {
a, err := readProc("/proc/self/attr/current")
// On some systems, if AppArmor or SELinux are not installed, you get an
// error when you try and read `/proc/self/attr/current`, even though the
// file exists.
if err != nil || a == "" {
a = "none"
}
log.Printf("Process security attributes: %v", a)
return nil
}

Expand Down Expand Up @@ -156,7 +165,7 @@ func logConfig() error {
logUser()
logCapabilities()
logSeccomp()
logAppArmor()
logSecurityAttributes()
err = readMounts()
if err != nil {
return err
Expand Down

0 comments on commit 4ad8f26

Please sign in to comment.