Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
openSUSE:Step:FrontRunner
docker.18278
bsc1073877-0001-apparmor-clobber-docker-default...
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File bsc1073877-0001-apparmor-clobber-docker-default-profile-on-start.patch of Package docker.18278
From 63c14342e66130e6669a3cc40fa9d4fe7f562d33 Mon Sep 17 00:00:00 2001 From: Aleksa Sarai <asarai@suse.de> Date: Fri, 29 Jun 2018 17:59:30 +1000 Subject: [PATCH] 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> --- components/engine/daemon/apparmor_default.go | 14 ++++++++++---- .../engine/daemon/apparmor_default_unsupported.go | 4 ++++ components/engine/daemon/daemon.go | 5 +++-- 3 files changed, 17 insertions(+), 6 deletions(-) diff --git a/components/engine/daemon/apparmor_default.go b/components/engine/daemon/apparmor_default.go index 78511ea68c47..0435924fd101 100644 --- a/components/engine/daemon/apparmor_default.go +++ b/components/engine/daemon/apparmor_default.go @@ -22,6 +22,15 @@ func DefaultApparmorProfile() string { return "" } +func clobberDefaultAppArmorProfile() error { + if apparmor.IsEnabled() { + 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.IsEnabled() { loaded, err := aaprofile.IsLoaded(defaultApparmorProfile) @@ -35,10 +44,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/components/engine/daemon/apparmor_default_unsupported.go b/components/engine/daemon/apparmor_default_unsupported.go index dd581dc7dadb..5b14979cd4a3 100644 --- a/components/engine/daemon/apparmor_default_unsupported.go +++ b/components/engine/daemon/apparmor_default_unsupported.go @@ -2,6 +2,10 @@ package daemon // import "github.com/docker/docker/daemon" +func clobberDefaultAppArmorProfile() error { + return nil +} + func ensureDefaultAppArmorProfile() error { return nil } diff --git a/components/engine/daemon/daemon.go b/components/engine/daemon/daemon.go index e75cee6c8c18..48fb5d969140 100644 --- a/components/engine/daemon/daemon.go +++ b/components/engine/daemon/daemon.go @@ -807,8 +807,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.30.0
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor