Add AppArmor key to quadlet .container files

Fixes: #27095
Signed-off-by: givensuman <givensuman@duck.com>
This commit is contained in:
givensuman
2025-10-30 21:02:20 -04:00
parent 23e6a89d36
commit e7b50c33df
4 changed files with 19 additions and 0 deletions

View File

@@ -62,6 +62,7 @@ const (
KeyAddHost = "AddHost"
KeyAllTags = "AllTags"
KeyAnnotation = "Annotation"
KeyAppArmor = "AppArmor"
KeyArch = "Arch"
KeyArtifact = "Artifact"
KeyAuthFile = "AuthFile"
@@ -248,6 +249,7 @@ var (
KeyAddDevice: true,
KeyAddHost: true,
KeyAnnotation: true,
KeyAppArmor: true,
KeyAutoUpdate: true,
KeyCgroupsMode: true,
KeyContainerName: true,
@@ -775,6 +777,11 @@ func ConvertContainer(container *parser.UnitFile, unitsInfoMap map[string]*UnitI
podman.add("--security-opt", fmt.Sprintf("label=level:%s", securityLabelLevel))
}
apparmor, hasApparmor := container.Lookup(ContainerGroup, KeyAppArmor)
if hasApparmor && len(apparmor) > 0 {
podman.add("--security-opt", fmt.Sprintf("apparmor=%s", apparmor))
}
devices := container.LookupAllStrv(ContainerGroup, KeyAddDevice)
for _, device := range devices {
if device[0] == '-' {