mirror of
https://github.com/roddhjav/apparmor.d.git
synced 2024-11-16 00:13:48 +01:00
40 lines
763 B
Go
40 lines
763 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 builder
|
|
|
|
import (
|
|
"fmt"
|
|
|
|
"github.com/roddhjav/apparmor.d/pkg/prebuild/cfg"
|
|
)
|
|
|
|
var (
|
|
// Build the profiles with the following directive applied
|
|
Builds = []Builder{}
|
|
|
|
// Available builders
|
|
Builders = map[string]Builder{}
|
|
)
|
|
|
|
// Main directive interface
|
|
type Builder interface {
|
|
cfg.BaseInterface
|
|
Apply(profile string) string
|
|
}
|
|
|
|
func Register(names ...string) {
|
|
for _, name := range names {
|
|
if b, present := Builders[name]; present {
|
|
Builds = append(Builds, b)
|
|
} else {
|
|
panic(fmt.Sprintf("Unknown builder: %s", name))
|
|
}
|
|
}
|
|
}
|
|
|
|
func RegisterBuilder(d Builder) {
|
|
Builders[d.Name()] = d
|
|
}
|