# Elasticsearch Keystore Authentication Failure

**URL:** <https://discuss.elastic.co/t/elasticsearch-keystore-authentication-failure/233259>\
**Category:** Elasticsearch\
**Created:** [May 19, 2020, 7:19am UTC](https://discuss.elastic.co/t/elasticsearch-keystore-authentication-failure/233259 "2020-05-19T07:19:18Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Aidan\_Li](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/aidan_li/32/68606_2.png) [@Aidan\_Li](https://discuss.elastic.co/u/Aidan_Li)\
**Post date:** [May 19, 2020, 7:19am UTC](https://discuss.elastic.co/t/elasticsearch-keystore-authentication-failure/233259/1 "2020-05-19T07:19:18Z")

</div>

I have a GCP bucket, and machines running with ES 7.6.1 in two separate clusters:

- cluster 0, with machines "machine 0"
- cluster 1, with machines "machine 1"
- GCP Bucket

My goal is:

1. register a repository with this GCP Bucket on machine 0
2. snapshot to this bucket with machine 0
3. register a repository with this GCP Bucket on machine 1
4. restore from the snapshot created by machine 0

For both machines, I have:

1. installed [repository-gcs](https://www.elastic.co/guide/en/elasticsearch/plugins/current/repository-gcs.html)
2. added the credentials to ES: `elasticsearch-keystore add-file gcs.client.default.credentials_file <service_account.json>`
3. `POST localhost:9200/_nodes/reload_secure_settings` to reset the secure settings.
4. Restart ES (only necessary on older versions of ES, but I tried it anyway)

From there I am able to:

1. Register a repository with this GCP Bucket on machine 0
2. Snapshot to the bucket
3. Restore from this snapshot back to machine 0

However, I am _not_ able to register, snapshot, or restore following the **exact** same steps on machine 1. I have tried at least 10 times on multiple different machines from each cluster and am able to reliably interact only with machines from cluster 0.

For machines from cluster 1, I get this authentication error:

```auto
curl -X PUT "localhost:9200/_snapshot/test-backup?pretty" -H 'Content-Type: application/json' -d'
> {
> "type": "gcs",
> "settings": {
> "bucket": "<bucket>",
> "base_path": "backup"
> }
> }
> '
{
  "error" : {
    "root_cause" : [
      {
        "type" : "blob_store_exception",
        "reason" : "Unable to check if bucket exists"
      }
    ],
    "type" : "repository_exception",
    "reason" : "[test-backup] cannot create blob store",
    "caused_by" : {
      "type" : "blob_store_exception",
      "reason" : "Unable to check if bucket exists",
      "caused_by" : {
        "type" : "security_exception",
        "reason" : "access denied (\"java.lang.RuntimePermission\" \"accessDeclaredMembers\")"
      }
    }
  },
  "status" : 500
}

```

On machines from cluster 1, I can even access the bucket using [gsutil](https://cloud.google.com/storage/docs/gsutil/commands/ls), so I don't believe it's a network configuration issue.

I am completely out of ideas as to why two machines, with the same version of ES, configured the same way with `elasticsearcy-keystore` with the same service account would behave differently in this scenario.

Any suggestions would be greatly appreciated.

---

<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 16, 2020, 7:19am UTC](https://discuss.elastic.co/t/elasticsearch-keystore-authentication-failure/233259/2 "2020-06-16T07:19:20Z")

</div>

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