Skip to content
This repository has been archived by the owner on Mar 9, 2022. It is now read-only.

Commit

Permalink
Merge pull request #812 from Random-Liu/cherrypick-#808
Browse files Browse the repository at this point in the history
Erase ambient capabilities.
  • Loading branch information
Random-Liu authored Jun 11, 2018
2 parents 8845f14 + 73d3ea1 commit 4cf084d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
5 changes: 5 additions & 0 deletions pkg/server/container_create.go
Original file line number Diff line number Diff line change
Expand Up @@ -372,6 +372,11 @@ func (c *criService) generateContainerSpec(id string, sandboxID string, sandboxP
securityContext.GetCapabilities())
}
}
// Clear all ambient capabilities. The implication of non-root + caps
// is not clearly defined in Kubernetes.
// See https://github.com/kubernetes/kubernetes/issues/56374
// Keep docker's behavior for now.
g.Spec().Process.Capabilities.Ambient = []string{}

g.SetProcessSelinuxLabel(processLabel)
g.SetLinuxMountLabel(mountLabel)
Expand Down
1 change: 1 addition & 0 deletions pkg/server/container_create_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,7 @@ func TestContainerCapabilities(t *testing.T) {
assert.NotContains(t, spec.Process.Capabilities.Inheritable, exclude)
assert.NotContains(t, spec.Process.Capabilities.Permitted, exclude)
}
assert.Empty(t, spec.Process.Capabilities.Ambient)
}
}

Expand Down

0 comments on commit 4cf084d

Please sign in to comment.