diff --git a/HowtoElasticsearch.md b/HowtoElasticsearch.md index 3080f10c..ef35d65e 100644 --- a/HowtoElasticsearch.md +++ b/HowtoElasticsearch.md @@ -350,9 +350,8 @@ non_heap_used.value 175388648 heap_committed.value 2130051072 ~~~ -## Sécurisation -Par défaut, Elasticsearch n'est absolument pas sécurisé. Il a donc plusieurs opérations à faire pour sécuriser un nœud ou un cluster. +## Sécurisation Elastic définit 3 niveaux de sécurisation : @@ -418,6 +417,7 @@ On pourra ainsi créer des comptes applicatifs, avec On ajoutera l'argument suivant à la commande de check_http pour s'authentifier `--authorization 'remote_monitoring_user:PASSWORD'` + #### Ajustement configuration Kibana Dans `/etc/kibana/kibana.yml`, on spécifie le compte a utiliser : @@ -445,10 +445,12 @@ Enter value for elasticsearch.password: PASSWORD Puis redémarrer Kibana `systemctl restart kibana` + ### Passage en HTTPS Il y a plusieurs options pour. Le plus simple est de générer une PKI spéciale au cluster Elasticsearch avec les outils proposés. + #### Amorce de la PKI ~~~ @@ -481,6 +483,7 @@ Comme ce n'est pas un dossier conventionnel, on peut choisir de le déplacer dan # mv /usr/share/elasticsearch/elastic-stack-ca.p12 /etc/elasticsearch/elastic-stack-ca.p12 ~~~ + #### Communication inter-nœuds Pour chaque nœud Elasticsearch, il faut générer un certificat avec l'outil `/usr/share/elasticsearch/bin/elasticsearch-certutil` @@ -1694,3 +1697,40 @@ On peut rencontrer ce problème sur un cluster. L'explication donnée par Elastic est : « cannot allocate because a previous copy of the primary shard existed but can no longer be found on the nodes in the cluster » (sortie de `curl '127.0.0.1:9200/_cluster/allocation/explain?pretty'`). Il est possible que le shard se trouvait sur un noeud du cluster inaccessible ou mal enlevé du cluster, ou qu'il y ait eu un problème matériel là ou se trouvait le shard. + + +### Erreur `Failed to authenticate user 'elastic'` avec `elasticsearch-setup-passwords` + +Si en exécutant [`elasticsearch-setup-passwords`](https://www.elastic.co/guide/en/elasticsearch/reference/current/setup-passwords.html) vous rencontrez cette erreur : + +~~~ +# /usr/share/elasticsearch/bin/elasticsearch-setup-passwords auto + +Failed to authenticate user 'elastic' against https://172.20.3.233:9200/_security/_authenticate?pretty +Possible causes include: + * The password for the 'elastic' user has already been changed on this cluster + * Your elasticsearch node is running against a different keystore + This tool used the keystore at /etc/elasticsearch/elasticsearch.keystore + +You can use the `elasticsearch-reset-password` CLI tool to reset the password of the 'elastic' user + +ERROR: Failed to verify bootstrap password, with exit code 78 +~~~ + +D'abord, if faut savoir que l'utilisation de `elasticsearch-setup-passwords` est dépréciée à partir d'Elasticsearch 8 en faveur de [`elasticsearch-setup-passwords`](https://www.elastic.co/guide/en/elasticsearch/reference/current/reset-password.html). + +Cet utilitaire utilise le mot de passe « boostrap » créé à l'installation d'Elasticseach. S'il a été changé ou que vous ne l'avez pas (installation via Ansible par exemple), alors **vous ne pouvez pas utiliser cet utilitaire**. + +Alternativement, vous pouvez changer les mots de passe via via [`elasticsearch-setup-passwords`](https://www.elastic.co/guide/en/elasticsearch/reference/current/reset-password.html), [Kibana](/HowtoKibana) ou l'[API de changement des mots de passe](https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-change-password.html). + +Par exemple, avec [`elasticsearch-setup-passwords`](https://www.elastic.co/guide/en/elasticsearch/reference/current/reset-password.html) : + +~~~ +# /usr/share/elasticsearch/bin/elasticsearch-reset-password --auto --user +This tool will reset the password of the [] user to an autogenerated value. +The password will be printed in the console. +Please confirm that you would like to continue [y/N] y +Password for the [] user successfully reset. +New value: +~~~ +