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

[WIP] - keystone token authentication #25536

Closed
wants to merge 1 commit into from

Conversation

zhouhaibing089
Copy link
Contributor

@zhouhaibing089 zhouhaibing089 commented May 12, 2016

This is the keystone token authentication used as authenticator.Token which provides another authentication options.

features include:

  1. token validation via keystone api
  2. local validation via decode

referring #25391 as there will be todo list based on the present discussion there, which includes:

  1. support keystone v3 token
  2. register into authn and adding the flags.

@kfox1111 @liggitt @mkumatag please comment if you get any concern about this, thanks! since there will be more fix accordingly, so I will mark this as a WIP, but u know, it is ready for comments.

Also /cc @ashw7n @uruddarraju and @arkxu who implements the token local validation.


This change is Reviewable

@k8s-bot
Copy link

k8s-bot commented May 12, 2016

Can one of the admins verify that this patch is reasonable to test? If so, please reply "ok to test".
(Note: "add to whitelist" is no longer supported. Please update configurations in kubernetes/test-infra/jenkins/job-configs/kubernetes-jenkins-pull instead.)

This message may repeat a few times in short succession due to jenkinsci/ghprb-plugin#292. Sorry.

Otherwise, if this message is too spammy, please complain to ixdy.

2 similar comments
@k8s-bot
Copy link

k8s-bot commented May 12, 2016

Can one of the admins verify that this patch is reasonable to test? If so, please reply "ok to test".
(Note: "add to whitelist" is no longer supported. Please update configurations in kubernetes/test-infra/jenkins/job-configs/kubernetes-jenkins-pull instead.)

This message may repeat a few times in short succession due to jenkinsci/ghprb-plugin#292. Sorry.

Otherwise, if this message is too spammy, please complain to ixdy.

@k8s-bot
Copy link

k8s-bot commented May 12, 2016

Can one of the admins verify that this patch is reasonable to test? If so, please reply "ok to test".
(Note: "add to whitelist" is no longer supported. Please update configurations in kubernetes/test-infra/jenkins/job-configs/kubernetes-jenkins-pull instead.)

This message may repeat a few times in short succession due to jenkinsci/ghprb-plugin#292. Sorry.

Otherwise, if this message is too spammy, please complain to ixdy.

@k8s-github-robot k8s-github-robot added size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. release-note-label-needed labels May 12, 2016
@kfox1111
Copy link

@zhouhaibing089 Thanks for posting this. This code, and the one in the other review seem pretty complimentary. #25391 has a bit less code in the getting of the Keystone Auth user credentials part, reusing a lot of existing code in k8s. I think that part's cleaner over there.

This code seems to be mostly about adding pki token validation support. Thats awesome work. I hadn't attempted that since we're using Fernet tokens on all of our clouds now. The tests here are very nice too.

The rest of #25391 is related to returning data from the token over to authz plugins, and I have one almost completed I think. Once we can figure out the Extra data accessibility thing. I think its only a day or two away before I can post that.

So, how would you like to proceed? I think the other patch is maybe a good place to start from, and then we can rebase this one on top of the other one to add the pki support to it? That way, we don't have one gigantic patch.

I'm much more use to using Gerrit so I don't quite know how the workflow for having one PR depend on another PR works, if that's even possible. Anyone know?

Thanks,
Kevin

@zhouhaibing089
Copy link
Contributor Author

zhouhaibing089 commented May 13, 2016

#25391 has a bit less code in the getting of the Keystone Auth user credentials part, reusing a lot of existing code in k8s. I think that part's cleaner over there.

if you mean reusing most of the plugin/pkg/auth/authentication/password/keystone/keystone.go, I would say it is not clean, they are different, username/password and token should be located at different package, separately, I think @uruddarraju is the author of that file, I have a discussion with him before, as there will be many place using openstack client, it is better to abstract out for reuse in both password/keystone.go and token/keystone/keystone.go.

This code seems to be mostly about adding pki token validation support.

It is also not true, it is a special case that the token which starts with PKIZ_ and MII could be validated locally by downloading the keystone signing cert and decode directly. but if you see apicall.go, it is way to call keystone token api to validate it, it will handle other cases if the local one does not support it.

The rest of #25391 is related to returning data from the token over to authz plugins

I admire your work, which I would like to pick, especially thank you for reminds me of adding Roles into the Extra field.

So, how would you like to proceed?

I do not want to be selfishly, so let's discuss, I personally think porting your feature here would be much easier though.

To address your concern, I will do some refactoring on plugin/pkg/auth/authentication/password/keystone/keystone.go as well.

@zhouhaibing089
Copy link
Contributor Author

@kfox1111 we could do some offline discussion, however I could not find your email in your profile, so would you mind sending message with me in slack haibzhou or email zhouhaibing089@gmail.com?

@zhouhaibing089 zhouhaibing089 force-pushed the ks-token branch 3 times, most recently from 4065f12 to 316318c Compare May 13, 2016 02:59
@kfox1111
Copy link

Its unfortunate you waited so long to post this. I've been working on the other set for a while and I've gotten the whole thing working in the other review.

I was able to test it with PKI tokens with the remote authentication does work with it, so I believe the majority of the code here is an optimization for local authentication of PKI tokens. (All of the vendor/github.com/fullsailor/pkcs7/* stuff)

I think all the other features that this patch does, is already covered in the other version? Are there any gaps?

If that's the case, I still think its probably a good idea to layer these changes on top of the other patch set, rather the selectively copy features from the other patch set into this one. Then this set of optimizations can happen as a separate review, allowing for an easier set of reviews.

To merge, I think all we need to do is merge one file that exists in both:
plugin/pkg/auth/authenticator/token/keystone/keystone.go

And remove the following lines from this patchset as they are no longer needed:
cmd/kube-apiserver/app/options/options.go
cmd/kube-apiserver/app/server.go
federation/cmd/federated-apiserver/app/options/options.go
federation/cmd/federated-apiserver/app/server.go
pkg/apiserver/authenticator/authn.go
pkg/util/openstack/client.go
pkg/util/openstack/doc.go
plugin/pkg/auth/authenticator/token/keystone/apicall.go

@k8s-github-robot k8s-github-robot added kind/old-docs needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. labels May 13, 2016
@zhouhaibing089
Copy link
Contributor Author

rebased.

@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 14, 2016
@k8s-github-robot
Copy link

@zhouhaibing089 PR needs rebase

@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 19, 2016
@k8s-github-robot k8s-github-robot added size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. and removed size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. labels Jun 2, 2016
@k8s-bot
Copy link

k8s-bot commented Jun 15, 2016

Can one of the admins verify that this patch is reasonable to test? If so, please reply "ok to test".
(Note: "add to whitelist" is no longer supported. Please update configurations in kubernetes/test-infra/jenkins/job-configs/kubernetes-jenkins-pull instead.)

This message may repeat a few times in short succession due to jenkinsci/ghprb-plugin#292. Sorry.

Otherwise, if this message is too spammy, please complain to ixdy.

1 similar comment
@k8s-bot
Copy link

k8s-bot commented Jun 24, 2016

Can one of the admins verify that this patch is reasonable to test? If so, please reply "ok to test".
(Note: "add to whitelist" is no longer supported. Please update configurations in kubernetes/test-infra/jenkins/job-configs/kubernetes-jenkins-pull instead.)

This message may repeat a few times in short succession due to jenkinsci/ghprb-plugin#292. Sorry.

Otherwise, if this message is too spammy, please complain to ixdy.

@kfox1111
Copy link

keep-open

@k8s-bot
Copy link

k8s-bot commented Jul 26, 2016

Can one of the admins verify that this patch is reasonable to test? If so, please reply "ok to test".
(Note: "add to whitelist" is no longer supported. Please update configurations in kubernetes/test-infra/jenkins/job-configs/kubernetes-jenkins-pull instead.)

This message may repeat a few times in short succession due to jenkinsci/ghprb-plugin#292. Sorry.

Otherwise, if this message is too spammy, please complain to ixdy.

2 similar comments
@k8s-bot
Copy link

k8s-bot commented Aug 11, 2016

Can one of the admins verify that this patch is reasonable to test? If so, please reply "ok to test".
(Note: "add to whitelist" is no longer supported. Please update configurations in kubernetes/test-infra/jenkins/job-configs/kubernetes-jenkins-pull instead.)

This message may repeat a few times in short succession due to jenkinsci/ghprb-plugin#292. Sorry.

Otherwise, if this message is too spammy, please complain to ixdy.

@k8s-bot
Copy link

k8s-bot commented Aug 13, 2016

Can one of the admins verify that this patch is reasonable to test? If so, please reply "ok to test".
(Note: "add to whitelist" is no longer supported. Please update configurations in kubernetes/test-infra/jenkins/job-configs/kubernetes-jenkins-pull instead.)

This message may repeat a few times in short succession due to jenkinsci/ghprb-plugin#292. Sorry.

Otherwise, if this message is too spammy, please complain to ixdy.

@zhouhaibing089
Copy link
Contributor Author

Close it as it is not my focus for now, also it causes many spam messages.

@stevemcquaid
Copy link

stevemcquaid commented Sep 2, 2016

@zhouhaibing089 I think I would like to pick this up - would you be willing to chat on kube-slack if we have questions?

@kfox1111
Copy link

kfox1111 commented Sep 2, 2016

@stevemcquaid : I've got a version here that I think is pretty close: #25624

@liggitt
Copy link
Member

liggitt commented Sep 2, 2016

@stevemcquaid if you have interest in openstack token auth, I'd recommend working with @kfox1111 instead on #25391

@zhouhaibing089
Copy link
Contributor Author

@kfox1111 @liggitt @stevemcquaid Basically I am suggesting to move to a webhook implementation, it causes some maintainance pain, as openstack is too diversity, we have v2 token, and now we have v3 toke which adds the domain parameter, and actually, the token itself has four types as far as I know.

If necessary, I will pick something up(like local validator, cache, etc) when @kfox1111 has done all the things right.

@admiyo
Copy link

admiyo commented Jan 18, 2017

Is this dead? Is it possible to make this use all of the Keystone auth methods instead of hardcoding it to Keystone Password?

@liggitt
Copy link
Member

liggitt commented Jan 18, 2017

@admiyo see #25391 instead for server side honoring of keystone tokens, and #39587 for client-side hooks to obtain tokens from config read from openstack environment vars

k8s-github-robot pushed a commit that referenced this pull request Aug 7, 2017
Automatic merge from submit-queue (batch tested with PRs 50087, 39587, 50042, 50241, 49914)

plugin/pkg/client/auth: add openstack auth provider

This is an implementation of auth provider for OpenStack world, just like python-openstackclient, we read the environment variables of a list `OS_*`, and client will cache a token to interact with each components, we can do the same here, the client side can cache a token locally at the first time, and rotate automatically when it expires.

This requires an implementation of token authenticator at server side, refer:

1.  [made by me] #25536, I can carry this on when it is fine to go.
2.  [made by @kfox1111] #25391

The reason why I want to add this is due to the `client-side` nature, it will be confusing to implement it downstream, we would like to add this support here, and customers can get `kubectl` like they usually do(`brew install kubernetes-cli`), and it will just work.

When this is done, we can deprecate the password keystone authenticator as the following reasons:

1.  as mentioned at some other places, the `domain` is another parameters which should be provided.
2.  in case the user supplies `apikey` and `secrets`, we might want to fill the `UserInfo` with the real name which is not implemented for now.

cc @erictune @liggitt 

```
add openstack auth provider
```
dims pushed a commit to dims/openstack-cloud-controller-manager that referenced this pull request Sep 6, 2017
Automatic merge from submit-queue (batch tested with PRs 50087, 39587, 50042, 50241, 49914)

plugin/pkg/client/auth: add openstack auth provider

This is an implementation of auth provider for OpenStack world, just like python-openstackclient, we read the environment variables of a list `OS_*`, and client will cache a token to interact with each components, we can do the same here, the client side can cache a token locally at the first time, and rotate automatically when it expires.

This requires an implementation of token authenticator at server side, refer:

1.  [made by me] kubernetes/kubernetes#25536, I can carry this on when it is fine to go.
2.  [made by @kfox1111] kubernetes/kubernetes#25391

The reason why I want to add this is due to the `client-side` nature, it will be confusing to implement it downstream, we would like to add this support here, and customers can get `kubectl` like they usually do(`brew install kubernetes-cli`), and it will just work.

When this is done, we can deprecate the password keystone authenticator as the following reasons:

1.  as mentioned at some other places, the `domain` is another parameters which should be provided.
2.  in case the user supplies `apikey` and `secrets`, we might want to fill the `UserInfo` with the real name which is not implemented for now.

cc @erictune @liggitt 

```
add openstack auth provider
```
dims pushed a commit to dims/openstack-cloud-controller-manager that referenced this pull request Jan 13, 2018
Automatic merge from submit-queue (batch tested with PRs 50087, 39587, 50042, 50241, 49914)

plugin/pkg/client/auth: add openstack auth provider

This is an implementation of auth provider for OpenStack world, just like python-openstackclient, we read the environment variables of a list `OS_*`, and client will cache a token to interact with each components, we can do the same here, the client side can cache a token locally at the first time, and rotate automatically when it expires.

This requires an implementation of token authenticator at server side, refer:

1.  [made by me] kubernetes/kubernetes#25536, I can carry this on when it is fine to go.
2.  [made by @kfox1111] kubernetes/kubernetes#25391

The reason why I want to add this is due to the `client-side` nature, it will be confusing to implement it downstream, we would like to add this support here, and customers can get `kubectl` like they usually do(`brew install kubernetes-cli`), and it will just work.

When this is done, we can deprecate the password keystone authenticator as the following reasons:

1.  as mentioned at some other places, the `domain` is another parameters which should be provided.
2.  in case the user supplies `apikey` and `secrets`, we might want to fill the `UserInfo` with the real name which is not implemented for now.

cc @erictune @liggitt 

```
add openstack auth provider
```
tamalsaha pushed a commit to kmodules/shared-informer that referenced this pull request Aug 13, 2020
Automatic merge from submit-queue (batch tested with PRs 50087, 39587, 50042, 50241, 49914)

plugin/pkg/client/auth: add openstack auth provider

This is an implementation of auth provider for OpenStack world, just like python-openstackclient, we read the environment variables of a list `OS_*`, and client will cache a token to interact with each components, we can do the same here, the client side can cache a token locally at the first time, and rotate automatically when it expires.

This requires an implementation of token authenticator at server side, refer:

1.  [made by me] kubernetes/kubernetes#25536, I can carry this on when it is fine to go.
2.  [made by @kfox1111] kubernetes/kubernetes#25391

The reason why I want to add this is due to the `client-side` nature, it will be confusing to implement it downstream, we would like to add this support here, and customers can get `kubectl` like they usually do(`brew install kubernetes-cli`), and it will just work.

When this is done, we can deprecate the password keystone authenticator as the following reasons:

1.  as mentioned at some other places, the `domain` is another parameters which should be provided.
2.  in case the user supplies `apikey` and `secrets`, we might want to fill the `UserInfo` with the real name which is not implemented for now.

cc @erictune @liggitt

```
add openstack auth provider
```

Kubernetes-commit: 59b8fa32f129be29f146bfd4888a5d1ab7e71ca5
openshift-publish-robot pushed a commit to openshift/kubernetes that referenced this pull request Oct 29, 2020
…ceful-4.5

[release-4.5] Bug 1881351: KCM and KS graceful termination

Origin-commit: 3f0e0566c5abf9bbbfa5af0352e2796cd0f9f061
tamalsaha pushed a commit to gomodules/jsonpath that referenced this pull request Apr 21, 2021
Automatic merge from submit-queue (batch tested with PRs 50087, 39587, 50042, 50241, 49914)

plugin/pkg/client/auth: add openstack auth provider

This is an implementation of auth provider for OpenStack world, just like python-openstackclient, we read the environment variables of a list `OS_*`, and client will cache a token to interact with each components, we can do the same here, the client side can cache a token locally at the first time, and rotate automatically when it expires.

This requires an implementation of token authenticator at server side, refer:

1.  [made by me] kubernetes/kubernetes#25536, I can carry this on when it is fine to go.
2.  [made by @kfox1111] kubernetes/kubernetes#25391

The reason why I want to add this is due to the `client-side` nature, it will be confusing to implement it downstream, we would like to add this support here, and customers can get `kubectl` like they usually do(`brew install kubernetes-cli`), and it will just work.

When this is done, we can deprecate the password keystone authenticator as the following reasons:

1.  as mentioned at some other places, the `domain` is another parameters which should be provided.
2.  in case the user supplies `apikey` and `secrets`, we might want to fill the `UserInfo` with the real name which is not implemented for now.

cc @erictune @liggitt

```
add openstack auth provider
```

Kubernetes-commit: 59b8fa32f129be29f146bfd4888a5d1ab7e71ca5
tamalsaha pushed a commit to gomodules/jsonpath that referenced this pull request Apr 21, 2021
Automatic merge from submit-queue (batch tested with PRs 50087, 39587, 50042, 50241, 49914)

plugin/pkg/client/auth: add openstack auth provider

This is an implementation of auth provider for OpenStack world, just like python-openstackclient, we read the environment variables of a list `OS_*`, and client will cache a token to interact with each components, we can do the same here, the client side can cache a token locally at the first time, and rotate automatically when it expires.

This requires an implementation of token authenticator at server side, refer:

1.  [made by me] kubernetes/kubernetes#25536, I can carry this on when it is fine to go.
2.  [made by @kfox1111] kubernetes/kubernetes#25391

The reason why I want to add this is due to the `client-side` nature, it will be confusing to implement it downstream, we would like to add this support here, and customers can get `kubectl` like they usually do(`brew install kubernetes-cli`), and it will just work.

When this is done, we can deprecate the password keystone authenticator as the following reasons:

1.  as mentioned at some other places, the `domain` is another parameters which should be provided.
2.  in case the user supplies `apikey` and `secrets`, we might want to fill the `UserInfo` with the real name which is not implemented for now.

cc @erictune @liggitt

```
add openstack auth provider
```

Kubernetes-commit: 59b8fa32f129be29f146bfd4888a5d1ab7e71ca5
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

9 participants