Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
69c0746
fix(build): attach: use the profile header name for namespaced profi…
roddhjav Jul 27, 2026
bcc6f61
chore: cosmetic.
roddhjav Jul 27, 2026
c05b4a4
build: add future option to prebuild command.
roddhjav Jul 27, 2026
654d256
feat(install): configure: let the ignore task read user drop-in files.
roddhjav Jul 27, 2026
6fed0f0
feat(install): configure: add the OverwriteFromLinks task.
roddhjav Jul 27, 2026
0b530f5
feat(install): configure: set flags from a list of sources.
roddhjav Jul 27, 2026
8f9ddaa
feat(install): configure: add the Include task.
roddhjav Jul 27, 2026
ae58ad2
feat(install): configure: add the SelectInstalled task.
roddhjav Jul 27, 2026
3176880
feat(install): tasks: record the group of each profile on merge.
roddhjav Jul 27, 2026
2ac6928
feat(install): builder: add the DeployMode builder.
roddhjav Jul 27, 2026
3ce311d
tests: add unit tests for the builder, configure, flatpak, runtime an…
roddhjav Jul 27, 2026
dc28d61
feat(install): util: read flags and ignore rules from *.conf drop-in …
roddhjav Jul 27, 2026
c203401
tests: add unit tests for the profile mode builder.
roddhjav Jul 27, 2026
9d47d03
fix(aa): parse: keep if/else chains split by a blank line in one para…
roddhjav Jul 27, 2026
5f201e8
feat(install): add the aa-install tool.
roddhjav Jul 27, 2026
a94f343
feat(install): move the profile flags and modes to the install config.
roddhjav Jul 27, 2026
d01e464
build(debian): split the package and install the profiles with aa-ins…
roddhjav Jul 27, 2026
24064c4
build(arch): install the profiles with aa-install.
roddhjav Jul 27, 2026
14a9d64
fix(build): wrongly ignored group.
roddhjav Jul 27, 2026
55c19ca
build(opensuse): split the package and install the profiles with aa-i…
roddhjav Jul 27, 2026
6d4a246
build(debian): remove the hide file generator.
roddhjav Jul 27, 2026
fa85e3f
build: ship aa-install, and the profiles in /usr/share/apparmor.d.
roddhjav Jul 27, 2026
9941777
docs: add the aa-install man page and shell completions.
roddhjav Jul 27, 2026
b4d6f36
fix: various build fixes.
roddhjav Jul 27, 2026
1a94a4e
feat(install): add the --all option.
roddhjav Jul 27, 2026
4134ce7
ci(github): update CI to last changes.
roddhjav Jul 27, 2026
e9f703a
ci(github): run on ubuntu 26.04.
roddhjav Jul 28, 2026
a2f4c16
ci(github): update the github actions.
roddhjav Jul 28, 2026
afc54cd
fix(install): only keep disable links for profiles present on the tar…
roddhjav Jul 29, 2026
c67019f
fear(profiles): various profiles improvements.
roddhjav Jul 29, 2026
6f857e0
feat(abs): stop auditing pycache recompilation.
roddhjav Jul 29, 2026
9655924
feat(install): user config drop-ins fully replace vendor files.
roddhjav Jul 29, 2026
91d02b6
build(debian): ensure apparmor.d-base is a deps of apparmor.d
roddhjav Jul 29, 2026
e0a6922
feat(install): add an include mode to the install config.
roddhjav Jul 29, 2026
b454a1a
feat(install): complain, all and enforce option do not imply install.
roddhjav Jul 29, 2026
5c956be
ci(github): add minimal workflow permission.
roddhjav Jul 29, 2026
1db8c3f
feat(state): add the system state detection.
roddhjav Jul 29, 2026
2fcbc07
fix(install): protect the namespaces directory from profile selection.
roddhjav Jul 29, 2026
1477c61
feat(install): move the overwrite mechanism to the install config.
roddhjav Jul 29, 2026
6550ee2
feat(profile): add aa-install.
roddhjav Jul 29, 2026
f3750f1
feat(abs): add journal-read.
roddhjav Jul 29, 2026
b741263
fix: rpm spec file.
roddhjav Jul 29, 2026
f4ce7af
fix(gitlab): update deb jobs.
roddhjav Jul 29, 2026
3ccf01e
buid(debian): ensure apparmor.d-base has the same version than apparm…
roddhjav Jul 29, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 29 additions & 20 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,15 @@ name: Ubuntu

on: [push, pull_request, workflow_dispatch]

permissions:
contents: read

jobs:
check:
runs-on: ubuntu-24.04
runs-on: ubuntu-26.04
steps:
- name: Check out repository code
uses: actions/checkout@v4
uses: actions/checkout@v7

- name: Install linter dependencies
run: |
Expand All @@ -24,28 +27,33 @@ jobs:
strategy:
matrix:
include:
- os: ubuntu-24.04
- os: ubuntu-26.04
mode: default
steps:
- name: Check out repository code
uses: actions/checkout@v4
uses: actions/checkout@v7

- name: Install Build dependencies
run: |
sudo apt-get update -q
sudo apt-get install -y \
devscripts debhelper config-package-dev \
devscripts debhelper \
auditd apparmor-profiles apparmor-utils
pipx install rust-just
echo "$HOME/.local/bin" >> $GITHUB_PATH
sudo rm /etc/apparmor.d/usr.lib.snapd.snap-confine.real
sudo rm -f /etc/apparmor.d/usr.lib.snapd.snap-confine.real

- name: Build the apparmor.d package
run: |
just build-dpkg

- name: Install apparmor.d
run: sudo dpkg --install .pkg/apparmor.d_*_amd64.deb || true
run: |
sudo dpkg --install .pkg/apparmor.d*.deb || true
sudo aa-install --install --all

- name: Show the installation status
run: sudo aa-install --status

- name: Reload AppArmor
run: |
Expand All @@ -63,29 +71,29 @@ jobs:
- name: Show Number of loaded profile
run: sudo aa-status --profiled

- name: Cache the build package
if: matrix.mode == 'default' && matrix.os == 'ubuntu-24.04'
uses: actions/cache/save@v4
- name: Cache the build packages
if: matrix.mode == 'default' && matrix.os == 'ubuntu-26.04'
uses: actions/cache/save@v6
with:
path: .pkg/apparmor.d_*_amd64.deb
key: ${{ matrix.os }}-${{ matrix.mode }}-${{ hashFiles('.pkg/apparmor.d_*_amd64.deb') }}
path: .pkg/apparmor.d*.deb
key: ${{ matrix.os }}-${{ matrix.mode }}-${{ hashFiles('.pkg/apparmor.d*.deb') }}

tests:
runs-on: ubuntu-24.04
runs-on: ubuntu-26.04
needs: build
if: github.ref_name == 'dev' || github.event_name == 'workflow_dispatch'
steps:
- name: Check out repository code
uses: actions/checkout@v4
uses: actions/checkout@v7

- name: Restore the cached build package
uses: actions/cache/restore@v4
- name: Restore the cached build packages
uses: actions/cache/restore@v6
with:
fail-on-cache-miss: true
path: .pkg/apparmor.d_*_amd64.deb
key: ubuntu-24.04-default-${{ hashFiles('.pkg/apparmor.d_*_amd64.deb') }}
path: .pkg/apparmor.d*.deb
key: ubuntu-26.04-default-${{ hashFiles('.pkg/apparmor.d*.deb') }}
restore-keys: |
ubuntu-24.04-default-
ubuntu-26.04-default-

- name: Install Tests dependencies
run: |
Expand All @@ -98,7 +106,8 @@ jobs:

- name: Install apparmor.d
run: |
sudo dpkg --install .pkg/apparmor.d_*_amd64.deb || true
sudo dpkg --install .pkg/apparmor.d*.deb || true
sudo aa-install --install --all
sudo systemctl restart apparmor.service
sudo systemctl daemon-reload
systemctl --user daemon-reload
Expand Down
6 changes: 3 additions & 3 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ bash:
- shellcheck --shell=bash
PKGBUILD dists/*.sh tests/check.sh
tests/packer/*.sh tests/packer/src/aa-update
tests/autopkgtest/autopkgtest.sh debian/common.postinst debian/common.postrm
tests/autopkgtest/autopkgtest.sh debian/apparmor.d.postinst debian/apparmor.d.postrm

golangci-lint:
stage: lint
Expand Down Expand Up @@ -142,7 +142,7 @@ preprocess-debian:
script:
- apt-get update -q
- apt-get install -y apparmor apparmor-profiles
- dpkg --install $PKGDEST/${PKGNAME}_*
- dpkg --install $PKGDEST/${PKGNAME}*.deb
- apparmor_parser --preprocess /etc/apparmor.d 1> /dev/null

preprocess-ubuntu:
Expand All @@ -153,7 +153,7 @@ preprocess-ubuntu:
script:
- apt-get update -q
- apt-get install -y apparmor apparmor-profiles
- dpkg --install $PKGDEST/${PKGNAME}_*
- dpkg --install $PKGDEST/${PKGNAME}*.deb
- apparmor_parser --preprocess /etc/apparmor.d 1> /dev/null

preprocess-opensuse:
Expand Down
52 changes: 28 additions & 24 deletions Justfile
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ help:
# Build the go programs
[group('build')]
build:
@go build -o {{build}}/ ./cmd/aa-install
@go build -o {{build}}/ ./cmd/aa-log
@go build -o {{build}}/ ./cmd/aa-mode
@go build -o {{build}}/ ./cmd/prebuild
Expand Down Expand Up @@ -150,6 +151,7 @@ install-base:
install-tools:
#!/usr/bin/env bash
set -eu -o pipefail
install -Dm0755 {{build}}/aa-install {{destdir}}/usr/bin/aa-install
install -Dm0755 {{build}}/aa-log {{destdir}}/usr/bin/aa-log
install -Dm0755 {{build}}/aa-mode {{destdir}}/usr/bin/aa-mode
mapfile -t share < <(find "{{build}}/share" -type f -not -name "*.md" -not -name "*aa-flatpak*" -printf "%P\n")
Expand All @@ -168,18 +170,12 @@ install-aa-flatpak:

# Install prebuilt profiles
[group('install')]
install-prebuilt:
install-prebuilt: _install-fixup
#!/usr/bin/env bash
set -eu -o pipefail
mapfile -t aa < <(find "{{build}}/apparmor.d" -type f -not -path "*/abstractions/*" -not -path "*/tunables/*" -printf "%P\n")
for file in "${aa[@]}"; do
#install -Dm0644 "{{build}}/apparmor.d/$file" "{{destdir}}/usr/share/apparmor.d/$file"
install -Dm0644 "{{build}}/apparmor.d/$file" "{{destdir}}/etc/apparmor.d/$file"
done
mapfile -t links < <(find "{{build}}/apparmor.d" -type l -printf "%P\n")
for file in "${links[@]}"; do
mkdir -p "{{destdir}}/etc/apparmor.d/disable"
cp -d "{{build}}/apparmor.d/$file" "{{destdir}}/etc/apparmor.d/$file"
install -Dm0644 "{{build}}/apparmor.d/$file" "{{destdir}}/usr/share/apparmor.d/$file"
done
for file in "{{build}}/systemd/system/"*; do
service="$(basename "$file")"
Expand All @@ -190,20 +186,22 @@ install-prebuilt:
install -Dm0644 "$file" "{{destdir}}/usr/lib/systemd/user/$service.d/apparmor.conf"
done

# Ensure profiles compatibility with upstream
[group('install')]
_install-fixup:
# The hostname profile fully conflicts with apparmor.d and must be disabled
@mkdir -p "{{destdir}}/etc/apparmor.d/disable"
@ln -sf ../hostname "{{destdir}}/etc/apparmor.d/disable/hostname"

# Install prebuild profiles
[group('install')]
install: install-tools
install: install-tools _install-fixup
#!/usr/bin/env bash
set -eu -o pipefail
mapfile -t aa < <(find "{{build}}/apparmor.d" -type f -printf "%P\n")
for file in "${aa[@]}"; do
install -Dm0644 "{{build}}/apparmor.d/$file" "{{destdir}}/etc/apparmor.d/$file"
done
mapfile -t links < <(find "{{build}}/apparmor.d" -type l -printf "%P\n")
for file in "${links[@]}"; do
mkdir -p "{{destdir}}/etc/apparmor.d/disable"
cp -d "{{build}}/apparmor.d/$file" "{{destdir}}/etc/apparmor.d/$file"
done
for file in "{{build}}/systemd/system/"*; do
service="$(basename "$file")"
install -Dm0644 "$file" "{{destdir}}/usr/lib/systemd/system/$service.d/apparmor.conf"
Expand Down Expand Up @@ -295,22 +293,26 @@ build-rpm: (_ensure_pkgdest)
# Build & install apparmor.d on Arch based systems
[group('packages')]
pkg: build-pkg
@sudo pacman -U --noconfirm \
{{pkgdest}}/{{pkgname}}-`just version`*.pkg.tar* \
{{pkgdest}}/{{pkgname}}-base-`just version`*.pkg.tar* \
{{pkgdest}}/{{pkgname}}-tools-`just version`*.pkg.tar*
#!/usr/bin/env bash
shopt -s extglob
sudo pacman -U --noconfirm \
{{pkgdest}}/{{pkgname}}?(-base|-tools)-$(just version)*.pkg.tar!(*.sig)

# Build & install apparmor.d on Debian based systems
[group('packages')]
dpkg name="": build-dpkg
dpkg: build-dpkg
@sudo dpkg -i \
{{pkgdest}}/{{pkgname}}{{ if name != "" { "." + name } else { "" } }}_`just version`*.deb
{{pkgdest}}/{{pkgname}}_`just version`*.deb \
{{pkgdest}}/{{pkgname}}-base_`just version`*.deb \
{{pkgdest}}/{{pkgname}}-tools_`just version`*.deb

# Build & install apparmor.d on OpenSUSE based systems
[group('packages')]
rpm: build-rpm
@sudo rpm -ivh --force \
{{pkgdest}}/{{pkgname}}-`just version`*.rpm
{{pkgdest}}/{{pkgname}}-`just version`-*.rpm \
{{pkgdest}}/{{pkgname}}-base-`just version`-*.rpm \
{{pkgdest}}/{{pkgname}}-tools-`just version`-*.rpm

# Run the linters
[group('linter')]
Expand All @@ -321,7 +323,7 @@ lint:
shellcheck --shell=bash \
PKGBUILD dists/*.sh tests/check.sh \
tests/packer/*.sh tests/packer/src/aa-update \
tests/autopkgtest/autopkgtest.sh debian/common.postinst debian/common.postrm
tests/autopkgtest/autopkgtest.sh debian/apparmor.d.postinst debian/apparmor.d.postrm

# Run style checks on the profiles
[group('linter')]
Expand All @@ -331,6 +333,7 @@ check:
# Generate the man pages
[group('docs')]
man:
@pandoc -t man -s -o share/man/man1/aa-install.1 share/man/man1/aa-install.md
@pandoc -t man -s -o share/man/man1/aa-mode.1 share/man/man1/aa-mode.md
@pandoc -t man -s -o share/man/man8/aa-log.8 share/man/man8/aa-log.md

Expand All @@ -352,8 +355,9 @@ serve:
# Remove all build artifacts
clean:
@rm -rf \
debian/.debhelper debian/debhelper* debian/*.debhelper debian/{{pkgname}}* \
debian/*.substvars debian/*.debhelper debian/files \
debian/.debhelper debian/debhelper* debian/*.debhelper debian/{{pkgname}}/ \
debian/{{pkgname}}-base/ debian/{{pkgname}}-tools/ \
debian/*.substvars debian/*.debhelper debian/*.debhelper.log debian/files \
{{pkgdest}}/{{pkgname}}* {{pkgdest}}/ubuntu {{pkgdest}}/debian \
{{pkgdest}}/archlinux {{pkgdest}}/opensuse \
{{build}} coverage.out .logs/autopkgtest/ site .cache
Expand Down
3 changes: 1 addition & 2 deletions PKGBUILD
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,7 @@ build() {
export GOPATH="${srcdir}"
export GOFLAGS="-buildmode=pie -trimpath -ldflags=-linkmode=external -mod=readonly -modcacherw -tags=dev"
export DISTRIBUTION=arch
just complain
# just prebuild
just prebuild
# just build-aa-flatpak
}

Expand Down
1 change: 1 addition & 0 deletions apparmor.d/abstractions/audio-client
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
owner @{HOME}/.pulse-cookie rwk,

owner @{user_cache_dirs}/event-sound-cache.tdb.@{hex32}.@{multiarch} rwk, # libcanberra
owner @{user_cache_dirs}/event-sound-cache.tdb.*.@{multiarch} rwk, # TODO: hostname

owner @{user_config_dirs}/pulse/ rw,
owner @{user_config_dirs}/pulse/client.conf r,
Expand Down
2 changes: 2 additions & 0 deletions apparmor.d/abstractions/common/electron
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@
include <abstractions/nameservice-strict>
include <abstractions/ssl_certs>

unix (send receive) type=seqpacket peer=(label=@{name}//crashpad_handler),

@{bin}/xdg-mime rix,
@{bin}/xdg-settings rix,

Expand Down
6 changes: 6 additions & 0 deletions apparmor.d/abstractions/ibus-strict
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,12 @@

abi <abi/5.0>,

owner @{desktop_config_dirs}/ibus/bus/ r,
owner @{desktop_config_dirs}/ibus/bus/@{hex32}-unix-@{int} r,
owner @{desktop_config_dirs}/ibus/bus/@{hex32}-unix-wayland-@{int} r,
owner @{desktop_config_dirs}/ibus/bus/machine-id-unix-@{int} r,
owner @{desktop_config_dirs}/ibus/bus/machine-id-unix-wayland-@{int} r,

owner @{user_cache_dirs}/ibus/dbus-@{rand8} rw,

owner @{user_config_dirs}/ibus/ r,
Expand Down
21 changes: 21 additions & 0 deletions apparmor.d/abstractions/journal-read
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# apparmor.d - Full set of apparmor profiles
# Copyright (C) 2026 Alexandre Pujol <alexandre@pujol.io>
# SPDX-License-Identifier: GPL-2.0-only

# Read only access to journalctl binary log files

abi <abi/5.0>,

/etc/machine-id r,
/var/lib/dbus/machine-id r,

/{run,var}/log/journal/ r,
/{run,var}/log/journal/system.journal r,
/{run,var}/log/journal/system@@{hex16}-@{hex16}.journal~ r,
/{run,var}/log/journal/system@@{hex32}-@{hex16}-@{hex16}.journal r,
/{run,var}/log/journal/user-@{uid}.journal r,
/{run,var}/log/journal/user-@{uid}@@{hex16}-@{hex16}.journal~ r,

include if exists <abstractions/journal-read.d>

# vim:syntax=apparmor
6 changes: 6 additions & 0 deletions apparmor.d/abstractions/nss
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,12 @@
owner @{HOME}/.pki/nssdb/{cert9,key4}.db rwk,
owner @{HOME}/.pki/nssdb/{cert9,key4}.db-journal rw,

owner @{user_share_dirs}/pki/ rw,
owner @{user_share_dirs}/pki/nssdb/ rw,
owner @{user_share_dirs}/pki/nssdb/pkcs11.txt rw,
owner @{user_share_dirs}/pki/nssdb/{cert9,key4}.db rwk,
owner @{user_share_dirs}/pki/nssdb/{cert9,key4}.db-journal rw,

include if exists <abstractions/nss.d>

# vim:syntax=apparmor
6 changes: 3 additions & 3 deletions apparmor.d/abstractions/python.d/complete
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@

#aa:only apparmor>=4.1
# Normal python run do not need to update pycache files. It is done by pycompile.
audit @{lib}/@{python_name}/{,**/}__pycache__/ w,
audit @{lib}/@{python_name}/{,**/}__pycache__/**.pyc w,
audit @{lib}/@{python_name}/{,**/}__pycache__/**.pyc.@{u64} w,
@{lib}/@{python_name}/{,**/}__pycache__/ w,
@{lib}/@{python_name}/{,**/}__pycache__/**.pyc w,
@{lib}/@{python_name}/{,**/}__pycache__/**.pyc.@{u64} w,

#aa:only test
owner /tmp/pytest-of-user/ rw,
Expand Down
Loading