2023-08-18 00:00:52 +02:00
|
|
|
// apparmor.d - Full set of apparmor profiles
|
2024-02-07 00:16:21 +01:00
|
|
|
// Copyright (C) 2021-2024 Alexandre Pujol <alexandre@pujol.io>
|
2023-08-18 00:00:52 +02:00
|
|
|
// SPDX-License-Identifier: GPL-2.0-only
|
|
|
|
|
|
|
|
package aa
|
|
|
|
|
2024-04-23 22:26:09 +02:00
|
|
|
const (
|
|
|
|
tokALLOW = "allow"
|
|
|
|
tokAUDIT = "audit"
|
|
|
|
tokDENY = "deny"
|
|
|
|
)
|
|
|
|
|
2024-05-05 00:41:47 +02:00
|
|
|
type constraint uint
|
|
|
|
|
|
|
|
const (
|
|
|
|
anyKind constraint = iota // The rule can be found in either preamble or profile
|
|
|
|
preambleKind // The rule can only be found in the preamble
|
|
|
|
blockKind // The rule can only be found in a profile
|
|
|
|
)
|
|
|
|
|
2024-04-19 23:43:02 +02:00
|
|
|
// Rule generic interface for all AppArmor rules
|
|
|
|
type Rule interface {
|
2024-04-16 22:51:56 +02:00
|
|
|
Less(other any) bool
|
|
|
|
Equals(other any) bool
|
2024-04-23 22:26:09 +02:00
|
|
|
String() string
|
2024-05-05 00:41:47 +02:00
|
|
|
Constraint() constraint
|
|
|
|
Kind() string
|
2024-04-16 22:51:56 +02:00
|
|
|
}
|
|
|
|
|
2024-04-19 23:43:02 +02:00
|
|
|
type Rules []Rule
|
2024-04-16 22:51:56 +02:00
|
|
|
|
2024-04-23 22:26:09 +02:00
|
|
|
func (r Rules) String() string {
|
|
|
|
return renderTemplate("rules", r)
|
|
|
|
}
|