2024-04-15 15:09:04 +02:00
|
|
|
{{- /* apparmor.d - Full set of apparmor profiles */ -}}
|
|
|
|
{{- /* Copyright (C) 2021-2024 Alexandre Pujol <alexandre@pujol.io> */ -}}
|
|
|
|
{{- /* SPDX-License-Identifier: GPL-2.0-only */ -}}
|
|
|
|
|
|
|
|
{{- define "profile" -}}
|
|
|
|
|
2024-04-16 22:51:56 +02:00
|
|
|
{{- with .Header -}}
|
2024-04-15 15:09:04 +02:00
|
|
|
{{- "profile" -}}
|
|
|
|
{{- with .Name -}}
|
|
|
|
{{ " " }}{{ . }}
|
|
|
|
{{- end -}}
|
|
|
|
{{- with .Attachments -}}
|
|
|
|
{{ " " }}{{ join . }}
|
|
|
|
{{- end -}}
|
|
|
|
{{- with .Attributes -}}
|
|
|
|
{{ " xattrs=(" }}{{ join . }}{{ ")" }}
|
|
|
|
{{- end -}}
|
|
|
|
{{- with .Flags -}}
|
|
|
|
{{ " flags=(" }}{{ join . }}{{ ")" }}
|
|
|
|
{{- end -}}
|
2024-04-17 19:02:41 +02:00
|
|
|
{{- " {\n" -}}
|
2024-04-15 15:09:04 +02:00
|
|
|
{{- end -}}
|
|
|
|
|
|
|
|
{{- $oldtype := "" -}}
|
|
|
|
{{- range .Rules -}}
|
|
|
|
{{- $type := typeof . -}}
|
|
|
|
{{- if eq $type "Rule" -}}
|
2024-04-17 19:02:41 +02:00
|
|
|
{{- template "comment" . -}}
|
2024-04-15 15:09:04 +02:00
|
|
|
{{- "\n" -}}
|
|
|
|
{{- continue -}}
|
|
|
|
{{- end -}}
|
|
|
|
{{- if and (ne $type $oldtype) (ne $oldtype "") -}}
|
|
|
|
{{- "\n" -}}
|
|
|
|
{{- end -}}
|
|
|
|
{{- indent "" -}}
|
|
|
|
|
|
|
|
{{- if eq $type "Include" -}}
|
|
|
|
{{ template "include" . }}
|
|
|
|
{{- end -}}
|
|
|
|
|
|
|
|
{{- if eq $type "Rlimit" -}}
|
2024-04-17 19:02:41 +02:00
|
|
|
{{- template "rlimit" . -}}
|
2024-04-15 15:09:04 +02:00
|
|
|
{{- end -}}
|
|
|
|
|
|
|
|
{{- if eq $type "Userns" -}}
|
2024-04-17 19:02:41 +02:00
|
|
|
{{- template "userns" . -}}
|
2024-04-15 15:09:04 +02:00
|
|
|
{{- end -}}
|
|
|
|
|
|
|
|
{{- if eq $type "Capability" -}}
|
2024-04-17 19:02:41 +02:00
|
|
|
{{- template "capability" . -}}
|
2024-04-15 15:09:04 +02:00
|
|
|
{{- end -}}
|
|
|
|
|
|
|
|
{{- if eq $type "Network" -}}
|
2024-04-17 19:02:41 +02:00
|
|
|
{{- template "network" . -}}
|
2024-04-15 15:09:04 +02:00
|
|
|
{{- end -}}
|
|
|
|
|
|
|
|
{{- if eq $type "Mount" -}}
|
2024-04-17 19:02:41 +02:00
|
|
|
{{- template "mount" . -}}
|
2024-04-15 15:09:04 +02:00
|
|
|
{{- end -}}
|
|
|
|
|
2024-04-17 19:02:41 +02:00
|
|
|
{{- if eq $type "Remount" -}}
|
|
|
|
{{- template "remount" . -}}
|
2024-04-15 15:09:04 +02:00
|
|
|
{{- end -}}
|
|
|
|
|
2024-04-17 19:02:41 +02:00
|
|
|
{{- if eq $type "Umount" -}}
|
|
|
|
{{- template "umount" . -}}
|
2024-04-15 15:09:04 +02:00
|
|
|
{{- end -}}
|
|
|
|
|
|
|
|
{{- if eq $type "PivotRoot" -}}
|
2024-04-17 19:02:41 +02:00
|
|
|
{{- template "pivot_root" . -}}
|
2024-04-15 15:09:04 +02:00
|
|
|
{{- end -}}
|
|
|
|
|
|
|
|
{{- if eq $type "ChangeProfile" -}}
|
2024-04-17 19:02:41 +02:00
|
|
|
{{- template "change_profile" . -}}
|
2024-04-15 15:09:04 +02:00
|
|
|
{{- end -}}
|
|
|
|
|
|
|
|
{{- if eq $type "Mqueue" -}}
|
2024-04-17 19:02:41 +02:00
|
|
|
{{- template "mqueue" . -}}
|
2024-04-15 15:09:04 +02:00
|
|
|
{{- end -}}
|
|
|
|
|
|
|
|
{{- if eq $type "Unix" -}}
|
2024-04-17 19:02:41 +02:00
|
|
|
{{- template "unix" . -}}
|
2024-04-15 15:09:04 +02:00
|
|
|
{{- end -}}
|
|
|
|
|
|
|
|
{{- if eq $type "Ptrace" -}}
|
2024-04-17 19:02:41 +02:00
|
|
|
{{- template "ptrace" . -}}
|
2024-04-15 15:09:04 +02:00
|
|
|
{{- end -}}
|
|
|
|
|
|
|
|
{{- if eq $type "Signal" -}}
|
2024-04-17 19:02:41 +02:00
|
|
|
{{- template "signal" . -}}
|
2024-04-15 15:09:04 +02:00
|
|
|
{{- end -}}
|
|
|
|
|
|
|
|
{{- if eq $type "Dbus" -}}
|
2024-04-17 19:02:41 +02:00
|
|
|
{{- template "dbus" . -}}
|
2024-04-15 15:09:04 +02:00
|
|
|
{{- end -}}
|
|
|
|
|
|
|
|
{{- if eq $type "File" -}}
|
2024-04-17 19:02:41 +02:00
|
|
|
{{- template "file" . -}}
|
2024-04-15 15:09:04 +02:00
|
|
|
{{- end -}}
|
|
|
|
|
|
|
|
{{- if eq $type "Profile" -}}
|
|
|
|
{{ template "profile" . }}
|
|
|
|
{{- end -}}
|
|
|
|
|
|
|
|
{{- "\n" -}}
|
|
|
|
{{- $oldtype = $type -}}
|
|
|
|
{{- end -}}
|
|
|
|
|
2024-04-16 22:51:56 +02:00
|
|
|
{{- with .Header -}}
|
2024-04-15 15:09:04 +02:00
|
|
|
{{- "}\n" -}}
|
|
|
|
{{- end -}}
|
|
|
|
|
|
|
|
{{- end -}}
|