57506 Commits

Author SHA1 Message Date
Michael Vogt
54754e50ed packaging: release version 2.58 2.58 2022-12-01 21:23:01 +01:00
Michael Vogt
811c4e3e1e packaging: update the changelog to include details about 2.57.6 2022-12-01 21:23:01 +01:00
Michael Vogt
3b462757e3 releasing package snapd version 2.57.6 2022-12-01 06:30:48 +01:00
Alex Murray
ab331761c7 overlord/snapmgr: Bump vulnerable snap version check
This should ensure that any older versions of snapd that are vulnerable to this
new CVE-2022-3328 are uninstalled on upgrade to the fixed version.

Signed-off-by: Alex Murray <alex.murray@canonical.com>
2022-12-01 06:30:48 +01:00
Alex Murray
1374c96ca5 tests/main/snap-confine-drops-sys-admin: use stat to check owner/perms
The output format of ls could vary depending on the local systems locale etc whereas
the output of stat is fixed so use this instead to check file owner /
permissions.

Signed-off-by: Alex Murray <alex.murray@canonical.com>
2022-12-01 06:30:48 +01:00
Alex Murray
f11ba28889 many: Use /tmp/snap-private-tmp for per-snap private tmps
To avoid unprivileged users being able to interfere with the creation of the
private snap mount namespace, instead of creating this as /tmp/snap.$SNAP_NAME/
we can now use the systemd-tmpfiles configuration to do this for us
at boot with a known fixed name (/tmp/snap-private-tmp/) and then use that as
the base dir for creating per-snap private tmp mount
namespaces (eg. /tmp/snap-private-tmp/snap.$SNAP_INSTANCE/tmp) etc.

Signed-off-by: Alex Murray <alex.murray@canonical.com>
2022-12-01 06:30:48 +01:00
Alex Murray
68cd7b61b7 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:30:48 +01:00
Miguel Pires
55af307b9b cmd/snap: test allowed and forbidden refresh hold values
Signed-off-by: Miguel Pires <miguel.pires@canonical.com>
2022-11-30 17:53:27 +01:00
Miguel Pires
bb784254a6 cmd/snap: be more consistent in --hold help and err messages
Signed-off-by: Miguel Pires <miguel.pires@canonical.com>
2022-11-30 17:53:27 +01:00
Miguel Pires
701541daf7 cmd/snap: error on refresh holds that are negative or too short
Signed-off-by: Miguel Pires <miguel.pires@canonical.com>
2022-11-30 17:53:27 +01:00
Alfonso Sánchez-Beato
bb1c5eccb4 o/homedirs: make sure we do not write to /var on build time
Make sure we do not try to write /var/lib/snapd/system-params while
being run from ubuntu-image/snap prepare.
2022-11-28 15:21:47 +01:00
Alfonso Sánchez-Beato
8fcfacb637 image: make sure file customizations happen also when we have defaults
Some customizations (cloud init configuration seeding, disabling of
console conf) were not happening for UC16/18 if there were also
defaults in the gadget. This fixes an early return that was the
cause (LP: #1997494).

Thanks to Alberto Mardegan for test suggestion.
2022-11-28 15:21:47 +01:00
Alfonso Sánchez-Beato
1d420f4fa8 tests/fde-on-classic: set ubuntu-seed label in seed partitions
Which is needed now when using system-seed-null role.
2022-11-28 13:14:53 +01:00
Samuele Pedroni
4ae4f99cc2 gadget: system-seed-null should also have fs label ubuntu-seed 2022-11-28 13:14:53 +01:00
Samuele Pedroni
03d26a4b20 many: gadget.HasRole, ubuntu-seed can come also from system-seed-null
use HasRole in snap-bootstrap and cover the point about both
system-seed and system-seed-null getting mounted as ubuntu-seed
2022-11-28 13:14:53 +01:00
Alfonso Sánchez-Beato
9e74c4dcc8 o/devicestate: fix paths for retrieving recovery key on classic
We do not have the "system-data" subfolder on classic.
2022-11-28 10:52:15 +01:00
Maciej Borzecki
9220227faf cmd/snap-confine: do not discard const qualifier
GCC 12.2.1 with the default build flags in Rawhide is more picky than usual, and
fails with this:

snap-confine/selinux-support.c:85:29: error: initialization discards 'const' qualifier from pointer target type [-Werror=discarded-qualifiers]
   85 |         char *new_ctx_str = context_str(ctx);
      |                             ^~~~~~~~~~~
cc1: all warnings being treated as errors

Signed-off-by: Maciej Borzecki <maciek.borzecki@gmail.com>
2022-11-28 09:53:42 +01:00
Michael Vogt
89374671a0 interfaces: allow python3.10+ in the default template
Currently snaps that use python3.10 from core22 will fail on older
releases of ubuntu:
```
$ sudo snap install test-snapd-sh-core22
$ test-snapd-sh-core22.sh -c 'python3 -c "import ssl"'
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/usr/lib/python3.10/ssl.py", line 98, in <module>
    import _ssl             # if we can't import it, let the error propagate
ImportError: /usr/lib/python3.10/lib-dynload/_ssl.cpython-310-x86_64-linux-gnu.so: failed to map segment from shared object
```

It turns out our apparmor template only allows:
```
  /usr/lib{,32,64}/python3.[0-9]/lib-dynload/*.so      mr,
```
so anything beyond `python3.9` will not work. This commit adds a
regression test and allows for `/python3.[0-9]*/` to fix the
issue.
2022-11-23 16:24:17 +01:00
Samuele Pedroni
e4816c8084 o/restart: some clarifications 2022-11-23 14:58:04 +01:00
Samuele Pedroni
09568906af o/restart: fix PendingForSystemRestart
the test confusingly didn't have a positive case, which should have hinted
to potential problems
2022-11-23 14:58:04 +01:00
James Henstridge
56c7ce8a67 interfaces: allow wayland slot snaps to access shm files created by Firefox
Wayland clients share memory with the compositor by creating a file
descriptor, and passing it to the server via an SCM_RIGHTS message. Both
sides then mmap the fd. For GTK and Qt apps, this doesn't require any
additional permissions because they create the fd with memfd_create(),
which has no file system path.

Unfortunately Firefox's Wayland code uses shm_open(), which creates a
file system backed file. The compositor will only be able to use the fd
it receives if it's AppArmor profile allows access to that file. So we
need a rule granting access to the path it uses.
2022-11-23 12:34:47 +01:00
Miguel Pires
76cddc61ae daemon: improve function name
Rename validationSetForTracked to validationSetsForTracking.

Signed-off-by: Miguel Pires <miguel.pires@canonical.com>
2022-11-22 12:35:01 +01:00
Miguel Pires
81e090457a o/assertstate: add Sequence() to val set tracking
Since Current sometimes differed from PinnedAt even when PinnedAt != 0,
be more robust by using a Sequence() method that takes PinnedAt into
account when reading as well.

Signed-off-by: Miguel Pires <miguel.pires@canonical.com>
2022-11-22 12:35:01 +01:00
Miguel Pires
c6dc934ca7 o/assertstate: set val set 'Current' to pinned sequence
Make sure that the current sequence number in the validation set
tracking is set to the same as the pinned sequence number, if the
validation set is pinned (PinnedAt != 0).

Signed-off-by: Miguel Pires <miguel.pires@canonical.com>
2022-11-22 12:35:01 +01:00
Alberto Mardegan
8ac464e9d8 tests: tweak the libvirt interface test to work on 22.10
The test is failing with a non critical AppArmor error message, but the
real failure is due to QEMU command-line parsing:

    error: internal error: qemu unexpectedly closed the monitor:
    2022-10-03T11:56:15.932697Z qemu-system-x86_64:
    -device {"driver":"virtio-balloon-pci","id":"balloon0","bus":"pci.0","addr":"0x2"}:
    PCI: slot 2 function 0 not available for virtio-balloon-pci, in use by virtio-net-pci,id=(null)

This happens because something in libvirt (or maybe QEMU itself) adds an
implicit PCI device on address 0x2 -- the log line pasted above shows
what device is being added. This bug has also been noticed by other
projects, see comment 45 on https://bugzilla.redhat.com/show_bug.cgi?id=2034160

The workaround we use is to specify a virtio-net-pci device on another
PCI address, in order to avoid the address conflict.
2022-11-18 12:07:43 +01:00