Skip to content

elasticsearch-keystore add --stdin does not behave like add-file #39993

@thna123459

Description

@thna123459

This is related to: #35433

Elasticsearch version (bin/elasticsearch --version):

6.6.1

Description of the problem including expected versus actual behavior:

Keystore data inserted with elasticsearch-keystore add --stdin is unusable for GCS credentials while data inserted using elasticsearch-keystore add-file is perfectly fine.

It is not clear if this really is the intended behaviour:
https://github.com/elastic/elasticsearch/blob/master/server/src/main/java/org/elasticsearch/common/settings/KeyStoreWrapper.java#L542

If yes, then at least the Puppet code will need adjustments to bind types to credentials because it only supports add --stdin at this point:
https://github.com/elastic/puppet-elasticsearch/blob/master/lib/puppet/provider/elasticsearch_keystore/elasticsearch_keystore.rb

This needs to be described there at least:
https://www.elastic.co/guide/en/elasticsearch/plugins/current/repository-gcs-usage.html

Steps to reproduce:

Loading data with using:

cat /secrets/file | /usr/share/elasticsearch/bin/elasticsearch-keystore add --force --stdin  gcs.client.XYZ.credentials_file

... produces an error upon POST _nodes/reload_secure_settings:

   {
      "name" : "mynode.net",
      "reload_exception" : {
        "type" : "illegal_argument_exception",
        "reason" : "Secret setting gcs.client.XYZ.credentials_file is not a file"
      }
    }

While inserting the same data using add-file does not output any error

/usr/share/elasticsearch/bin/elasticsearch-keystore add-file --force gcs.client.XYZ.credentials_file /secrets/file

Note: The keystores do not have the same file sizes on disk (2559 bytes with --stdin, 2557 with add-file).

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions