mirror of
https://github.com/roddhjav/apparmor.d.git
synced 2025-01-18 08:58:15 +01:00
build: initial preparation for apparmor 4.
This commit is contained in:
parent
d810acd58f
commit
eb98d2b49f
1 changed files with 14 additions and 0 deletions
|
@ -9,6 +9,7 @@ import (
|
|||
"strings"
|
||||
|
||||
"github.com/roddhjav/apparmor.d/pkg/aa"
|
||||
"github.com/roddhjav/apparmor.d/pkg/util"
|
||||
"golang.org/x/exp/slices"
|
||||
)
|
||||
|
||||
|
@ -21,6 +22,12 @@ var (
|
|||
regAttachments = regexp.MustCompile(`(profile .* @{exec_path})`)
|
||||
regFlags = regexp.MustCompile(`flags=\(([^)]+)\)`)
|
||||
regProfileHeader = regexp.MustCompile(` {`)
|
||||
regAbi4To3 = util.ToRegexRepl([]string{
|
||||
`abi/4.0`, `abi/3.0`,
|
||||
`(?m)^.*mqueue.*$`, ``,
|
||||
`(?m)^.*userns.*$`, ``,
|
||||
`(?m)^.*io_uring.*$`, ``,
|
||||
})
|
||||
)
|
||||
|
||||
type BuildFunc func(string) string
|
||||
|
@ -79,3 +86,10 @@ func BuildUserspace(profile string) string {
|
|||
}
|
||||
return profile
|
||||
}
|
||||
|
||||
func BuildABI3(profile string) string {
|
||||
for _, abi4t3 := range regAbi4To3 {
|
||||
profile = abi4t3.Regex.ReplaceAllLiteralString(profile, abi4t3.Repl)
|
||||
}
|
||||
return profile
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue