# Logstash keystore password access issue

**URL:** <https://discuss.elastic.co/t/logstash-keystore-password-access-issue/159168>\
**Category:** Logstash\
**Tags:** elastic-stack-security\
**Created:** [December 3, 2018, 12:14pm UTC](https://discuss.elastic.co/t/logstash-keystore-password-access-issue/159168 "2018-12-03T12:14:41Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![sachintanpure85](https://avatars.discourse-cdn.com/v4/letter/s/96bed5/32.png) [@sachintanpure85](https://discuss.elastic.co/u/sachintanpure85)\
**Post date:** [December 3, 2018, 12:14pm UTC](https://discuss.elastic.co/t/logstash-keystore-password-access-issue/159168/1 "2018-12-03T12:14:42Z")

</div>

Hi ,

I was using below code to check the Logstash/elasticsearch node status

ElasticResponse() {  
wget -S --no-check-certificate --spider --user {USER} --password {PASSWORD} https://${LOGSTASH\_HOST} 2\>&1 | tee -a $LOGFILE  
cat LOGFILE |grep 'HTTP/1.0 200 OK' if [? == 0]; then  
echo "`date` $SCRIPTNAME Connected to the elastic server" | tee -a $LOGFILE  
else  
return\_code=10;  
echo "`date` $SCRIPTNAME Elastic server is not working response code($return\_code)" | tee -a $LOGFILE  
exit $return\_code  
fi  
}

Now with the latest upgrade 6.3.2 , I have added USER and PASSWORD to keystore ,  
But Iam not able to access it in .ksh file (above code), where its accessible for .conf file

input {  
elasticsearch {  
hosts =\> ["LOGSTASH\_HOST"]  
user =\> "{USER}" password =\> "{PASSWORD}"  
ssl =\> true  
}

how can I access keystore password in my .ksh file or on unix machine ?

---

<div class="post-metadata">

**Author:** ![ikakavas](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ikakavas/32/34430_2.png) [@ikakavas](https://discuss.elastic.co/u/ikakavas)\
**Post date:** [December 12, 2018, 7:37am UTC](https://discuss.elastic.co/t/logstash-keystore-password-access-issue/159168/2 "2018-12-12T07:37:47Z")

</div>

Previously you had `USER` and `PASS` set as environment variables and this is why you could access them in your shell script.  
Now you can use `USER` and `PASS` in your config because these are stored in the Logstash keystore which is specific to Logstash. It is not designed to be interoperable with other system processes ( Your Korn Shell in this example ) and there is no provided way to query/get values from it so there is no out-of-the-box way to do what you need.

If you want to use the same credentials outside of Logstash, you need to handle them securely on your own.

---

<div class="post-metadata">

**Author:** ![sachintanpure85](https://avatars.discourse-cdn.com/v4/letter/s/96bed5/32.png) [@sachintanpure85](https://discuss.elastic.co/u/sachintanpure85)\
**Post date:** [December 12, 2018, 11:15am UTC](https://discuss.elastic.co/t/logstash-keystore-password-access-issue/159168/3 "2018-12-12T11:15:06Z")

</div>

@ikakavas : Thank you for your response.

I am able to use the LOGSTASH\_KEYSTORE\_PASS in my .ksh after adding as env variable.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [January 9, 2019, 11:15am UTC](https://discuss.elastic.co/t/logstash-keystore-password-access-issue/159168/4 "2019-01-09T11:15:06Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
