From 33381db09ddf10f76b15395924d9b3d1ee7d2275 Mon Sep 17 00:00:00 2001 From: unclejack Date: Tue, 3 Jun 2014 21:49:34 +0300 Subject: [PATCH] apparmor: write & load the profile on every start Docker-DCO-1.1-Signed-off-by: Cristian Staretu (github: unclejack) --- apparmor/setup.go | 34 +--------------------------------- 1 file changed, 1 insertion(+), 33 deletions(-) diff --git a/apparmor/setup.go b/apparmor/setup.go index ef6333a..8ed5437 100644 --- a/apparmor/setup.go +++ b/apparmor/setup.go @@ -2,7 +2,6 @@ package apparmor import ( "fmt" - "io" "os" "os/exec" "path" @@ -12,42 +11,11 @@ const ( DefaultProfilePath = "/etc/apparmor.d/docker" ) -func InstallDefaultProfile(backupPath string) error { +func InstallDefaultProfile() error { if !IsEnabled() { return nil } - // If the profile already exists, check if we already have a backup - // if not, do the backup and override it. (docker 0.10 upgrade changed the apparmor profile) - // see gh#5049, apparmor blocks signals in ubuntu 14.04 - if _, err := os.Stat(DefaultProfilePath); err == nil { - if _, err := os.Stat(backupPath); err == nil { - // If both the profile and the backup are present, do nothing - return nil - } - // Make sure the directory exists - if err := os.MkdirAll(path.Dir(backupPath), 0755); err != nil { - return err - } - - // Create the backup file - f, err := os.Create(backupPath) - if err != nil { - return err - } - defer f.Close() - - src, err := os.Open(DefaultProfilePath) - if err != nil { - return err - } - defer src.Close() - - if _, err := io.Copy(f, src); err != nil { - return err - } - } - // Make sure /etc/apparmor.d exists if err := os.MkdirAll(path.Dir(DefaultProfilePath), 0755); err != nil { return err