etsy / 411

An Alert Management Web Application
https://demo.fouroneone.io
MIT License
971 stars 112 forks source link

missing authentication token for REST request #130

Closed tatdatpham closed 7 years ago

tatdatpham commented 7 years ago

Im ussing ES 5.40, enabled xpack. When i create new search for testing, i got error

[Thu Jun 22 01:27:09.960161 2017] [:error] [pid 22170] [client 192.168.71.1:52208] except [NONE] FOO\\SearchException: "{"error":{"root_cause":[{"type":"security_exception","reason":"missing authentication token for REST request [/%5Bfb-fim-terminal-%5D/_search?ignore_unavailable=true]","header":{"WWW-Authenticate":"Basic realm=\\"security\\" charset=\\"UTF-8\\""}}],"type":"security_exception","reason":"missing authentication token for REST request [/%5Bfb-fim-terminal-%5D/_search?ignore_unavailable=true]","header":{"WWW-Authenticate":"Basic realm=\\"security\\" charset=\\"UTF-8\\""}},"status":401}" at [/var/www/411/phplib/Search/Elasticsearch.php:286] 0:[FOO\\Elasticsearch_Search->search() called at [/var/www/411/phplib/Search/Elasticsearch.php:118]] 1:[FOO\\Elasticsearch_Search->_execute() called at [/var/www/411/phplib/Search.php:263]] 2:[FOO\\Search->execute() called at [/var/www/411/phplib/Job/Search.php:58]] 3:[FOO\\Search_Job->_run() called at [/var/www/411/phplib/REST/Searches.php:206]] 4:[FOO\\Searches_REST->test() called at [/var/www/411/phplib/REST/Searches.php:60]] 5:[FOO\\Searches_REST->POST() called at [/var/www/411/phplib/REST.php:108]] 6:[FOO\\REST->route() called at [/var/www/411/htdocs/api/searches.php:6]], referer: http://alert.log.ho.fpt.vn/searches/new?type=es
[Thu Jun 22 01:27:10.150854 2017] [:error] [pid 22170] [client 192.168.71.1:52208] except [NONE] Elasticsearch\\Common\\Exceptions\\BadRequest400Exception: "" at [/var/www/411/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Connections/Connection.php:610] 0:[Elasticsearch\\Connections\\Connection->process4xxError() called at [/var/www/411/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Connections/Connection.php:273]] 1:[Elasticsearch\\Connections\\Connection->Elasticsearch\\Connections\\{closure}() called at [/var/www/411/vendor/react/promise/src/FulfilledPromise.php:25]] 2:[React\\Promise\\FulfilledPromise->then() called at [/var/www/411/vendor/guzzlehttp/ringphp/src/Future/CompletedFutureValue.php:55]] 3:[GuzzleHttp\\Ring\\Future\\CompletedFutureValue->then() called at [/var/www/411/vendor/guzzlehttp/ringphp/src/Core.php:341]] 4:[GuzzleHttp\\Ring\\Core::proxy() called at [/var/www/411/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Connections/Connection.php:294]] 5:[Elasticsearch\\Connections\\Connection->Elasticsearch\\Connections\\{closure}() called at [/var/www/411/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Connections/Connection.php:171]] 6:[Elasticsearch\\Connections\\Connection->performRequest() called at [/var/www/411/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Transport.php:100]] 7:[Elasticsearch\\Transport->performRequest() called at [/var/www/411/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Namespaces/BooleanRequestWrapper.php:38]] 8:[Elasticsearch\\Namespaces\\BooleanRequestWrapper::performRequest() called at [/var/www/411/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Namespaces/IndicesNamespace.php:689]] 9:[Elasticsearch\\Namespaces\\IndicesNamespace->existsTemplate() called at [/var/www/411/phplib/ESClient.php:71]] 10:[FOO\\ESClient->initializeIndex() called at [/var/www/411/phplib/ESClient.php:33]] 11:[FOO\\ESClient->__construct() called at [/var/www/411/phplib/Target/DB.php:22]] 12:[FOO\\DB_Target->__construct() called at [/var/www/411/phplib/Job/Search.php:73]] 13:[FOO\\Search_Job->_run() called at [/var/www/411/phplib/REST/Searches.php:206]] 14:[FOO\\Searches_REST->test() called at [/var/www/411/phplib/REST/Searches.php:60]] 15:[FOO\\Searches_REST->POST() called at [/var/www/411/phplib/REST.php:108]] 16:[FOO\\REST->route() called at [/var/www/411/htdocs/api/searches.php:6]], referer: http://alert.log.ho.fpt.vn/searches/new?type=es

How to config username + pass when access to ES ? (i'm ussing XPACK) And how to config option for slack work behind proxy?

Thanks you!

kiwiz commented 7 years ago

You can pass credentials directly in the array of hosts. Example: 'http://user:pass@localhost:9200'