Permalink
Browse files

Issue #173: Add support for client certificates

  • Loading branch information...
kiwiz committed Oct 15, 2018
1 parent 53193d2 commit 7db1d7677632232e349b99419320adc53aaa4fcc
Showing with 12 additions and 0 deletions.
  1. +6 −0 config_example.php
  2. +6 −0 phplib/Search/Elasticsearch.php
@@ -78,6 +78,8 @@
* Ex: 'http://user:pass@localhost:9200'
* 'index_hosts': An array of hosts to use for indexing (if different from 'hosts').
* 'ssl_cert': Path to an ssl certificate if your cluster uses HTTPS.
* 'ssl_client_cert': Path to an ssl client certificate if your cluster uses HTTPS.
* 'ssl_client_key': Path to an ssl client key if your cluster uses HTTPS.
* 'index': The index to query. Leave as null to query all indices.
* If the index is date_based, accepts index patterns. (Otherwise, it's taken literally)
* Any characters wrapped by [] will be taken literally.
@@ -105,6 +107,8 @@
'hosts' => ['http://localhost:9200'],
'index_hosts' => [],
'ssl_cert' => null,
'ssl_client_cert' => null,
'ssl_client_key' => null,
'index' => null,
'date_based' => false,
'date_interval' => null,
@@ -117,6 +121,8 @@
'hosts' => ['http://localhost:9200'],
'index_hosts' => [],
'ssl_cert' => null,
'ssl_client_cert' => null,
'ssl_client_key' => null,
'index' => '[logstash-]Y.m.d',
'date_based' => true,
'date_interval' => 'd',
@@ -152,6 +152,12 @@ public function getConnection($host) {
if(!is_null($cfg['ssl_cert'])) {
$cb->setSSLVerification($cfg['ssl_cert']);
}
if(!is_null($cfg['ssl_client_key'])) {
$cb->setSSLKey($cfg['ssl_client_key']);
}
if(!is_null($cfg['ssl_client_cert'])) {
$cb->setSSLCert($cfg['ssl_client_cert']);
}
if(!is_null($host)) {
$cb->setHosts([$host]);
}

0 comments on commit 7db1d76

Please sign in to comment.