func appArmorCanStack() bool {
	contentBytes, err := ioutil.ReadFile("/sys/kernel/security/apparmor/features/domain/stack")
	if err != nil {
		return false
	}

	if string(contentBytes) != "yes\n" {
		return false
	}

	contentBytes, err = ioutil.ReadFile("/sys/kernel/security/apparmor/features/domain/version")
	if err != nil {
		return false
	}

	content := string(contentBytes)

	parts := strings.Split(strings.TrimSpace(content), ".")

	if len(parts) == 0 {
		logger.Warn("Unknown apparmor domain version", log.Ctx{"version": content})
		return false
	}

	major, err := strconv.Atoi(parts[0])
	if err != nil {
		logger.Warn("Unknown apparmor domain version", log.Ctx{"version": content})
		return false
	}

	minor := 0
	if len(parts) == 2 {
		minor, err = strconv.Atoi(parts[1])
		if err != nil {
			logger.Warn("Unknown apparmor domain version", log.Ctx{"version": content})
			return false
		}
	}

	return major >= 1 && minor >= 2
}
func appArmorCanStack() bool {
	contentBytes, err := ioutil.ReadFile("/sys/kernel/security/apparmor/features/domain/stack")
	if err != nil {
		return false
	}

	if string(contentBytes) != "yes\n" {
		return false
	}

	contentBytes, err = ioutil.ReadFile("/sys/kernel/security/apparmor/features/domain/version")
	if err != nil {
		return false
	}

	content := string(contentBytes)

	parts := strings.Split(strings.TrimSpace(content), ".")

	if len(parts) == 0 {
		logger.Warn("Unknown apparmor domain version", log.Ctx{"version": content})
		return false
	}

	major, err := strconv.Atoi(parts[0])
	if err != nil {
		logger.Warn("Unknown apparmor domain version", log.Ctx{"version": content})
		return false
	}

	minor := 0
	if len(parts) == 2 {
		minor, err = strconv.Atoi(parts[1])
		if err != nil {
			logger.Warn("Unknown apparmor domain version", log.Ctx{"version": content})
			return false
		}
	}

	return major >= 1 && minor >= 2
}
func appArmorCanStack ( ) bool { contentBytes , err := ioutil . ReadFile ( " " ) if err != nil { return false } if string ( contentBytes ) != " \n " { return false } contentBytes , err = ioutil . ReadFile ( " " ) if err != nil { return false } content := string ( contentBytes ) parts := strings . Split ( strings . TrimSpace ( content ) , " " ) if len ( parts ) == 0 { logger . Warn ( " " , log . Ctx { " " : content } ) return false } major , err := strconv . Atoi ( parts [ 0 ] ) if err != nil { logger . Warn ( " " , log . Ctx { " " : content } ) return false } minor := 0 if len ( parts ) == 2 { minor , err = strconv . Atoi ( parts [ 1 ] ) if err != nil { logger . Warn ( " " , log . Ctx { " " : content } ) return false } } return major >= 1 && minor >= 2 }
// Returns true if AppArmor stacking support is available.
Returns true if AppArmor stacking support is available .