From f4ba16861f3dbee0569b50e5843c0acde3b65201 Mon Sep 17 00:00:00 2001 From: Alexandre Pujol Date: Tue, 22 Aug 2023 22:58:35 +0100 Subject: [PATCH] feat(aa-log): minor apparmor profile struct tweak. --- pkg/aa/rules.go | 10 +++++----- pkg/aa/template.j2 | 18 +++++++++--------- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/pkg/aa/rules.go b/pkg/aa/rules.go index 997bbd1f..4913b3be 100644 --- a/pkg/aa/rules.go +++ b/pkg/aa/rules.go @@ -52,8 +52,8 @@ type Qualifier struct { // Preamble rules type Abi struct { - AbsPath string - MagicPath string + Path string + IsMagic bool } type Alias struct { @@ -62,9 +62,9 @@ type Alias struct { } type Include struct { - IfExists bool - AbsPath string - MagicPath string + IfExists bool + Path string + IsMagic bool } type Variable struct { diff --git a/pkg/aa/template.j2 b/pkg/aa/template.j2 index 4b4939a4..8d083e19 100644 --- a/pkg/aa/template.j2 +++ b/pkg/aa/template.j2 @@ -4,10 +4,10 @@ {{- if .Abi -}} {{- range .Abi -}} - {{- if .AbsPath -}} - abi "{{ .AbsPath }}",{{ "\n" }} + {{- if .IsMagic -}} + abi <{{ .Path }}>,{{ "\n" }} {{- else -}} - abi <{{ .MagicPath }}>,{{ "\n" }} + abi "{{ .Path }}",{{ "\n" }} {{- end -}} {{- end -}} {{ "\n" }} @@ -26,10 +26,10 @@ {{- if .IfExists -}} {{- "if exists " -}} {{- end -}} - {{- if .AbsPath -}} - "{{ . }}"{{ "\n" }} + {{- if .IsMagic -}} + <{{ .Path }}>{{ "\n" }} {{- else -}} - <{{ .MagicPath }}>{{ "\n" }} + "{{ .Path }}"{{ "\n" }} {{- end -}} {{- end -}} {{ "\n" }} @@ -296,10 +296,10 @@ profile {{ .Name }}{{ " " }} {{- range .Includes -}} {{- if .IfExists -}} {{ "include if exists " | indent }} - {{- if .AbsPath -}} - "{{ . }}"{{ "\n" }} + {{- if .IsMagic -}} + <{{ .Path }}>{{ "\n" }} {{- else -}} - <{{ .MagicPath }}>{{ "\n" }} + "{{ .Path }}"{{ "\n" }} {{- end -}} {{- end -}} {{- end -}}