Commit Graph

127 Commits

Author SHA1 Message Date
Max Goltzsche
fa5e6587f1
handle new error where sa jwt issued in the future
Signed-off-by: Max Goltzsche <max.goltzsche@gmail.com>
2023-03-02 03:15:13 +01:00
Max Goltzsche
031075d149
check jwt timestamp for zero value
Co-authored-by: Jordan Liggitt <jordan@liggitt.net>
2023-03-02 03:09:49 +01:00
Max Goltzsche
df8fa2eab5
bump go-jose to v2.6.0
Update go-jose from v2.2.2 to v2.6.0.
This is to make the kubernetes code compatible with newer go-jose versions that have a small breaking change (`jwt.NewNumericDate()` returns a pointer).

Signed-off-by: Max Goltzsche <max.goltzsche@gmail.com>
2023-03-02 02:53:17 +01:00
Shihang Zhang
e878bc17e6
Update pkg/serviceaccount/legacy.go
Co-authored-by: Jordan Liggitt <jordan@liggitt.net>
2022-12-16 12:54:52 -08:00
Shihang Zhang
0852a49020 graduate LegacyServiceAccountTokenTracking to beta 2022-12-16 10:34:17 -08:00
Kubernetes Prow Robot
d93ea2557f
Merge pull request #111908 from dengyufeng2206/new-test0818
spelling fix
2022-11-08 13:51:20 -08:00
Shihang Zhang
569cd70a52 track legacy service account tokens 2022-10-24 09:37:53 -07:00
dengyufeng2206
402b09f532 spelling fix
Signed-off-by: dengyufeng2206 <deng.yufeng@zte.com.cn>
2022-08-18 18:28:21 +08:00
Davanum Srinivas
a9593d634c
Generate and format files
- Run hack/update-codegen.sh
- Run hack/update-generated-device-plugin.sh
- Run hack/update-generated-protobuf.sh
- Run hack/update-generated-runtime.sh
- Run hack/update-generated-swagger-docs.sh
- Run hack/update-openapi-spec.sh
- Run hack/update-gofmt.sh

Signed-off-by: Davanum Srinivas <davanum@gmail.com>
2022-07-26 13:14:05 -04:00
Davanum Srinivas
ab690750df
Switch to v3 of github.com/emicklei/go-restful
Signed-off-by: Davanum Srinivas <davanum@gmail.com>
2022-06-09 14:11:41 -04:00
Davanum Srinivas
9405e9b55e
Check in OWNERS modified by update-yamlfmt.sh
Signed-off-by: Davanum Srinivas <davanum@gmail.com>
2021-12-09 21:31:26 -05:00
Monis Khan
92c8596002
serviceaccount/claims: include validation failure error in the log
Without this fix, the errors are logged as:

unexpected validation error: *errors.errorString

Signed-off-by: Monis Khan <mok@vmware.com>
2021-10-27 16:50:25 -04:00
Shihang Zhang
925900317e allow multiple of --service-account-issuer 2021-04-19 09:54:11 -07:00
yoyinzyc
587cadf726 add context to serviceaccount authenticator metrics 2021-03-08 14:16:48 -08:00
Benjamin Elder
56e092e382 hack/update-bazel.sh 2021-02-28 15:17:29 -08:00
cici37
95acec5a3b Move client_builder to k8s.io/controller-manager 2020-10-19 14:48:22 -07:00
Jiajie Yang
ebbd455b24 Restrict service account token metrics to kube-apiserver only. 2020-05-21 15:34:57 -07:00
Davanum Srinivas
07d88617e5
Run hack/update-vendor.sh
Signed-off-by: Davanum Srinivas <davanum@gmail.com>
2020-05-16 07:54:33 -04:00
Davanum Srinivas
442a69c3bd
switch over k/k to use klog v2
Signed-off-by: Davanum Srinivas <davanum@gmail.com>
2020-05-16 07:54:27 -04:00
Jiajie Yang
ae0e52d28c Monitoring safe rollout of time-bound service account token. 2020-04-22 11:59:16 -07:00
Jordan Liggitt
5125310023 Consider future deletionTimestamps when validating bound tokens 2020-03-27 14:37:33 -04:00
Charles Eckman
5a176ac772 Provide OIDC discovery endpoints
- Add handlers for service account issuer metadata.
- Add option to manually override JWKS URI.
- Add unit and integration tests.
- Add a separate ServiceAccountIssuerDiscovery feature gate.

Additional notes:
- If not explicitly overridden, the JWKS URI will be based on
  the API server's external address and port.

- The metadata server is configured with the validating key set rather
than the signing key set. This allows for key rotation because tokens
can still be validated by the keys exposed in the JWKs URL, even if the
signing key has been rotated (note this may still be a short window if
tokens have short lifetimes).

- The trust model of OIDC discovery requires that the relying party
fetch the issuer metadata via HTTPS; the trust of the issuer metadata
comes from the server presenting a TLS certificate with a trust chain
back to the from the relying party's root(s) of trust. For tests, we use
a local issuer (https://kubernetes.default.svc) for the certificate
so that workloads within the cluster can authenticate it when fetching
OIDC metadata. An API server cannot validly claim https://kubernetes.io,
but within the cluster, it is the authority for kubernetes.default.svc,
according to the in-cluster config.

Co-authored-by: Michael Taufen <mtaufen@google.com>
2020-02-11 16:23:31 -08:00
Mike Danese
3aa59f7f30 generated: run refactor 2020-02-07 18:16:47 -08:00
Tim Allclair
9d3670f358 Ensure testing credentials are labeled as such 2020-02-04 10:36:05 -08:00
chenyaqi01
66be69bb0e replace bytes.Compare() with bytes.Equal() 2019-09-27 10:08:49 +08:00
Taahir Ahmed
b4e99584ce serviceaccounts: Add JWT KeyIDs to tokens
This commit fills out the JWT "kid" (KeyID) field on most
serviceaccount tokens we create.  The KeyID value we use is derived
from the public key of keypair that backs the cluster's OIDC issuer.

OIDC verifiers use the KeyID to smoothly cope with key rotations:

  * During a rotation, the verifier will have multiple keys cached
    from the issuer, any of which could have signed the token being
    verified.  KeyIDs let the verifier pick the appropriate key
    without having to try each one.

  * Seeing a new KeyID is a trigger for the verifier to invalidate its
    cached keys and fetch the new set of valid keys from the identity
    provider.

The value we use for the KeyID is derived from the identity provider's
public key by serializing it in DER format, taking the SHA256 hash,
and then urlsafe base64-encoding it.  This gives a value that is
strongly bound to the key, but can't be reversed to obtain the public
key, which keeps people from being tempted to derive the key from the
key ID and using that for verification.

Tokens based on jose OpaqueSigners are omitted for now --- I don't see
any way to actually run the API server that results in an OpaqueSigner
being used.
2019-08-28 14:18:23 -07:00
Andrew Lytvynov
18458392ca Extract new keyutil package from client-go/util/cert
This package contains public/private key utilities copied directly from
client-go/util/cert. All imports were updated.

Future PRs will actually refactor the libraries.

Updates #71004
2019-02-19 09:48:59 -08:00
Roy Lenferink
b43c04452f Updated OWNERS files to include link to docs 2019-02-04 22:33:12 +01:00
Jordan Liggitt
a9dc919f82 Look up service accounts from informer before trying live lookup 2018-12-06 16:48:39 -05:00
Mike Danese
67bbf753cb retrofit svcacct token authenticator to support audience validation 2018-11-13 20:38:41 -08:00
Davanum Srinivas
954996e231
Move from glog to klog
- Move from the old github.com/golang/glog to k8s.io/klog
- klog as explicit InitFlags() so we add them as necessary
- we update the other repositories that we vendor that made a similar
change from glog to klog
  * github.com/kubernetes/repo-infra
  * k8s.io/gengo/
  * k8s.io/kube-openapi/
  * github.com/google/cadvisor
- Entirely remove all references to glog
- Fix some tests by explicit InitFlags in their init() methods

Change-Id: I92db545ff36fcec83afe98f550c9e630098b3135
2018-11-10 07:50:31 -05:00
Jordan Liggitt
360a890c58 serviceaccount subproject approvers/reviewers 2018-11-06 00:57:39 -05:00
Mike Danese
e5227216c0 rebase authenticators onto new interface. 2018-10-22 10:16:59 -07:00
k8s-ci-robot
3478e94495
Merge pull request #69664 from stepyu/master
fix typos
2018-10-14 08:13:37 -07:00
stepyu
75887ec33c fix typos 2018-10-12 16:56:08 +08:00
Eric Chiang
766f5875bf Remove ericchiang from OWNERS files
Kept myself in the OpenID Connect ones for now.
2018-10-11 18:11:15 -07:00
WanLinghao
1c8d0eec01 add a test case which check secret's type 2018-09-26 09:21:36 +08:00
Mike Danese
43eaeb8c6c svcacct: pass pod information in user.Info.Extra() when available
Fixes https://github.com/kubernetes/kubernetes/issues/59670
2018-08-31 11:54:50 -07:00
Kubernetes Submit Queue
166a1356e8
Merge pull request #62420 from mikedanese/jose-bump
Automatic merge from submit-queue (batch tested with PRs 67707, 62420). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

svcacct: support jose.OpaqueSigner and push errors to token generator creation

```release-note
NONE
```
2018-08-23 15:39:59 -07:00
Mike Danese
e68f14a249 jwt: support opaque signer and push errors to token generator creation 2018-08-23 12:21:56 -07:00
yue9944882
17306b540b externalize serviceaacount admission controller
remove unused internal serviceaccount util
2018-08-22 11:41:54 +08:00
WanLinghao
ac94a0a253 fix a nit error in log 2018-06-27 14:21:27 +08:00
Jeff Grafton
23ceebac22 Run hack/update-bazel.sh 2018-06-22 16:22:57 -07:00
Jeff Grafton
a725660640 Update to gazelle 0.12.0 and run hack/update-bazel.sh 2018-06-22 16:22:18 -07:00
Mike Danese
f39ec8b333 add myself as an approver in various auth related directories
matching the subprojects I work on:

https://docs.google.com/document/d/1RJvnSPOJ3JC61gerCpCpaCtzQjRcsZ2tXkcyokr6sLY/edit
2018-05-17 11:32:37 -07:00
WanLinghao
9e7379ab97 clean duplicate test function 2018-04-27 13:43:12 +08:00
WanLinghao
198b9e482c fix a error in serviceaccount validate.
This error is a human-writing error.
	Small as it is, it could cause recreate Object validate
	through bug.
	This patch fix it.
2018-04-24 14:48:37 +08:00
WanLinghao
c1e5b1bf2c Clean unused error type variable
The function which invoked this variable
	was removed by
	https://github.com/kubernetes/kubernetes/pull/58725/
2018-04-15 14:05:55 +08:00
Mike Danese
024f57affe implement token authenticator for new id tokens 2018-02-27 17:20:46 -08:00
Mike Danese
8ad1c6655b add support for /token subresource in serviceaccount registry 2018-02-21 13:16:51 -08:00