build: separate the base-strict abs from the re-attach builder.
Enable the use of the base-strict abs on all setup.
This commit is contained in:
parent
a1ba00bec3
commit
4f9d2703d4
4 changed files with 37 additions and 7 deletions
|
|
@ -8,7 +8,7 @@
|
||||||
|
|
||||||
abi <abi/4.0>,
|
abi <abi/4.0>,
|
||||||
|
|
||||||
include <abstractions/base-strict>
|
include <abstractions/base>
|
||||||
|
|
||||||
@{att}/@{run}/systemd/journal/dev-log w,
|
@{att}/@{run}/systemd/journal/dev-log w,
|
||||||
@{att}/@{run}/systemd/journal/socket w,
|
@{att}/@{run}/systemd/journal/socket w,
|
||||||
|
|
|
||||||
|
|
@ -32,8 +32,9 @@ func init() {
|
||||||
|
|
||||||
// Build tasks applied by default
|
// Build tasks applied by default
|
||||||
builder.Register(
|
builder.Register(
|
||||||
"userspace", // Resolve variable in profile attachments
|
"userspace", // Resolve variable in profile attachments
|
||||||
"hotfix", // Temporary fix for #74, #80 & #235
|
"hotfix", // Temporary fix for #74, #80 & #235
|
||||||
|
"base-strict", // Use base-strict as base abstraction
|
||||||
)
|
)
|
||||||
|
|
||||||
// Matrix of ABI/Apparmor version to integrate with
|
// Matrix of ABI/Apparmor version to integrate with
|
||||||
|
|
|
||||||
|
|
@ -49,10 +49,7 @@ func (b ReAttach) Apply(opt *Option, profile string) (string, error) {
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
insert = "@{att} = /\n"
|
insert = "@{att} = /\n"
|
||||||
profile = strings.ReplaceAll(profile,
|
|
||||||
"include <abstractions/base>",
|
|
||||||
"include <abstractions/base-strict>",
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return strings.Replace(profile, origin, insert+origin, 1), nil
|
return strings.Replace(profile, origin, insert+origin, 1), nil
|
||||||
|
|
|
||||||
32
pkg/prebuild/builder/base-strict.go
Normal file
32
pkg/prebuild/builder/base-strict.go
Normal file
|
|
@ -0,0 +1,32 @@
|
||||||
|
// 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 (
|
||||||
|
"strings"
|
||||||
|
|
||||||
|
"github.com/roddhjav/apparmor.d/pkg/prebuild"
|
||||||
|
)
|
||||||
|
|
||||||
|
type BaseStrict struct {
|
||||||
|
prebuild.Base
|
||||||
|
}
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
RegisterBuilder(&BaseStrict{
|
||||||
|
Base: prebuild.Base{
|
||||||
|
Keyword: "base-strict",
|
||||||
|
Msg: "Feat: use 'base-strict' as base abstraction",
|
||||||
|
},
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
func (b BaseStrict) Apply(opt *Option, profile string) (string, error) {
|
||||||
|
profile = strings.ReplaceAll(profile,
|
||||||
|
"include <abstractions/base>",
|
||||||
|
"include <abstractions/base-strict>",
|
||||||
|
)
|
||||||
|
return profile, nil
|
||||||
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue