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

Authentication with client certificat with Keycloak #1221

Open
lynchmaniac opened this issue Jan 7, 2025 · 0 comments
Open

Authentication with client certificat with Keycloak #1221

lynchmaniac opened this issue Jan 7, 2025 · 0 comments
Labels
question Further information is requested

Comments

@lynchmaniac
Copy link

Describe the question

First of all, thank you very much for this great project that works extremely well ❤️ I have been testing it intensively for several weeks now 🚀

The connection via Keycloak with a user of a realm works perfectly, coupled with RBAC, I can give the rights that suit me.
I would like to add a layer of security by requiring users to have a client certificate to authenticate in addition to the identifier and password.

In the documentation, a priori it is not possible to pass a client certificate to Keycloak to authenticate, even through the oidc-auth-request-extra-params parameter I have not found how to do it.

So my question is simple, is it possible for kubelogin to provide, during its request to Keycloak, a client certificate that will be part of the authentication?

To reproduce

Configure Keycloak to have X509 authentification:

  • Added the X509_CA_BUNDLE environment variable in the container. This variable points to the CA used for the client certificate
  • Create an X509 realm
  • Configure all requests in HTTPS
  • Copy the Browser flow to "X509 Browser"
  • Modify the "X509 Browser" flow
  • Delete unwanted steps (Kerberos, identity Providers...)
  • Add X509 Validate Username Form
  • Configure X509 Validate Username Form (alternative, identity source email, mapping method username or email)
  • Modify the binding
  • Create a user with or without credential (it didn't work for both)

My Kubeconfig:

  • name: tony
    user:
    exec:
    apiVersion: client.authentication.k8s.io/v1beta1
    args:
    - oidc-login
    - get-token
    - --oidc-issuer-url=https://keycloak.test/realms/x509
    - --oidc-client-id=test
    - --username=tonystark
    - --token-cache-dir=~/.kube/cache/oidc-login/tony@kind-poc-newyear
    command: kubectl
    env: null
    interactiveMode: IfAvailable
    provideClusterInfo: false

Your environment

  • OS: Debian (under WSL)
  • kubelogin version: e.g. v1.31.0
  • kubectl version: e.g. v1.31.1
  • OpenID Connect provider: Keycloak
@lynchmaniac lynchmaniac added the question Further information is requested label Jan 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

1 participant