# Getting 'missing auth credentials' after setting SSL in Elasticsearch

**URL:** <https://discuss.elastic.co/t/getting-missing-auth-credentials-after-setting-ssl-in-elasticsearch/235906>\
**Category:** Elasticsearch\
**Created:** [June 5, 2020, 7:54am UTC](https://discuss.elastic.co/t/getting-missing-auth-credentials-after-setting-ssl-in-elasticsearch/235906 "2020-06-05T07:54:18Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![tmporary](https://avatars.discourse-cdn.com/v4/letter/t/7bcc69/32.png) [@tmporary](https://discuss.elastic.co/u/tmporary)\
**Post date:** [June 5, 2020, 7:54am UTC](https://discuss.elastic.co/t/getting-missing-auth-credentials-after-setting-ssl-in-elasticsearch/235906/1 "2020-06-05T07:54:18Z")

</div>

Hi,

Recently I set up ssl for HTTP and TCP in elasticsearch but I'm constantly getting below error when trying to call elastic API

`curl -k --cert MY_CERT.pem:Password 'https://localhost:9200/_xpack/security/_authenticate?pretty'`

Error:

```
 "error" : {
    "root_cause" : [
      {
        "type" : "security_exception",
        "reason" : "missing authentication credentials for REST request [/_xpack/security/_authenticate?pretty]",
        "header" : {
          "WWW-Authenticate" : [
            "Bearer realm=\"security\"",
            "ApiKey",
            "Basic realm=\"security\" charset=\"UTF-8\""
          ]
        }
      }
    ],
    "type" : "security_exception",
    "reason" : "missing authentication credentials for REST request [/_xpack/security/_authenticate?pretty]",
    "header" : {
      "WWW-Authenticate" : [
        "Bearer realm=\"security\"",
        "ApiKey",
        "Basic realm=\"security\" charset=\"UTF-8\""
      ]
    }
  },
  "status" : 401
}

```

Elastic config:

```
cluster.name: local_test_cluster

node.name: master_main

network.host: 0.0.0.0

bootstrap.memory_lock: true

node.master: true
node.data: false

discovery.seed_hosts: localhost:9300

cluster.initial_master_nodes: master_main

xpack:
  security:
    enabled: true
    transport:
      ssl:
        enabled: true
        verification_mode: certificate
        keystore:
          path: certs/cert.p12
          password: xyz
          type: PKCS12
        truststore:
          path: certs/cert.p12
          password: xyz
          type: PKCS12
    http:
      ssl:
        enabled: true
        verification_mode: certificate
        client_authentication: optional
        keystore:
          path: certs/cert.p12
          password: xyz
          type: PKCS12
        truststore:
          path: certs/cert.p12
          password: XYZ
          type: PKCS12
  monitoring:
    enabled: true

```

I've tried running:

`bin/elasticsearch-setup-passwords interactive`

and then

`curl -k --cert MY_CERT.pem:PASWORD -u elastic:password 'https://localhost:9200/_xpack/security/_authenticate?pretty'`

but then I'm getting:

```
{
  "error" : {
    "root_cause" : [
      {
        "type" : "security_exception",
        "reason" : "failed to authenticate user [elastic]",
        "header" : {
          "WWW-Authenticate" : [
            "Bearer realm=\"security\"",
            "ApiKey",
            "Basic realm=\"security\" charset=\"UTF-8\""
          ]
        }
      }
    ],
    "type" : "security_exception",
    "reason" : "failed to authenticate user [elastic]",
    "header" : {
      "WWW-Authenticate" : [
        "Bearer realm=\"security\"",
        "ApiKey",
        "Basic realm=\"security\" charset=\"UTF-8\""
      ]
    }
  },
  "status" : 401
}

```

Even if that worked then Id have to do this in my target environment where elastic is deployed and I cannot do that. Can someone help on this one?

---

<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:** [July 3, 2020, 7:54am UTC](https://discuss.elastic.co/t/getting-missing-auth-credentials-after-setting-ssl-in-elasticsearch/235906/2 "2020-07-03T07:54:22Z")

</div>

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