356 Commits

Author SHA1 Message Date
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
Alex Murray
dbd4fc753d data: Add systemd-tmpfiles configuration to create private tmp dir
Use systemd-tmpfiles to create the private tmp mount namespace root
dir (/tmp/snap-private-tmp) on boot as owned by root with restrictive
permissions. We can use this as a known location to then create per-snap
private tmp mount namespace dirs (/tmp/snap-private-tmp/snap.$SNAP_INSTANCE)
etc.

Signed-off-by: Alex Murray <alex.murray@canonical.com>
2022-12-01 06:29:44 +01:00
Michael Vogt
c502f0cd50 Merge pull request #12037 from valentindavid/valentindavid/systemd-mount-unit-deps
many: create snapd.mounts targets to schedule mount units
2022-11-08 08:29:27 +01:00
Valentin David
d09e269b97 systemd: move zfs-mount.service dependency to snapd.mounts-pre.target 2022-10-20 14:49:22 +02:00
Valentin David
c827e52caf many: use snapd.mounts targets to schedule mount units
`snapd.mounts-pre.target` will be before any mount unit,
`snapd.mounts.target`.  Now we can schedule before or after mounts
without needing to modify the mount units.

We also install those mounts to `snapd.mounts.target` so that we can
make snapd.service for example, "want" all mounts.
2022-10-20 14:49:21 +02:00
Michael Vogt
38078ae775 data: tweak apt integration config var
Thanks for Julian for suggesting this.
2022-10-12 11:25:15 +02:00
Alberto Mardegan
7fe4772e26 many: add stub services for prompting
The implementation of these services is not yet ready, but in order to
be able to deliver it in a snap package, we need to have at least the
service files installed on the system by the distribution package.

These stubs just reexecute the binaries from the snap.

* tests: add spread test for reexec of prompt services

* packaging: update distros for prompt services

Ship them in Debian and Ubuntu, remove them elsewhere.

* cmd: update error message with unimplemented prompt services

* tests: do not disable prompt-reexec tests in UC

* many: disable prompting for 14.04

The kernel changes will most likely not land there.

* many: install prompt services for Ubuntu Core

* tests: exclude UC16 from reexec-prompt test

The services are installed, but disabled; enabling them is not trivial
and not worth the effort, since prompting will most likely not be
backported there.

* wrappers/core18: don't fail if the prompt service is missing in snapd

This fixes a spread failure in the tests/core/snapd-refresh-vs-services
test, where we install an old version of snapd (2.49) which does not
have the Prompt service.

* tests: fix typo in comment

Thanks @pedronis.

* cmd: add license header

Thanks @Meulengracht
2022-10-10 15:50:59 +02:00
Alberto Mardegan
0786c47ee5 data/selinux: allow snapd to detect WSL
Commit 5545f79af9 introduced a check for
WSL that causes our spread tests (in particular, selinux-clean) to fail
on Fedora and CentOS.

Add the rules from `audit2allow -a` to the SELinux rules, to suppress
those warnings.
2022-09-30 09:01:07 +03:00
Michael Vogt
25813173d9 Merge pull request #12094 from mardy/services-comment
data/systemd/Makefile: add comment warning about "snapd." prefix
2022-09-05 07:47:33 +02:00
Michael Vogt
9dee6cb3b7 Merge pull request #12020 from kubiko/preseed-add-snapd-fstabs
data: include snapd/mounts in preseeded blob
2022-09-02 17:38:05 +02:00
Alberto Mardegan
9ba87a56c0 data/systemd/Makefile: add comment warning about "snapd." prefix
I've been hit by this working on abranch where I was adding my own
service. Thanks @mvo5 for the time-saver hint!
2022-08-31 12:04:55 +03:00
Alberto Mardegan
8fc73b96ac data/selinux: allow snaps to read certificates (#12050)
This fixes an error occurring in our spread tests on Centos:

    2022-08-17T12:52:45.7861235Z type=AVC msg=audit(08/17/22 12:52:06.099:6583) : avc:  denied  { open } for  pid=71804 comm=snap path=/etc/pki/tls/openssl.cnf dev="sda2" ino=33578739 scontext=system_u:system_r:snappy_cli_t:s0 tcontext=system_u:object_r:cert_t:s0 tclass=file permissive=1
    2022-08-17T12:52:45.7898682Z type=AVC msg=audit(08/17/22 12:52:06.099:6583) : avc:  denied  { read } for  pid=71804 comm=snap name=openssl.cnf dev="sda2" ino=33578739 scontext=system_u:system_r:snappy_cli_t:s0 tcontext=system_u:object_r:cert_t:s0 tclass=file permissive=1
    2022-08-17T12:52:45.7899442Z type=AVC msg=audit(08/17/22 12:52:06.099:6583) : avc:  denied  { search } for  pid=71804 comm=snap name=pki dev="sda2" ino=50341665 scontext=system_u:system_r:snappy_cli_t:s0 tcontext=system_u:object_r:cert_t:s0 tclass=dir permissive=1

Note that with this change we are not removing the call to

    miscfiles_read_all_certs(snappy_t)

because it was actually present twice in this file.
2022-08-22 10:28:23 +03:00
Ondrej Kubik
06f8e9c09d data: include snapd/mounts in preseeded blob
When collecting preseeded data, include also snapd/mounts.
This directory contains layout info and is essential to have
a correct layout functionality on preseeded system.

Signed-off-by: Ondrej Kubik <ondrej.kubik@canonical.com>
2022-08-08 15:33:17 +03:00