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

enable SA secret ref limitting per SA. Default to insecure #3907

Merged
merged 2 commits into from
Aug 21, 2015

Conversation

deads2k
Copy link
Contributor

@deads2k deads2k commented Jul 24, 2015

Upstream kubernetes/kubernetes#11827

  1. allows a particular service account to be enforcing and require references to a secret to be in the mountable list.
  2. provides config values to say which service accounts should be enforcing by default
  3. provides a config value to disable the (default)permissive mode for the entire cluster

@smarterclayton Before I take this upstream, does it do what you want?
@liggitt Did you have something else in mind? This doesn't require any API changes and leave the cluster admin in control as to whether he wants to allow a project admin to do this.

@liggitt
Copy link
Contributor

liggitt commented Jul 24, 2015

Seems reasonable at first glance (I didn't look in great detail yet). I'd define the annotation upstream (what's the case for a different annotation meaning "allow all" between openshift and upstream?), and I'd test for a value of "true", not just presence.

@liggitt
Copy link
Contributor

liggitt commented Jul 24, 2015

Need to be clear that that modifying annotations of service accounts in the "ensure" list won't reconcile existing service accounts with those names.

if options.ServiceAccountConfig.AllowPermissive {
saAdmitter.AllowAllSecretsAnnotation = configapi.ServiceAccountAllowAnySecretAnnotation
}
admissionController = admission.NewChainHandler(admissionController, saAdmitter)
Copy link
Contributor

Choose a reason for hiding this comment

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

We have to keep service account admission at its current position in the chain

Copy link
Contributor

Choose a reason for hiding this comment

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

SCC depends on it being set, and quota should come last since a later rejection will allocate quota until the reconcile controller frees it

Copy link
Contributor Author

Choose a reason for hiding this comment

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

SCC depends on it being set, and quota should come last since a later rejection will allocate quota until the reconcile controller frees it

You know what we need: a dependency graph.... :)

@deads2k
Copy link
Contributor Author

deads2k commented Jul 24, 2015

comments addressed.

@deads2k deads2k force-pushed the configure-sa-controller branch 2 times, most recently from 2905eb2 to b1b4846 Compare July 24, 2015 19:46
@deads2k
Copy link
Contributor Author

deads2k commented Jul 27, 2015

@pweil- You worked enough with service accounts to review?

@deads2k deads2k changed the title disable SA secret ref limitting per SA enable SA secret ref limitting per SA. Default to insecure Jul 28, 2015
@deads2k
Copy link
Contributor Author

deads2k commented Jul 28, 2015

Inverted to be insecure by default.

@smarterclayton The way I currently have it will make existing clusters suddenly less secure. Do you want to keep pre-existing configs enforcing? It's easy, I just wasn't sure you'd want to do that because it will be kind of weird config-wise.

@smarterclayton
Copy link
Contributor

I think if we make this change then we'll want to doc it in templates and
make it work that way, which means new templates would fail. I think it's
ok to change the default behavior in this one case unless we can make a
case this isn't what we want in general.

On Tue, Jul 28, 2015 at 9:23 AM, David Eads notifications@github.com
wrote:

Inverted to be insecure by default.

@smarterclayton https://github.com/smarterclayton The way I currently
have it will make existing clusters suddenly less secure. Do you want to
keep pre-existing configs enforcing? It's easy, I just wasn't sure you'd
want to do that because it will be kind of weird config-wise.


Reply to this email directly or view it on GitHub
#3907 (comment).

Clayton Coleman | Lead Engineer, OpenShift

@deads2k
Copy link
Contributor Author

deads2k commented Jul 28, 2015

Renamed to limitSecretReferences. Do you want to eliminate the ability to have automatically provisioned service accounts secure by default? Right now I made the "deployer" service account secured by default.

@liggitt
Copy link
Contributor

liggitt commented Jul 28, 2015

Do you want to eliminate the ability to have automatically provisioned service accounts secure by default?

I don't want to eliminate that

@liggitt
Copy link
Contributor

liggitt commented Jul 28, 2015

Also, "secure"/"insecure" are probably misleading terms. Enforcing/permissive might be better

@smarterclayton
Copy link
Contributor

the ability to have provisioned service accounts enforcing by default

Is really no different to me than whether enforcing is the default. I
think it's just simpler to enforce or not enforce by default, and let the
annotation be created by users if they want to set their desired
enforcement.

On Tue, Jul 28, 2015 at 5:03 PM, Jordan Liggitt notifications@github.com
wrote:

Also, "secure"/"insecure" are probably misleading terms.
Enforcing/permissive might be better


Reply to this email directly or view it on GitHub
#3907 (comment).

Clayton Coleman | Lead Engineer, OpenShift

@deads2k
Copy link
Contributor Author

deads2k commented Jul 29, 2015

I
think it's just simpler to enforce or not enforce by default, and let the
annotation be created by users if they want to set their desired
enforcement.

In order to achieve that, you need the switch to allow a subset of managedNames to have the enforcing annotation by default. Otherwise, the user has no way to ensure an enforcing service account in every namespace.

@smarterclayton
Copy link
Contributor

I'm not sure we have to ensure an enforcing service account in every
namespace.

On Wed, Jul 29, 2015 at 7:37 AM, David Eads notifications@github.com
wrote:

I
think it's just simpler to enforce or not enforce by default, and let the
annotation be created by users if they want to set their desired
enforcement.

In order to achieve that, you need the switch to allow a subset of
managedNames to have the enforcing annotation by default. Otherwise, the
user has no way to ensure an enforcing service account in every namespace.


Reply to this email directly or view it on GitHub
#3907 (comment).

Clayton Coleman | Lead Engineer, OpenShift

@liggitt liggitt self-assigned this Aug 3, 2015
@deads2k
Copy link
Contributor Author

deads2k commented Aug 7, 2015

[test]

1 similar comment
@deads2k
Copy link
Contributor Author

deads2k commented Aug 7, 2015

[test]

@smarterclayton
Copy link
Contributor

What's the latest on this?

On Fri, Aug 7, 2015 at 2:47 PM, David Eads notifications@github.com wrote:

[test]


Reply to this email directly or view it on GitHub
#3907 (comment).

Clayton Coleman | Lead Engineer, OpenShift

@deads2k
Copy link
Contributor Author

deads2k commented Aug 10, 2015

Upstream has stalled. We could commit in origin without getting it into upstream. The API hasn't changed, but it would mean that we end up carrying slightly different admission code via patches. Nothing too bad, but @liggitt should take a look.

@@ -144,6 +147,15 @@ func (e *ServiceAccountsController) Stop() {
}
}

func (e *ServiceAccountsController) ensuresServiceAccount(name string) bool {
Copy link
Contributor

Choose a reason for hiding this comment

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

weird name... also, unused?

@deads2k
Copy link
Contributor Author

deads2k commented Aug 20, 2015

rebased

@@ -38,6 +39,9 @@ import (
// DefaultServiceAccountName is the name of the default service account to set on pods which do not specify a service account
const DefaultServiceAccountName = "default"

// EnforceMountableSecretsAnnotation is a default annotation that indicates that a service account should enforce mountable secrets
Copy link
Contributor

Choose a reason for hiding this comment

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

doc that the value should be "true", not just present

@liggitt
Copy link
Contributor

liggitt commented Aug 20, 2015

nit on annotation doc, admission plugin chain construction changes, then LGTM

@deads2k deads2k force-pushed the configure-sa-controller branch 2 times, most recently from bdd0095 to deb60c0 Compare August 20, 2015 17:52
@deads2k
Copy link
Contributor Author

deads2k commented Aug 20, 2015

comments addressed.

@deads2k
Copy link
Contributor Author

deads2k commented Aug 20, 2015

flake: #4294

re[test]

return nil, err
}

masterConfig.ServiceAccountConfig.LimitSecretReferences = true
Copy link
Contributor

Choose a reason for hiding this comment

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

interesting... I like it, but a comment about why we're not using a default would be good to keep this from getting removed by someone

Copy link
Contributor Author

Choose a reason for hiding this comment

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

interesting... I like it, but a comment about why we're not using a default would be good to keep this from getting removed by someone

done

@liggitt
Copy link
Contributor

liggitt commented Aug 20, 2015

LGTM

@liggitt
Copy link
Contributor

liggitt commented Aug 20, 2015

upstream PR updated?

@liggitt liggitt added the lgtm Indicates that a PR is ready to be merged. label Aug 20, 2015
@deads2k
Copy link
Contributor Author

deads2k commented Aug 20, 2015

upstream PR updated?

yes

@deads2k
Copy link
Contributor Author

deads2k commented Aug 20, 2015

[merge]

@openshift-bot
Copy link
Contributor

continuous-integration/openshift-jenkins/merge SUCCESS (https://ci.openshift.redhat.com/jenkins/job/merge_pull_requests_origin/3053/) (Image: devenv-fedora_2187)

@openshift-bot
Copy link
Contributor

continuous-integration/openshift-jenkins/test FAILURE (https://ci.openshift.redhat.com/jenkins/job/test_pull_requests_origin/4361/)

@openshift-bot
Copy link
Contributor

Evaluated for origin merge up to 8198fde

@openshift-bot
Copy link
Contributor

Evaluated for origin test up to 8198fde

openshift-bot pushed a commit that referenced this pull request Aug 21, 2015
@openshift-bot openshift-bot merged commit 36201f6 into openshift:master Aug 21, 2015
@deads2k deads2k deleted the configure-sa-controller branch September 1, 2015 12:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lgtm Indicates that a PR is ready to be merged.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants