apparmor.d/pkg/prebuild/builder/abi.go
Alexandre Pujol 5e14271f76
Merge FSP: rewrite the systemd profiles #753
* dev: (49 commits)
  fix: use mappings/sudo in su.
  build: justfile: add group.
  tests: update sbin.list
  fix: linter check.
  fix: add gpartedbin back to sbin.list.
  tests: show error line in sbin check.
  feat(profile): update sbin list and ensure the profiles use the good variable (sbin or bin).
  tests: remove symbolic link from sbin.
  test: add some security checks.
  tests: add more check for sbin path
  tests: rewrite and expand the profile check to more files.
  feat(tunable): add the archive_path variable.
  feat(profile): update gnome profiles.
  feat(fsp): small fsp improvement.
  feat(abs): minor improvement & cosmetic.
  feat(profile): add profiles for whoopsie.
  feat(profile): add initial profile for systemd-initctl.
  feat(profile): minor fsp related improvment.
  feat(fsp): setup RBAC mapping in auth enabled profiles.
  build: ignore all rule in abi3.
  ...
2025-06-16 21:41:08 +02:00

37 lines
767 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 (
"github.com/roddhjav/apparmor.d/pkg/prebuild"
"github.com/roddhjav/apparmor.d/pkg/util"
)
var (
regAbi4To3 = util.ToRegexRepl([]string{
`abi/4.0`, `abi/3.0`,
` userns,`, ` # userns,`,
` mqueue`, ` # mqueue`,
` all`, ` # all`,
` deny mqueue`, ` # deny mqueue`,
})
)
type ABI3 struct {
prebuild.Base
}
func init() {
RegisterBuilder(&ABI3{
Base: prebuild.Base{
Keyword: "abi3",
Msg: "Convert all profiles from abi 4.0 to abi 3.0",
},
})
}
func (b ABI3) Apply(opt *Option, profile string) (string, error) {
return regAbi4To3.Replace(profile), nil
}