Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

check_elasticsearch_cluster_status.pl doesnt send credentials #348

Open
FallingSkie opened this issue Oct 9, 2020 · 2 comments
Open

check_elasticsearch_cluster_status.pl doesnt send credentials #348

FallingSkie opened this issue Oct 9, 2020 · 2 comments

Comments

@FallingSkie
Copy link

Hello,

I have upgraded my version from 0.2.0 to 0.3.0 because of the implemented auth-method. But every time I'm trying this I get an error. First I thought it is my command, but my command was right. Than I thought it is our Proxy or our Firewall. But nothing, still the same issue. Then I tcpdumped it, and my username and password didnt get submitted.
Here is my command (i have replaced a few data):
./check_elasticsearch_cluster_status.pl -H host(replaced).domain(replaced) --user username(replaced) --password password(replaced) -C clustername(replaced) -vvv

The error I get:
check_elasticsearch_cluster_status.pl version 0.3.0 => Hari Sekhon Utils version 1.18.6

host: host(replaced).domain(replaced)
port: 9200
user: username(replaced)
password:
cluster: clustername(replaced)

setting timeout to 10 secs

querying Elasticsearch
HTTP GET http://host(replaced).domain(replaced):9200/_cluster/health?pretty=true
returned HTML:

{
"error" : {
"root_cause" : [
{
"type" : "security_exception",
"reason" : "missing authentication credentials for REST request [/_cluster/health?pretty=true]",
"header" : {
"WWW-Authenticate" : "Basic realm="security" charset="UTF-8""
}
}
],
"type" : "security_exception",
"reason" : "missing authentication credentials for REST request [/_cluster/health?pretty=true]",
"header" : {
"WWW-Authenticate" : "Basic realm="security" charset="UTF-8""
}
},
"status" : 401
}

http status code: 401
http status message: Unauthorized

CRITICAL: 401 Unauthorized. Error: security_exception: missing authentication credentials for REST request [/_cluster/health?pretty=true]

Here the TCPDUMP:
tcpdump:
GET /_cluster/health?pretty=true HTTP/1.1
TE: deflate,gzip;q=0.3
Connection: TE, close
Host: host(replaced).domain(replaced):9200
User-Agent: Hari Sekhon check_elasticsearch_cluster_status.pl version 0.3.0

If I make an API-call with the same data it works pretty fine. But from the server nothing!

Thanks for your help.

LG

@HariSekhon
Copy link
Owner

Set -vvv, you should see something like this to tell you if the basic authentication is being sent:

./check_elasticsearch.pl --user hari --password test -H localhost -vvv
verbose mode on

check_elasticsearch.pl version 0.4.0  =>  Hari Sekhon Utils version 1.19.6

host:                     localhost
port:                     9200
user:                     hari
password:                 <omitted>

setting timeout to 10 secs

querying Elasticsearch
HTTP GET http://localhost:9200/?pretty=true (basic authentication)
...

Basically this is handled in my underlying libraries such that is $user and $password are set them it automatically enables authentication:

https://github.com/HariSekhon/lib/blob/master/HariSekhon/Elasticsearch.pm#L182

which calls and enables it here:

https://github.com/HariSekhon/lib/blob/master/HariSekhonUtils.pm#L1446

@HariSekhon
Copy link
Owner

Did you resolve this or could you post the debug -v -v -v output?

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants