Keycloak Is AWESOME! Single Sign On Made Easy!

Sdílet
Vložit
  • čas přidán 2. 06. 2024
  • Keycloak is an open source, Red Hat sponsored, authentication and authorisation platform that you can self host! In this video I show you how to configure, deploy, and setup single sign on for Portainer and Proxmox.
    Keycloak Docker Files:
    github.com/JamesTurland/JimsG...
    Recommended Hardware: github.com/JamesTurland/JimsG...
    Discord: / discord
    Twitter: / jimsgarage_
    Reddit: / jims-garage
    GitHub: github.com/JamesTurland/JimsG...
    00:00 - Introduction to Keycloak and Single Sign On
    01:38 - Keycloak Feature Review
    03:29 - Docker Compose Overview
    07:54 - Deploying Containers
    09:26 - Keycloak GUI & Configuration (Portainer and Proxmox)
    14:45 - Portainer
    18:28 - Proxmox
    22:27 - Identity Providers
    23:30 - Outro
  • Věda a technologie

Komentáře • 119

  • @nil1729
    @nil1729 Před 3 měsíci +2

    Thanks, It's a nice step by step guide to containerize keycloak and deployment altogether.

  • @thomasgollenia7577
    @thomasgollenia7577 Před 6 měsíci +9

    spent hours without beeing able to get keycloak running! Now it works. Thanks so much for your research and explanation!

  • @reit5584
    @reit5584 Před 8 měsíci +2

    Great content, very clear explanation! Thanks a lot, Jim.

  • @orlando3650
    @orlando3650 Před 7 měsíci +2

    Great content, Jim!
    Just wanted to highlight, since you’re using Keyclock for SSO, the importance of creating the users in the OAuth2/OIDC server, leaving that to the clients with auto-user-creation option turned on makes your system less secure, particularly if one of your services got hacked.

  • @user-lx3bf7vc5l
    @user-lx3bf7vc5l Před 4 měsíci +1

    Thanks for your video! It helped me very much :)

  • @olsenlid
    @olsenlid Před 8 měsíci +4

    Can't wait to dive into this! You're on a roll recently. Keep it up. 3k next :)

    • @Jims-Garage
      @Jims-Garage  Před 8 měsíci

      Thanks, so much to cover! Just wish I had more spare evenings.

  • @mrrogers4591
    @mrrogers4591 Před 8 měsíci +10

    Complements on your great videos. I've been a subscriber for a while because you explain complicated topics quite well making it easy to implement for an average homelab hobbyist. Hopefully you get thousands more subscribers for all the good videos you make.

    • @Jims-Garage
      @Jims-Garage  Před 8 měsíci

      Thank you for your kind words, fingers crossed!

    • @crc_code
      @crc_code Před 8 měsíci +2

      You read my mind 😃,,
      That’s what I started to write 👌😀

    • @Jims-Garage
      @Jims-Garage  Před 8 měsíci

      @@crc_code thanks 👍

  • @louisbullock8615
    @louisbullock8615 Před 8 měsíci +1

    Great Video.....Good work.

  • @cheebadigga4092
    @cheebadigga4092 Před 7 měsíci +1

    Thank you! Very nice

  • @try-that
    @try-that Před 8 měsíci +1

    Not heard of this before. Nice video, not sure I'm going to try it, but still enjoyed it

    • @Jims-Garage
      @Jims-Garage  Před 8 měsíci

      It's a great tool, although I feel that Authentik is probably going to be the sweet spot for most as it does the web proxy for applications that lack authentication.

  • @NNNNNNNNNNNNNNNNNN9
    @NNNNNNNNNNNNNNNNNN9 Před 20 dny +1

    Jolly Good Show!

  • @AnythingGodamnit
    @AnythingGodamnit Před 3 měsíci +1

    I'm currently trying to decide between Authentik and Keycloak and this has helped, though I'm still unsure. But you've opened the door to me just playing around with them and seeing which one appeals to me most. Thanks!

    • @Jims-Garage
      @Jims-Garage  Před 3 měsíci +1

      I think Authentik is the right balance for a homelab.

  • @bluesquadron593
    @bluesquadron593 Před 8 měsíci +2

    By the way, there is a noticeable increase of pace in how you communicate in the recent videos. Like when compare it even just few months back! Nice to see this.

    • @Jims-Garage
      @Jims-Garage  Před 8 měsíci +2

      Thanks. I like to think I've come a long way in a short span of time. All of this is new to me. Constantly looking to improve.

  • @jeffreycui9933
    @jeffreycui9933 Před 19 dny

    good video. 12'40", openid-connection does authentication only, it's built on oauth2 which takes care of authorization.

  • @HeneryH
    @HeneryH Před 5 měsíci +1

    This video covers cases where your varied apps all have native openid capabilities.
    Traefik also has the ability to use a key cloak 'forward auth' middleware to add authentication for ANY app.
    I’ve need struggling through that now. Your video is a great source for me to clean up my homeland docker settings though.
    Thank you

    • @Jims-Garage
      @Jims-Garage  Před 5 měsíci

      Thanks for sharing, I'll look into that.

  • @shujaakbar1493
    @shujaakbar1493 Před 8 měsíci +1

    Hello Jims, really enjoyed your video. Please create a video for keycloak and kibana integration.

    • @Jims-Garage
      @Jims-Garage  Před 8 měsíci

      Thanks, I'll consider it for a follow up

  • @fbombi2229
    @fbombi2229 Před 6 dny +1

    Hi Jim, awesome content, I was reviewing the docker compose, and it was not working for me, however after reviewing it in detail, I was able to make it work by changing the service name in the docker compose from postgresql to postgres or changing the environment variable KC_DB_URL_HOST , since I had the error password
    FATAL: password authentication failed for user "keycloak"
    Again, as always great content.

  • @mandalorian2010
    @mandalorian2010 Před 6 měsíci +1

    this is an awesome tutorial. One of the problems I am having is getting access to the users keycloak interface. For the admin account on the master realm, that super easy. but its not so straightforward in the documentation about how to access the users portal for setting up MFA, changin passwords, etc.

    • @Jims-Garage
      @Jims-Garage  Před 6 měsíci

      Thanks. I'm aiming to come back to keycloak in the near future and perhaps I can cover those items. I'm really interested in using hardware tokes for auth / zero trust.

  • @cronaldomaia
    @cronaldomaia Před 7 měsíci +2

    Hi Jim, excellent video, just one detail, it's not good practice to use the realm master as a default, I know it's just an example, but it's always good practice to create a realm and leave the master to manage your keycloak ;)

    • @Jims-Garage
      @Jims-Garage  Před 7 měsíci

      Thanks, agreed. I believe I do mention that at the start but perhaps a case of practice what you preach.

  • @johnderix1947
    @johnderix1947 Před 8 měsíci +2

    Great explanation, especially for non native english persons like me.

  • @LoudS1l3nz
    @LoudS1l3nz Před 3 měsíci

    Thank you for the video. I followed your guide but when i stop/remove the containers, all changes are gone. so there is nothing persistant stored in the DB! Help please!

  • @szpl
    @szpl Před 2 měsíci +1

    Good explanation, thanks ! When do you plan to roll out the video referred in the last "Outro" section about integrating Keycloak with other identity providers like Google / Facebook / Azure ?

    • @Jims-Garage
      @Jims-Garage  Před 2 měsíci +1

      Soon, I keep being sidetracked...

    • @szpl
      @szpl Před 2 měsíci

      Super, can't wait !!!

  • @diegonayalazo
    @diegonayalazo Před 5 měsíci +1

    Thanks

  • @user-bb8vm2nd1h
    @user-bb8vm2nd1h Před 4 měsíci +1

    Hi Jim! Thank´s for the video.I´m trying to connect spring boot microservices with keycloak using an external rds db, not containerized. I actually can do with keycloak 16, but using 23 version can´t connect with that db. Do you know what could be the problem? I got some errors related with quarkus ...

    • @Jims-Garage
      @Jims-Garage  Před 4 měsíci

      I'm not sure. Perhaps requires an encrypted connection? I'm not familiar with the differences between the versions.

  • @Popcorncandy09
    @Popcorncandy09 Před 5 měsíci

    I get Oauth authorisation failure... :? the dns entries are there in pihole and both keycloak and portainer are on the same docker host with traefik.

  • @Daniel-qo9uv
    @Daniel-qo9uv Před 6 měsíci +1

    Thanks Jim, It's awesome this video. How can we connect Keycloak to a personal website with php?

    • @Jims-Garage
      @Jims-Garage  Před 6 měsíci +1

      You're welcome. You'd need something that supports OIDC / OAuth2. I recommend checking out my Authentik video, that has a proxy for authentication so you can add it to any site (I think that is what you're after).

  • @orhanfirik
    @orhanfirik Před 24 dny

    Great content thanks for sharing it. Could you please share the proxmox user creation step details? (assigning the necessary permission to the user that you created)

  • @yarrapatni1002
    @yarrapatni1002 Před 6 měsíci

    Followed your guide. When trying to sign into portainer getting "Failure
    Unauthorized".. tried creating user in portainer and also with Automatic user provisioning = ON. Nginx proxy configured to forward to my docker containers.

    • @Jims-Garage
      @Jims-Garage  Před 6 měsíci

      I haven't tested with nginx but there's no reason it shouldn't work. Double check all of the OIDC settings. Make sure to check scope and profile.

  • @francoislebec7516
    @francoislebec7516 Před 8 měsíci +1

    Great job ! Do you run Keycloak inside proxmox on a vm(running docker) or ct, or outside proxmox ?
    Cause if it’s hosted on proxmox and keycloak is not running, how do you log in to Proxmox using auth ?

    • @monish05m
      @monish05m Před 8 měsíci

      api's connect differently than regular users.

    • @Jims-Garage
      @Jims-Garage  Před 8 měsíci

      You can always fall back to standard PAM login (the default). I'm currently running in Kubernetes so it helps with this problem.

    • @francoislebec7516
      @francoislebec7516 Před 8 měsíci +1

      Indeed. Thank you for these fantastic videos !

  • @tedwu2398
    @tedwu2398 Před 19 dny +1

    Thanks for the video. Recently, i build the yml file, but it says external proxy network doesn't exist. What can do here?

    • @Jims-Garage
      @Jims-Garage  Před 19 dny +1

      It expects Traefik to be available on a network called proxy. You can use a different proxy if you like.

  • @ladiesmen246
    @ladiesmen246 Před 4 měsíci

    Hey, I replicated your Keycloak setup and it seems that keycloak isn't using the postgres db. For example if you create a new client/realm/anything it doesn't write into the external db, but is instead using the internal h2 db. You can verify that by checking the internal db's under /opt/keycloak/data/h2/keycloakdb.mv.db.
    I got it working with the following env variables (Keycloak 22.0.3 and latest) :
    - KC_DB=postgres
    - KC_DB_URL_HOST=postgresql
    - KC_DB_URL_PORT=5432 #also exposing ports of the postgres db - might be optional
    - KC_DB_URL_DATABASE=keycloak
    - KC_DB_SCHEMA=public
    With the working external db you won't lose data with commands like "docker compose down".
    BTW Thank you for your great content. It helps a lot. :)

  • @rbartsch
    @rbartsch Před 8 měsíci +1

    Great video!
    Does Keycloak support SCIM 2.0?

    • @Jims-Garage
      @Jims-Garage  Před 8 měsíci

      Not natively (I don't think), but there's third party support github.com/Captain-P-Goldfish/scim-for-keycloak

  • @mb0133
    @mb0133 Před 8 měsíci +1

    how would you enable am existing logon "bind" to a yubikey with an x.509 cert
    ?

    • @Jims-Garage
      @Jims-Garage  Před 8 měsíci

      Good question, I don't know. It's certainly something I want to look into though.

    • @indykoning
      @indykoning Před 7 měsíci +1

      I'm guessing that would fall under setting up WebAuthn in keycloak, it's usually what is used for fingerprint scanners and hardware keys for authentication

  • @RupertoCamarena
    @RupertoCamarena Před 3 měsíci +1

    could you explain how OAuth work with immich?
    thanks!!

    • @Jims-Garage
      @Jims-Garage  Před 2 měsíci

      Check here: immich.app/docs/administration/oauth/ it should be very similar to my Portainer example

  • @lolololowbx280
    @lolololowbx280 Před 8 měsíci +1

    Could you do review on sandfly security? It had free license for 50 linux device and i think it's good for homelab linux

  • @gandalfgrey91
    @gandalfgrey91 Před měsícem +1

    Not quite grasping from your compose file how traefik is managing SSL certificates.

    • @Jims-Garage
      @Jims-Garage  Před měsícem

      Check my Traefik video out, that should explain things. Videos are kind of in order.

    • @gandalfgrey91
      @gandalfgrey91 Před měsícem

      @@Jims-Garage Oh great. I didn’t even think to check, probably because I’m so burnt out trying to get keycloak to work

  • @agentlytle
    @agentlytle Před 7 měsíci +1

    Where did you get the endpoints from

    • @Jims-Garage
      @Jims-Garage  Před 7 měsíci

      They're in the official documentation (if you're referring to keycloak).

  • @fabiano9714
    @fabiano9714 Před 13 hodinami +1

    How did keycloak know that was Jim that was logging in for the first time you logged in your applications ?

    • @Jims-Garage
      @Jims-Garage  Před 13 hodinami

      Do you have a timestamp? Likely because I'm already logged into keycloak with that account.

    • @Jims-Garage
      @Jims-Garage  Před 13 hodinami

      Do you have a timestamp? Likely because I'm already logged into keycloak with that account.

    • @fabiano9714
      @fabiano9714 Před 13 hodinami +1

      @@Jims-Garage Got it. You were logged with admin account so you already had a validade token. Otherwise you would get the keycloak loggin page. Correct?

    • @Jims-Garage
      @Jims-Garage  Před 13 hodinami

      @@fabiano9714 yes, that's correct

  • @silverstone7778
    @silverstone7778 Před 2 měsíci +1

    To say that it's a tricky container is an understatement. Why can't it just start and throw any errors in the browser ? Instead you have to try like 100 different options, some of which work in "start" mode, some in "start-devel" mode, some require setting up some https certificates even if you want it to just sit behind traefik, etc. You have to inspect all the logs using docker / podman logs keycloak-server (or whatever your container is) and try to sort out the cryptic messages. And it's not even clear if the first time you have to spin up a custom container to "build" and create the required tables in the database. I wish it would just work 🙃. Authentik wasn't easy to set up, but keycloak is like 100 times worse so far. I keep getting "Bad Gateway" Error messages ...

    • @Jims-Garage
      @Jims-Garage  Před 2 měsíci +1

      If it helps, I Authentik in my lab. It's the best choice IMO as it supports non-oauth apps.

    • @silverstone7778
      @silverstone7778 Před 2 měsíci

      @@Jims-GarageI'm still figuring out how to use it and for what I need it. Probably stupid misunderstandings on my part, but I'd just like 2FA with my Home Assistant using TOTP from Aegis app on my phone. And on my VPS I wanted to use Authentik + Netbird, since Tailscale/Headscale doesn't resolve DNS on Android (and tailscale "community" isn't interested in helping with Headscale) and I'm running into weird bugs with Zerotier/Headscale and Podman (there is some issues building/combining/reusing Docker/Podman "blobs"). All this convoluted trouble just because Home Assistant Companion App doesn't like custom Certificates so I need Letsencrypted signed Certificates and my Domain Name 😅. At least Netbird cloud DNS Resolution seems to work on android (not sure if it's that or the fact that the records correctly propagate to the root DNS Servers though).

  • @JohnWeland
    @JohnWeland Před 4 měsíci +1

    nice. can you use this in/with Cloudflare Tunnels as the auth mechanism? I know Cloudflare Tunnels has some risk, but if you can get passed the fact they have sight into the data. For a lot of things in the lab it should be permissible.
    Secondly, I have 1 or 2 "production" workloads I need to move to my NAS server as that's the only server likely stay alive any given moment. After that I plan to nuke the lab and start over. Not sure if I will be on 3 nodes of Proxmox or if I want to tackle Harvester. Either way where should I start?
    Cloudflare, Keycloak, Traefik? you know outside-in, auth, and routing then spin up services to tinker with? Trying to come up with a bit of a ground zero run book of creating the lab, do A, B, C, then whatever tickets your fancy.

    • @Jims-Garage
      @Jims-Garage  Před 4 měsíci +1

      I don't know if it can be used with Cloudflare Tunnels. Essentially if the app uses OAuth2 it should be possible.
      I would play with harvester but I don't recommend it for a Homelab, it's too heavy. A Proxmox cluster is the right balance IMO.
      For general homelab Auth I recommend Authentik. It does everything that keycloak does plus it supports Auth proxy as many homelab apps don't use OAuth2

    • @JohnWeland
      @JohnWeland Před 4 měsíci +1

      @@Jims-Garage yeah I started with Harvester maybe a little over a year ago when I only had one node. I liked how you can run rancher on harvester to control then Kube and VM within Harvester.
      Maybe I'll stick with Proxmox though. I don't know.

    • @Jims-Garage
      @Jims-Garage  Před 4 měsíci

      @@JohnWeland it's definitely a great tool to learn and if it works for you then use it.

    • @JohnWeland
      @JohnWeland Před 4 měsíci +1

      @@Jims-Garage yeah I have very little "need" if I am being honest. Just a couple of services that I "need" to keep alive. Now that I have my third node in the post... I don't know what Want to do with the "lab" portion of my home lab.
      I'm a cloud architect/engineer. And I feel that less and less of the lab is translating over to my career. Most of my day is spent in CDK building things in AWS. I'll have to do some re-evaluating. Maybe I trade out my dell r620s for a handful of Raspberry Pi XD.

  • @RupertoCamarena
    @RupertoCamarena Před 2 měsíci +1

    could we just use keycloak like Authelia or Authentik? it look great an the idea begin its just Awesome!! mora of Keycloak please.

    • @Jims-Garage
      @Jims-Garage  Před 2 měsíci

      It's great for oidc/OAuth2, but doesn't have a proxy like Authentik. IMO Authentik is the best choice for a homelab.

  • @SatinderSingh71
    @SatinderSingh71 Před 6 měsíci +1

    Casdoor is another modern open source solution for IAM

    • @Jims-Garage
      @Jims-Garage  Před 6 měsíci

      Thanks, I'll take a look

    • @SatinderSingh71
      @SatinderSingh71 Před 6 měsíci +1

      Key cloak feels kinda old and casdoor seems to be the new kid on the block. The UI is definitely prettier 😍

    • @Jims-Garage
      @Jims-Garage  Před 6 měsíci

      @@SatinderSingh71 check out my Zitadel video. That's pretty awesome and new as well

    • @SatinderSingh71
      @SatinderSingh71 Před 3 měsíci +1

      Any plans on casdoor video? Great video on zitadel too

    • @Jims-Garage
      @Jims-Garage  Před 3 měsíci

      @@SatinderSingh71 I do plan to come back to it in the future (not sure when)

  • @DocMAX
    @DocMAX Před 7 měsíci +1

    SSO is fine, but what if someone gets access to my desktop?

    • @Jims-Garage
      @Jims-Garage  Před 7 měsíci

      Agreed, it's a convenience Vs security trade-off. Best thing is SSO with multifactor authentication.

  • @bluesquadron593
    @bluesquadron593 Před 8 měsíci +3

    Slow down Jimbo. Video almost every day?

    • @Jims-Garage
      @Jims-Garage  Před 8 měsíci

      Sorry 😂

    • @syotos8643
      @syotos8643 Před 8 měsíci +5

      I wont complain because im loving the content. Just dont burn out.

    • @try-that
      @try-that Před 8 měsíci +2

      I was saying to my partner today, about how good the channel was, but hoped Jim remembered he had a family because of the amount of video's he's been outputting.😀

    • @Jims-Garage
      @Jims-Garage  Před 8 měsíci +1

      @@try-that most of these videos are filmed between 10pm and 2am! Always family first!

    • @try-that
      @try-that Před 8 měsíci

      @@Jims-Garage If only I could do that sort day now, old age has caught up with me🥱

  • @Slv577
    @Slv577 Před 26 dny +1

    british ai kurwa

  • @badmadmat20
    @badmadmat20 Před 6 měsíci +3

    Unfortunately you dove to much into the practical side of this in my opinion or you should update the description to clarify that you just want to configure and deploy keycloak. I am missing a lot of theoretical explanation of the internals of the things you configure and why..

    • @Jims-Garage
      @Jims-Garage  Před 6 měsíci +4

      Thanks, I appreciate the feedback. I think the description is accurate as it states it's deployment and configuration, and in the video I state that I'm only scratching the surface. It's difficult to cover everything in all videos as I've already covered elements of SSO, OAuth in Authelia (and subsequently Zitadel). I will be coming back to Keycloak in the future.

    • @szpl
      @szpl Před 2 měsíci +1

      Agree, if you would explain all protocols and details, it would be a 12h video nobody would watch. Its better to focus on Keycloak, and maybe a different video on how modern auth methods work. Just my 2 cents

  • @Con-ge2kl
    @Con-ge2kl Před 3 měsíci +1

    From the github docker-compose.yaml - Keycloak doesn't connect to Postgres - Issue raised on github -
    Service refences postgresql but KC_DB_URL_HOST=postgres

    • @Jims-Garage
      @Jims-Garage  Před 3 měsíci

      Try adding the port. postgres:port

    • @Con-ge2kl
      @Con-ge2kl Před 3 měsíci

      @@Jims-Garage As in
      postgresql:
      expose:
      - 5432
      I'd tried that
      My Keycloak Vars:
      environment:
      - KC_PROXY_ADDRESS_FORWARDING=true
      - KC_HOSTNAME_STRICT=false
      - KC_HOSTNAME=keycloak.####.####
      - KC_PROXY=edge
      - KC_HTTP_ENABLED=true
      - KC_DB=postgres
      - KC_DB_USERNAME=keycloak
      - KC_DB_PASSWORD=SUPERsecret
      - KC_DB_URL_HOST=postgresql
      - KC_DB_URL_PORT=5432
      - KC_DB_URL_DATABASE=keycloak
      - KEYCLOAK_ADMIN=admin
      - KEYCLOAK_ADMIN_PASSWORD=password

    • @radiofisik
      @radiofisik Před měsícem

      - KC_DB_URL_HOST=postgresql