How to Set Up AppArmor Profiles for Custom Applications on SUSE SLES 15

Version note, checked October 6, 2026: This procedure applies to SUSE Linux Enterprise Server (SLES) 15 SP7 and compatible SLE 15 systems that use AppArmor. SUSE documents AppArmor as installed and running by default on SLES 15 SP7. SUSE Linux 16.0 removes AppArmor and uses SELinux instead, so do not apply the commands below to version 16.0; use SUSE’s SUSE Linux 16.0 comparison guide and the SELinux documentation for that release.

AppArmor is a Linux security module that restricts what a program can access. A profile is the policy attached to an executable: it can allow or deny access to files, capabilities, and other resources. This guide takes you from confirming the platform to enforcing a tested profile, with a cautious learning phase so a custom application is less likely to break unexpectedly.

What should you prepare before creating a profile?

Use a test or maintenance window if the application is important. You need an administrator account with sudo, the application’s actual executable path, and a list of the normal tasks it performs. Include background work, startup and shutdown, configuration reloads, uploads or exports, scheduled jobs, and any network-connected functions. A profile learned from one launch cannot infer features you never exercise.

Know where the application reads and writes data, which account runs it, and whether it starts helper processes. Avoid testing against sensitive production data when possible. Record the current service state and keep a copy of any existing profile before making changes.

How do you confirm AppArmor is available on this SUSE release?

First check the operating-system release and current AppArmor state:

cat /etc/os-release
sudo aa-status
Terminal command showing cat /etc/os-release before checking the SUSE release.
Check the SUSE release first; the command shown reads the operating-system identification file.
Terminal command showing sudo aa-status to inspect loaded AppArmor profiles.
Use aa-status to see whether AppArmor is active and which profiles are loaded.

Confirm the system reports SLES 15 SP7 or another release whose documentation supports AppArmor. On SLES 15 SP7, the SUSE guide says AppArmor is installed and running by default. If it is missing, SUSE documents installation with sudo zypper in -t pattern apparmor. If the service is installed but not running, inspect the system’s startup policy and service status before enabling it; do not disable the security module to work around an application problem. Consult SLES 15 SP7 AppArmor getting-started guide and SLES 15 SP7 AppArmor command-line tools guide for release-specific details.

How do you identify the executable AppArmor should profile?

AppArmor profiles are associated with program paths, so identify the actual executable rather than assuming the command users type is the binary. For a command available through the shell path, run:

command -v myapp
Terminal command command -v myapp used to locate an application executable.
Replace myapp with the application command and confirm the resolved executable path before profiling it.

For a service, inspect its unit definition and process details using the tools available on your system. A launcher script, symbolic link, or interpreter may lead to a different executable than expected. Resolve a known path with readlink -f /path/to/myapp where appropriate. Substitute the verified absolute path in every command below; /usr/local/bin/myapp is only an example.

Before profiling, check whether a profile already exists under /etc/apparmor.d. SUSE stores profiles there, and the filename commonly replaces slashes in the executable path with dots. For example, /usr/local/bin/myapp maps to a filename such as usr.local.bin.myapp. Do not overwrite an existing vendor or locally maintained profile without reviewing it. SUSE also lists extra profiles under /usr/share/apparmor/extra-profiles; a suitable profile may provide a starting point, but it still needs review for your application and release (SUSE profile repository documentation).

How do you generate an initial profile safely?

Run the profile-generation tool as an administrator, using the full executable path:

sudo aa-genprof /usr/local/bin/myapp
Terminal command sudo aa-genprof /usr/local/bin/myapp to begin an initial AppArmor profile.
Start aa-genprof with the verified executable path; the path here is an example to replace.

aa-genprof creates a starting profile and places the program in complain mode while you exercise it. Complain mode records policy violations but does not block the denied operation, which allows you to observe behavior before enforcement. Follow the tool’s prompts; after exercising the application, use its scan option to review logged events. SUSE describes this as an iterative process, not a guarantee that the automatically suggested profile is complete.

Which actions should you test, and where do you find denials?

While the profile is in complain mode, use the application as a normal operator would. Test ordinary workflows and less frequent but supported tasks, including reads, writes, uploads, report generation, service restarts, and helper jobs. Keep the test realistic: a program may use different files or child processes for an export than for its home screen.

Review kernel messages and the audit log for AppArmor events:

sudo journalctl -k | grep -i apparmor
Terminal command journalctl -k piped to grep -i apparmor to review kernel AppArmor messages.
After exercising the program, inspect kernel messages for AppArmor events; this command displays matching entries if present.

Depending on the system’s logging setup, SUSE also points to /var/log/audit/audit.log, journalctl | grep -i apparmor, and dmesg -T. A missing match in one log view does not prove the profile is correct: verify that the application was exercised and check the logging service and other documented log locations. Do not treat a generated profile as tested merely because the application starts once.

How should you review and refine the profile?

As root, use aa-logprof to process logged events and answer the prompts:

sudo aa-logprof
Terminal command sudo aa-logprof for reviewing logged AppArmor events and profile rules.
Use aa-logprof to examine observed accesses and decide which belong in the application’s policy.

For each event, ask whether the access is necessary for a documented application task. Allow only the narrow path, access mode, or capability the program requires. A configuration file read may be expected; an unplanned write to an unrelated directory may signal a mistake or a separate component that needs investigation. Rules that are too broad weaken confinement, while rules that are too narrow can break valid tasks.

  • Do not accept every prompt automatically or add blanket access to all files.
  • Avoid broad wildcards and unnecessary capabilities; prefer a precise path and the smallest required permissions.
  • Repeat the workload and log-review cycle after profile edits. Include separate service operations and background tasks.
  • Keep changes scoped to the target application; do not make unrelated profile edits to silence noise.

The profile is an access-control boundary, so a prompt should be answered from application behavior and operational requirements, not simply because it appeared in a log. The SUSE SLES 15 SP7 AppArmor command-line tools guide explains the command-line tools, and SUSE AppArmor support reference links to relevant man pages including aa-genprof, aa-logprof, and apparmor_parser.

When should you switch the profile to enforce mode?

Move to enforcement only after representative workflows succeed and you have reviewed legitimate events. Enforce the one application profile, reload AppArmor’s profile set, and restart the application or service so the running process uses the updated policy:

sudo aa-enforce /usr/local/bin/myapp
sudo systemctl reload apparmor
Terminal commands aa-enforce for the example application followed by systemctl reload apparmor.
Apply enforcement to the target profile, then reload AppArmor; replace the example path with the verified executable.

SUSE notes that reloading rereads profiles in /etc/apparmor.d; a program already running may need to be restarted before the updated profile takes effect. Coordinate that restart with the service owner and use the correct service-management command for the application. Then repeat key workflows under enforcement rather than assuming complain-mode success proves they will work unchanged.

How do you verify the result and recover from a regression?

Check the profile state and look for new denials after testing:

sudo aa-status
sudo journalctl -k | grep -i apparmor
Terminal commands aa-status and journalctl -k filtered for AppArmor after profile enforcement.
Verify the loaded profile and review new AppArmor messages after exercising the application in enforce mode.

Confirm the intended profile is loaded and in enforce mode, the service remains healthy, and each required task still works. If enforcement blocks a legitimate operation, gather the relevant event, review whether the access is truly required, and refine the profile narrowly. For a short, controlled diagnosis, sudo aa-complain /usr/local/bin/myapp can put that program’s profile into complain mode; investigate, update, and retest before returning it to enforcement with aa-enforce. Reload and restart as needed. Avoid turning off AppArmor globally or granting broad permissions as a quick fix.

What common mistakes should you avoid?

  • Using the wrong release instructions: the workflow here is for SLES 15 AppArmor. SUSE Linux 16.0 uses SELinux instead, according to SUSE’s comparison guide.
  • Profiling a wrapper instead of the real program: verify the executable that actually runs, especially for services and scripts.
  • Learning too little: untested features do not generate observed accesses, so an incomplete profile may fail later.
  • Approving prompts without context: every added permission should serve a required application task.
  • Forgetting the restart: reload profiles, then restart a running application when needed so the process adopts the policy.
  • Editing without a rollback path: back up locally maintained profiles and track changes in version control or your system’s configuration-management process.

Official SUSE references

These references were checked on October 6, 2026. Commands and package details can vary by product release; confirm the documentation for the exact SLES service pack installed before making changes.

Leave a Comment

How to Access a Windows BitLocker Partition in Linux

How to Access a Windows BitLocker Partition in Linux

Use Dislocker to unlock a BitLocker volume in Linux, mount its virtual NTFS file read-only, and safely unmount it without exposing your password in a command.

5 Safe Ways to Reduce RAM Usage on Linux

5 Safe Ways to Reduce RAM Usage on Linux

Learn how to reduce RAM usage on Linux by finding memory-hungry apps, trimming browser and startup load, and testing a lighter desktop safely.

4 WhatsApp Alternatives for Linux Users: Telegram, Signal, Wire, and Element

4 WhatsApp Alternatives for Linux Users: Telegram, Signal, Wire, and Element

Compare four WhatsApp alternatives for Linux by privacy defaults, desktop support, setup requirements, and the people each app suits.

How to Fix a VirtualBox VM Launch Error on Linux

How to Fix a VirtualBox VM Launch Error on Linux

Troubleshoot a VirtualBox VM that will not start on Linux by checking vboxdrv, kernel headers, Secure Boot, Extension Pack versions, and VM logs.

How to Transfer an Ubuntu User to a New Computer

How to Transfer an Ubuntu User to a New Computer

Transfer your Ubuntu user data with a tar archive and external drive, then restore personal files and selected settings without overwriting the new setup.

How to Get Started with gThumb on GNOME

How to Get Started with gThumb on GNOME

Install gThumb on Linux, browse and make simple photo edits, then set it as the default app for the image types you choose in GNOME.

How to Make Music Playlists on Linux With Rhythmbox or VLC

How to Make Music Playlists on Linux With Rhythmbox or VLC

Create an organized playlist in Rhythmbox or save a reusable XSPF playlist in VLC. Learn how to add tracks, name a list, and reopen it on Linux.

How to Install the Dino XMPP Client on Linux

How to Install the Dino XMPP Client on Linux

Install Dino on Linux with Flatpak or your distribution’s package manager. Get current Ubuntu, Debian, Fedora, and Arch commands, plus first-launch tips.

How to Switch to the LTS Kernel in Arch Linux

How to Switch to the LTS Kernel in Arch Linux

Install Arch Linux’s linux-lts kernel, add it to GRUB or systemd-boot, select it at startup, and verify it while keeping a fallback kernel.

How to Install LibreELEC on a Raspberry Pi 4

How to Install LibreELEC on a Raspberry Pi 4

Download the right Pi 4 image, write it to a microSD card, and complete LibreELEC’s first-run setup with Raspberry Pi Imager.