Stop snap package of discord from spamming your syslog

Apparmor
Apparmor is a security module that restrict apps.

Snap packages & apparmor
Snap packages comes with their own apparmor profiles the only issue with this is that if you make changes to those profiles they will reset every time you update that program.

What is discord spamming?
Discord is spamming armor="DENIED" operation="ptrace" class="ptrace" profile="snap.discord.discord" pid=612063 comm="Utils" requested_mask="read" denied_mask="read" peer="unconfined" Example of what my syslog looked like;

Its spamming this because discord uses ptrace every 5 second to scan your pc and find what game you’re playing for the discord activities.

Making snap packages apparmor profiles permanent
You can make the profiles permanent with copying the profile from /var/lib/snapd/apparmor/profiles

and pasting it into /etc/apparmor.d


When you have done this you can open the snap.discord.discord in /etc/apparmor.d or nano /etc/apparmor.d/snap.discord.discord and add these lines in the end

deny /proc/@{pid}/cmdline r,
deny ptrace (read),
deny capability sys_ptrace,


These commands makes apparmor still block discord from using ptrace but they also tell apparmor to not log every time it blocks it.

I got this fix from sogetthis at Discord ptrace AppArmor denials - #18 by sogetthis - snap - snapcraft.io

4 Likes

Thanks for sharing this with the community, very useful.

1 Like