How to configure secure_password for an xpack email?

  1. I have configured email/smtp/user in my docker-compose.yml file.
  2. Added action to send email from watcher.
  3. Watcher executed and throwing error. I need to configure secure_password when i add into docker compose, ElasticSearch is not allowing sensitive data in the configuration. Should use keystore or some other way. Please help.

1> docker-compose.yml configuration:
services:
es-master:
container_name: es-master
environment:
- node.name=es-master
- xpack.watcher.enabled=true
- xpack.notification.email.account.outlook_account.profile=outlook
- xpack.notification.email.account.outlook_account.smtp.auth=true
- xpack.notification.email.account.outlook_account.smtp.starttls.enable=true
- xpack.notification.email.account.outlook_account.smtp.host=emailhostserver
- xpack.notification.email.account.outlook_account.smtp.port=25
- xpack.notification.email.account.outlook_account.smtp.user=MANOJ.G@companyemail.com

2> error from watcher _execute:
"actions" : [
{
"id" : "send_email",
"type" : "email",
"status" : "failure",
"error" : {
"root_cause" : [
{
"type" : "messaging_exception",
"reason" : "failed to send email with subject [TEST: Watcher Notification] via account [outlook_account]"
}
],
"type" : "messaging_exception",
"reason" : "failed to send email with subject [TEST: Watcher Notification] via account [outlook_account]",
"caused_by" : {
"type" : "authentication_failed_exception",
"reason" : "failed to connect, no password specified?"
}
}
}
]

3> specified pwd in docker-compose.yml
- xpack.notification.email.account.outlook_account.smtp.secure_password=abceEdmdb

Observed error:-

"Caused by: java.lang.IllegalArgumentException: Setting [xpack.notification.email.account.outlook_account.smtp.secure_password] is a secure setting and must be stored inside the Elasticsearch keystore, but was found inside elasticsearch.yml",

How to configure secure_password, please help?

See https://www.elastic.co/guide/en/elasticsearch/reference/master/docker.html#docker-keystore-bind-mount

You need to create a keystore and mount it into your image.