From 0761a6c4664f4785afbc5c4ca3dfe9531a9b9053 Mon Sep 17 00:00:00 2001 From: Alexandre Pujol Date: Tue, 28 May 2024 18:16:21 +0100 Subject: [PATCH] feat(aa): add the hat template. --- pkg/aa/templates/hat.j2 | 18 ++++++++++++++++++ pkg/aa/templates/rules.j2 | 4 ++++ 2 files changed, 22 insertions(+) create mode 100644 pkg/aa/templates/hat.j2 diff --git a/pkg/aa/templates/hat.j2 b/pkg/aa/templates/hat.j2 new file mode 100644 index 00000000..694c3acc --- /dev/null +++ b/pkg/aa/templates/hat.j2 @@ -0,0 +1,18 @@ +{{- /* apparmor.d - Full set of apparmor profiles */ -}} +{{- /* Copyright (C) 2021-2024 Alexandre Pujol */ -}} +{{- /* SPDX-License-Identifier: GPL-2.0-only */ -}} + +{{- define "hat" -}} + + {{- "hat" -}} + {{- with .Name -}} + {{ " " }}{{ . }} + {{- end -}} + + {{- " {\n" -}} + {{- setindent "++" -}} + {{- template "rules" .Rules -}} + {{- setindent "--" -}} + {{- indent "}" -}} + +{{- end -}} diff --git a/pkg/aa/templates/rules.j2 b/pkg/aa/templates/rules.j2 index 9a611332..efc057e0 100644 --- a/pkg/aa/templates/rules.j2 +++ b/pkg/aa/templates/rules.j2 @@ -114,6 +114,10 @@ {{- template "profile" . -}} {{- end -}} + {{- if eq $kind "hat" -}} + {{- template "hat" . -}} + {{- end -}} + {{- "\n" -}} {{- $oldkind = $kind -}} {{- end -}}