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

set selinux labels on build docker containers when running pods in crio #17094

Merged
merged 1 commit into from
Nov 29, 2017

Conversation

bparees
Copy link
Contributor

@bparees bparees commented Oct 30, 2017

@openshift-ci-robot openshift-ci-robot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Oct 30, 2017
@bparees
Copy link
Contributor Author

bparees commented Oct 30, 2017

/test crio

@openshift-merge-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: bparees

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these OWNERS Files:

You can indicate your approval by writing /approve in a comment
You can cancel your approval by writing /approve cancel in a comment

@openshift-merge-robot openshift-merge-robot added approved Indicates a PR has been approved by an approver from all required OWNERS files. needs-api-review vendor-update Touching vendor dir or related files labels Oct 30, 2017
@bparees
Copy link
Contributor Author

bparees commented Oct 30, 2017

/unassign @mfojtik @stevekuznetsov
/assign @mrunalp

@bparees
Copy link
Contributor Author

bparees commented Oct 30, 2017

/test crio

@bparees
Copy link
Contributor Author

bparees commented Oct 30, 2017

/test crio

@bparees
Copy link
Contributor Author

bparees commented Oct 30, 2017

/test crio

return fmt.Sprintf("label=level:%s", match[1]), nil
}
}
return "", nil
Copy link
Member

Choose a reason for hiding this comment

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

Do we want to return an error if we don't find a match or just skip adding SecurityOpt if we don't find it adding a warning in the log?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yeah i'll add a warning and skip.

Copy link
Contributor

Choose a reason for hiding this comment

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

Is this code being run within a container? Why not just use

if label, err := selinux.CurrentLabel(); err != nil {
....
}

level := selinux.NewContext("level")

Copy link
Contributor

Choose a reason for hiding this comment

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

import "github.com/opencontainers/selinux/go-selinux"

@runcom
Copy link
Member

runcom commented Oct 31, 2017

/test crio

1 similar comment
@runcom
Copy link
Member

runcom commented Oct 31, 2017

/test crio

@runcom
Copy link
Member

runcom commented Oct 31, 2017

@runcom
Copy link
Member

runcom commented Oct 31, 2017

/test crio

}
if match := selinuxLabelPattern.FindStringSubmatch(s.Text()); match != nil {
glog.V(6).Infof("found selinux labels: %v", match[1])
return fmt.Sprintf("label=level:%s", match[1]), nil
Copy link

Choose a reason for hiding this comment

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

I thought we needed to match user/role/type as well here? What happens if there is a customer SELinux label on the container, no match?

Copy link

Choose a reason for hiding this comment

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

s/customer/custom but in any case, response was explained here: #17094 (comment)

@rhatdan
Copy link
Contributor

rhatdan commented Oct 31, 2017

@pweil- It is a safe assumption that this is not the case. And you probably don't want to match the type. Most likely you are running a container that can talk to docker, which is probably a looser policy while you want to run the build with the traditional SELinux label.

In SELinux terms the User and Role are almost never used.

@bparees
Copy link
Contributor Author

bparees commented Oct 31, 2017

@bparees there are still build tests failing in the cri-o job in the CI

@runcom they look like networking problems now:

2017-10-31T14:43:28.274286308Z Fetching source index from https://rubygems.org/
2017-10-31T14:43:28.328875682Z Retrying source fetch due to error (2/3): Bundler::HTTPError Could not fetch specs from https://rubygems.org/
2017-10-31T14:43:28.340385595Z Retrying source fetch due to error (3/3): Bundler::HTTPError Could not fetch specs from https://rubygems.org/
2017-10-31T14:43:28.362562913Z Could not fetch specs from https://rubygems.org/
2017-10-31T14:43:28.726290541Z F1031 14:43:28.726242       1 helpers.go:120] error: build error: The command '/bin/sh -c scl enable rh-ruby22 "bundle install"' returned a non-zero code: 17

@ashcrow
Copy link
Member

ashcrow commented Oct 31, 2017

Travis is complaining on make verify-commits:

The following UPSTREAM commits modify Godeps repos other than the repo the commit declares:

[9d8e54aa7] UPSTREAM: 687: add securityopt arg support

  - pkg/build/vendor/github.com/fsouza/go-dockerclient/image.go

[ERROR] PID 2647: hack/lib/cmd.sh:241: `return "${return_code}"` exited with status 1.

@ashcrow
Copy link
Member

ashcrow commented Oct 31, 2017

extended_image_ecosystem:

Oct 31 19:21:09.014: INFO: At 2017-10-31 19:20:44 +0000 UTC - event for django-ex: {deployer-controller } FailedCreate: Error creating deployer pod: pods "django-ex-1-deploy" already exists

@mrunalp
Copy link
Member

mrunalp commented Oct 31, 2017

@bparees We preserved a test instance and I was able to logon and verify that regular pods have internet connectivity. If you can stop a build with assemble script on one of these then we can debug the networking issues tomorrow.

@runcom
Copy link
Member

runcom commented Nov 27, 2017

/retest

@runcom
Copy link
Member

runcom commented Nov 27, 2017

Cri-o wise, this PR looks good as it fixes build tests 👍

@mrunalp
Copy link
Member

mrunalp commented Nov 28, 2017

@bparees Can we get this merged?

@bparees
Copy link
Contributor Author

bparees commented Nov 28, 2017

@mrunalp it's fine with me, i assumed you wanted the crio tests passing.

@bparees
Copy link
Contributor Author

bparees commented Nov 28, 2017

also the "extended builds" suite is being skipped. i'd prefer to see it actually pass that suite.

@bparees
Copy link
Contributor Author

bparees commented Nov 28, 2017

(for which we need @stevekuznetsov to tell us why it's being skipped)

@mrunalp
Copy link
Member

mrunalp commented Nov 28, 2017

@bparees If we pass all the build tests here then we should be fine merging. Of the remaining 4 we have a PR for fixing one (#17198) and the other 3 are still being looked at.

@runcom
Copy link
Member

runcom commented Nov 28, 2017

/test crio

@stevekuznetsov
Copy link
Contributor

@bparees the extended build test looks like it ran and failed -- what do you mean?

@bparees
Copy link
Contributor Author

bparees commented Nov 28, 2017

@stevekuznetsov wasn't the situation last night.

@bparees bparees added the lgtm Indicates that a PR is ready to be merged. label Nov 28, 2017
@runcom
Copy link
Member

runcom commented Nov 28, 2017

/test crio

@bparees
Copy link
Contributor Author

bparees commented Nov 28, 2017

/test extended_builds

@runcom
Copy link
Member

runcom commented Nov 28, 2017

/test extended_conformance_install

@openshift-ci-robot
Copy link

@bparees: The following tests failed, say /retest to rerun them all:

Test name Commit Details Rerun command
ci/openshift-jenkins/extended_conformance_install_update 6744e6c link /test extended_conformance_install_update
ci/openshift-jenkins/extended_conformance_crio bce732a link /test crio
ci/openshift-jenkins/extended_builds bce732a link /test extended_builds

Full PR test history. Your PR dashboard. Please help us cut down on flakes by linking to an open issue when you hit one in your PR.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here.

@openshift-merge-robot
Copy link
Contributor

Automatic merge from submit-queue (batch tested with PRs 17476, 17143, 15115, 17094, 17500).

@openshift-merge-robot openshift-merge-robot merged commit 2748ff8 into openshift:master Nov 29, 2017
@runcom
Copy link
Member

runcom commented Nov 29, 2017

@bparees @mrunalp this should be back ported to release-1.7 branch as well

@bparees
Copy link
Contributor Author

bparees commented Nov 29, 2017

@runcom why?

@runcom
Copy link
Member

runcom commented Nov 29, 2017

@bparees to fix builds there as well?

@bparees
Copy link
Contributor Author

bparees commented Nov 29, 2017

@runcom we don't generally backport things to older origin releases. I assume we didn't make any claims about crio support in 3.7 (since we didn't get it working before 3.7 shipped) so i don't see why we'd backport it now.

@mrunalp
Copy link
Member

mrunalp commented Nov 29, 2017

We did ship cri-o in tech preview for 3.7.

@runcom
Copy link
Member

runcom commented Nov 29, 2017

@runcom we don't generally backport things to older origin releases. I assume we didn't make any claims about crio support in 3.7 (since we didn't get it working before 3.7 shipped) so i don't see why we'd backport it now.

as @mrunalp said, we shipped it as tech preview and we have this working now. It would be nice to have this backported so people can actually start using CRI-O if they want and we get feedback and all the rest

@stevekuznetsov
Copy link
Contributor

We're not usually in the business of releasing point patches on top of old Origin releases. /cc @smarterclayton

@runcom
Copy link
Member

runcom commented Nov 29, 2017

We're not usually in the business of releasing point patches on top of old Origin releases. /cc @smarterclayton

ack ack, sorry for the noise :)

@bparees bparees deleted the crio_selinux branch November 29, 2017 18:13
openshift-merge-robot added a commit that referenced this pull request Feb 15, 2018
Automatic merge from submit-queue.

[release-3.7] setup selinux labels for build containers

back ports #17094 to `release-3.7`

@smarterclayton PTAL
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. lgtm Indicates that a PR is ready to be merged. size/S Denotes a PR that changes 10-29 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.