# Es service failed with AD shield

**URL:** https://discuss.elastic.co/t/es-service-failed-with-ad-shield/54817
**Category:** Elasticsearch
**Tags:** elastic-stack-security
**Created:** [July 6, 2016, 11:53am UTC](https://discuss.elastic.co/t/es-service-failed-with-ad-shield/54817 "2016-07-06T11:53:06Z")
**Posts on this page:** 14
**Page:** 1

<div class="post-metadata">

### Author: ![gilisade](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/gilisade/32/98740_2.png) [@gilisade](https://discuss.elastic.co/u/gilisade)
#### Post date: [July 6, 2016, 11:53am UTC](https://discuss.elastic.co/t/es-service-failed-with-ad-shield/54817/1 "2016-07-06T11:53:06Z")

</div>

hi added these lines to my ES server at elasticsearch.yml  
shield.authc.realms:  
active\_directory:  
type: active\_directory  
order: 0  
domain\_name: [domain.com](http://domain.com)  
unmapped\_groups\_as\_roles: true  
url: ldap://domain.com

after doing that , the elasticsearch service won't start  
nothing in the logs , when commenting out these lines everything is working just fine  
am i missing something?

---

<div class="post-metadata">

### Author: ![gilisade](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/gilisade/32/98740_2.png) [@gilisade](https://discuss.elastic.co/u/gilisade)
#### Post date: [July 6, 2016, 11:57am UTC](https://discuss.elastic.co/t/es-service-failed-with-ad-shield/54817/2 "2016-07-06T11:57:30Z")

</div>

forgot to add :  
i have shield installed properly and so far i have used basic authentication  
and everything worked

---

<div class="post-metadata">

### Author: ![jaymode](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jaymode/32/50103_2.png) [@jaymode](https://discuss.elastic.co/u/jaymode)
#### Post date: [July 6, 2016, 12:24pm UTC](https://discuss.elastic.co/t/es-service-failed-with-ad-shield/54817/3 "2016-07-06T12:24:21Z")

</div>

what version of shield are you using?

---

<div class="post-metadata">

### Author: ![gilisade](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/gilisade/32/98740_2.png) [@gilisade](https://discuss.elastic.co/u/gilisade)
#### Post date: [July 6, 2016, 1:04pm UTC](https://discuss.elastic.co/t/es-service-failed-with-ad-shield/54817/4 "2016-07-06T13:04:40Z")

</div>

Hi, thanks for your reply  
Im using shield 2.3

---

<div class="post-metadata">

### Author: ![jaymode](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jaymode/32/50103_2.png) [@jaymode](https://discuss.elastic.co/u/jaymode)
#### Post date: [July 6, 2016, 1:33pm UTC](https://discuss.elastic.co/t/es-service-failed-with-ad-shield/54817/5 "2016-07-06T13:33:21Z")

</div>

Is that 2.3.0? Can you try 2.3.2? [https://www.elastic.co/guide/en/shield/current/release-notes.html#\_2\_3\_2](https://www.elastic.co/guide/en/shield/current/release-notes.html#_2_3_2)

---

<div class="post-metadata">

### Author: ![gilisade](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/gilisade/32/98740_2.png) [@gilisade](https://discuss.elastic.co/u/gilisade)
#### Post date: [July 6, 2016, 1:36pm UTC](https://discuss.elastic.co/t/es-service-failed-with-ad-shield/54817/6 "2016-07-06T13:36:15Z")

</div>

it's 2.3.3 actually

---

<div class="post-metadata">

### Author: ![gilisade](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/gilisade/32/98740_2.png) [@gilisade](https://discuss.elastic.co/u/gilisade)
#### Post date: [July 6, 2016, 1:39pm UTC](https://discuss.elastic.co/t/es-service-failed-with-ad-shield/54817/7 "2016-07-06T13:39:07Z")

</div>

by the way  
any shiled setting i put in the elasticsearch.yml , after restart , the es service fails  
like i tried to add this setting : shield.audit.enabled  
and again restarted the service and again it faild

---

<div class="post-metadata">

### Author: ![jaymode](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jaymode/32/50103_2.png) [@jaymode](https://discuss.elastic.co/u/jaymode)
#### Post date: [July 6, 2016, 1:59pm UTC](https://discuss.elastic.co/t/es-service-failed-with-ad-shield/54817/8 "2016-07-06T13:59:09Z")

</div>

Have you tried starting elasticsearch manually `bin/elasticsearch` rather than as a service to see if any exception is printed?

---

<div class="post-metadata">

### Author: ![gilisade](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/gilisade/32/98740_2.png) [@gilisade](https://discuss.elastic.co/u/gilisade)
#### Post date: [July 7, 2016, 6:29am UTC](https://discuss.elastic.co/t/es-service-failed-with-ad-shield/54817/9 "2016-07-07T06:29:57Z")

</div>

yes , got this message  
Exception in thread "main" ElasticsearchException[Failed to load logging configu ration]; nested: NoSuchFileException[/usr/share/elasticsearch/config];  
Likely root cause: java.nio.file.NoSuchFileException: /usr/share/elasticsearch/c onfig  
at sun.nio.fs.UnixException.translateToIOException(UnixException.java:86 )  
at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:102)  
at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:107)  
at sun.nio.fs.UnixFileAttributeViews$Basic.readAttributes(UnixFileAttrib uteViews.java:55)  
at sun.nio.fs.UnixFileSystemProvider.readAttributes(UnixFileSystemProvid er.java:144)  
at sun.nio.fs.LinuxFileSystemProvider.readAttributes(LinuxFileSystemProv ider.java:99)  
at java.nio.file.Files.readAttributes(Files.java:1737)  
at java.nio.file.FileTreeWalker.getAttributes(FileTreeWalker.java:225)  
at java.nio.file.FileTreeWalker.visit(FileTreeWalker.java:276)  
at java.nio.file.FileTreeWalker.walk(FileTreeWalker.java:322)  
at java.nio.file.Files.walkFileTree(Files.java:2662)  
at org.elasticsearch.common.logging.log4j.LogConfigurator.resolveConfig( LogConfigurator.java:142)  
at org.elasticsearch.common.logging.log4j.LogConfigurator.configure(LogC onfigurator.java:103)  
at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:243)  
at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:35)  
Refer to the log for complete error details.

---

<div class="post-metadata">

### Author: ![gilisade](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/gilisade/32/98740_2.png) [@gilisade](https://discuss.elastic.co/u/gilisade)
#### Post date: [July 7, 2016, 6:35am UTC](https://discuss.elastic.co/t/es-service-failed-with-ad-shield/54817/10 "2016-07-07T06:35:42Z")

</div>

ok , i've moved the ymls files to the /usr/share/elasticsearch/config dorectory and now i'm getting this:

Exception in thread "main" SettingsException[Failed to load settings from [elasticsearch.yml]]; nested: E lasticsearchParseException[malformed, expected end of settings but encountered additional content startin g at line number: [97], column number: [1]]; nested: ParserException[expected '', but fou nd BlockMappingStart  
in 'reader', line 97, column 1:  
shield.authc.realms:  
^  
];  
Likely root cause: expected '', but found BlockMappingStart  
in 'reader', line 97, column 1:  
shield.authc.realms:  
^

```
    at com.fasterxml.jackson.dataformat.yaml.snakeyaml.parser.ParserImpl$ParseDocumentStart.produce(P arserImpl.java:225)
    at com.fasterxml.jackson.dataformat.yaml.snakeyaml.parser.ParserImpl.peekEvent(ParserImpl.java:15 8)
    at com.fasterxml.jackson.dataformat.yaml.snakeyaml.parser.ParserImpl.getEvent(ParserImpl.java:168 )
    at com.fasterxml.jackson.dataformat.yaml.YAMLParser.nextToken(YAMLParser.java:342)
    at org.elasticsearch.common.xcontent.json.JsonXContentParser.nextToken(JsonXContentParser.java:53 )
    at org.elasticsearch.common.settings.loader.XContentSettingsLoader.load(XContentSettingsLoader.ja va:72)
    at org.elasticsearch.common.settings.loader.XContentSettingsLoader.load(XContentSettingsLoader.ja va:45)
    at org.elasticsearch.common.settings.loader.YamlSettingsLoader.load(YamlSettingsLoader.java:46)
    at org.elasticsearch.common.settings.Settings$Builder.loadFromStream(Settings.java:1080)
    at org.elasticsearch.common.settings.Settings$Builder.loadFromPath(Settings.java:1067)
    at org.elasticsearch.node.internal.InternalSettingsPreparer.prepareEnvironment(InternalSettingsPr eparer.java:88)
    at org.elasticsearch.common.cli.CliTool.<init>(CliTool.java:107)
    at org.elasticsearch.common.cli.CliTool.<init>(CliTool.java:100)
    at org.elasticsearch.bootstrap.BootstrapCLIParser.<init>(BootstrapCLIParser.java:48)
    at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:226)
    at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:35)

```

Refer to the log for complete error details.

---

<div class="post-metadata">

### Author: ![gilisade](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/gilisade/32/98740_2.png) [@gilisade](https://discuss.elastic.co/u/gilisade)
#### Post date: [July 7, 2016, 8:04am UTC](https://discuss.elastic.co/t/es-service-failed-with-ad-shield/54817/11 "2016-07-07T08:04:13Z")

</div>

i dont know why but now the service is starting stays active for 4-5 sec and then fails again with the following error in the log file :  
java.lang.IllegalArgumentException: missing realm type for [domain\_name] realm  
at org.elasticsearch.shield.authc.Realms.initRealms(Realms.java:111)  
at org.elasticsearch.shield.authc.Realms.doStart(Realms.java:59)  
at org.elasticsearch.common.component.AbstractLifecycleComponent.start(AbstractLifecycleComponent.java:68)  
at org.elasticsearch.node.Node.start(Node.java:255)  
at org.elasticsearch.bootstrap.Bootstrap.start(Bootstrap.java:206)  
at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:272)  
at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:35)  
[2016-07-07 10:58:13,152][INFO][node] [elastic\_test\_02] stopping ...  
[2016-07-07 10:58:13,152][INFO][node] [elastic\_test\_02] stopped  
[2016-07-07 10:58:13,152][INFO][node] [elastic\_test\_02] closing ...  
[2016-07-07 10:58:13,158][INFO][node] [elastic\_test\_02] closed

---

<div class="post-metadata">

### Author: ![jaymode](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jaymode/32/50103_2.png) [@jaymode](https://discuss.elastic.co/u/jaymode)
#### Post date: [July 7, 2016, 10:46am UTC](https://discuss.elastic.co/t/es-service-failed-with-ad-shield/54817/12 "2016-07-07T10:46:05Z")

</div>

It seems like your elasticsearch.yml file isn't formatted correctly. Can you upload the actual file and preserve formatting?

---

<div class="post-metadata">

### Author: ![gilisade](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/gilisade/32/98740_2.png) [@gilisade](https://discuss.elastic.co/u/gilisade)
#### Post date: [July 7, 2016, 11:24am UTC](https://discuss.elastic.co/t/es-service-failed-with-ad-shield/54817/13 "2016-07-07T11:24:12Z")

</div>

Yes , you were right , the format was bad .. i played around a little bit with the spaces and tabs , that solved it  
Thanks you so mach for your help!

---

<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 6, 2017, 1:42pm UTC](https://discuss.elastic.co/t/es-service-failed-with-ad-shield/54817/14 "2017-07-06T13:42:55Z")

</div>


