2023-01-29 22:18:22 +01:00
---
title: Installation
---
2024-08-30 21:38:30 +02:00
## Setup
2023-01-29 22:18:22 +01:00
2024-08-30 21:38:30 +02:00
!!! danger
2023-01-29 22:18:22 +01:00
2024-08-30 21:38:30 +02:00
Do **not** expect this project to work correctly on your desktop if your Desktop Environment (DE) and Display Manager (DM) are not supported. Your DE/DM might not load, and that would be a **feature** .
2024-07-06 00:45:51 +02:00
2024-08-30 21:38:30 +02:00
Due to the development stage of this project, the default package configuration installs all profiles in **complain** mode. The recommended installation workflow is as-follow:
2024-10-01 23:53:30 +02:00
1. ** [Configure AppArmor ](#configure-apparmor )** AppArmor for *apparmor.d* .
1. ** [Install ](#installation )** *apparmor.d* in the (default) complain mode.
1. ** [Configure your personal directories ](configuration.md )**.
2024-08-30 21:38:30 +02:00
1. Reboot your system.
1. You **must** check for any AppArmor logs with [`aa-log` ](usage.md#apparmor-log ).
2024-10-01 23:53:30 +02:00
1. ** [Report ](https://apparmor.pujol.io/report/ )** any raised logs.
1. Use the profiles in *complain* mode for a while (a week), regularly check for new AppArmor logs.
2024-08-30 21:38:30 +02:00
1. Only if there are no logs raised for your daily usage, install it in [enforce mode ](enforce.md ).
2024-04-28 18:47:07 +02:00
2023-01-29 22:18:22 +01:00
## Requirements
**AppArmor**
2024-06-07 21:28:46 +02:00
An `AppArmor` supported Linux distribution is required. The default profiles and abstractions shipped with AppArmor must be installed.
2023-01-29 22:18:22 +01:00
**Desktop environment**
The following desktop environments are supported:
2024-10-01 23:53:30 +02:00
- [x] :material-gnome: Gnome (GDM)
- [x] :simple-kde: KDE (SDDM)
- [ ] :simple-xfce: XFCE (Lightdm) *(work in progress)*
2023-01-29 22:18:22 +01:00
2024-01-27 20:54:13 +01:00
**Build dependency**
2023-01-29 22:18:22 +01:00
2024-08-30 21:38:30 +02:00
* Go >= 1.21
2024-10-01 23:53:30 +02:00
## Configure AppArmor
As there are a lot of rules (~80k lines), it is recommended to enable fast caching compression of AppArmor profiles. In `/etc/apparmor/parser.conf` , add `write-cache` and `Optimize=compress-fast` :
```sh
echo 'write-cache' | sudo tee -a /etc/apparmor/parser.conf
echo 'Optimize=compress-fast' | sudo tee -a /etc/apparmor/parser.conf
```
2024-08-30 21:38:30 +02:00
## Installation
2023-01-29 22:18:22 +01:00
2024-08-30 21:38:30 +02:00
=== ":material-arch: Archlinux"
2023-01-29 22:18:22 +01:00
2024-08-30 21:38:30 +02:00
`apparmor.d-git` is available in the [Arch User Repository][aur]:
2023-04-24 13:18:57 +02:00
2024-08-30 21:38:30 +02:00
```sh
yay -S apparmor.d-git # or your preferred AUR install method
```
2023-01-29 22:18:22 +01:00
2024-08-30 21:38:30 +02:00
Or without an AUR helper:
2023-01-29 22:18:22 +01:00
2024-08-30 21:38:30 +02:00
```sh
git clone https://aur.archlinux.org/apparmor.d-git.git
cd apparmor.d-git
makepkg -si
```
2023-01-29 22:18:22 +01:00
2024-08-30 21:38:30 +02:00
=== ":material-ubuntu: Ubuntu"
2023-01-29 22:18:22 +01:00
2024-08-30 21:38:30 +02:00
Build the package from sources:
2023-08-19 15:32:08 +02:00
```sh
2024-08-30 21:38:30 +02:00
sudo apt install apparmor-profiles build-essential config-package-dev debhelper golang-go rsync git
git clone https://github.com/roddhjav/apparmor.d.git
cd apparmor.d
dpkg-buildpackage -b -d --no-sign
sudo dpkg -i ../apparmor.d_*.deb
2023-08-19 15:32:08 +02:00
```
2024-08-30 21:38:30 +02:00
!!! tip
If you have `devscripts` installed, you can use the one liner:
```sh
make dpkg
```
!!! warning
**Beware** : do not install a `.deb` made for Debian on Ubuntu, the packages are different.
If your distribution is based on Ubuntu, you may want to manually set the target distribution by exporting `DISTRIBUTION=ubuntu` .
=== ":material-debian: Debian"
Build the package from sources:
2023-10-21 01:13:30 +02:00
```sh
2024-08-30 21:38:30 +02:00
sudo apt install apparmor-profiles build-essential config-package-dev debhelper golang-go rsync git
git clone https://github.com/roddhjav/apparmor.d.git
cd apparmor.d
dpkg-buildpackage -b -d --no-sign
sudo dpkg -i ../apparmor.d_*.deb
2023-10-21 01:13:30 +02:00
```
2023-08-19 15:32:08 +02:00
2024-08-30 21:38:30 +02:00
!!! tip
2024-04-28 18:34:38 +02:00
2024-08-30 21:38:30 +02:00
If you have `devscripts` installed, you can use the one liner:
2024-04-28 18:34:38 +02:00
2024-08-30 21:38:30 +02:00
```sh
make dpkg
```
2024-04-28 18:34:38 +02:00
2024-08-30 21:38:30 +02:00
!!! note
2023-02-05 01:22:21 +01:00
2024-08-30 21:38:30 +02:00
You may need golang from the backports repository to build:
2023-02-05 01:22:21 +01:00
2024-08-30 21:38:30 +02:00
```sh
echo 'deb http://deb.debian.org/debian bookworm-backports main contrib non-free' | sudo tee -a /etc/apt/sources.list
sudo apt update
sudo apt install -t bookworm-backports golang-go
```
2023-02-05 01:22:21 +01:00
2024-08-30 21:38:30 +02:00
!!! warning
2023-01-29 22:18:22 +01:00
2024-10-01 23:53:30 +02:00
**Beware** : do not install a `.deb` made for Ubuntu on Debian, the packages are different.
2023-01-29 22:18:22 +01:00
2024-08-30 21:38:30 +02:00
If your distribution is based on Debian, you may want to manually set the target distribution by exporting `DISTRIBUTION=debian` .
2023-01-29 22:18:22 +01:00
2024-08-30 21:38:30 +02:00
=== ":simple-suse: openSUSE"
2023-02-11 19:59:08 +01:00
2024-08-30 21:38:30 +02:00
openSUSE users need to add [cboltz ](https://en.opensuse.org/User:Cboltz ) repo on OBS:
2023-02-11 19:59:08 +01:00
```sh
2024-08-30 21:38:30 +02:00
zypper addrepo https://download.opensuse.org/repositories/home:cboltz/openSUSE_Factory/home:cboltz.repo
zypper refresh
zypper install apparmor.d
2023-02-11 19:59:08 +01:00
```
2024-08-30 21:38:30 +02:00
=== ":material-home: Partial"
For test purposes, you can install specific profiles with the following commands. Abstractions, tunable, and most of the OS dependent post-processing is managed.
```sh
make
sudo make profile-names...
```
2023-08-19 15:32:08 +02:00
2024-08-30 21:38:30 +02:00
!!! warning
2023-08-19 15:32:08 +02:00
2024-08-30 21:38:30 +02:00
Partial installation is discouraged because profile dependencies are not fetched. To prevent some AppArmor issues, the dependencies are automatically switched to unconfined (`rPx` -> `rPUx` ). The installation process warns on the missing profiles so that you can easily install them if desired. (PR is welcome see [#77 ](https://github.com/roddhjav/apparmor.d/issues/77 ))
For instance, `sudo make pass` gives:
```sh
Warning: profile dependencies fallback to unconfined.
@{bin}/wl-{copy,paste} rPx,
@{bin}/xclip rPx,
@{bin}/python3.@{int} rPx -> pass-import, # pass-import
2024-09-08 14:25:49 +02:00
@{pager_path} rPx -> child-pager,
2024-08-30 21:38:30 +02:00
'.build/apparmor.d/pass' -> '/etc/apparmor.d/pass'
```
So, you can install the additional profiles `wl-copy` , `xclip` , `pass-import` , and `child-pager` if desired.
2024-10-01 23:53:30 +02:00
[Next: Configure your personal directories ](configuration.md ){ .md-button .md-button--primary }
2024-08-30 21:38:30 +02:00
## Uninstallation
=== ":material-arch: Archlinux"
```sh
sudo pacman -R apparmor.d
```
=== ":material-ubuntu: Ubuntu"
```sh
sudo apt purge apparmor.d
```
=== ":material-debian: Debian"
```sh
sudo apt purge apparmor.d
```
=== ":simple-suse: openSUSE"
```sh
sudo zypper remove apparmor.d
```
2023-08-19 15:32:08 +02:00
2023-01-29 22:18:22 +01:00
[aur]: https://aur.archlinux.org/packages/apparmor.d-git