27 Commits

Author SHA1 Message Date
Samuele Pedroni
f6a3a2e1e2 i/backends,o/ifacestate: cleanup backends.All
get rid of the long-standing fmt.Printf instead of proper logging

given that the backends are a bit stateful nowadays, keeping a fixed set across
managers instantiation didn't completely make sense anyway

this avoids also the oddness of ifacestate having code to mock a global of a
different package
2022-10-02 16:37:41 +02:00
James Henstridge
764e424fbe interfaces: add polkit security backend to list of backends 2021-04-20 19:17:48 +08:00
Pawel Stolowski
b87345b8bb Introduce interfaces.SecurityBackendOptions for passing Preseed mode flag to backends via Initialize(). Change maybeRestart to a method of snap manager. 2020-02-18 10:43:41 +01:00
Pawel Stolowski
b6f3af8976 Implement workaround for enabling services after first boot. Integrate preseed with snapmgr and devicemgr.Add spread tests for preseeding. 2020-01-24 13:08:59 +01:00
Maciej Borzecki
6431d40710 many: tweak AppArmor level indicator naming
Shorten the name, do not repeat AppArmor in the name needlessly.

Signed-off-by: Maciej Borzecki <maciej.zenon.borzecki@canonical.com>
2019-09-25 09:34:12 +02:00
Maciej Borzecki
95f7a8e523 interfaces/backends: tweak import name of sandbox/apparmor in the tests
Signed-off-by: Maciej Borzecki <maciej.zenon.borzecki@canonical.com>
2019-09-25 09:14:14 +02:00
Maciej Borzecki
7a638de95d many: use sandbox/apparmor package for poking the AppArmor support status
The AppArmor related code was moved to
github.com/snapcore/snapd/sandbox/apparmor package. Update the remaining code to
use the package.

Signed-off-by: Maciej Borzecki <maciej.zenon.borzecki@canonical.com>
2019-09-24 14:01:31 +02:00
Zygmunt Krynicki
a045a192f5 interfaces/backends: make use of UnusableAppArmor
The 2.36.x release branch was using PartialAppArmor coupled with
additional check for lack of parser features to know that apparmor ought
to be disabled inside snapd. Meanwhile in master a new level,
UnusableAppArmor, was introduced to express that. This patch reconciles
the code to be in sync with master.

While I was at it, I added a test for UnusableAppArmor level.

Signed-off-by: Zygmunt Krynicki <me@zygoon.pl>
2018-12-14 10:35:19 +01:00
Zygmunt Krynicki
12e16ef8d1 interfaces/backends: detect too old apparmor_parser (2.36)
This patch changes logic conditionally adding the apparmor backend to not do so
if the kernel has some support in the case that the userspace parser is too old
to parse the profiles we generate.

In practical terms this means we run without apparmor on openSUSE Leap
42.3 which in turn fixes a bug that prevented snapd from working
correctly with stricter error reporting during startup phase when system
key is considered.

A simple spread test ensures that openSUSE Leap 42.3 is not using
apparmor anymore.

Fixes: https://bugs.launchpad.net/snapd/+bug/1805485
Signed-off-by: Zygmunt Krynicki <me@zygoon.pl>
2018-11-30 09:40:13 +01:00
Zygmunt Krynicki
0705c8ac8b interfaces: add test ensuring that systemd is before apparmor
Signed-off-by: Zygmunt Krynicki <zygmunt.krynicki@canonical.com>
2018-08-27 09:59:24 +02:00
Zygmunt Krynicki
8e6600186f interfaces: justify why systemd must go before apparmor
Signed-off-by: Zygmunt Krynicki <zygmunt.krynicki@canonical.com>
2018-08-27 09:02:36 +02:00
Michael Vogt
25497aa1c4 address review feedback 2017-09-14 09:22:04 +02:00
Zygmunt Krynicki
af4eba34d4 interfaces/backends: switch apparmor to release-based APIs
Signed-off-by: Zygmunt Krynicki <zygmunt.krynicki@canonical.com>
2017-09-12 12:55:23 +02:00
Zygmunt Krynicki
ae3076191a many: rename FeatureLevel (type) to SupportLevel
Signed-off-by: Zygmunt Krynicki <zygmunt.krynicki@canonical.com>
2017-09-12 11:39:02 +02:00
Zygmunt Krynicki
eb4ba7387a many: rename apparmor.Evaluate to .SupportLevel
Signed-off-by: Zygmunt Krynicki <zygmunt.krynicki@canonical.com>
2017-09-12 11:29:16 +02:00
Zygmunt Krynicki
ebbb1b17f0 many: rename apparmor.None to .NoSupport
Signed-off-by: Zygmunt Krynicki <zygmunt.krynicki@canonical.com>
2017-09-12 11:08:22 +02:00
Zygmunt Krynicki
dbfcb2e165 many: rename apparmor.Full to .FullSupport
Signed-off-by: Zygmunt Krynicki <zygmunt.krynicki@canonical.com>
2017-09-12 11:06:22 +02:00
Zygmunt Krynicki
c39ce2b7e9 many: rename apparmor.Partial to .PartialSupport
Signed-off-by: Zygmunt Krynicki <zygmunt.krynicki@canonical.com>
2017-09-12 10:58:24 +02:00
Zygmunt Krynicki
371349f32f interfaces/backends: explain importance of printing to stdout
Signed-off-by: Zygmunt Krynicki <zygmunt.krynicki@canonical.com>
2017-08-30 10:26:49 +02:00
Zygmunt Krynicki
319f1490e4 interfaces/backends: fix typo
Signed-off-by: Zygmunt Krynicki <zygmunt.krynicki@canonical.com>
2017-08-30 10:25:15 +02:00
Zygmunt Krynicki
2683266949 interfaces/backends: enable apparmor backend on parital feature set
AppArmor may be fully or only partially supported on a given system. In
the past when partially supported apparmor was detected then the backend
would not be loaded, leading to very confusing and error-prone behavior
for people switching between mainline (unpatched) and ubuntu (patched)
kernels. Because the backend was not loaded then now-stale profiles were
*not* updated or removed and things behaved oddly, where incorrect
profiles were actually loaded into the kernel (apparmor tries to degrade
gracefully but the profiles were not permissive enough).

With this patch the apparmor backend is loaded as long as the kernel
module is loaded and enabled. This will be coupled with a patch to the
backend, which will generate more permissive profiles for
anything-less-than-full feature set. This patch will allow snapd to
enable apparmor on Debian, openSUSE as well as Ubuntu running pre-4.15
mainline kernels.

Signed-off-by: Zygmunt Krynicki <me@zygoon.pl>
2017-08-28 11:25:07 +02:00
Michael Vogt
8a92e4ff01 misc: revert "Log if the system goes into ForceDevMode" (#3038)
This reverts commit 5f929a7ef1 as
suggested by Gustavo.
2017-03-15 17:44:15 -03:00
Michael Vogt
5f929a7ef1 Log if the system goes into ForceDevMode
Also update tests to fail if snapd ever goes into ForceDevMode during
the tests.
2017-03-15 11:57:26 +01:00
Zygmunt Krynicki
5f3982606d interfaces/backends: add systemd to the list of backends
Signed-off-by: Zygmunt Krynicki <zygmunt.krynicki@canonical.com>
2016-10-19 08:17:24 +02:00
Pawel Stolowski
00840e8fc2 Renamed to kmod and SecurityKMod 2016-09-15 10:59:39 +02:00