Keycloak Prod mode env KEYCLOAK_ENABLE_TLS not picked up

Viewed 40

Hello everyone I am attempting to run my bitnami/keycloak on production mode but as I turn on the KEYCLOAK_PRODUCTION=true the system says i need to turn on the TLS but even though I added the variable the system still says I need to turn on the TLS. The env KEYCLOAK_ENABLE_TLS is not being picked up for some reason. Please help !!!

    version: '2'
    services:
      postgresql:
        image: docker.io/bitnami/postgresql:11
        environment:
          # ALLOW_EMPTY_PASSWORD is recommended only for development.
          - ALLOW_EMPTY_PASSWORD=yes
          - POSTGRESQL_USERNAME=bn_keycloak
          - POSTGRESQL_DATABASE=bitnami_keycloak
        volumes:
          - 'postgresql_data:/bitnami/postgresql'

      keycloak:
        image: docker.io/bitnami/keycloak:18
        environment:
          - KEYCLOAK_ENABLE_TLS=true
          - KEYCLOAK_PRODUCTION=true
          - KEYCLOAK_TLS_TRUSTSTORE_FILE=/opt/bitnami/keycloak/certs/truststore.jks 
          - KEYCLOAK_TLS_KEYSTORE_FILE=/opt/bitnami/keycloak/certs/server.jks
          - KEYCLOAK_TLS_TRUSTSTORE_PASSWORD=password
          - KEYCLOAK_TLS_KEYSTORE_PASSWORD=password
        volumes:
          - ./server.jks:/opt/bitnami/keycloak/certs/server.jks
          - ./server.jks:/opt/bitnami/keycloak/certs/truststore.jks
        depends_on:
          - postgresql
        ports:
          - "80:8080"

    volumes:
      postgresql_data:
        driver: local

and here is my output:

    keycloak_1    | keycloak 09:52:35.97 Welcome to the Bitnami keycloak container
    keycloak_1    | keycloak 09:52:35.97 Subscribe to project updates by watching https://github.com/bitnami/bitnami-docker-keycloak
    keycloak_1    | keycloak 09:52:35.98 Submit issues and feature requests at https://github.com/bitnami/bitnami-docker-keycloak/issues
    keycloak_1    | keycloak 09:52:35.98
    keycloak_1    | keycloak 09:52:35.99 INFO  ==> ** Starting keycloak setup **
    keycloak_1    | keycloak 09:52:36.03 INFO  ==> Validating settings in KEYCLOAK_* env vars...
    keycloak_1    | keycloak 09:52:36.03 ERROR ==> You need to have TLS enabled. Please set the KEYCLOAK_ENABLE_TLS variable to true

NOTE: I am aware that most configuration are for dev mode but my main concern is that the KEYCLOAK_ENABLE_TLS variable is not being picked up. Thank you

1 Answers

(I wanted to write all this as a comment but I cannot do it yet. Should we not be able to comment BEFORE being able to answer? Anyways...)

I know little about containerization (I plan to learn that soon) but I do know a lot more about database design and implementation.

According to your configuration, your "keycloak" (whatsoever that is) depends on PostgreSQL. As of 2022, TLS support in that RDBMS does not come "out-of-the-box". Since 2014, everytime I use PostgreSQL I have to follow the "ritual" of building it from source code to add TLS support.

Does the image of PostgreSQL in your container support TLS? Check that...

Related