opendistro-for-elasticsearch / sample-code

👋 Welcome to the Open Distro sample-code area. Share your great ideas and code samples with the Open Distro Community.
https://github.com/opendistro-for-elasticsearch/sample-code
Apache License 2.0
278 stars 81 forks source link

unable to redirect to keycloak metdata data #255

Open vatsalPatel82 opened 3 years ago

vatsalPatel82 commented 3 years ago

I am trying to set up AWS open distro on-premise and want to perform SAML using keycloak. I have installed docker version 1.8.0 of both elastic search and kibana which is running successfully. But when I am trying to enable SAML of my keycloak using metadata URL it redirects me to its default one which is mentioned below.

I want the docker-compose file to read the metadata URL of provided keycloak, not the default one.

Error occurred while attempting to refresh metadata from 'http://SAML-IdP:8080/simplesaml/saml2/idp/metadata.php'
#config.yml:
---
_meta:
  type: "config"
  config_version: 2

config:
  dynamic:
    http:
      anonymous_auth_enabled: false
    authc:
      internal_auth:
        order: 0
        description: "HTTP basic authentication using the internal user database"
        http_enabled: true
        transport_enabled: true
        http_authenticator:
          type: basic
          challenge: false
        authentication_backend:
          type: internal
      saml_auth:
        order: 1
        description: "SAML provider"
        http_enabled: true
        transport_enabled: false
        http_authenticator:
          type: saml
          challenge: true
          config:
            idp:
              metadata_url: https://keycloak.com #a dummy metadata_url
              entity_id: https://keycloak.com #a dummy entityid
            sp:
              entity_id: http://localhost:5601
              for1ceAuthn: true
            kibana_url: http://localhost:5601
            subject_key: UserID
            roles_key: Role
            exchange_key: 1a2a3a4a5a6a7a8a9a0a1b2b3b4b5b6b
        authentication_backend:
          type: noop
#docker-compose.yml:
version: '3'
services:
  odfe-node1:
    image: amazon/opendistro-for-elasticsearch:1.8.0
    container_name: odfe-node1
    environment:
      - cluster.name=odfe-cluster
      - node.name=odfe-node1
      - discovery.seed_hosts=odfe-node1
      - cluster.initial_master_nodes=odfe-node1
      - bootstrap.memory_lock=true # along with the memlock settings below, disables swapping
      - "ES_JAVA_OPTS=-Xms512m -Xmx512m" # minimum and maximum Java heap size, recommend setting both to 50% of system RAM
    ulimits:
      memlock:
        soft: -1
        hard: -1
      nofile:
        soft: 65536 # maximum number of open files for the Elasticsearch user, set to at least 65536 on modern systems
        hard: 65536
    volumes:
      - odfe-data1:/usr/share/elasticsearch/data
      - ./config.yml:/usr/share/elasticsearch/plugins/opendistro_security/securityconfig/config.yml
    ports:
      - 9200:9200
      - 9600:9600 # required for Performance Analyzer
    networks:
      - odfe-net  
  kibana:
    image: amazon/opendistro-for-elasticsearch-kibana:1.8.0
    container_name: odfe-kibana
    ports:
      - 5601:5601
    expose:
      - "5601"
    environment:
      ELASTICSEARCH_URL: https://odfe-node1:9200
      ELASTICSEARCH_HOSTS: https://odfe-node1:9200
    volumes:
      - ./custom-kibana.yml:/usr/share/kibana/config/kibana.yml
    networks:
      - odfe-net

volumes:
  odfe-data1:

networks:
  odfe-net: