feat(aa-log): add AppArmorProfile.String using a template.
This commit is contained in:
parent
4f40cb6d78
commit
574891d445
3 changed files with 341 additions and 0 deletions
|
|
@ -7,8 +7,30 @@ package aa
|
|||
import (
|
||||
_ "embed"
|
||||
"strings"
|
||||
"text/template"
|
||||
)
|
||||
|
||||
const indentation = " "
|
||||
|
||||
//go:embed template.j2
|
||||
var tmplFileAppArmorProfile string
|
||||
|
||||
var tmplFunctionMap = template.FuncMap{
|
||||
"indent": indent,
|
||||
"overindent": indentDbus,
|
||||
}
|
||||
|
||||
var tmplAppArmorProfile = template.Must(template.New("profile").
|
||||
Funcs(tmplFunctionMap).Parse(tmplFileAppArmorProfile))
|
||||
|
||||
func indent(s string) string {
|
||||
return indentation + s
|
||||
}
|
||||
|
||||
func indentDbus(s string) string {
|
||||
return indentation + " " + s
|
||||
}
|
||||
|
||||
// TODO: Should be a map of slice, not exhausive yet
|
||||
var maskToAccess = map[string]string{
|
||||
"a": "w",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue