Skip to content

Modify "sudoer" group and "privileged" SCC to seamlessly work together#16213

Merged
openshift-merge-robot merged 2 commits intoopenshift:masterfrom
php-coder:gh16092_scc_and_impersonation
Sep 9, 2017
Merged

Modify "sudoer" group and "privileged" SCC to seamlessly work together#16213
openshift-merge-robot merged 2 commits intoopenshift:masterfrom
php-coder:gh16092_scc_and_impersonation

Conversation

@php-coder
Copy link
Contributor

Prior this change, a member of "sudoer" group couldn't create a privileged pod (or perform oc exec against it). Also before, a user couldn't impersonate system:masters group. Now all of these are became possible.

PTAL @openshift/sig-security

Fixes #16092

@openshift-ci-robot openshift-ci-robot added the size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. label Sep 7, 2017
@enj enj assigned liggitt, deads2k and simo5 and unassigned fabianofranz and csrwng Sep 7, 2017
Copy link
Contributor

@enj enj left a comment

Choose a reason for hiding this comment

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

@php-coder you need to regenerate the bootstrap policy YAML files.

UPDATE_BOOTSTRAP_POLICY_FIXTURE_DATA=true hack/test-go.sh pkg/cmd/server/bootstrappolicy

},
Rules: []rbac.PolicyRule{
rbac.NewRule("impersonate").Groups(userGroup, legacyUserGroup).Resources(authorizationapi.SystemUserResource, authorizationapi.UserResource).Names(SystemAdminUsername).RuleOrDie(),
rbac.NewRule("impersonate").Groups(userGroup, legacyUserGroup).Resources(authorizationapi.SystemGroupResource, authorizationapi.GroupResource).Names(MastersGroup).RuleOrDie(),
Copy link
Contributor

Choose a reason for hiding this comment

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

@deads2k we seem to have 3 different copies of MastersGroup. I do not know which one we want to use, and if we want to delete some of said copies.

Copy link
Contributor

Choose a reason for hiding this comment

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

@deads2k we seem to have 3 different copies of MastersGroup. I do not know which one we want to use, and if we want to delete some of said copies.

We probably don't want the package dependencies for most constants.

func GetBoostrapSCCAccess(infraNamespace string) (map[string][]string, map[string][]string) {
groups := map[string][]string{
SecurityContextConstraintPrivileged: {ClusterAdminGroup, NodesGroup},
SecurityContextConstraintPrivileged: {ClusterAdminGroup, NodesGroup, MastersGroup},
Copy link
Contributor

Choose a reason for hiding this comment

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

@deads2k do we want to go ahead an remove ClusterAdminGroup?

Copy link
Contributor

Choose a reason for hiding this comment

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

@deads2k do we want to go ahead an remove ClusterAdminGroup

Mark the constant deprecated, but I wouldn't remove it. If people used it (and it looks reasonable to use), a tighten shouldn't break them.


os::cmd::expect_success 'oc adm policy add-cluster-role-to-user sudoer wheel'
os::cmd::try_until_text 'oc policy who-can impersonate systemusers system:admin' "wheel"
os::cmd::try_until_text 'oc policy who-can impersonate systemgroups system:masters' "wheel"
Copy link
Contributor

Choose a reason for hiding this comment

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

also check:

oc policy who-can impersonate users system:admin
oc policy who-can impersonate groups system:masters

…stem:masters group.

This change improves UX and allows to a member of the sudoer
group to, for example, create a privileged pod using impersonation:

$ oc create -f privileged.pod --as system:admin
@php-coder php-coder force-pushed the gh16092_scc_and_impersonation branch from 9f94f06 to 228bc1c Compare September 8, 2017 09:52
@openshift-ci-robot openshift-ci-robot added size/S Denotes a PR that changes 10-29 lines, ignoring generated files. and removed size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. labels Sep 8, 2017
@php-coder
Copy link
Contributor Author

@enj @liggitt Thanks! The comments have been addressed. PTAL.

@enj
Copy link
Contributor

enj commented Sep 8, 2017

/lgtm

@openshift-ci-robot openshift-ci-robot added the lgtm Indicates that a PR is ready to be merged. label Sep 8, 2017
@openshift-merge-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: enj, php-coder

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

Details 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 the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Sep 8, 2017
@openshift-bot
Copy link
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

@openshift-merge-robot
Copy link
Contributor

Automatic merge from submit-queue

@openshift-merge-robot openshift-merge-robot merged commit 8134819 into openshift:master Sep 9, 2017
@php-coder php-coder deleted the gh16092_scc_and_impersonation branch September 13, 2017 20:55
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.

10 participants