Code Monkey home page Code Monkey logo

keycloak-nginx-https-self's Introduction

Nginx Reverse Proxy to add HTTPS for Keycloak

Why?

tl;dr: Telling minikube to use a locally started OIDC provider is hard.

The goal was to setup an OIDC provider for a local minikube installation. However, the kubernetes apiserver does not support non-https OIDC Issuers. When using a self-signed certificate apiserver accepts a CA. So the goal was to set this up with a rootCA that can then be trusted by the API server

Requirements

Docker, Docker-compose, openssl Optional: Minikube if you also want to start up minikube with OIDC pointed to the proxied keycloak

How to use?

It should be relatively easy to reproduce:

1. Create CA

Run

./create_ca.sh

2. Create and sign Certificates for nginx

Run

./issue_cert.sh

This also adds the virtual box magic IP "10.0.2.2" as a subjectAltName to the certificate

3. build nginx and start up the network

docker-compose build && docker-compose up

4. (Optional) Add client in keycloak

Open https://localhost:8443 and sign in with user admin and password pass. Then create a client called kubernetes-cluster.

5. (Optional) start up minikube pointed to keycloak

Run

./start_minikube.sh

You can now use OpenID connect to authenticate against your minikube cluster. Keep in mind that the token will be considered invalid if the issuer doesn't exactly match the way it was specified when starting up the apiserver. This means if you get your token from localhost it will not have 10.0.2.2 in the issuer uri. To get around that you can simply create an alias IP. There is a script (./add_ip.sh) which works on macOS. On linux you can probably do the same with iptables.

keycloak-nginx-https-self's People

Contributors

etiennedi avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.