Commit graph

1246 commits

Author SHA1 Message Date
Georgia Garcia
bb53886211 profiles: add nautilus unconfined profile
Nautilus uses user namespaces to load thumbnails, hence it needs an
unconfined profile when user namespaces are restricted from unconfined
like other applications in MR #1123

Although nautilus has extensions that would allow opening a terminal
from the nautilus interface, they do not inherit nautilus' AppArmor
label, therefore the use of unconfined does not allow arbitrary use of
unprivileged user namespaces using the nautilus label.

https://gitlab.com/apparmor/apparmor/-/merge_requests/1123

In addition this serves as a handle to uniquely identify them instead
of unconfined to peers in policy.

Note that unconfined mode should be changed for default_allow when
https://gitlab.com/apparmor/apparmor/-/merge_requests/1109 is merged.

Fixes: https://bugs.launchpad.net/bugs/2047256
Signed-off-by: Georgia Garcia <georgia.garcia@canonical.com>
2024-02-29 08:21:25 -03:00
John Johansen
108f489f2b profiles: update visual studio code so that it can be run from gnome
The current attachment works from the commandline but not from
gnome as it uses an alternate path.

Fixes: https://gitlab.com/apparmor/apparmor/-/issues/368
Signed-off-by: John Johansen <john.johansen@canonical.com>
2024-02-24 20:27:13 -08:00
Maxime Bélair
fd25954c56 add element-desktop unconfined profile 2024-02-20 12:38:26 +00:00
John Johansen
ca3afe1691 Merge add more unconfined profiles
These applications need to use user namespaces, hence it needs an
unconfined profile when user namespaces are restricted from unconfined
like other applications in MR #1123

https://gitlab.com/apparmor/apparmor/-/merge_requests/1123

In addition this serves as a handle to uniquely identify them instead
of unconfined to peers in policy.

Note that unconfined mode should be changed for default_allow when
https://gitlab.com/apparmor/apparmor/-/merge_requests/1109 is merged.

Signed-off-by: Georgia Garcia <georgia.garcia@canonical.com>

MR: https://gitlab.com/apparmor/apparmor/-/merge_requests/1149
Approved-by: John Johansen <john@jjmx.net>
Merged-by: John Johansen <john@jjmx.net>
2024-02-07 09:37:08 +00:00
David Disseldorp
2b8cf1be80 abstractions/openssl: allow version specific engdef & engines paths
Some openssl distributions use version specific engdef and engines paths
to support multi-version installations.

Fixes: https://bugzilla.opensuse.org/show_bug.cgi?id=1219571
Signed-off-by: David Disseldorp <ddiss@suse.de>
2024-02-07 10:31:34 +11:00
Georgia Garcia
89a9f76733 add more unconfined profiles
These applications need to use user namespaces, hence it needs an
unconfined profile when user namespaces are restricted from unconfined
like other applications in MR #1123

https://gitlab.com/apparmor/apparmor/-/merge_requests/1123

In addition this serves as a handle to uniquely identify them instead
of unconfined to peers in policy.

Note that unconfined mode should be changed for default_allow when
https://gitlab.com/apparmor/apparmor/-/merge_requests/1109 is merged.

Signed-off-by: Georgia Garcia <georgia.garcia@canonical.com>
2024-02-06 15:10:20 -03:00
Georgia Garcia
0e378f52a8 add keybase unconfined profile
Keybase needs to use user namespaces, hence it needs an unconfined
profile when user namespaces are restricted from unconfined like other
applications in MR #1123

https://gitlab.com/apparmor/apparmor/-/merge_requests/1123

In addition this serves as a handle to uniquely identify keybase
instead of unconfined to peers in policy.

Note that unconfined mode should be changed for default_allow when
https://gitlab.com/apparmor/apparmor/-/merge_requests/1109 is merged.

Signed-off-by: Georgia Garcia <georgia.garcia@canonical.com>
2024-02-02 16:53:58 -03:00
Georgia Garcia
789cda2f08 add special unprivileged_userns profile
Unprivileged user namespace creation is allowed an will result in a
transition into the unprivileged_userns profile. The
unprivileged_userns profile with then deny all capabilities within the
profile. Execution of applications is allowed within the
unprivileged_userns profile but, they will result in a stack with the
unprivileged_userns profile, that is to say the unprivileged_userns
profile can not be dropped (capabilities can not be gained).

If the unprivileged_userns profile does not exist, unprivileged user
namespace creation is denied as before.

Signed-off-by: Georgia Garcia <georgia.garcia@canonical.com>
2024-02-02 10:52:26 -03:00
Georgia Garcia
6add80d83f add profiles for applications that create user namespaces
These are profiles for applications that create user namespaces, both
the actual policy and unconfined profiles, like it was done in MR
1123.

https://gitlab.com/apparmor/apparmor/-/merge_requests/1123

In addition this serves as a handle to uniquely identify these
applications instead of unconfined to peers in policy.

Note that unconfined mode should be changed for default_allow when
https://gitlab.com/apparmor/apparmor/-/merge_requests/1109 is merged.

Signed-off-by: Georgia Garcia <georgia.garcia@canonical.com>
2024-02-02 10:51:06 -03:00
John Johansen
c8a2dc34d9 Merge firefox: remove owner restrictions for /proc/$pid/net/*
On openSUSE, these files are owned by root.

This partially reverts 70809fc716 / https://gitlab.com/apparmor/apparmor/-/merge_requests/1131

MR: https://gitlab.com/apparmor/apparmor/-/merge_requests/1132
Approved-by: John Johansen <john@jjmx.net>
Merged-by: John Johansen <john@jjmx.net>
2024-01-12 08:32:00 +00:00
Georgia Garcia
dc821ef762 profiles: add brave browser to the snap_browsers abstraction
Signed-off-by: Georgia Garcia <georgia.garcia@canonical.com>
2024-01-02 15:25:49 -03:00
Christian Boltz
fcd46063fd
firefox: remove owner restrictions for /proc/$pid/net/*
On openSUSE, these files are owned by root.

This partially reverts 70809fc716 / https://gitlab.com/apparmor/apparmor/-/merge_requests/1131
2023-12-24 17:19:10 +01:00
Daniel Richard G
70809fc716 firefox: add "owner" keywords, updates from usage monitoring
Also relocate the ptrace rule so it belongs to the crash reporter,
not the Widevine plugin
2023-12-22 19:25:01 -05:00
Christian Boltz
81bc26c934 Merge add steam profile for applications in unconfined mode
Steam needs to use user namespaces, hence it needs an unconfined
profile when user namespaces are restricted from unconfined like other
applications in MR1123

  https://gitlab.com/apparmor/apparmor/-/merge_requests/1123

In addition this serves as a handle to uniquely identify stream
instead of unconfined to peers in policy.

    Note that unconfined mode should be changed for default_allow
    when https://gitlab.com/apparmor/apparmor/-/merge_requests/1109 is
    merged.

Signed-off-by: John Johansen <john.johansen@canonical.com>

MR: https://gitlab.com/apparmor/apparmor/-/merge_requests/1125
Merged-by: Christian Boltz <apparmor@cboltz.de>
2023-11-26 16:30:41 +00:00
John Johansen
7c684f9d22 profiles: convert local include to match profile name
The recently added unconfined profiles use the binary name for the
local include instead of the profile name. Switch to using the
profile name for the local include.

Signed-off-by: John Johansen <john.johansen@canonical.com>
2023-11-24 18:53:51 -08:00
John Johansen
6c01b90c13 add steam profile for applications in unconfined mode
Steam needs to use user namespaces, hence it needs an unconfined
profile when user namespaces are restricted from unconfined like other
applications in MR1123

  https://gitlab.com/apparmor/apparmor/-/merge_requests/1123

In addition this serves as a handle to uniquely identify stream
instead of unconfined to peers in policy.

    Note that unconfined mode should be changed for default_allow
    when https://gitlab.com/apparmor/apparmor/-/merge_requests/1109 is
    merged.

Signed-off-by: John Johansen <john.johansen@canonical.com>
2023-11-24 15:48:53 -08:00
Georgia Garcia
2594d936ad add profiles for applications in unconfined mode
Adding profiles for applications even if they allow all operations
will allow them to be referenced as peer by other policies. This is a
step towards a more comprehensive system policy, adding names, instead
of just unconfined, to peers of existing policy and to applications
that are known to use unprivileged user namespaces.

Note that unconfined mode should be changed for default_allow
when https://gitlab.com/apparmor/apparmor/-/merge_requests/1109 is
merged.

Signed-off-by: Georgia Garcia <georgia.garcia@canonical.com>
2023-11-23 10:34:20 -03:00
Julio Gonzalez Gil
96b1aa549b
Allow reading /run/systemd/sessions/
Several applications use it now that utmp and wtmp are
being removed because they are not Y2038 compliant

This is the case for example in openSUSE Tumbleweed and
openSUSE MicroOS:
https://microos.opensuse.org/blog/2023-11-06-utmp-and-wtmp-are-gone/

Closes https://gitlab.com/apparmor/apparmor/-/issues/360
2023-11-08 18:13:03 +01:00
John Johansen
54915dabc4 Merge Allow reading /etc/authselect/nsswitch.conf
On systems with authselect installed, /etc/nsswitch.conf is a symlink to
/etc/authselect/nsswitch.conf.

Fixes: https://gitlab.com/apparmor/apparmor-profiles/-/issues/13

I propose this patch for 3.0..master.

Closes apparmor-profiles#13
MR: https://gitlab.com/apparmor/apparmor/-/merge_requests/1119
Approved-by: John Johansen <john@jjmx.net>
Merged-by: John Johansen <john@jjmx.net>
2023-11-03 03:22:05 +00:00
Christian Boltz
d4dff5ce4e
Allow reading /etc/authselect/nsswitch.conf
On systems with authselect installed, /etc/nsswitch.conf is a symlink to
/etc/authselect/nsswitch.conf.

Fixes: https://gitlab.com/apparmor/apparmor-profiles/-/issues/13
2023-11-01 17:03:06 +01:00
Malte S. Stretz
8b95030665 ubuntu-browsers.d/kde: fix plasma-browser-integration
Out of the box the KDE plasma-browser-integration package does not work
after a user installed the corresponding Firefox extension: The browser
can't start the native host binary. The same is probably true for
Chromium.

This was originally reported to KDE at https://bugs.kde.org/show_bug.cgi?id=397399
2023-10-18 11:37:18 +02:00
Antonius Mulder
61fc6805a9 abstractions: pipewire rt conf
Pipewire also uses the client-rt.conf file, add this to
the audio abstraction.
2023-10-13 13:06:42 -07:00
Christian Boltz
adf19138d5
Don't create local/* profile sniplets by default
... and document how to create them if you still want them.

Fixes: https://gitlab.com/apparmor/apparmor/-/issues/337
2023-08-20 11:49:10 +02:00
John Johansen
941118c699 Merge profiles: allow for the default dovecot libexecdir
Though many Linux distros choose to pass _/usr/lib_ as the libexecdir while configuring dovecot, such as [Debian](https://sources.debian.org/src/dovecot/1%3A2.3.20%2Bdfsg1-1/debian/rules/#L132) and [Arch](https://gitlab.archlinux.org/archlinux/packaging/packages/dovecot/-/blob/main/PKGBUILD#L76), others like Alpine Linux and Gentoo don't pass anything as libexecdir, allowing it to default to _/usr/libexec_.

Both appear to be valid. From [FHS 3.0, Chapter 4.7](https://refspecs.linuxfoundation.org/FHS_3.0/fhs/ch04s07.html):
> Some previous versions of this document did not support _/usr/libexec_, despite it being standard practice in a number of environments. To accomodate this restriction, it became common practice to use _/usr/lib_ instead. Either practice is now acceptable, but each application must choose one way or the other to organize itself.

Allow for the default libexec subdir _/usr/libexec/dovecot_ as well as the more common
_/usr/lib/dovecot_.

Signed-off-by: Peter Levine <plevine457@gmail.com>

MR: https://gitlab.com/apparmor/apparmor/-/merge_requests/1080
Approved-by: John Johansen <john@jjmx.net>
Merged-by: John Johansen <john@jjmx.net>
2023-08-14 07:54:19 +00:00
Christian Boltz
65de34f462 Merge Add include if exists <tunables/$FILE.d> to all tunables
(except the deprecated tunables/sys)

This allows users to extend variables without editing the main tunables
files.

It also allows to cleanly introduce new tunable files (via
tunables/global.d) and new aliases (via tunables/alias.d).

Note: some files already had `include <tunables/$FILE.d>`. These get
changed to `include if exists`, and the comments for these includes get
unified.

Also extend make check to ensure that all tunables include tunables/$FILE.d

Fixes: https://gitlab.com/apparmor/apparmor/-/issues/347

I propose this patch for 3.0..master.

Closes #347
MR: https://gitlab.com/apparmor/apparmor/-/merge_requests/1077
Approved-by: timeout
Merged-by: Christian Boltz <apparmor@cboltz.de>
2023-08-13 15:02:45 +00:00
Peter Levine
37ffc6eac8 profiles: allow for the default dovecot libexecdir
Allow for the default libexec subdir, /usr/libexec/dovecot, as well
as the more common /usr/lib/dovecot.

Signed-off-by: Peter Levine <plevine457@gmail.com>
2023-08-03 01:30:42 -04:00
Christian Boltz
d6bc107940
make check: ensure that all tunables include tunables/$FILE.d
(except the deprecated tunables/sys)
2023-07-30 00:58:21 +02:00
Christian Boltz
5657799dc7
Add include if exists <tunables/$FILE.d> to all tunables
(except the deprecated tunables/sys)

This allows users to extend variables without editing the main tunables
files.

It also allows to cleanly introduce new tunable files (via
tunables/global.d) and new aliases (via tunables/alias.d).

Note: some files already had `include <tunables/$FILE.d>`. These get
changed to `include if exists`, and the comments for these includes get
unified.

Fixes: https://gitlab.com/apparmor/apparmor/-/issues/347
2023-07-30 00:47:34 +02:00
Daniel Richard G
018efdeb9d firefox: fix app name and DBus access 2023-07-25 20:04:26 -04:00
John Johansen
f1b4da2f64 policy: update to use 4.0 abi
Begin preparing policy for the 4.0 release. This may result in new
denials. This is expected and needed to make sure policy is ready
for the 4.0 release.

Signed-off-by: John Johansen <john.johansen@canonical.com>
2023-06-30 23:36:12 -07:00
John Johansen
271f0e2366 Merge firefox: updates from usage monitoring
I have a number of updates for the Firefox profile, based on monitoring AppArmor logs in the course of my own usage.

I'm going to try annotating the diff with the appropriate log messages, to see if that is a useful way of documenting the changes.

MR: https://gitlab.com/apparmor/apparmor/-/merge_requests/1055
Approved-by: John Johansen <john@jjmx.net>
Merged-by: John Johansen <john@jjmx.net>
2023-07-01 01:06:17 +00:00
Daniel Richard G
dc5d999c5b firefox: updates from usage monitoring 2023-06-30 18:38:31 -04:00
Daniel Richard G
07919c2c70 abstractions/fonts: allow writing to fontconfig user cache files 2023-06-30 18:26:28 -04:00
Daniel Richard G
3b51143d87 abstractions/fonts: allow locking fontconfig user cache files 2023-06-29 21:26:59 -04:00
Vincas Dargis
155be0ffc4 abstactions/kde: allow reading global Debian KDE settings
New denials detected on Debian Sid:

```
type=AVC msg=audit(1687372581.246:738): apparmor="DENIED" operation="open" class="file" profile="qtox" name="/usr/share/desktop-base/kf5-settings/kdeglobals" pid=17988 comm="qtox" requested_mask="r" denied_mask="r" fsuid=1000 ouid=0FSUID="vincas" OUID="root"
```

Debian package `desktop-base` contains some global KDE settings files:

```
$ dpkg -L desktop-base | fgrep kf5
/usr/share/desktop-base/kf5-settings
/usr/share/desktop-base/kf5-settings/baloofilerc
/usr/share/desktop-base/kf5-settings/kdeglobals
/usr/share/desktop-base/kf5-settings/kscreenlockerrc
```

Add file rules to allow reading global KDE settings.
2023-06-26 20:09:55 +03:00
Daniel Richard G
15112b3a49 usr.sbin.sshd: Add permissions masked by internal-sftp section
Also replace /(var/)run with @{run} and /sys with @{sys}, and fix a
typo (etc.legal)
2023-06-10 16:49:24 -04:00
John Johansen
ad3750058d Merge abstractions/base: Add transparent hugepage support
Found in testing a slimmed-down `usr.sbin.sshd` profile:
```
Jun  8 21:09:38 testvm kernel: [   54.847014] audit: type=1400 audit(1686272978.009:68): apparmor="DENIED" operation="open" profile="/usr/sbin/sshd" name="/sys/kernel/mm/transparent_hugepage/hpage_pmd_size" pid=1035 comm="sshd" requested_mask="r" denied_mask="r" fsuid=0 ouid=0
```
Not sure what glibc/system call uses this, but it seems pretty broadly applicable, and read access is presumably harmless. [THP reference](https://www.kernel.org/doc/html/latest/admin-guide/mm/transhuge.html)

MR: https://gitlab.com/apparmor/apparmor/-/merge_requests/1050
Approved-by: John Johansen <john@jjmx.net>
Merged-by: John Johansen <john@jjmx.net>
2023-06-09 08:46:31 +00:00
Daniel Richard G
3844e45220 abstractions/base: Add transparent hugepage support 2023-06-09 01:14:13 -04:00
Daniel Richard G
4b9ba3977b abstractions/authentication: Add GSSAPI mechanism modules config 2023-06-09 00:47:32 -04:00
John Johansen
6e0d776f65 Merge profiles: allow reading of /etc/ld-musl-*.path
/etc/ld-musl-*.path is required to perform dynamic linking on musl libc.
The wildcard is to match all CPU architectures, like x86_64.

type=AVC msg=audit(1686087677.497:67): apparmor="DENIED" operation="open" class="file" profile="syslog-ng" name="/etc/ld-musl-x86_64.path" pid=25866 comm="syslog-ng" requested_mask="r" denied_mask="r" fsuid=0 ouid=0

Closes #333

Signed-off-by: Nikita Romaniuk <kelvium@yahoo.com>

Closes #333
MR: https://gitlab.com/apparmor/apparmor/-/merge_requests/1047
Approved-by: John Johansen <john@jjmx.net>
Merged-by: John Johansen <john@jjmx.net>
2023-06-09 01:59:53 +00:00
John Johansen
8ef7e91a38 Merge Improvements from the Ubuntu 20.04 Firefox profile
This brings in numerous improvements from the Firefox AppArmor profile that Ubuntu ships in 20.04/focal. The raw profile may be viewed [here](https://bazaar.launchpad.net/~mozillateam/firefox/firefox-trunk.head/view/head:/debian/usr.bin.firefox.apparmor.14.10) (or alternately [here](https://bazaar.launchpad.net/~mozillateam/firefox/firefox.focal/view/head:/debian/usr.bin.firefox.apparmor.14.10)).

To review, you may not only want to compare this new version against HEAD, but also against the Ubuntu profile, which has a smaller diff. I suggest preprocessing the latter with the following to reduce extraneous diffs:
```
sed 's,@{PROC}/\[0-9\]\*/,@{PROC}/@{pid}/,g; s,/@{pid}/task/\[0-9\]\*/,/@{pid}/task/@{tid}/,g; s/#\(include\)/\1/'
```

I've made a few minor edits along the way, such as using AppArmor variables instead of preprocessing directives (like `@MOZ_LIBDIR@`) that are substituted in the Firefox package build. Any feature/stylistic downgrades in the Ubuntu profile should have been filtered out.

MR: https://gitlab.com/apparmor/apparmor/-/merge_requests/1043
Approved-by: John Johansen <john@jjmx.net>
Merged-by: John Johansen <john@jjmx.net>
2023-06-09 01:57:25 +00:00
Nikita Romaniuk
d8e25ce915
profiles: allow reading of /etc/ld-musl-*.path
/etc/ld-musl-*.path is required to perform dynamic linking on musl libc.
The wildcard is to match all CPU architectures, like x86_64.

type=AVC msg=audit(1686087677.497:67): apparmor="DENIED" operation="open" class="file" profile="syslog-ng" name="/etc/ld-musl-x86_64.path" pid=25866 comm="syslog-ng" requested_mask="r" denied_mask="r" fsuid=0 ouid=0

Closes #333

Signed-off-by: Nikita Romaniuk <kelvium@yahoo.com>
2023-06-07 01:09:33 +03:00
Georgia Garcia
daec4bc82a profiles: add lock file permission to snap browsers
When opening snap browsers with evince using the snap_browsers
abstraction, we get the following AppArmor denials which prevent the
browsers from opening

audit: type=1400 audit(1685996894.479:225): apparmor="DENIED" operation="open" class="file" profile="/usr/bin/evince//snap_browsers" name="/var/lib/snapd/inhibit/firefox.lock" pid=13282 comm="snap" requested_mask="r" denied_mask="r" fsuid=1000 ouid=0

audit: type=1400 audit(1685997517.142:259): apparmor="DENIED" operation="file_lock" class="file" profile="/usr/bin/evince//snap_browsers" name="/var/lib/snapd/inhibit/firefox.lock" pid=14200 comm="snap" requested_mask="k" denied_mask="k" fsuid=1000 ouid=0

Signed-off-by: Georgia Garcia <georgia.garcia@canonical.com>
2023-06-05 17:39:28 -03:00
Daniel Richard G
d367adf1f1 Improvements from the Ubuntu 20.04 Firefox profile
The Ubuntu profile is available at (trunk and branch locations)
  https://bazaar.launchpad.net/~mozillateam/firefox/firefox-trunk.head/view/head:/debian/usr.bin.firefox.apparmor.14.10
  https://bazaar.launchpad.net/~mozillateam/firefox/firefox.focal/view/head:/debian/usr.bin.firefox.apparmor.14.10
2023-05-30 15:22:25 -04:00
John Johansen
f629340d1b Merge chromium_browser: Inherit updates from apparmor-profiles repo
Bring in updates and improvements that have been made to the Chromium profile at `apparmor-profiles/ubuntu/20.04/usr.bin.chromium-browser`.

The changes are largely as follows:

* Use `@{pid}` or `@{tid}` instead of `[0-9]*`

* Use the discrete `lsb_release` profile instead of a subprofile

* Add a few additional libraries to the `sandbox` subprofile

Once this is in, the Chromium profiles in `apparmor-profiles` can be considered deprecated, and I would advise slating them for removal altogether.

MR: https://gitlab.com/apparmor/apparmor/-/merge_requests/1032
Approved-by: Christian Boltz <apparmor@cboltz.de>
Merged-by: John Johansen <john@jjmx.net>
2023-05-18 16:57:59 +00:00
Daniel Richard G
bd0d401b3d nscd: add permission to allow supporting unscd
May 9 18:07:42 darkstar kernel: [ 2706.138823] audit: type=1400
audit(1683670062.580:839): apparmor="DENIED" operation="sendmsg"
profile="nscd" name="/run/systemd/notify" pid=4343 comm="nscd"
requested_mask="w" denied_mask="w" fsuid=125 ouid=0
2023-05-10 00:31:06 -04:00
Daniel Richard G
4507bdc020 chromium_browser: Inherit updates from apparmor-profiles repo
Bring in updates and improvements that have been made to the Chromium
profile at apparmor-profiles/ubuntu/20.04/usr.bin.chromium-browser
2023-05-10 00:19:55 -04:00
John Johansen
09b35f836b Merge Abstractions: better integration
This is the first MR of a possibly very long list of MR in order to upstream stable abstraction & profiles previously tested in https://github.com/roddhjav/apparmor.d

This first MR focuses on integrating abstraction completion from the `*.d` directory in [apparmor.d/abstractions](https://github.com/roddhjav/apparmor.d/tree/main/apparmor.d/abstractions)

MR: https://gitlab.com/apparmor/apparmor/-/merge_requests/995
Approved-by: John Johansen <john@jjmx.net>
Merged-by: John Johansen <john@jjmx.net>
2023-05-02 12:34:04 +00:00
John Johansen
fa86a7f1d9 Merge abstractions/freedesktop.org: allow custom cursors
... by allowing to read all files below ~/.icons instead of only the
directory listing.

I propose this patch for all branches.

MR: https://gitlab.com/apparmor/apparmor/-/merge_requests/1008
Approved-by: John Johansen <john@jjmx.net>
Merged-by: John Johansen <john@jjmx.net>
2023-04-25 02:24:50 +00:00
Daniel Richard G
408e148109 Add profile for rpcbind 2023-04-18 16:35:34 -04:00