# Facing issue while configuring TLS

**URL:** <https://discuss.elastic.co/t/facing-issue-while-configuring-tls/299691>\
**Category:** Elasticsearch\
**Created:** [March 15, 2022, 7:07am UTC](https://discuss.elastic.co/t/facing-issue-while-configuring-tls/299691 "2022-03-15T07:07:50Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![shivendra95](https://avatars.discourse-cdn.com/v4/letter/s/eb9ed0/32.png) [@shivendra95](https://discuss.elastic.co/u/shivendra95)\
**Post date:** [March 15, 2022, 7:07am UTC](https://discuss.elastic.co/t/facing-issue-while-configuring-tls/299691/1 "2022-03-15T07:07:50Z")

</div>

Hi,  
I'm, configuring Elasticsearch with TLS but facing error when I restart the Elasticsearch server  
This is my Elasticsearch.yml configuration for security

```auto
xpack.security.enabled: true
xpack.security.transport.ssl.enabled: true
xpack.security.transport.ssl.verification_mode: certificate 
xpack.security.transport.ssl.client_authentication: required
xpack.security.transport.ssl.keystore.path: elastic-certificates.p12
xpack.security.transport.ssl.truststore.path: elastic-certificates.p12

```

This is the error I'm getting

```auto
[2022-03-15T12:32:23,041][ERROR][o.e.b.Bootstrap] [es-test-node-1] Exception
java.lang.IllegalArgumentException: a key must be provided to run as a server. the key should be configured using the [xpack.security.http.ssl.key] or [xpack.security.http.ssl.keystore.path] setting
	at org.elasticsearch.xpack.security.transport.netty4.SecurityNetty4HttpServerTransport.<init>(SecurityNetty4HttpServerTransport.java:61) ~[?:?]
	at org.elasticsearch.xpack.security.Security.lambda$getHttpTransports$27(Security.java:1489) ~[?:?]
	at org.elasticsearch.node.Node.newHttpTransport(Node.java:1589) ~[elasticsearch-7.17.0.jar:7.17.0]
	at org.elasticsearch.node.Node.<init>(Node.java:818) ~[elasticsearch-7.17.0.jar:7.17.0]
	at org.elasticsearch.node.Node.<init>(Node.java:309) ~[elasticsearch-7.17.0.jar:7.17.0]
	at org.elasticsearch.bootstrap.Bootstrap$5.<init>(Bootstrap.java:234) ~[elasticsearch-7.17.0.jar:7.17.0]
	at org.elasticsearch.bootstrap.Bootstrap.setup(Bootstrap.java:234) ~[elasticsearch-7.17.0.jar:7.17.0]
	at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:434) [elasticsearch-7.17.0.jar:7.17.0]
	at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:166) [elasticsearch-7.17.0.jar:7.17.0]
	at org.elasticsearch.bootstrap.Elasticsearch.execute(Elasticsearch.java:157) [elasticsearch-7.17.0.jar:7.17.0]
	at org.elasticsearch.cli.EnvironmentAwareCommand.execute(EnvironmentAwareCommand.java:77) [elasticsearch-7.17.0.jar:7.17.0]
	at org.elasticsearch.cli.Command.mainWithoutErrorHandling(Command.java:112) [elasticsearch-cli-7.17.0.jar:7.17.0]
	at org.elasticsearch.cli.Command.main(Command.java:77) [elasticsearch-cli-7.17.0.jar:7.17.0]
	at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:122) [elasticsearch-7.17.0.jar:7.17.0]
	at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:80) [elasticsearch-7.17.0.jar:7.17.0]
[2022-03-15T12:32:23,048][ERROR][o.e.b.ElasticsearchUncaughtExceptionHandler] [es-test-node-1] uncaught exception in thread [main]
org.elasticsearch.bootstrap.StartupException: java.lang.IllegalArgumentException: a key must be provided to run as a server. the key should be configured using the [xpack.security.http.ssl.key] or [xpack.security.http.ssl.keystore.path] setting
	at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:170) ~[elasticsearch-7.17.0.jar:7.17.0]
	at org.elasticsearch.bootstrap.Elasticsearch.execute(Elasticsearch.java:157) ~[elasticsearch-7.17.0.jar:7.17.0]
	at org.elasticsearch.cli.EnvironmentAwareCommand.execute(EnvironmentAwareCommand.java:77) ~[elasticsearch-7.17.0.jar:7.17.0]
	at org.elasticsearch.cli.Command.mainWithoutErrorHandling(Command.java:112) ~[elasticsearch-cli-7.17.0.jar:7.17.0]
	at org.elasticsearch.cli.Command.main(Command.java:77) ~[elasticsearch-cli-7.17.0.jar:7.17.0]
	at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:122) ~[elasticsearch-7.17.0.jar:7.17.0]
	at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:80) ~[elasticsearch-7.17.0.jar:7.17.0]
Caused by: java.lang.IllegalArgumentException: a key must be provided to run as a server. the key should be configured using the [xpack.security.http.ssl.key] or [xpack.security.http.ssl.keystore.path] setting
	at org.elasticsearch.xpack.security.transport.netty4.SecurityNetty4HttpServerTransport.<init>(SecurityNetty4HttpServerTransport.java:61) ~[?:?]
	at org.elasticsearch.xpack.security.Security.lambda$getHttpTransports$27(Security.java:1489) ~[?:?]
	at org.elasticsearch.node.Node.newHttpTransport(Node.java:1589) ~[elasticsearch-7.17.0.jar:7.17.0]
	at org.elasticsearch.node.Node.<init>(Node.java:818) ~[elasticsearch-7.17.0.jar:7.17.0]
	at org.elasticsearch.node.Node.<init>(Node.java:309) ~[elasticsearch-7.17.0.jar:7.17.0]
	at org.elasticsearch.bootstrap.Bootstrap$5.<init>(Bootstrap.java:234) ~[elasticsearch-7.17.0.jar:7.17.0]
	at org.elasticsearch.bootstrap.Bootstrap.setup(Bootstrap.java:234) ~[elasticsearch-7.17.0.jar:7.17.0]
	at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:434) ~[elasticsearch-7.17.0.jar:7.17.0]
	at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:166) ~[elasticsearch-7.17.0.jar:7.17.0]

```

Please help me in resolving this

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [March 15, 2022, 8:24am UTC](https://discuss.elastic.co/t/facing-issue-while-configuring-tls/299691/2 "2022-03-15T08:24:43Z")

</div>

Not expert on that field but I guess that the message is telling everything:

> a key must be provided to run as a server. the key should be configured using the [xpack.security.http.ssl.key] or [xpack.security.http.ssl.keystore.path] setting

Also upgrade your version 7.17.0 is not the latest from 7.17 😉  
Or better use 8.1 which is now secured by default.

---

<div class="post-metadata">

**Author:** ![shivendra95](https://avatars.discourse-cdn.com/v4/letter/s/eb9ed0/32.png) [@shivendra95](https://discuss.elastic.co/u/shivendra95)\
**Post date:** [March 15, 2022, 8:53am UTC](https://discuss.elastic.co/t/facing-issue-while-configuring-tls/299691/3 "2022-03-15T08:53:19Z")

</div>

Even after adding the xpack.security.http.ssl.key configuration, getting the same error.

---

<div class="post-metadata">

**Author:** ![shivendra95](https://avatars.discourse-cdn.com/v4/letter/s/eb9ed0/32.png) [@shivendra95](https://discuss.elastic.co/u/shivendra95)\
**Post date:** [March 15, 2022, 9:29am UTC](https://discuss.elastic.co/t/facing-issue-while-configuring-tls/299691/4 "2022-03-15T09:29:40Z")

</div>

Hi,  
I was using the wrong configuration file this whole time, that's why this issue was coming. I have resolved it by using the correct configuration file.

---

<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:** [April 12, 2022, 9:30am UTC](https://discuss.elastic.co/t/facing-issue-while-configuring-tls/299691/5 "2022-04-12T09:30:39Z")

</div>

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