Openshift Elasticsearch Plugin

Sonatype helps open source projects to set up Maven repositories on https://oss.sonatype.org/

License

License

Categories

Categories

OpenShift Container PaaS Providers Search Business Logic Libraries Elasticsearch
GroupId

GroupId

io.fabric8.elasticsearch
ArtifactId

ArtifactId

openshift-elasticsearch-plugin
Last Version

Last Version

5.6.13.5
Release Date

Release Date

Type

Type

zip
Description

Description

Openshift Elasticsearch Plugin
Sonatype helps open source projects to set up Maven repositories on https://oss.sonatype.org/
Project URL

Project URL

http://fabric8.io/
Project Organization

Project Organization

Red Hat
Source Code Management

Source Code Management

http://github.com/fabric8io/openshift-elasticsearch-plugin/

Download openshift-elasticsearch-plugin

Dependencies

compile (10)

Group / Artifact Type Version
io.fabric8 : kubernetes-openshift-uberjar jar 4.0.3
com.github.zafarkhaja : java-semver jar 0.9.0
com.jayway.jsonpath : json-path jar 2.3.0
com.floragunn : search-guard-5 jar 5.6.13-19.2
com.floragunn : search-guard-ssl jar 5.6.13-23
commons-lang : commons-lang jar 2.6
commons-io : commons-io jar 2.1
com.google.guava : guava jar 19.0
commons-cli : commons-cli jar 1.3.1
commons-codec : commons-codec jar 1.9

provided (1)

Group / Artifact Type Version
org.elasticsearch : elasticsearch jar 5.6.13

test (5)

Group / Artifact Type Version
io.fabric8 : openshift-server-mock jar 4.0.3
junit : junit jar 4.12
org.mockito : mockito-core jar 1.9.0-rc1
org.yaml : snakeyaml jar 1.16
org.slf4j : slf4j-log4j12 jar 1.7.13

Project Modules

There are no modules declared in this project.

OpenShift ElasticSearch plugin

This is an OpenShift plugin to ElasticSearch to:

  • Dynamically update the SearchGuard ACL based on a user's name
  • Transform kibana index requests to support multitenant deployments for non-operations users when so configured.

Note: Previous versions of this plugin created a Kibana profile for each user regardless of their role, which is still the default mode of operation. It is now possible to configure the Kibana index mode to allow operations users to share the Kibana index to store dashboards and visualizations. It is highly recommended that operations teams establish agreements and naming conventions so users do not overwrite each others work.

Configuring the Authorization Backend

searchguard:
  dynamic:
  ...
    authc:
      openshift_domain:
        enabled: true
        order: 0
        http_authenticator:
          challenge: false
          type: io.fabric8.elasticsearch.plugin.auth.OpenShiftTokenAuthentication
        authentication_backend:
          type: io.fabric8.elasticsearch.plugin.auth.OpenShiftTokenAuthentication
          config:
            note: The following is optional and adds the group 'prometheus' to the user if SAR is satisfied
            subjectAccessReviews:
              prometheus:
                namespace: openshift-logging
                verb: view
                resource: prometheus
                resourceAPIGroup: metrics.openshift.io

Configuring your initial ACLs

The OpenShift-Elasticsearch-Plugin assumes the initial ACLs are seeded when the cluster is started.

Action Groups

This plugin will produce role and role mappings that assume certain action groups are defined with the base SearchGuard ACL documents. Samples of the generated roles and role mappings are found in the unit tests. Additional sample ACL document configurations are here. The generated roles and role mappings are periodically expired to reduce the possibility of a mismatch between the allowed permissions and a user's Openshift projects. See the 'Additional Configuration Parameters' to modify the period.

As with sgadmin, the plugin needs to use the certificate with a DN that matches the searchguard.authcz.admin_dn as defined in the ES config to be able to update the Searchguard index. You can specify the certificate and truststore information for the esClient with the following properties:

Property Description
openshift.searchguard.keystore.path The certificate that contains the cert and key for the admin_dn. Default: /usr/share/elasticsearch/config/admin.jks
openshift.searchguard.truststore.path The truststore that contains the certificate for Elasticsearch. Default: /usr/share/elasticsearch/config/logging-es.truststore.jks
openshift.searchguard.keystore.password The password to open the keystore. Default: kspass
openshift.searchguard.truststore.password The password to open the truststore. Default: tspass
openshift.searchguard.keystore.type The file type for the keystore. JKS or PKCS12 are accepted. Default: JKS
openshift.searchguard.truststore.type The file type for the truststore. JKS or PKCS12 are accepted. Default: JKS

Configure the projects for '.operations'

You can configure which projects are deemed part of the .operations index for ACL configuration.

In your config file:

openshift.operations.project.names: ["default", "openshift", "openshift-infra"]

The defaults must all be in lower-case to be properly matched.

Additional Configuration Parameters

The following additional parameters can be set in set in elasticsearch.yml:

Property Description
io.fabric8.elasticsearch.acl.user_profile_prefix The prefix to use to store Kibana user visualizations (default: .kibana.USERUUID)
io.fabric8.elasticsearch.kibana.mapping.app Absolute file path to a JSON document that defines the index mapping for applications
io.fabric8.elasticsearch.kibana.mapping.ops Absolute file path to a JSON document that defines the index mapping for operations
io.fabric8.elasticsearch.kibana.mapping.empty Absolute file path to a JSON document that defines the index mapping for blank indexes
openshift.acl.expire_in_millis The delay in milliseconds before generated ACLs are removed from
openshift.config.project_index_prefix The string value that project/namespace indices use as their prefix (default: ``) for example, with the common data model, if the namespace is test, the index name will be `project.test.$uuid.YYYY.MM.DD`. In this case, use `"project"` as the prefix - do not include the trailing `.`.
openshift.kibana.index.mode The setting that determines the kibana index is used by users. Valid values are one of the following:
  • unique (Default) - Each user gets a unique index for kibana visualizations (e.g. .kibana.USER_UUID)
  • ops_shared - Users who are in an ops role will share an index (e.g. kibana) while non ops users will have a unique index (e.g. .kibana.USER_UUID)

Note: The io.fabric8.elasticsearch.kibana.mapping.* properties are required and must be defined for the plugin to function. A sample file may be found in the samples folder.

Removed Configuration Parameters

The following config parameters were removed:

Property Version
io.fabric8.elasticsearch.acl.user_profile_prefix
openshift.acl.dynamic.enabled 5.6.10.4
openshift.kibana.rewrite.enabled 5.6.10.4

Development

Manually install custom version of SearchGuard

  • $ mvn install:install-file -Dfile=lib/search-guard-5-5.6.10-19.2-rh.jar -Dpackaging=jar

Following are the dependencies

Remote Debugging deployed to Openshift

  • Edit the Elasticsearch deployment config:
$oc edit dc/$ES_DCNAME

  • Add environment variable:
...
    spec:
      containers:
      - env:
        - name: ES_JAVA_OPTS
          value: -Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=4021
...
  • Forward the debug port
oc port-forward $ES_PODNAME 4000:4021
  • Attach Eclipse debugger to forwarded port Debug args

Debugging and running from Eclipse

Note: Mileage may vary here as this has not been verified since the plugin was compatible with ES1.7x

  • Install ES

  • Create a run configuration

  • Main Class Main class

  • VM args:

-Des.path.home=${env_var:ES_HOME} -Delasticsearch -Des.foreground=yes -Dfile.encoding=UTF-8 -Delasticsearch -Xms256m -Xmx1g -Djava.awt.headless=true -XX:+UseParNewGC -XX:+UseConcMarkSweepGC -XX:CMSInitiatingOccupancyFraction=75 -XX:+UseCMSInitiatingOccupancyOnly -XX:+HeapDumpOnOutOfMemoryError -XX:+DisableExplicitGC

VM Args

  • Environment Variables:

Environment Variables

io.fabric8.elasticsearch

fabric8

open source development platform for kubernetes

Versions

Version
5.6.13.5
5.6.13.4
5.6.13.3
5.6.13.2
5.6.13.1
5.6.12.2
5.6.10.4
5.6.10.3
5.6.10.2
5.6.10.1
5.6.10.0
5.6.9.1
2.4.4.23
2.4.4.19
2.4.4.16
2.4.4.15
2.4.4.14
2.4.4.13
2.4.4.11
2.4.4.9
2.4.4.8
2.4.4.7
2.4.4.6
2.4.4.5
2.4.4.4
2.4.4.3
2.4.4.2
2.4.4.1
2.4.4.0
2.4.1.10
2.4.1.9
2.4.1.8
2.4.1.7
2.4.1.6
2.4.1.5
2.4.1.4
2.4.1.3
2.4.1.2
2.4.1.1
2.4.1
2.3.5.7
2.3.5.6
2.3.5.5
2.3.5.4
2.3.5.3
2.3.5.1
2.3.5.0
2.3.3.2
2.3.3.1
2.3.3.0
0.18
0.17
0.16
0.15
0.14
0.13
0.12
0.11
0.9
0.8
0.7
0.6
0.5
0.4
0.3
0.2
0.1