mirror of
https://github.com/roddhjav/apparmor.d.git
synced 2024-12-26 15:06:45 +01:00
47 lines
822 B
Go
47 lines
822 B
Go
// apparmor.d - Full set of apparmor profiles
|
|
// Copyright (C) 2021-2024 Alexandre Pujol <alexandre@pujol.io>
|
|
// SPDX-License-Identifier: GPL-2.0-only
|
|
|
|
package aa
|
|
|
|
const (
|
|
HAT Kind = "hat"
|
|
)
|
|
|
|
// Hat represents a single AppArmor hat.
|
|
type Hat struct {
|
|
Base
|
|
Name string
|
|
Rules Rules
|
|
}
|
|
|
|
func (p *Hat) Kind() Kind {
|
|
return HAT
|
|
}
|
|
|
|
func (p *Hat) Constraint() Constraint {
|
|
return BlockRule
|
|
}
|
|
|
|
func (p *Hat) String() string {
|
|
return renderTemplate(p.Kind(), p)
|
|
}
|
|
|
|
func (r *Hat) Validate() error {
|
|
return nil
|
|
}
|
|
|
|
func (r *Hat) Compare(other Rule) int {
|
|
o, _ := other.(*Hat)
|
|
return compare(r.Name, o.Name)
|
|
}
|
|
|
|
func (r *Hat) Merge(other Rule) bool {
|
|
return false // Never merge hat blocks
|
|
}
|
|
|
|
func (r *Hat) Lengths() []int {
|
|
return []int{} // No len for hat
|
|
}
|
|
|
|
func (r *Hat) setPaddings(max []int) {} // No paddings for hat
|