1525 Commits

Author SHA1 Message Date
James Henstridge
277b4f01bc data, packaging: install polkit policy files via data Makefile 2024-07-03 13:38:58 +02:00
Zygmunt Krynicki
11236a6ab7 packaging: remove ubuntu-core-launcher
Remove removal code or installation code, depending on distribution. In all
cases ubuntu-core-launcher is obsolete and has not been used in nearly a
decade.

Jira: SNAPDENG-23247

Signed-off-by: Zygmunt Krynicki <zygmunt.krynicki@canonical.com>
2024-06-18 12:37:31 +02:00
Oliver Calder
6905775c44 i/prompting: implement path pattern matching (#13866)
Path pattern matching is implemented via the doublestar package, which
emulates bash's globstar matching. Patterns may include '*' wildcard
characters (which match any number of non-separator characters), '**'
doublestars (which match zero or more subdirectories), '?' wildcard
characters (which match exactly one non-separator character), and nested
groups delimited by '{' and '}'. Notably, path patterns are *not* allowed
to have character classes delimited by '[' and ']', nor inverted
classes of the form "[^abc]".

There is a limit on the number of groups allowed in path patterns, but
up to that limit, groups may be arbitrarily nested or sequential.

Signed-off-by: Oliver Calder <oliver.calder@canonical.com>

i/prompting: fix typo and add notes to remove test boilerplate

Signed-off-by: Oliver Calder <oliver.calder@canonical.com>

i/prompting: use separate test suite for patterns

Signed-off-by: Oliver Calder <oliver.calder@canonical.com>

i/prompting: improve unit test coverage

Signed-off-by: Oliver Calder <oliver.calder@canonical.com>

* i/prompting: count and validate true number of expanded patterns

Rather than counting the number of groups and using it as a heuristic
for the number of patterns into which a given path pattern will expand,
instead compute the true number of expanded patterns and compare it
against a set limit.

Signed-off-by: Oliver Calder <oliver.calder@canonical.com>

* i/prompting: implement path pattern checks in constraints

Signed-off-by: Oliver Calder <oliver.calder@canonical.com>

* i/prompting: throw error if group depth exceeds maximum expanded patterns

Signed-off-by: Oliver Calder <oliver.calder@canonical.com>

* packaging: add doublestar dependency for prompting pattern matching

Signed-off-by: Oliver Calder <oliver.calder@canonical.com>

* i/prompting: remove standalone path pattern validation

Signed-off-by: Oliver Calder <oliver.calder@canonical.com>

---------

Signed-off-by: Oliver Calder <oliver.calder@canonical.com>
2024-06-17 20:12:22 +02:00
Sergio Cazzolato
23f572ba10 tests: remove centos-8 support (#14056)
Centos-8 support is removed as it is EOL
2024-06-10 14:17:26 -03:00
Maciej Borzecki
f6530b9f21 packaging/debian-sid: remove secboot related files from boot
Signed-off-by: Maciej Borzecki <maciej.borzecki@canonical.com>
2024-06-10 08:38:49 +02:00
Maciej Borzecki
315a552f12 packaging/debian-sid: keep gadget/install/kernel.go
We remove files during build on debian sid, make sure to keep the file which
carries definitions of required structures.

Signed-off-by: Maciej Borzecki <maciej.borzecki@canonical.com>
2024-06-10 08:38:49 +02:00
Sergio Cazzolato
1d0c82a197 tests: add packaging link for fedora-40 (#14049)
This is needed to be able to run spread tests in fedora-40
2024-06-05 14:35:22 -03:00
Maciej Borzecki
62e1d60f42 packaging/snapd.mk: generate GNU build ID for Go binaries
The Go toolchain only generates a Go build ID, but GNU build IDs are expected to
present almost universally. Make sure to generate GNU build IDs for Go binaries
like we do in Fedora packaging, so that rpmbuild is happy. Note, that not all Go
toolchains we build with support -B gobuildid, hence populate the GNU build ID
with random bytes, but leave a note about a fix we need here.

Signed-off-by: Maciej Borzecki <maciej.borzecki@canonical.com>
2024-06-03 14:13:00 +02:00
Zygmunt Krynicki
2d4b16fca9 packaging: remove stale workaround from snap-seccomp RHEL build
There's no need to use sed to remove -lseccomp, the code uses
pkg-config to interrogate for the right build flags.

This was tested with mock (fedora build tool) for EPEL-{7,8,9}
and FC-{39,40,41}.

Signed-off-by: Zygmunt Krynicki <zygmunt.krynicki@canonical.com>
2024-05-28 10:55:03 +02:00
Zygmunt Krynicki
18bdf07cea packaging: depend on systemd-dev for udev.pc
Signed-off-by: Zygmunt Krynicki <zygmunt.krynicki@canonical.com>
2024-05-21 16:28:00 +02:00
Maciej Borzecki
58dfc18843 packaging: do not require fakeroot on Amazon Linux 2
Do not require fakeroot on Amazon Linux 2, as we do not run unit tests there
anyway, and it's not available in the repositories.

Signed-off-by: Maciej Borzecki <maciej.borzecki@canonical.com>
2024-05-06 16:23:40 +02:00
Maciej Borzecki
1ce896a32d packaging/fedora: disable logging of executed commands
The amount of logs produced by this is staggering and it's near impossible to
locate errors.

Signed-off-by: Maciej Borzecki <maciej.borzecki@canonical.com>
2024-05-06 16:23:40 +02:00
Maciej Borzecki
8accae8e99 packaging: make sure that /var/lib/snapd/environment exists (#13944)
Have the snapd packaging helper create /var/lib/snapd/environment. This fixes
RPM build on openSUSE:

```
RPM build errors:
    Directory not found: /usr/src/packages/BUILDROOT/snapd-1337.2.63-0.x86_64/var/lib/snapd/environment
```

Signed-off-by: Maciej Borzecki <maciej.borzecki@canonical.com>
2024-05-06 12:33:44 +02:00
Alfonso Sánchez-Beato
1bc4cfdd2b packaging: make sure <state>/snapd/enviroment is created
where it was not the case yet.
2024-05-02 07:47:33 +01:00
Ernest Lotter
3c8cbf4173 Merge pull request #13887 from ernestl/changelogs-2.63
release: 2.63
2024-04-30 19:57:43 +02:00
Maciej Borzecki
657a524078 packaging/fedora: add squashfs-tools to build requirements
Needed by unit tests

Signed-off-by: Maciej Borzecki <maciej.borzecki@canonical.com>
2024-04-29 14:42:52 +02:00
Maciej Borzecki
6da559a1a6 packaging/fedora: unit tests require fakeroot, add it to build requirements
Signed-off-by: Maciej Borzecki <maciej.borzecki@canonical.com>
2024-04-29 14:42:52 +02:00
ernestl
40efd81c2f release: 2.63 2024-04-24 11:27:52 +02:00
alfonsosanchezbeato
bdeb1a9cf0 packaging: add kmod as Depends (#13830)
It is needed now on hybrid systems to be able to build the drivers
tree.
2024-04-24 11:27:52 +02:00
alfonsosanchezbeato
fe0ce14314 packaging: add kmod as Depends (#13830)
It is needed now on hybrid systems to be able to build the drivers
tree.
2024-04-15 12:05:57 +02:00
Maciej Borzecki
0dd7e2f4e2 .github/workflows, advisor, packaging: switch to go.etcd.io/bbolt (#13804)
* go: add go.etcd.io/bbolt@1.3.9

Signed-off-by: Maciej Borzecki <maciej.borzecki@canonical.com>

* advisor: switch to go.etcd.io/bbolt, since github.com/boltdb/bolt is no longer maintained

The upstream boltdb repository at https://github.com/boltdb/bolt is no longer
maintained and has been archived. The community has moved to forks, where
https://github.com/etcd-io/bbolt seems to be the one with most use.

Signed-off-by: Maciej Borzecki <maciej.borzecki@canonical.com>

* packaging/fedora: switch to go.etcd.io/bbolt

Signed-off-by: Maciej Borzecki <maciej.borzecki@canonical.com>

* packaging/debian-sid: require bbolt

Signed-off-by: Maciej Borzecki <maciej.borzecki@canonical.com>

* advisor: drop nobolt variant

Since we've switched to a different upstream, nobolt variant is no longer
needed.

Signed-off-by: Maciej Borzecki <maciej.borzecki@canonical.com>

* packaging/debian-sid: drop nobolt hacks

Signed-off-by: Maciej Borzecki <maciej.borzecki@canonical.com>

* github: drop nobolt unit test variant

Signed-off-by: Maciej Borzecki <maciej.borzecki@canonical.com>

* github: add missing newline

Signed-off-by: Maciej Borzecki <maciej.borzecki@canonical.com>

---------

Signed-off-by: Maciej Borzecki <maciej.borzecki@canonical.com>
2024-04-11 16:33:37 +02:00
Maciej Borzecki
bae9178245 many: merge release 2.62 (#13749)
* gadget: if storage traits is zero sized file, assume traits do not exist (#13719)

This is a safe fallback, as no-existent storage traits is a valid usecase.

Signed-off-by: Ondrej Kubik <ondrej.kubik@canonical.com>

* tests: fix recovery-system-reboot install test that was being interrupted by a system reboot (#13736)

* tests/nested/manual/recovery-system-reboot: fix test that was being interrupted by a system reboot

In the case of an auto-refresh, the system would reboot. This resulted
in some cryptic failures. Make sure to wait for an auto-refresh to
happen before removing the recovery system, and make sure to wait for
the system to reboot once the auto-refresh has finished.

* tests/nested/manual/recovery-system-reboot: add an extra wait to continue waiting after reboot

* sandbox/apparmor: detect but ignore apparmor 4 (#13740)

Due to issues with incorrect behavior to mediate:

    stat /dev/mqueue

For applications governed by the profile that allows it via

    mqueue,

We cannot yet use apparmor 4, even if one is supported on the host. This does
impact userns mediation but it is better to have the old mediation and not
break snaps, than to have some new mediation in some cases and some unexpected
mediation in other cases.

Once the mqueue, issue is identified and we have updated bundled apparmor to a
stable release of apparmor 4, this patch can be reverted.

Signed-off-by: Zygmunt Krynicki <zygmunt.krynicki@canonical.com>

* release: 2.62

* NEWS: restore WIP items

Signed-off-by: Maciej Borzecki <maciej.borzecki@canonical.com>

---------

Signed-off-by: Ondrej Kubik <ondrej.kubik@canonical.com>
Signed-off-by: Zygmunt Krynicki <zygmunt.krynicki@canonical.com>
Signed-off-by: Maciej Borzecki <maciej.borzecki@canonical.com>
Co-authored-by: Ondra Kubik <ondrej.kubik@canonical.com>
Co-authored-by: Andrew Phelps <136256549+andrewphelpsj@users.noreply.github.com>
Co-authored-by: Zygmunt Bazyli Krynicki <zygmunt.krynicki@canonical.com>
Co-authored-by: ernestl <ernest.lotter@canonical.com>
2024-03-22 14:45:25 +01:00
Zygmunt Krynicki
c5c5116adf packaging: fix debian builds broken by github.com/snapcore/bolt
The effort to allow Debian to build without bolt support, have been
insufficient, as we have discovered that parts of dh_golang do not support go
build tags.

As an alternative that is brutal but works, remove the single offending file
that causes 'go list -f ...' to enumerate github.com/snapcore/bolt due to
missing -tags nobolt argument that debhelper does not provide.

Signed-off-by: Zygmunt Krynicki <zygmunt.krynicki@canonical.com>
2024-03-12 14:31:17 +01:00
Maciej Borzecki
69528a936a interfaces/udev, cmd/snap-confine: support for snaps managing own device cgroups (#13642)
* dirs: add directory location for storing cgroup policy related flags

Signed-off-by: Maciej Borzecki <maciej.borzecki@canonical.com>

* interfaces/udev: introduce cgroup policy flag for self managed device cgroup

Some snaps, due to their interfaces, are allowed to self manage the device
cgroup. In this case, the assumption was to not emit any rules at all, and
instead rely on the implicit behavior that no rules means no matching devices
and hence no device cgroup filtering. However, with introduction of a device
cgroup by default for all snaps on core24 onward, regardless of any assigned
devices, we need a separate source of information to indicate that a snap can do
self management.

The patch introduces a policy flags under /var/lib/snapd/cgroup, named
snap.<name>.device, eg.
/var/lib/snapd/cgroup/snap.docker.device, which provides a hints for
snap-confine to not set up a device cgroup filtering for apps.

Signed-off-by: Maciej Borzecki <maciej.borzecki@canonical.com>

* cmd/snap-confine: support snaps which self-manage device cgroup

Support for snaps for which policy explicitly states that the device cgroup is
self-managed. The typical use case is container like technologies. In such
scenario, there will be a device cgroup configuration file at a known location
which got generated by snapd whenever the relevant interface state changed.

Signed-off-by: Maciej Borzecki <maciej.borzecki@canonical.com>

* tests/main/security-device-cgroups-self-manage: spread test

Signed-off-by: Maciej Borzecki <maciej.borzecki@canonical.com>

* cmd/snap-confine: drop base from bases exempt from mandatory device cgroup

We have confirmed that there are no snaps which (ab)use system files and use
bare base to obtain access to devices. As such, the bare base can be dropped
form the list of bases exempt from mandatory device cgroup.

Signed-off-by: Maciej Borzecki <maciej.borzecki@canonical.com>

* interfaces/udev: remove snap devices file when removing the snap

Signed-off-by: Maciej Borzecki <maciej.borzecki@canonical.com>

* interfaces/udev: consistent use of fs.ErrNotExist

Signed-off-by: Maciej Borzecki <maciej.borzecki@canonical.com>

* cmd/snap-confine: leave comments

Signed-off-by: Maciej Borzecki <maciej.borzecki@canonical.com>

* interfaces/udev: tweak return path

Signed-off-by: Maciej Borzecki <maciej.borzecki@canonical.com>

* interfaces/udev: improve managed device cgroup unit tests, verify calls to udevadm

Signed-off-by: Maciej Borzecki <maciej.borzecki@canonical.com>

* NEWS: leave a note about mandatory device cgroup

Signed-off-by: Maciej Borzecki <maciej.borzecki@canonical.com>

* tests/main/security-device-cgroups-self-manage: tweak comments

Signed-off-by: Maciej Borzecki <maciej.borzecki@canonical.com>

* interfaces/udev: always write the device file

Always write the device file which serves as a synchronization point between
snap-confine and the snapd udev backend.

Signed-off-by: Maciej Borzecki <maciej.borzecki@canonical.com>

* cmd/libsnap-confine-private: add helper for waiting for a file to show up

Signed-off-by: Maciej Borzecki <maciej.borzecki@canonical.com>

* cmd/snap-confine: make cgroup device file mandatory

Make the per-snap /var/lib/snapd/cgroup/snap.*.device file mandatory, such that
it can be used as a synchronization point between snapd calling Setup() of
relevant security backends and the execution path in snap-confine.

Signed-off-by: Maciej Borzecki <maciej.borzecki@canonical.com>

* cmd/snap-mgmt: do cleanup of /var/lib/snapd/cgroup

Signed-off-by: Maciej Borzecki <maciej.borzecki@canonical.com>

* packaging: declare /var/lib/snapd/cgroup

Signed-off-by: Maciej Borzecki <maciej.borzecki@canonical.com>

* cmd/snap-confine: use the file wait helper

Signed-off-by: Maciej Borzecki <maciej.borzecki@canonical.com>

* packaging: create cgroup directory

Signed-off-by: Maciej Borzecki <maciej.borzecki@canonical.com>

* tests/main/security-device-cgroups-self-manage: update file check

Signed-off-by: Maciej Borzecki <maciej.borzecki@canonical.com>

* tests/main/security-device-cgroups-required-or-optional: update test to verify device file

Signed-off-by: Maciej Borzecki <maciej.borzecki@canonical.com>

* interfaces/udev: refactor reloading

Signed-off-by: Maciej Borzecki <maciej.borzecki@canonical.com>

* cmd/snap-confine: move device cgroup mode selection to a helper

Extract device cgroup mode selection into a helper function.

Signed-off-by: Maciej Borzecki <maciej.borzecki@canonical.com>

---------

Signed-off-by: Maciej Borzecki <maciej.borzecki@canonical.com>
2024-03-07 13:23:58 +01:00
ernestl
4194045021 release: 2.61.3 2024-03-07 10:54:29 +02:00