Commit Graph

368 Commits

Author SHA1 Message Date
Maciej Borzecki
bf3af32bbc data/selinux: update policy to allow stat of /run/systemd/container (#13872)
Since 3cfa28a0fc snap-confine checks if the system is running in a container. It
does so by reading /run/systemd/container. Extend the SELinux to allow basic
search operations within /run/systemd. It is unlikely anyone runs snapd in a
container where the SELinux is enabled on the host, so the actual file read
permissions are likely not needed.

Signed-off-by: Maciej Borzecki <maciej.borzecki@canonical.com>
2024-04-24 11:27:52 +02:00
alfonsosanchezbeato
5fdec02b92 data/systemd: allow notifications for all snapd subprocesses (#13797)
Allow all service's control group processes to send notifications via
sd_notify. This is necesssary to prevent log flooding with systemd
warnings like:

Apr 05 14:36:55 qemuname systemd[1]: snapd.service: Got notification
message from PID 1002, but reception only permitted for main PID 917

This warnings are happening due to a change in systemd 254 that makes
all systemd programs (systemctl, udevadm, systemd-detect-virt, etc.)
send EXIT_STATUS notifications when exiting.

Fixes LP#2060310.
2024-04-10 18:05:33 +02:00
Valentin David
d1cf336e7c many: avoid execution while current symlink is missing
Make sure that /snap/snapd/current is set before executing any binary
from snapd snap.

We will rely on `/snap/snapd/current/lib64/ld-linux.so.2` (varies
depending on architecture) being available to execute binaries from
the snap. So the symlink has to be set before we restart services.
2024-03-13 13:08:24 +01:00
Oliver Calder
ecc68bf74e daemon,data/polkit: add polkit action for managing snap configuration
Adds `polkitActionManageConfiguration`.

Signed-off-by: Oliver Calder <oliver.calder@canonical.com>
2024-03-13 09:35:51 +01:00
Maciej Borzecki
dd5950fd5c data/preseed: add /var/lib/snapd/cgroup to preseed include patterns
Add /var/lib/snapd/cgroup to patterns picked up by snapd in preseeding.

Signed-off-by: Maciej Borzecki <maciej.borzecki@canonical.com>
2024-03-12 13:32:44 +01:00
Alfonso Sánchez-Beato
c82f44d110 data,tests: copy kernel drivers tree to the preseed tarball
and check in spread test.
2024-02-15 18:56:47 +00:00
Valentin David
4b0569c749 data/systemd: make snapd.seed wait for snapd.socket only
snapd.service should not need to be started from snapd.seed.service
to start. Only snapd.socket needs to be started.
2024-02-14 08:35:59 +01:00
Philip Meulengracht
87f931d1d4 data/selinux: add missing polkitd permission for snappy_t/snappy_cli_t (#13561)
* data/selinux: add missing polkitd type for snappy_cli_t

* data/selinux: fix indentation

* data/selinux: allow snapd to poke polkitd as well

* data/selinux: be consistent in order
2024-02-09 12:49:09 +01:00
Valentin David
62aee2b680 snapd.apparmor.service: add explicit dependency to snapd.mounts.target
In case of re-execution, snapd snap has to be
mounted. apparmor.service has a dependency to local-fs.target which is
enough in theory. But in case this dependency dispappears, it is
better to have an explicit dependency to snapd.mount.target in the
unit.
2024-02-09 10:19:11 +01:00
Oliver Calder
18002010a5 Revert "many: add stub services for prompting"
This reverts commit 7fe4772e26.

Signed-off-by: Oliver Calder <oliver.calder@canonical.com>
2024-02-08 09:30:18 +01:00
Oliver Calder
258ddf79bf Revert "data: fix snapd.aa-prompt-ui.service to actually get started (#12693)"
This reverts commit 82b79b4322.

Signed-off-by: Oliver Calder <oliver.calder@canonical.com>
2024-02-08 09:30:18 +01:00
Sergio Cazzolato
5b3f294b3e Fix selinux policy for polkit agent
The selinux-clean test started failing in fedora and centos recently.

It is caused by a change in the polkit_agent interface where now the
polkit-agent-helper-1 is located here
/usr/lib{exec,/polkit-1}/polkit-agent-helper-1

The change has been introduced in:
https://github.com/snapcore/snapd/pull/13261

The denial produced is the following:
type=AVC msg=audit(1698154354.527:12577): avc:  denied  { getattr } for
pid=82525 comm="snapd" path="/usr/lib/polkit-1/polkit-agent-helper-1"
dev="sda5" ino=109823 scontext=system_u:system_r:snappy_t:s0
tcontext=system_u:object_r:policykit_auth_exec_t:s0 tclass=file
permissive=1
2023-10-25 09:10:48 +02:00
Sergio Cazzolato
f71b83203b tests: fix selinux-lxd in centos-7 (#13224)
Update the selinux policy to fix the denial which is shown in centos 7

type=AVC msg=audit(09/26/23 12:44:11.492:315) : avc:  denied  { rename }
for  pid=28207 comm=snapd name=lxd.lxc.yLBQbN9J4LrW~ dev="sda2"
ino=17679133 scontext=system_u:system_r:snappy_t:s0
tcontext=system_u:object_r:usr_t:s0 tclass=lnk_file permissive=1
2023-09-28 15:32:41 +02:00
Sergio Cazzolato
12adc7f85f tests: fix selinux-clean denials after removing snap (#13100)
After pr #13019 the selinux-clean test started failing after removing
the snap test-snapd-service.

type=AVC msg=audit(08/21/23 14:42:23.030:1354) : avc:  denied  { search
} for  pid=38749 comm=snap name=x1 dev="sda5" ino=196452
scontext=system_u:system_r:snappy_cli_t:s0
tcontext=system_u:object_r:snappy_var_t:s0 tclass=dir permissive=1
----
type=AVC msg=audit(08/21/23 14:42:23.030:1355) : avc:  denied  { getattr
} for  pid=38749 comm=snap path=/var/snap/test-snapd-service/x1
dev="sda5" ino=196452 scontext=system_u:system_r:snappy_cli_t:s0
tcontext=system_u:object_r:snappy_var_t:s0 tclass=dir permissive=1
----
type=AVC msg=audit(08/21/23 14:42:38.846:1412) : avc:  denied  { search
} for  pid=39200 comm=snap name=x1 dev="sda5" ino=196452
scontext=system_u:system_r:snappy_cli_t:s0
tcontext=system_u:object_r:snappy_var_t:s0 tclass=dir permissive=1
----
type=AVC msg=audit(08/21/23 14:42:38.846:1413) : avc:  denied  { getattr
} for  pid=39200 comm=snap path=/var/snap/test-snapd-service/x1
dev="sda5" ino=196452 scontext=system_u:system_r:snappy_cli_t:s0
tcontext=system_u:object_r:snappy_var_t:s0 tclass=dir permissive=1
2023-08-22 12:10:32 +02:00
Ondrej Kubik
db0fc0be0a data: include "modprobe.d" and "modules-load.d" in preseeded blob
Signed-off-by: Ondrej Kubik <ondrej.kubik@canonical.com>
2023-07-04 18:09:15 +02:00
Philip Meulengracht
e7caa4cdf7 data/selinux: require type boot_t 2023-05-10 08:38:58 +02:00
Philip Meulengracht
8f0a52fc01 data/selinux: appstream interface needs to be able to mount on /var/lib 2023-05-10 08:38:58 +02:00
Philip Meulengracht
15bb9b2fc2 data/selinux: more AVC denials that needs to be handled 2023-05-10 08:38:58 +02:00
Philip Meulengracht
9bc1899f93 data/selinux: move the etc rule to its own section 2023-05-03 10:00:27 +02:00
Philip Meulengracht
b38c5d3c87 data/selinux: add missing AVC rule for etc_t 2023-05-03 10:00:27 +02:00
Michael Vogt
82b79b4322 data: fix snapd.aa-prompt-ui.service to actually get started (#12693)
* data: fix snapd.aa-prompt-ui.service to actually get started

The current snapd.aa-prompt-ui.service user service is dbus activated.
However this does not work with the latest prompt design.

* packaing: add snapd.aa-prompt-ui.service to auto-start
2023-04-06 13:34:13 +02:00
Sergio Cazzolato
2e1778c5ad In selinux policy allow snapd to read upowerd binary
This is required by upower-observe interface.

Some tests are failing in centos and fedora after the
upowerObserveInterface was update in this way.

func (iface *upowerObserveInterface) StaticInfo() interfaces.StaticInfo
{
...
		ImplicitOnCore:
osutil.IsExecutable("/usr/libexec/upowerd"),
...
}

This is to avoid this denial:

type=SYSCALL msg=audit(1679948376.046:1319): arch=c000003e syscall=262
success=yes exit=0 a0=ffffffffffffff9c a1=c0001e47b0 a2=c0001246b8 a3=0
items=0 ppid=1 pid=40320 auid=4294967295 uid=0 gid=0 euid=0 suid=0
fsuid=0 egid=0 sgid=0 fsgid=0 tty=(none) ses=4294967295 comm="snapd"
exe="/usr/libexec/snapd/snapd" subj=system_u:system_r:snappy_t:s0
key=(null)
type=AVC msg=audit(1679948376.046:1319): avc:  denied  { getattr } for
pid=40320 comm="snapd" path="/usr/libexec/upowerd" dev="sda2"
ino=2180887 scontext=system_u:system_r:snappy_t:s0
tcontext=system_u:object_r:devicekit_power_exec_t:s0 tclass=file
permissive=1
2023-03-30 17:17:10 +01:00
Alberto Mardegan
6e618c4963 data/selinux: update comment 2023-01-10 09:25:45 +01:00
Alberto Mardegan
8047108c64 data/selinux: update policy for new snap-confine
We now build the snap "/" as a tmpfs, so we need additional permissions.
2023-01-10 09:25:45 +01:00
Sergio Costas
ff7978736b data: install snapcraft logo in /usr/share/snapd (#12388)
This commit ensures that the snapcraft icon is shown in the lock screen notifications. Unfortunately, to make it work it requires to be modified in the .deb package; it seems that there is no way of doing this in the snap package because the required change must be set in the "first" .desktop file, and /usr/share(/applications) is before than /var/lib/snapd/desktop(/applications) in the XDG_DATA_DIRS order.

Jira: DT-862
2022-12-07 11:05:42 +01:00