build: add support for apparmor 5.0 (current master branch)

This commit is contained in:
Alexandre Pujol 2025-08-29 20:14:12 +02:00
parent be0d481068
commit 2bb42bfca2
No known key found for this signature in database
GPG key ID: C5469996F0DF68EC
2 changed files with 31 additions and 7 deletions

View file

@ -38,3 +38,6 @@ openvpn
remmina remmina
transmission transmission
wg-quick wg-quick
systemd-detect-virt # Missing integration with @{p_systemd}
hostname # Has @{bin} denied in header, would conflict with apparmor.d's @{bin} tunables

View file

@ -23,6 +23,15 @@ func init() {
}) })
} }
func removeFiles(files []string) error {
for _, name := range files {
if err := prebuild.RootApparmord.Join(name).RemoveAll(); err != nil {
return err
}
}
return nil
}
func (p Configure) Apply() ([]string, error) { func (p Configure) Apply() ([]string, error) {
res := []string{} res := []string{}
@ -57,19 +66,31 @@ func (p Configure) Apply() ([]string, error) {
} }
if prebuild.Version == 4.1 { if prebuild.Version >= 4.1 {
// Remove files upstreamed in 4.1
remove := []string{ remove := []string{
// Remove files upstreamed in 4.1
"abstractions/devices-usb-read", "abstractions/devices-usb-read",
"abstractions/devices-usb", "abstractions/devices-usb",
"abstractions/nameservice-strict", "abstractions/nameservice-strict",
"tunables/multiarch.d/base", "tunables/multiarch.d/base",
"wg", // Upstream version is identical
// Direct upstream contributed profiles, similar to ours
"wg",
} }
for _, name := range remove { if err := removeFiles(remove); err != nil {
if err := prebuild.RootApparmord.Join(name).RemoveAll(); err != nil { return res, err
return res, err }
} }
if prebuild.Version >= 5.0 {
remove := []string{
// Direct upstrem contributed profiles, similar to ours
"dig",
"free",
"nslookup",
"who",
}
if err := removeFiles(remove); err != nil {
return res, err
} }
} }
return res, nil return res, nil