Giter VIP home page Giter VIP logo

fess-xpack's Introduction

X-Pack Support for Fess

Overview

X-Pack support for Fess is an extension library to work with Elasticsearch and X-Pack environment.

Download

See Maven Repository.

Setup

Install Elasticsearch with X-Pack

See Set up Elasticsearch and Installing X-Pack.

For example, you can create users for X-Pack by executing elasticsearch-setup-passwords command:

# /usr/share/elasticsearch/bin/elasticsearch-setup-passwords interactive
Initiating the setup of passwords for reserved users elastic,apm_system,kibana,logstash_system,beats_system,remote_monitoring_user.
You will be prompted to enter passwords as the process progresses.
Please confirm that you would like to continue [y/N]y


Enter password for [elastic]:
Reenter password for [elastic]:
Enter password for [apm_system]:
Reenter password for [apm_system]:
Enter password for [kibana]:
Reenter password for [kibana]:
Enter password for [logstash_system]:
Reenter password for [logstash_system]:
Enter password for [beats_system]:
Reenter password for [beats_system]:
Enter password for [remote_monitoring_user]:
Reenter password for [remote_monitoring_user]:
Changed password for user [apm_system]
Changed password for user [kibana]
Changed password for user [logstash_system]
Changed password for user [beats_system]
Changed password for user [remote_monitoring_user]
Changed password for user [elastic]

Generate Node Certificates

See Encrypting communications in Elasticsearch.

Using elasticsearch-certutil, 1) generate a new local certificate authority.

# /usr/share/elasticsearch/bin/elasticsearch-certutil ca
This tool assists you in the generation of X.509 certificates and certificate
signing requests for use with SSL/TLS in the Elastic stack.

The 'ca' mode generates a new 'certificate authority'
This will create a new X.509 certificate and private key that can be used
to sign certificate when running in 'cert' mode.

Use the 'ca-dn' option if you wish to configure the 'distinguished name'
of the certificate authority

By default the 'ca' mode produces a single PKCS#12 output file which holds:
    * The CA certificate
    * The CA's private key

If you elect to generate PEM format certificates (the -pem option), then the output will
be a zip file containing individual files for the CA certificate and private key

Please enter the desired output file [elastic-stack-ca.p12]:
Enter password for elastic-stack-ca.p12 :
  1. generate X.509 certificates and keys.
# /usr/share/elasticsearch/bin/elasticsearch-certutil cert --ca elastic-stack-ca.p12
warning: Falling back to java on path. This behavior is deprecated. Specify JAVA_HOME
This tool assists you in the generation of X.509 certificates and certificate
signing requests for use with SSL/TLS in the Elastic stack.

The 'cert' mode generates X.509 certificate and private keys.
    * By default, this generates a single certificate and key for use
       on a single instance.
    * The '-multiple' option will prompt you to enter details for multiple
       instances and will generate a certificate and key for each one
    * The '-in' option allows for the certificate generation to be automated by describing
       the details of each instance in a YAML file

    * An instance is any piece of the Elastic Stack that requires a SSL certificate.
      Depending on your configuration, Elasticsearch, Logstash, Kibana, and Beats
      may all require a certificate and private key.
    * The minimum required value for each instance is a name. This can simply be the
      hostname, which will be used as the Common Name of the certificate. A full
      distinguished name may also be used.
    * A filename value may be required for each instance. This is necessary when the
      name would result in an invalid file or directory name. The name provided here
      is used as the directory name (within the zip) and the prefix for the key and
      certificate files. The filename is required if you are prompted and the name
      is not displayed in the prompt.
    * IP addresses and DNS names are optional. Multiple values can be specified as a
      comma separated string. If no IP addresses or DNS names are provided, you may
      disable hostname verification in your SSL configuration.

    * All certificates generated by this tool will be signed by a certificate authority (CA).
    * The tool can automatically generate a new CA for you, or you can provide your own with the
         -ca or -ca-cert command line options.

By default the 'cert' mode produces a single PKCS#12 output file which holds:
    * The instance certificate
    * The private key for the instance certificate
    * The CA certificate

If you specify any of the following options:
    * -pem (PEM formatted output)
    * -keep-ca-key (retain generated CA key)
    * -multiple (generate multiple certificates)
    * -in (generate certificates from an input file)
then the output will be be a zip file containing individual certificate/key files

Enter password for CA (elastic-stack-ca.p12) :
Please enter the desired output file [elastic-certificates.p12]:
Enter password for elastic-certificates.p12 :

Certificates written to /home/vagrant/elastic-certificates.p12

This file should be properly secured as it contains the private key for
your instance.

This file is a self contained file and can be copied and used 'as is'
For each Elastic product that you wish to configure, you should copy
this '.p12' file to the relevant configuration directory
and then follow the SSL configuration instructions in the product guide.

For client applications, you may only need to copy the CA certificate and
configure the client to trust this certificate.
  1. copy the generated files to /etc/elasticsearch.
# cp elastic-certificates.p12 elastic-stack-ca.p12 /etc/elasticsearch/
# chgrp elasticsearch /etc/elasticsearch/elastic-certificates.p12 /etc/elasticsearch/elastic-stack-ca.p12
# chmod 640 /etc/elasticsearch/elastic-certificates.p12 /etc/elasticsearch/elastic-stack-ca.p12
  1. store passwords for ca and cert to key stores.
# /usr/share/elasticsearch/bin/elasticsearch-keystore add xpack.security.transport.ssl.keystore.secure_password
Enter value for xpack.security.transport.ssl.keystore.secure_password:
# /usr/share/elasticsearch/bin/elasticsearch-keystore add xpack.security.transport.ssl.truststore.secure_password
Enter value for xpack.security.transport.ssl.truststore.secure_password:

Create User and Role for Fess

To access Elasticsearch with X-Pack from Fess, create fess role:

curl -XPOST -u elastic 'localhost:9200/_xpack/security/role/fess' -H "Content-Type: application/json" -d '{
  "cluster": ["all"],
  "indices" : [
    {
      "names" : [ "fess*", ".fess*", ".configsync*", ".crawler*", ".suggest*" ],
      "privileges" : [ "all" ]
    }
  ]
}'

and then create fess user:

curl -XPOST -u elastic 'localhost:9200/_xpack/security/user/fess?pretty' -H 'Content-Type: application/json' -d'
{
  "password" : "changeme",
  "roles" : [ "fess" ],
  "full_name" : "Fess"
}'

Stop Elasticsearch

Stop Elasticsearch process.

# systemctl stop elasticsearch.service

Edit elasticsearch.yml

Insert the following setting into /etc/elasticsearch/elasticsearch.yml.

configsync.xpack.security.user: "fess:changeme"
xpack.security.enabled: true
xpack.security.transport.ssl.enabled: true
xpack.security.transport.ssl.verification_mode: certificate
xpack.security.transport.ssl.keystore.path: /etc/elasticsearch/elastic-certificates.p12
xpack.security.transport.ssl.truststore.path: /etc/elasticsearch/elastic-certificates.p12

Install Fess

See Installation Guide. X-Pack support for Fess is avaiable on Fess 12.1.1 or above.

Install X-Pack Support

Copy fess-xpack-12.X.X.X.jar to lib directory(ex. /usr/share/fess/app/WEB-INF/lib) and run jar file to download dependencies as below:

# cd /usr/share/fess/app/WEB-INF/lib
# java -Delasticsearch.version=6.7.2 -jar fess-xpack-12.X.X.X.jar

Create xpack.properties

Create xpack.properties in conf directory(ex. /etc/fess) and put X-Pack settings to the properties file.

xpack.security.user=fess:changeme
xpack.security.transport.ssl.enabled=true
xpack.security.transport.ssl.verification_mode=certificate
xpack.security.transport.ssl.keystore.path=/etc/fess/elastic-certificates.p12
xpack.security.transport.ssl.truststore.path=/etc/fess/elastic-certificates.p12

For other available settings, see Java Client and Security.

Copy Certificates

# cp /etc/elasticsearch/elastic-certificates.p12 /etc/fess/elastic-certificates.p12
# chown fess:fess /etc/fess/elastic-certificates.p12

Start Fess and Elasticsearch

# systemctl start elasticsearch.service
# systemctl start fess.service

Support

If you need any technical help, contact N2SM, Inc.

fess-xpack's People

Contributors

deka0106 avatar dependabot[bot] avatar marevol avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  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.