# How to pass encrypted USerName and Password in Logstash

**URL:** <https://discuss.elastic.co/t/how-to-pass-encrypted-username-and-password-in-logstash/132771>\
**Category:** Logstash\
**Created:** [May 22, 2018, 9:46am UTC](https://discuss.elastic.co/t/how-to-pass-encrypted-username-and-password-in-logstash/132771 "2018-05-22T09:46:08Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sekhar1](https://avatars.discourse-cdn.com/v4/letter/s/e19adc/32.png) [@Sekhar1](https://discuss.elastic.co/u/Sekhar1)\
**Post date:** [May 22, 2018, 9:46am UTC](https://discuss.elastic.co/t/how-to-pass-encrypted-username-and-password-in-logstash/132771/1 "2018-05-22T09:46:08Z")

</div>

Elastic Search Version 6.0.0  
Logstash version 6.0.0

logstash.conf file  
input {  
jdbc {  
jdbc\_connection\_string =\> "jdbc:postgresql://DbIP:port/DatabaseName"  
jdbc\_user =\> "dbuser"  
jdbc\_password =\> "dbpassword"  
jdbc\_driver\_class =\> "org.postgresql.Driver"  
jdbc\_driver\_library =\> "/home/Downloads/postgresql-42.1.4.jar"  
jdbc\_validate\_connection =\> true  
statement =\> 'select \*from order\_tbl'  
use\_column\_value =\> true  
tracking\_column\_type =\>"numeric"  
tracking\_column =\> "ford\_id"  
clean\_run =\> true  
}  
}  
output {  
elasticsearch {  
user =\> ESUser   
password =\> ESPassword  
ssl =\> true  
sniffing =\> true  
index =\> "1\_999"  
document\_type =\> "1\_999"  
document\_id =\> "%{ford\_id}"  
hosts =\> ["[https://ESIp](https://ESIp):Port"]  
}  
}

In the above conf file I specified actual username and password of DB and ES.I want to pass encrypt username and password of DB as well Elastic Search .Because of security reasons I can't hard code those values.I can't take read from Environment variable also.I Want to use AES algoritham for encrytion purpose.

One more thing How to decrypt in Elastic Search Side if Encrypted username and password came into the Elastic Search.

Please help as soon as possible.

---

<div class="post-metadata">

**Author:** ![magnusbaeck](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/magnusbaeck/32/44943_2.png) [@magnusbaeck](https://discuss.elastic.co/u/magnusbaeck)\
**Post date:** [May 22, 2018, 10:17am UTC](https://discuss.elastic.co/t/how-to-pass-encrypted-username-and-password-in-logstash/132771/2 "2018-05-22T10:17:46Z")

</div>

> In the above conf file I specified actual username and password of DB and ES.I want to pass encrypt username and password of DB as well Elastic Search

That's not supported.

---

<div class="post-metadata">

**Author:** ![Sekhar1](https://avatars.discourse-cdn.com/v4/letter/s/e19adc/32.png) [@Sekhar1](https://discuss.elastic.co/u/Sekhar1)\
**Post date:** [May 22, 2018, 10:30am UTC](https://discuss.elastic.co/t/how-to-pass-encrypted-username-and-password-in-logstash/132771/3 "2018-05-22T10:30:48Z")

</div>

You mean say encrypted username and password of Database can't pass?  
encrypted username and password of Elastic search can't pass?

Any latest version will support or not?.

Security reasons I can't pass actual value to conf file.

Any Way of writing wrapper class of logstash ?

---

<div class="post-metadata">

**Author:** ![magnusbaeck](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/magnusbaeck/32/44943_2.png) [@magnusbaeck](https://discuss.elastic.co/u/magnusbaeck)\
**Post date:** [May 22, 2018, 10:41am UTC](https://discuss.elastic.co/t/how-to-pass-encrypted-username-and-password-in-logstash/132771/4 "2018-05-22T10:41:37Z")

</div>

Logstash doesn't support storing encrypted credentials in its configuration file. Not for the jdbc input and not for the elasticsearch output.

> Any Way of writing wrapper class of logstash ?

I'm not sure what you mean but that, but it's certainly an option to contribute to the plugins in question (or fork them locally).

---

<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:** [June 19, 2018, 10:41am UTC](https://discuss.elastic.co/t/how-to-pass-encrypted-username-and-password-in-logstash/132771/5 "2018-06-19T10:41:39Z")

</div>

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