DEV Community

Ali Mahdiyanjoo
Ali Mahdiyanjoo

Posted on

Updating Elasticsearch with P12 Certificate

🔍 Background:

For updating Elasticsearch to versions 17.10 and 17.5 with a P12 certificate, you can follow the steps outlined below.

Steps:

  1. Access Docker Container:
docker exec -it {container_name} bash
Enter fullscreen mode Exit fullscreen mode
  1. Generate CA Certificate:
/usr/share/elasticsearch/bin/elasticsearch-certutil ca
Enter fullscreen mode Exit fullscreen mode
  • Enter a file name for the CA certificate in P12 format (e.g., New_Cer.p12)
  • Specify the cipher for SSL encryption.
  1. Sign the new Certificate:
/usr/share/elasticsearch/bin/elasticsearch-certutil cert --ca {First_created_file}.p12 --ca-pass "" --days {Date_Of_Expiration} --out "{Output_name}.p12" --pass ""
Enter fullscreen mode Exit fullscreen mode
  1. Replace SSL Certificate:
rm -rf /usr/share/elasticsearch/config/cert/elastic-stack-ca.p12
Enter fullscreen mode Exit fullscreen mode
mv {Location_Of_Created_File} /usr/share/elasticsearch/config/cert/elastic-stack-ca.p12
Enter fullscreen mode Exit fullscreen mode
  1. Update File Permissions:
sudo chown {Username}:{Group} /usr/share/elasticsearch/config/cert/elastic-stack-ca.p12
Enter fullscreen mode Exit fullscreen mode
  1. Check SSL Validation:
  • Dev Tool in Kibana:
GET /_ssl/certificates
Enter fullscreen mode Exit fullscreen mode
  • Check SSL Expiry Date:
curl -X GET http://{IP_Address}:9200/_ssl/certificates -u {Username}:{Password} | jq '.[-1].expiry' | cut -d '"' -f 2
Enter fullscreen mode Exit fullscreen mode

🚀 Completion:

By following these steps, you would have successfully updated Elasticsearch to the specified versions and configured it with a P12 certificate for secure communication.

Good luck with your Elasticsearch update! 🎉

Top comments (0)