danielberkompas/elasticsearch-elixir

TLS CLIENT ALERT: Fatal - Unknown CA

Closed this issue · 2 comments

mix elasticsearch.build posts --cluster Elastic.ElasticsearchCluster responds
** (Mix) Index posts could not be created.

%HTTPoison.Error{reason: {:tls_alert, {:unknown_ca, 'TLS client: In state wait_cert_cr at ssl_handshake.erl:2109 generated CLIENT ALERT: Fatal - Unknown CA\n'}}, id: nil}

I installed Elastic Search through Docker and it's initial REST API call to ensure Elastic Search properly installed was
curl --cacert http_ca.crt -u elastic:$ELASTIC_PASSWORD https://localhost:9200 .
The mix elasticsearch.build command does not support --cacert as option

If you're using OTP26 - https://www.erlang.org/blog/otp-26-highlights/#ssl-safer-defaults
Try this in your config:

config :my_app, MyApp.Elasticsearch.Cluster,
  enabled: false,
  default_options: [
    ssl: [{:verify, :verify_none}] #<=== this line
  ],
  api: Elasticsearch.API.HTTP,
  json_library: Jason

I followed the docker compose file setup for cluster, and this seems to work.