Skip to content
This repository has been archived by the owner on Dec 13, 2018. It is now read-only.

Commit

Permalink
Don't restrict lxc because of apparmor
Browse files Browse the repository at this point in the history
We don't have the flexibility to do extra things with lxc because it is
a black box and most fo the magic happens before we get a chance to
interact with it in dockerinit.
Docker-DCO-1.1-Signed-off-by: Michael Crosby <michael@crosbymichael.com> (github: crosbymichael)
  • Loading branch information
crosbymichael committed May 2, 2014
1 parent 883af43 commit da71a20
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion nsinit/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ func Init(container *libcontainer.Container, uncleanRootfs, consolePath string,
return fmt.Errorf("set process label %s", err)
}
if container.Context["restrictions"] != "" {
if err := restrict.Restrict(); err != nil {
if err := restrict.Restrict("proc", "sys"); err != nil {
return err
}
}
Expand Down
4 changes: 2 additions & 2 deletions security/restrict/restrict.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ import (

// This has to be called while the container still has CAP_SYS_ADMIN (to be able to perform mounts).
// However, afterwards, CAP_SYS_ADMIN should be dropped (otherwise the user will be able to revert those changes).
func Restrict() error {
func Restrict(mounts ...string) error {
// remount proc and sys as readonly
for _, dest := range []string{"proc", "sys"} {
for _, dest := range mounts {
if err := system.Mount("", dest, "", syscall.MS_REMOUNT|syscall.MS_RDONLY, ""); err != nil {
return fmt.Errorf("unable to remount %s readonly: %s", dest, err)
}
Expand Down

0 comments on commit da71a20

Please sign in to comment.