Bug 1965929 - kube-apiserver should use cert auth when reaching out to the oauth-apiserver with a TokenReview request
Summary: kube-apiserver should use cert auth when reaching out to the oauth-apiserver ...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: OpenShift Container Platform
Classification: Red Hat
Component: apiserver-auth
Version: 4.8
Hardware: Unspecified
OS: Unspecified
urgent
urgent
Target Milestone: ---
: 4.8.0
Assignee: Standa Laznicka
QA Contact: liyao
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2021-05-31 07:35 UTC by Standa Laznicka
Modified: 2021-07-27 23:10 UTC (History)
5 users (show)

Fixed In Version:
Doc Type: No Doc Update
Doc Text:
Clone Of:
Environment:
Last Closed: 2021-07-27 23:10:35 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Github openshift cluster-authentication-operator pull 416 0 None closed Bug 1965929: wire certs as the authentication means to openshift webhook authenticator 2021-06-07 15:27:59 UTC
Github openshift cluster-authentication-operator pull 450 0 None open Bug 1965929: bump lib-go to get improved performance for the CSR approver 2021-06-07 15:27:59 UTC
Github openshift library-go pull 1083 0 None closed Bug 1965929: add a CSR approving controller 2021-06-07 15:27:58 UTC
Red Hat Product Errata RHSA-2021:2438 0 None None None 2021-07-27 23:10:48 UTC

Description Standa Laznicka 2021-05-31 07:35:14 UTC
Description of problem:
We are now using the WebhookTokenAuthenticator auth stack for OpenShift authentication which means the kube-apiserver is reaching to the oauth-apiserver's TokenReview endpoint.

To avoid additional request from the oauth-apiserver to the kube-apiserver to validate the SA token, use client cert authenticaion.

Version-Release number of selected component (if applicable):
4.8

How reproducible:
100%

Comment 2 Standa Laznicka 2021-06-07 14:33:44 UTC
needs one more slight improvement from lib-go

Comment 4 liyao 2021-06-11 14:20:13 UTC
Tested in cluster 4.8.0-0.nightly-2021-06-10-071057

1. check secret/webhook-authentication-integrated-oauth content is presented with cert/key form
$ oc extract secret/webhook-authentication-integrated-oauth -n openshift-config

2. save cert and key
echo 'client-certificate-data value' | base64 -d > cert
echo 'client-key-data value' | base64 -d > key

3. In terminal A:

cat > tokenreview_invalid.json << EOF
{"kind":"TokenReview","apiVersion":"authentication.k8s.io/v1","spec":{"token":"aaaaaaaaaaaa"}}
EOF
oc login -u testuser-41 -p <password>
TOKEN=`oc whoami -t`
cat > tokenreview_valid.json << EOF
{"kind":"TokenReview","apiVersion":"authentication.k8s.io/v1","spec":{"token":"$TOKEN"}}
EOF

4.In terminal B:

VALIDATION_POD=`oc get pod -n openshift-oauth-apiserver --no-headers | awk '{print $1}' | head -n 1` 
oc port-forward -n openshift-oauth-apiserver $VALIDATION_POD 8443:8443

5.In terminal A again, using the cert and key file saved in step2

curl -ksS -XPOST --cert ./cert --key ./key -H "Content-Type: application/json" https://localhost:8443/apis/oauth.openshift.io/v1/tokenreviews/ -d @tokenreview_valid.json
...
  "status": {
    "authenticated": true,

check and find above .status.authenticated is true, which is the expected value.

Comment 7 errata-xmlrpc 2021-07-27 23:10:35 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (Moderate: OpenShift Container Platform 4.8.2 bug fix and security update), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHSA-2021:2438


Note You need to log in before you can comment on or make changes to this bug.