Skip to content

Allow route spec.host to be controlled by permission - #13905

Merged
openshift-bot merged 1 commit into
openshift:masterfrom
smarterclayton:make_route_set_require_permission
May 15, 2017
Merged

openshift-bot merged 1 commit into
openshift:masterfrom
smarterclayton:make_route_set_require_permission

Conversation

@smarterclayton

Copy link
Copy Markdown
Contributor

A new virtual resource routes/custom-host controls whether spec.host can be set a user

  • create is required to set a spec.host on creation
  • update is required to change spec.host at any subsequent change

Project admins and editors by default get create. Only cluster admin has update by default.

API compatibility is preserved for the error message returned by immutable fields.

@smarterclayton

Copy link
Copy Markdown
Contributor Author

@smarterclayton

Copy link
Copy Markdown
Contributor Author

[test] also fixed for ingress at the same time

@smarterclayton
smarterclayton force-pushed the make_route_set_require_permission branch from 9c24314 to f6b0681 Compare April 27, 2017 22:04
@sttts

sttts commented Apr 28, 2017

Copy link
Copy Markdown
Contributor

@smarterclayton seeing the same flake upstream as well:
https://github.com/kubernetes/kubernetes/issues?utf8=%E2%9C%93&q=is%3Aissue%20is%3Aopen%20%22Scaling%20down%20before%20scale%20up%20is%20finished%20should%22

We have only whitelisted issues with Basic StatefulSet functionality \[StatefulSetBasic\] should provide basic identity. Do you mean that cherry-pick?

@knobunc knobunc left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM

@knobunc
knobunc requested a review from rajatchopra April 28, 2017 12:42
@liggitt liggitt reopened this Apr 28, 2017
@liggitt

liggitt commented Apr 28, 2017

Copy link
Copy Markdown
Contributor

Silly github

// HostGeneratedAnnotationKey is the key for an annotation set to "true" if the route's host was generated
const HostGeneratedAnnotationKey = "openshift.io/host.generated"

// Registry is an interface for performing subject access reviews

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

s/Registry/SubjectAccessReview

@smarterclayton

Copy link
Copy Markdown
Contributor Author

Open question - do @Miciah do you want to gate setting custom external certs on this permission? In practice I don't need a custom cert if I can't customize the route, UNLESS there is no default cert, in which case someone needs to generate one cert per endpoint. How common is that?

@rajatchopra

Copy link
Copy Markdown
Contributor

Open question - do @Miciah do you want to gate setting custom external certs on this permission? In practice I don't need a custom cert if I can't customize the route, UNLESS there is no default cert, in which case someone needs to generate one cert per endpoint. How common is that?

In my (unsubstantiated) view, very uncommon.

@Miciah

Miciah commented May 1, 2017

Copy link
Copy Markdown
Contributor

For Online, we want to allow either both custom host and certificate or neither.

@twiest, are you aware of a use-case in Dedicated for prohibiting a user to create a route with a custom host while allowing that user to create a route with a custom certificate?

@twiest

twiest commented May 1, 2017

Copy link
Copy Markdown

@Miciah I don't, but I'm probably not the right person to ask.

I think @spurtell or @sspeiche are probably better people to ask. They work much closer with the dedicated customers than I do.

In order to simplify control over custom routes (routes with a
non-default spec.host), make using a custom host field require the
"create" verb on "routes/custom-host". By default, admin and edit within
a project will get this permission. Users are also prohibited from
setting or altering certificates without this permission.

Integrators who want to prohibit this can drop the permission from the
role and only allow cluster administrators to fill that field.
@smarterclayton
smarterclayton force-pushed the make_route_set_require_permission branch from f6b0681 to bef5a17 Compare May 6, 2017 21:26
@openshift-bot

Copy link
Copy Markdown
Contributor

Evaluated for origin test up to bef5a17

@smarterclayton

Copy link
Copy Markdown
Contributor Author

Gated setting destinationCACertificate, caCertificate, key, and certificate by the permission as well. Justification:

  1. Custom hosts is pretty powerful (take others names, camp)
  2. Custom certs are less powerful (hurt yourself, but deny everything if there is a bug)

Custom certs aren't useful unless you have custom hosts, or your admin won't configure the router to use a default wildcard. If they don't use a wildcard, it's usually because they want you to generate your own cert. If they do that, they can still ignore the default hostname on the router side.

Backwards compatible for existing routes, and for clusters that run reconcile on upgrade for new routes.

@openshift-bot

Copy link
Copy Markdown
Contributor

@smarterclayton

Copy link
Copy Markdown
Contributor Author

Any other review comments from anyone?

@abhgupta

Copy link
Copy Markdown
Member

The latest comments from you on this PR satisfy the Online use cases perfectly - no additional comments from me.

@smarterclayton

Copy link
Copy Markdown
Contributor Author

[merge] based on review comments.

@openshift-bot

Copy link
Copy Markdown
Contributor

Evaluated for origin merge up to bef5a17

@openshift-bot

openshift-bot commented May 15, 2017 •

Copy link
Copy Markdown
Contributor

continuous-integration/openshift-jenkins/merge SUCCESS (https://ci.openshift.redhat.com/jenkins/job/merge_pull_request_origin/648/) (Base Commit: 7e3e3c7) (Image: devenv-rhel7_6228)

@openshift-bot
openshift-bot merged commit b38274c into openshift:master May 15, 2017
res, err := s.sarClient.CreateSubjectAccessReview(
ctx,
&authorizationapi.SubjectAccessReview{
User: user.GetName(),

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@deads2k just noticed this wasn't populating group and scope info... there's a helper for populating a subject access review with the correct user info from the context

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I cribbed this from somewhere else as well. Helper I need?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

looks like it needs fixing in imagestreamimport.go

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

fixed in #14304

User: user.GetName(),
Action: authorizationapi.Action{
Verb: "create",
Group: api.GroupName,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@liggitt will this work for legacy api?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

10 participants