Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Seccomp to Annotations #25324

Merged
merged 1 commit into from
May 26, 2016
Merged

Conversation

jessfraz
Copy link
Contributor

@jessfraz jessfraz commented May 8, 2016

Add Seccomp API

This is a WIP of #24602, with some included changes to that proposal that I mentioned on it. For the most part those changes are that instead of passing the path to the profiles, the SeccompProfile struct is passed to the API. This way if using kubectl you can pass a local profile.

Things left to do:

  • Add Tests
  • Add ability to pass seccomp profile to kubectl, mostly wondering about the design on this one

This is my first PR to kubernetes so without a doubt some test somewhere will probably fail ;)

@k8s-github-robot k8s-github-robot added kind/api-change Categorizes issue or PR as related to adding, removing, or otherwise changing an API size/L Denotes a PR that changes 100-499 lines, ignoring generated files. release-note-label-needed labels May 8, 2016
@derekwaynecarr
Copy link
Member

@pmorie

@@ -1362,6 +1362,8 @@ type PodSecurityContext struct {
// Use the host's ipc namespace.
// Optional: Default to false.
HostIPC bool `json:"hostIPC,omitempty"`
// The SeccompProfile is the seccomp profile this pod should run under.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd appreciate a comment about the semantics wrt the per-container value and the per-pod value. Is it a total override? Additive? Subtractive?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I need to define that in the proposal, I want total override personally.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be a name right now to match the proposal, I do not want to specify these profiles inline -- it makes the policy much harder to write.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will update!

On Monday, May 9, 2016, Paul Morie notifications@github.com wrote:

In pkg/api/types.go
#25324 (comment)
:

@@ -1362,6 +1362,8 @@ type PodSecurityContext struct {
// Use the host's ipc namespace.
// Optional: Default to false.
HostIPC bool json:"hostIPC,omitempty"

  • // The SeccompProfile is the seccomp profile this pod should run under.

This should be a name right now to match the proposal, I do not want to
specify these profiles inline -- it makes the policy much harder to write.


You are receiving this because you were mentioned.
Reply to this email directly or view it on GitHub
https://github.com/kubernetes/kubernetes/pull/25324/files/ec54b7e13bbd79087fb34f0973f4482c0150c9c6#r62559109

Jessie Frazelle
4096R / D4C4 DD60 0D66 F65A 8EFC 511E 18F3 685C 0022 BFF3
pgp.mit.edu http://pgp.mit.edu/pks/lookup?op=get&search=0x18F3685C0022BFF3

@thockin
Copy link
Member

thockin commented May 9, 2016

I just scanned for API style, not full code review.

@erictune since this is VERY similar (and totally different impl) than the apparmor stuff we discussed.

@eparis
Copy link
Contributor

eparis commented May 9, 2016

ok to test

@k8s-github-robot k8s-github-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label May 12, 2016
@pmorie
Copy link
Member

pmorie commented May 23, 2016

@jfrazelle proposal is merged so you should be able to update with confidence from that now. We are trying to get LGTM on all 1.3 features today.

@jessfraz
Copy link
Contributor Author

Will do as sson as done with work! sorry!

On Mon, May 23, 2016 at 11:40 AM, Paul Morie notifications@github.com
wrote:

@jfrazelle https://github.com/jfrazelle proposal is merged so you
should be able to update with confidence from that now. We are trying to
get LGTM on all 1.3 features today.


You are receiving this because you were mentioned.
Reply to this email directly or view it on GitHub
#25324 (comment)

Jessie Frazelle
4096R / D4C4 DD60 0D66 F65A 8EFC 511E 18F3 685C 0022 BFF3
pgp.mit.edu http://pgp.mit.edu/pks/lookup?op=get&search=0x18F3685C0022BFF3

@@ -949,18 +946,33 @@ func (dm *DockerManager) checkVersionCompatibility() error {
return nil
}

func (dm *DockerManager) getDefaultSecurityOpt() ([]string, error) {
func (dm *DockerManager) getSecurityOpt(container *api.Container) ([]string, error) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Look for the annotation on the pod for this container (needs to be changed to accept the pod)

The precedent should be:

  1. container-specific annotation, if any
  2. pod-level annotation, if any
  3. default (unconfined?)

@jessfraz jessfraz changed the title WIP: Add Seccomp API Add Seccomp to Annotations May 24, 2016
@jessfraz
Copy link
Contributor Author

updated and added tests

@k8s-github-robot k8s-github-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label May 24, 2016
@pmorie pmorie added the release-note Denotes a PR that will be considered when it comes time to generate release notes. label May 24, 2016
@pmorie
Copy link
Member

pmorie commented May 24, 2016

@jfrazelle Looks like you need to run hack/update-all.sh. Can we get an E2E in a follow-up?

@jessfraz
Copy link
Contributor Author

ah my b

@pmorie
Copy link
Member

pmorie commented May 24, 2016

LGTM.

Let's do E2E coverage in a follow-up. Appreciate the effort getting this in for 1.3!

@pmorie pmorie added this to the v1.3 milestone May 24, 2016
@jessfraz
Copy link
Contributor Author

Did I miss another generation is that why the test is failing?

@ncdc
Copy link
Member

ncdc commented May 24, 2016

@jfrazelle more generation/verification fun:

Verifying ./hack/../hack/verify-flags-underscore.py
Found flags in golang files not in the list of known flags. Please add these to hack/verify-flags/known-flags.txt
seccomp-profile-root
FAILED   ./hack/../hack/verify-flags-underscore.py  8s

@jessfraz
Copy link
Contributor Author

ah got it

On Tue, May 24, 2016 at 10:05 AM, Andy Goldstein notifications@github.com
wrote:

@jfrazelle https://github.com/jfrazelle more generation/verification
fun:

Verifying ./hack/../hack/verify-flags-underscore.py
Found flags in golang files not in the list of known flags. Please add these to hack/verify-flags/known-flags.txt
seccomp-profile-root
FAILED ./hack/../hack/verify-flags-underscore.py 8s


You are receiving this because you were mentioned.
Reply to this email directly or view it on GitHub
#25324 (comment)

Jessie Frazelle
4096R / D4C4 DD60 0D66 F65A 8EFC 511E 18F3 685C 0022 BFF3
pgp.mit.edu http://pgp.mit.edu/pks/lookup?op=get&search=0x18F3685C0022BFF3

@ncdc
Copy link
Member

ncdc commented May 24, 2016

@jfrazelle squash please?

Signed-off-by: Jess Frazelle <me@jessfraz.com>
@jessfraz
Copy link
Contributor Author

done

@pmorie pmorie added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label May 24, 2016
@pmorie
Copy link
Member

pmorie commented May 24, 2016

LGTM, thanks!

@jessfraz
Copy link
Contributor Author

Nooooooooooooooo :(

@pweil-
Copy link
Contributor

pweil- commented May 25, 2016

ERROR: (gcloud.compute.networks.create) Some requests did not succeed:
 - Quota 'NETWORKS' exceeded. Limit: 75.0

Hmm, looks like you hit this: #26270

@eparis
Copy link
Contributor

eparis commented May 25, 2016

@k8s-bot e2e test this flake: #26270

@pmorie pmorie mentioned this pull request May 25, 2016
2 tasks
@ncdc
Copy link
Member

ncdc commented May 26, 2016

@k8s-bot e2e test this issue: #IGNORE
(seems like something quite bad happened in the test run https://console.cloud.google.com/storage/browser/kubernetes-jenkins/pr-logs/pull/25324/kubernetes-pull-build-test-e2e-gce/41970/)

will try to investigate if time permits

@k8s-bot
Copy link

k8s-bot commented May 26, 2016

GCE e2e build/test passed for commit aa8c72a.

@alex-mohr alex-mohr merged commit 4357b8a into kubernetes:master May 26, 2016
@jessfraz
Copy link
Contributor Author

Yay! thanks!

On Thu, May 26, 2016 at 10:51 AM, Alex Mohr notifications@github.com
wrote:

Merged #25324 #25324.


You are receiving this because you were mentioned.
Reply to this email directly or view it on GitHub
#25324 (comment)

Jessie Frazelle
4096R / D4C4 DD60 0D66 F65A 8EFC 511E 18F3 685C 0022 BFF3
pgp.mit.edu http://pgp.mit.edu/pks/lookup?op=get&search=0x18F3685C0022BFF3

return nil, err
}

return []string{fmt.Sprintf("seccomp=%s", b.Bytes())}, nil
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this really be the compacted file content or the filename itself? Compare https://docs.docker.com/engine/security/seccomp/

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes it needs to be the file contents. The docker cli takes a file name,
reads its contents, and transmits the contents to the daemon.

On Wednesday, June 8, 2016, Dr. Stefan Schimanski notifications@github.com
wrote:

In pkg/kubelet/dockertools/manager.go
#25324 (comment)
:

  • if !strings.HasPrefix(profile, "localhost") {
  •   return nil, fmt.Errorf("unknown seccomp profile option: %s", profile)
    
  • }
  • file, err := ioutil.ReadFile(filepath.Join(dm.seccompProfileRoot, strings.TrimPrefix(profile, "localhost/")))
  • if err != nil {
  •   return nil, err
    
  • }
  • b := bytes.NewBuffer(nil)
  • if err := json.Compact(b, file); err != nil {
  •   return nil, err
    
  • }
  • return []string{fmt.Sprintf("seccomp=%s", b.Bytes())}, nil

Should this really be the compacted file content or the filename itself?
Compare https://docs.docker.com/engine/security/seccomp/


You are receiving this because you commented.
Reply to this email directly, view it on GitHub
https://github.com/kubernetes/kubernetes/pull/25324/files/aa8c72adaaab6cba51ff868516ac5b423a95f069#r66230042,
or mute the thread
https://github.com/notifications/unsubscribe/AAABYoMSK4m547F8EFFS3otQ56-RjCKAks5qJpe1gaJpZM4IZwJt
.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/security kind/api-change Categorizes issue or PR as related to adding, removing, or otherwise changing an API lgtm "Looks good to me", indicates that a PR is ready to be merged. release-note Denotes a PR that will be considered when it comes time to generate release notes. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.