Uploaded image for project: 'OpenShift Bugs'
  1. OpenShift Bugs
  2. OCPBUGS-27859

[Doc] Document BYO oc login needs to explicitly set --oidc-certificate-authority flag if external OIDC certificate is not publicly trusted

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Normal Normal
    • None
    • 4.16.0
    • None
    • Moderate
    • No
    • Rejected
    • False
    • Hide

      None

      Show
      None
    • Release Note Not Required
    • In Progress

      Description of problem:

      BYO oc login does not honor KUBECONFIG's certificate-authority-data

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

      $ oc version
      Client Version: 4.16.0-0.nightly-2024-01-24-031529
      Kustomize Version: v5.0.4-0.20230601165947-6ce0bf390ce3
      Server Version: 4.16.0-0.nightly-2024-01-23-185225
      Kubernetes Version: v1.29.1+0e0d15b

      How reproducible:

      Always

      Steps to Reproduce:

      Set up env and run step 1 ~ 6 of https://issues.redhat.com/browse/OCPBUGS-27857 .
      
      Then run step 7:
      $ oc login --exec-plugin=oc-oidc --client-id=openshift-test-aud --extra-scopes=email,profile --callback-port=8080
      
      It hits:
      error: oidc authenticator error: oidc discovery error: Get "https://keycloak-keycloak.apps..../realms/master/.well-known/openid-configuration": tls: failed to verify certificate: x509: certificate signed by unknown authority
      error: oidc authenticator error: oidc discovery error: Get "https://keycloak-keycloak.apps..../realms/master/.well-known/openid-configuration": tls: failed to verify certificate: x509: certificate signed by unknown authority
      Unable to connect to the server: getting credentials: exec: executable oc failed with exit code 1
      
      But the route https://keycloak-keycloak.apps..../realms/master/.well-known/openid-configuration indeed just uses router CA which is already included in KUBECONFIG's certificate-authority-data.
      
      If I extract KUBECONFIG's certificate-authority-data and use it explicitly for oc login with --certificate-authority, then no such error:
      $ grep certificate-authority-data $KUBECONFIG | grep -Eo "[^ ]+$" | base64 -d > certificate-authority-data-origin-xxia-1.crt
      
      $ oc login --exec-plugin=oc-oidc --client-id=openshift-test-aud --extra-scopes=email,profile --callback-port=8080 --certificate-authority=combined-certificate-authority-xxia-1.crt
      Please visit the following URL in your browser: http://localhost:8080

      Actual results:

      7. BYO oc login does not honor KUBECONFIG's certificate-authority-data

      Expected results:

      7. BYO oc login should honor KUBECONFIG's certificate-authority-data, should need not explicitly extract and use KUBECONFIG's certificate-authority-data with --certificate-authority flag.

      Additional info:

          

            jneczypo Janelle Neczypor
            xxia-1 Xingxing Xia
            Xingxing Xia Xingxing Xia
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved: