Elasticsearch (monitoring)

De Wiki1000
Révision datée du 12 février 2018 à 08:57 par Syfre (discussion | contributions)
(diff) ← Version précédente | Voir la version actuelle (diff) | Version suivante → (diff)

{{#images:versionlatest-32x32.png|stock}}

Installation

  • Installer ES
  • Modifier /etc/elasticsearch/elasticsearch.yml (pour accès par remote host)
#network.host: 192.168.0.1
network.bind_host: 0.0.0.0
#
# Set a custom port for HTTP:
#
#http.port: 9200
#
# for plugin head :
http.cors.enabled: true
http.cors.allow-origin: "*"
http.cors.allow-headers: Authorization
#

Pour tester :

curl http://localhost:9200
  • Installer Kibana
  • Modifier /etc/kibana/kibana.yml (pour accès par remote host)
# To allow connections from remote users, set this parameter to a non-loopback address.
server.host: "0.0.0.0"

Pour tester :

curl http://localhost:5601

Sécurité

  • Installer x-pack pour ES et Kibana

(pour kibana upgrader la machine en 2c 8G pour l'installation, sinon cela hang avec seulement 3.5G de mémoire)

Une fois x-pack installé l'authentification basic est activée

elastic:changeme

kibana:changeme

Pour terter :

curl http://kibana:changeme@localhost:9200
  • Configurer kibana pour accéder à ES avec kibana:changeme :
elasticsearch.username: "kibana"
elasticsearch.password: "changeme"

Tester l'accès via un remote host, on doit avoir la page de login et se logger avec elastic:changeme

Configurer ES en SSL

  • Créer un certificat avec certgen de x-pack en renseignant le nom dns de la machine
  • unziper le fichier .zip ainsi créé => crée 2 rep /ca et /node1
  • Modifier /etc/elasticsearch/elasticsearch.yml pour activer SSL :
xpack.ssl.key: /etc/elasticsearch/x-pack/node1/node1.key
xpack.ssl.certificate: /etc/elasticsearch/x-pack/node1/node1.crt
xpack.ssl.certificate_authorities: /etc/elasticsearch/x-pack/ca/ca.crt
xpack.security.transport.ssl.enabled: true
xpack.security.http.ssl.enabled: true

Pour tester :

curl https://kibana:changeme@localhost:9200 --insecure

Configurer kibana pour accéder à ES en https

Voir https://www.elastic.co/guide/en/kibana/current/production.html

elasticsearch.url: "https://localhost:9200"
elasticsearch.ssl.verificationMode: none

Cela devrait aussi marcher avec (mais j'ai pas réussi ? soit erreur ES quand il essaye d'accéder a ca.pem soir démarre pas) :

elasticsearch.url: "https://localhost:9200"
elasticsearch.ssl.certificateAuthorities: [ "/etc/elasticsearch/x-pack/ca/ca.pem" ]
elasticsearch.ssl.verificationMode: full

Pour tester :

service kibana status

=>> Aug 10 16:15:16 syfreubuntu3 kibana[20955]: {"type":"response","@timestamp":"2017-08-10T16:15:16Z","tags":[],"pid":20955,"method":"get","statusCode":200,"req":{"

curl http://elastic:changeme@localhost:5601

Configurer kibana pour un accès browser HTTPS

==> marche pas ??
# SSL for outgoing requests from the Kibana Server (PEM formatted)
server.ssl.enabled: true
server.ssl.key: /etc/elasticsearch/x-pack/node1/node1.key
server.ssl.certificate: /etc/elasticsearch/x-pack/node1/node1.crt