forked from pool/docker
f28071cbb5
<https://docs.docker.com/engine/release-notes/24.0/#2406>. bsc#1215323 - Rebase patches: * 0001-SECRETS-daemon-allow-directory-creation-in-run-secre.patch * 0002-SECRETS-SUSE-implement-SUSE-container-secrets.patch * 0003-BUILD-SLE12-revert-graphdriver-btrfs-use-kernel-UAPI.patch * 0004-bsc1073877-apparmor-clobber-docker-default-profile-o.patch * cli-0001-docs-include-required-tools-in-source-tree.patch - Switch from disabledrun to manualrun in _service. - Add a docker.socket unit file, but with socket activation effectively disabled to ensure that Docker will always run even if you start the socket individually. Users should probably just ignore this unit file. bsc#1210141 OBS-URL: https://build.opensuse.org/package/show/Virtualization:containers/docker?expand=0&rev=395
90 lines
3.2 KiB
Diff
90 lines
3.2 KiB
Diff
From c19fad9e09248bf390fe9b2cd38f351104f186b8 Mon Sep 17 00:00:00 2001
|
|
From: Aleksa Sarai <asarai@suse.de>
|
|
Date: Fri, 29 Jun 2018 17:59:30 +1000
|
|
Subject: [PATCH 4/4] bsc1073877: apparmor: clobber docker-default profile on
|
|
start
|
|
|
|
In the process of making docker-default reloading far less expensive,
|
|
567ef8e7858c ("daemon: switch to 'ensure' workflow for AppArmor
|
|
profiles") mistakenly made the initial profile load at dockerd start-up
|
|
lazy. As a result, if you have a running Docker daemon and upgrade it to
|
|
a new one with an updated AppArmor profile the new profile will not take
|
|
effect (because the old one is still loaded). The fix for this is quite
|
|
trivial, and just requires us to clobber the profile on start-up.
|
|
|
|
Fixes: 567ef8e7858c ("daemon: switch to 'ensure' workflow for AppArmor profiles")
|
|
SUSE-Bugs: bsc#1099277
|
|
Signed-off-by: Aleksa Sarai <asarai@suse.de>
|
|
---
|
|
daemon/apparmor_default.go | 14 ++++++++++----
|
|
daemon/apparmor_default_unsupported.go | 4 ++++
|
|
daemon/daemon.go | 5 +++--
|
|
3 files changed, 17 insertions(+), 6 deletions(-)
|
|
|
|
diff --git a/daemon/apparmor_default.go b/daemon/apparmor_default.go
|
|
index 6376001613f7..5fde21a4af8a 100644
|
|
--- a/daemon/apparmor_default.go
|
|
+++ b/daemon/apparmor_default.go
|
|
@@ -24,6 +24,15 @@ func DefaultApparmorProfile() string {
|
|
return ""
|
|
}
|
|
|
|
+func clobberDefaultAppArmorProfile() error {
|
|
+ if apparmor.HostSupports() {
|
|
+ if err := aaprofile.InstallDefault(defaultAppArmorProfile); err != nil {
|
|
+ return fmt.Errorf("AppArmor enabled on system but the %s profile could not be loaded: %s", defaultAppArmorProfile, err)
|
|
+ }
|
|
+ }
|
|
+ return nil
|
|
+}
|
|
+
|
|
func ensureDefaultAppArmorProfile() error {
|
|
if apparmor.HostSupports() {
|
|
loaded, err := aaprofile.IsLoaded(defaultAppArmorProfile)
|
|
@@ -37,10 +46,7 @@ func ensureDefaultAppArmorProfile() error {
|
|
}
|
|
|
|
// Load the profile.
|
|
- if err := aaprofile.InstallDefault(defaultAppArmorProfile); err != nil {
|
|
- return fmt.Errorf("AppArmor enabled on system but the %s profile could not be loaded: %s", defaultAppArmorProfile, err)
|
|
- }
|
|
+ return clobberDefaultAppArmorProfile()
|
|
}
|
|
-
|
|
return nil
|
|
}
|
|
diff --git a/daemon/apparmor_default_unsupported.go b/daemon/apparmor_default_unsupported.go
|
|
index e3dc18b32b5e..9c7723056268 100644
|
|
--- a/daemon/apparmor_default_unsupported.go
|
|
+++ b/daemon/apparmor_default_unsupported.go
|
|
@@ -3,6 +3,10 @@
|
|
|
|
package daemon // import "github.com/docker/docker/daemon"
|
|
|
|
+func clobberDefaultAppArmorProfile() error {
|
|
+ return nil
|
|
+}
|
|
+
|
|
func ensureDefaultAppArmorProfile() error {
|
|
return nil
|
|
}
|
|
diff --git a/daemon/daemon.go b/daemon/daemon.go
|
|
index 4d76c5798888..15c95b50c4eb 100644
|
|
--- a/daemon/daemon.go
|
|
+++ b/daemon/daemon.go
|
|
@@ -839,8 +839,9 @@ func NewDaemon(ctx context.Context, config *config.Config, pluginStore *plugin.S
|
|
logrus.Warnf("Failed to configure golang's threads limit: %v", err)
|
|
}
|
|
|
|
- // ensureDefaultAppArmorProfile does nothing if apparmor is disabled
|
|
- if err := ensureDefaultAppArmorProfile(); err != nil {
|
|
+ // Make sure we clobber any pre-existing docker-default profile to ensure
|
|
+ // that upgrades to the profile actually work smoothly.
|
|
+ if err := clobberDefaultAppArmorProfile(); err != nil {
|
|
logrus.Errorf(err.Error())
|
|
}
|
|
|
|
--
|
|
2.42.0
|
|
|