# Not executing initial sgadmin

**URL:** <https://forum.search-guard.com/t/not-executing-initial-sgadmin/1288>\
**Category:** Search Guard\
**Created:** [January 17, 2019, 5:46pm UTC](https://forum.search-guard.com/t/not-executing-initial-sgadmin/1288 "2019-01-17T17:46:28Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Natalie\_Goldman](https://avatars.discourse-cdn.com/v4/letter/n/e95f7d/32.png) [@Natalie\_Goldman](https://forum.search-guard.com/u/Natalie_Goldman)\
**Post date:** [January 17, 2019, 5:46pm UTC](https://forum.search-guard.com/t/not-executing-initial-sgadmin/1288/1 "2019-01-17T17:46:28Z")

</div>

Dear Search Guard Community,

I am trying to install the Search Guard Plugin to elasticstack products running with/on a docker container and my final aim is to automate this partly with a script (attached) and some commands in the dockerfile.

My problem:

If I run sgadmin with the script this very classic error message appears:

"Search Guard Admin v6

Will connect to localhost:9300

ERR: Seems there is no Elasticsearch running on localhost:9300 - Will exit"

If I execute sgadmin a second time (manually) in the container (exact parameters given in the script), the following message appears:

Will connect to localhost:9300 … done

Unable to check whether cluster is sane: Cannot authenticate null  
Connected as CN=kirk.localhost,OU=Ops,O=localhost, Inc.,DC=localhost  
ERR: CN=kirk.localhost,OU=Ops,O=localhost, Inc.,DC=localhost is not an admin user  
Seems you use a client certificate but this one is not registered as admin\_dn  
Make sure elasticsearch.yml on all nodes contains:  
searchguard.authcz.admin\_dn:

- “CN=kirk.localhost,OU=Ops,O=localhost, Inc.,DC=localhost”

So both messages are mentioned in your documentation [sgadmin Troubleshooting | Security for Elasticsearch | Search Guard](https://docs.search-guard.com/latest/troubleshooting-sgadmin.html) and as far as I understand I did list `searchguard.authcz.admin_dn in my elasticsearch.yml and "kirk" is my amdin, because I declared "admin: true2 -right?!`

` `

`Considering the elastic logs, there are "issues" with kibana and x-pack, but if I configure kibana (right now uncommented in the script) I still can't execute sg_admin (bellow). `

I would be absolutly greatful for any answer. Thank you for Search Guard and your answersanyways \<3

[config\_sg\_sh.txt](https://forum.search-guard.com/uploads/short-url/vGibZ1JoVGZGovyn2mJigS9m9Kn.txt) (3.13 KB)

[elasticsearch.yml](https://forum.search-guard.com/uploads/short-url/zrDgxADp7Ya1i1DcGP5tSMtlqYl.yml) (3.43 KB)

[config.yml](https://forum.search-guard.com/uploads/short-url/bmG2CvorO6972RwthHCbA8Z7gvQ.yml) (838 Bytes)

> **···**
>
> * * *
> 
> When asking questions, please provide the following information:
> 
> - Search Guard and Elasticsearch version
> 
> search-guard-6:6.4.2-23.1, elasticsearchversion 6.4.2
> 
> - Installed and used enterprise modules, if any
> 
> none
> 
> - JVM version and operating system version
> 
> openjdk version “1.8.0\_181”  
> OpenJDK Runtime Environment (build 1.8.0\_181-8u181-b13-0ubuntu0.16.04.1-b13)  
> OpenJDK 64-Bit Server VM (build 25.181-b13, mixed mode) running in a docker container
> 
> - Search Guard configuration files
> 
> attached
> 
> - Elasticsearch log messages on debug level
> 
> {“type”:“log”,“@timestamp”:“2019-01-17T17:14:26Z”,“tags”:[“warning”,“stats-collection”],“pid”:295,“message”:“Unable to fetch data from reporting collector”}  
> {“type”:“error”,“@timestamp”:“2019-01-17T17:14:36Z”,“tags”:[“warning”,“stats-collection”],“pid”:295,“level”:“error”,“error”:{“message”:“Authentication Exception”,“name”:“Error”,“stack”:“Authentication Exception :: {"path":"/.kibana/\_search","query":{"ignore\_unavailable":true,"filter\_path":"aggregations.types.buckets"},"body":"{\"size\":0,\"query\":{\"terms\":{\"type\":[\"dashboard\",\"visualization\",\"search\",\"index-pattern\",\"graph-workspace\",\"timelion-sheet\"]}},\"aggs\":{\"types\":{\"terms\":{\"field\":\"type\",\"size\":6}}}}","statusCode":401,"response":"Unauthorized","wwwAuthenticateDirective":"Basic realm=\"Search Guard\""}\n at respond (/opt/kibana/node\_modules/elasticsearch/src/lib/transport.js:307:15)\n at checkRespForFailure (/opt/kibana/node\_modules/elasticsearch/src/lib/transport.js:266:7)\n at HttpConnector. (/opt/kibana/node\_modules/elasticsearch/src/lib/connectors/http.js:159:7)\n at IncomingMessage.bound (/opt/kibana/node\_modules/elasticsearch/node\_modules/lodash/dist/lodash.js:729:21)\n at emitNone (events.js:111:20)\n at IncomingMessage.emit (events.js:208:7)\n at endReadableNT (\_stream\_readable.js:1064:12)\n at \_combinedTickCallback (internal/process/next\_tick.js:138:11)\n at process.\_tickCallback (internal/process/next\_tick.js:180:9)”},“message”:“Authentication Exception”}  
> {“type”:“log”,“@timestamp”:“2019-01-17T17:14:36Z”,“tags”:[“warning”,“stats-collection”],“pid”:295,“message”:“Unable to fetch data from kibana collector”}  
> {“type”:“error”,“@timestamp”:“2019-01-17T17:14:36Z”,“tags”:[“warning”,“stats-collection”],“pid”:295,“level”:“error”,“error”:{“message”:“Authentication Exception”,“name”:“Error”,“stack”:“Authentication Exception :: {"path":"/.kibana/doc/config%3A6.4.2","query":{},"statusCode":401,"response":"Unauthorized","wwwAuthenticateDirective":"Basic realm=\"Search Guard\""}\n at respond (/opt/kibana/node\_modules/elasticsearch/src/lib/transport.js:307:15)\n at checkRespForFailure (/opt/kibana/node\_modules/elasticsearch/src/lib/transport.js:266:7)\n at HttpConnector. (/opt/kibana/node\_modules/elasticsearch/src/lib/connectors/http.js:159:7)\n at IncomingMessage.bound (/opt/kibana/node\_modules/elasticsearch/node\_modules/lodash/dist/lodash.js:729:21)\n at emitNone (events.js:111:20)\n at IncomingMessage.emit (events.js:208:7)\n at endReadableNT (\_stream\_readable.js:1064:12)\n at \_combinedTickCallback (internal/process/next\_tick.js:138:11)\n at process.\_tickCallback (internal/process/next\_tick.js:180:9)”},“message”:“Authentication Exception”}  
> {“type”:“log”,“@timestamp”:“2019-01-17T17:14:36Z”,“tags”:[“warning”,“stats-collection”],“pid”:295,“message”:“Unable to fetch data from kibana\_settings collector”}  
> {“type”:“error”,“@timestamp”:“2019-01-17T17:14:36Z”,“tags”:[“warning”,“stats-collection”],“pid”:295,“level”:“error”,“error”:{“message”:“Authentication Exception”,“name”:“Error”,“stack”:“Authentication Exception :: {"path":"/.reporting-\*/\_search","query":{"filter\_path":"hits.total,aggregations.jobTypes.buckets,aggregations.objectTypes.buckets,aggregations.layoutTypes.buckets,aggregations.statusTypes.buckets"},"body":"{\"size\":0,\"aggs\":{\"jobTypes\":{\"terms\":{\"field\":\"jobtype\",\"size\":2}},\"objectTypes\":{\"terms\":{\"field\":\"meta.objectType.keyword\",\"size\":3}},\"layoutTypes\":{\"terms\":{\"field\":\"meta.layout.keyword\",\"size\":3}},\"statusTypes\":{\"terms\":{\"field\":\"status\",\"size\":4}}}}","statusCode":401,"response":"Unauthorized","wwwAuthenticateDirective":"Basic realm=\"Search Guard\""}\n at respond (/opt/kibana/node\_modules/elasticsearch/src/lib/transport.js:307:15)\n at checkRespForFailure (/opt/kibana/node\_modules/elasticsearch/src/lib/transport.js:266:7)\n at HttpConnector. (/opt/kibana/node\_modules/elasticsearch/src/lib/connectors/http.js:159:7)\n at IncomingMessage.bound (/opt/kibana/node\_modules/elasticsearch/node\_modules/lodash/dist/lodash.js:729:21)\n at emitNone (events.js:111:20)\n at IncomingMessage.emit (events.js:208:7)\n at endReadableNT (\_stream\_readable.js:1064:12)\n at \_combinedTickCallback (internal/process/next\_tick.js:138:11)\n at process.\_tickCallback (internal/process/next\_tick.js:180:9)”},“message”:“Authentication Exception”}  
> {“type”:“log”,“@timestamp”:“2019-01-17T17:14:36Z”,“tags”:[“warning”,“stats-collection”],“pid”:295,“message”:“Unable to fetch data from reporting collector”}
> 
> - Other installed Elasticsearch or Kibana plugins, if any
> 
> none

---

<div class="post-metadata">

**Author:** ![searchguard\_google\_group](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.search-guard.com/searchguard_google_group/32/462_2.png) [@searchguard\_google\_group](https://forum.search-guard.com/u/searchguard_google_group)\
**Post date:** [January 17, 2019, 7:36pm UTC](https://forum.search-guard.com/t/not-executing-initial-sgadmin/1288/2 "2019-01-17T19:36:07Z")

</div>

What you can try in your script is to wait until sgadmin.sh was successful like

until ./sgadmin.sh --fail-fast -icl -nhnv -cacert /etc/elasticsearch/root-ca.pem -cert /etc/elasticsearch/kirk.pem -key /etc/elasticsearch/kirk.key ; do  
&nbsp;&nbsp;&nbsp;sleep 10  
done

and to solve your admin certificate problem i think the configuration in elasticsearch.yml should look like

searchguard.authcz.admin\_dn:  
&nbsp;&nbsp;- CN=kirk.localhost,OU=Ops,O=localhost\, Inc.,DC=localhost

Please validate with "cat elasticsearch.yml" (maybe the \ needs to be escaped due to sed)

> **···**
>
> > Am 17.01.2019 um 18:46 schrieb Natalie Goldman \<empoerterkolibri@gmail.com\>:
> > 
> > Dear Search Guard Community,
> > 
> > I am trying to install the Search Guard Plugin to elasticstack products running with/on a docker container and my final aim is to automate this partly with a script (attached) and some commands in the dockerfile.  
> > My problem:  
> > If I run sgadmin with the script this very classic error message appears:
> > 
> > "Search Guard Admin v6  
> > Will connect to localhost:9300  
> > ERR: Seems there is no Elasticsearch running on localhost:9300 - Will exit"
> > 
> > If I execute sgadmin a second time (manually) in the container (exact parameters given in the script), the following message appears:
> > 
> > Will connect to localhost:9300 ... done
> > 
> > Unable to check whether cluster is sane: Cannot authenticate null  
> > Connected as CN=kirk.localhost,OU=Ops,O=localhost\, Inc.,DC=localhost  
> > ERR: CN=kirk.localhost,OU=Ops,O=localhost\, Inc.,DC=localhost is not an admin user  
> > Seems you use a client certificate but this one is not registered as admin\_dn  
> > Make sure elasticsearch.yml on all nodes contains:  
> > searchguard.authcz.admin\_dn:  
> > &nbsp;&nbsp;- "CN=kirk.localhost,OU=Ops,O=localhost\, Inc.,DC=localhost"
> > 
> > So both messages are mentioned in your documentation [sgadmin Troubleshooting | Security for Elasticsearch | Search Guard](https://docs.search-guard.com/latest/troubleshooting-sgadmin.html) and as far as I understand I did list searchguard.authcz.admin\_dn in my elasticsearch.yml and "kirk" is my amdin, because I declared "admin: true2 -right?!
> > 
> > Considering the elastic logs, there are "issues" with kibana and x-pack, but if I configure kibana (right now uncommented in the script) I still can't execute sg\_admin (bellow).
> > 
> > I would be absolutly greatful for any answer. Thank you for Search Guard and your answersanyways \<3
> > 
> > ----  
> > When asking questions, please provide the following information:
> > 
> > \* Search Guard and Elasticsearch version  
> > search-guard-6:6.4.2-23.1, elasticsearchversion 6.4.2
> > 
> > \* Installed and used enterprise modules, if any  
> > none  
> > \* JVM version and operating system version  
> > openjdk version "1.8.0\_181"  
> > OpenJDK Runtime Environment (build 1.8.0\_181-8u181-b13-0ubuntu0.16.04.1-b13)  
> > OpenJDK 64-Bit Server VM (build 25.181-b13, mixed mode) running in a docker container
> > 
> > \* Search Guard configuration files  
> > attached
> > 
> > \* Elasticsearch log messages on debug level
> > 
> > {"type":"log","@timestamp":"2019-01-17T17:14:26Z","tags":["warning","stats-collection"],"pid":295,"message":"Unable to fetch data from reporting collector"}  
> > {"type":"error","@timestamp":"2019-01-17T17:14:36Z","tags":["warning","stats-collection"],"pid":295,"level":"error","error":{"message":"Authentication Exception","name":"Error","stack":"Authentication Exception :: {\"path\":\"/.kibana/\_search\",\"query\":{\"ignore\_unavailable\":true,\"filter\_path\":\"aggregations.types.buckets\"},\"body\":\"{\\\"size\\\":0,\\\"query\\\":{\\\"terms\\\":{\\\"type\\\":[\\\"dashboard\\\",\\\"visualization\\\",\\\"search\\\",\\\"index-pattern\\\",\\\"graph-workspace\\\",\\\"timelion-sheet\\\"]}},\\\"aggs\\\":{\\\"types\\\":{\\\"terms\\\":{\\\"field\\\":\\\"type\\\",\\\"size\\\":6}}}}\",\"statusCode\":401,\"response\":\"Unauthorized\",\"wwwAuthenticateDirective\":\"Basic realm=\\\"Search Guard\\\"\"}\n at respond (/opt/kibana/node\_modules/elasticsearch/src/lib/transport.js:307:15)\n at checkRespForFailure (/opt/kibana/node\_modules/elasticsearch/src/lib/transport.js:266:7)\n at HttpConnector.\<anonymous\> (/opt/kibana/node\_modules/elasticsearch/src/lib/connectors/http.js:159:7)\n at IncomingMessage.bound (/opt/kibana/node\_modules/elasticsearch/node\_modules/lodash/dist/lodash.js:729:21)\n at emitNone (events.js:111:20)\n at IncomingMessage.emit (events.js:208:7)\n at endReadableNT (\_stream\_readable.js:1064:12)\n at \_combinedTickCallback (internal/process/next\_tick.js:138:11)\n at process.\_tickCallback (internal/process/next\_tick.js:180:9)"},"message":"Authentication Exception"}  
> > {"type":"log","@timestamp":"2019-01-17T17:14:36Z","tags":["warning","stats-collection"],"pid":295,"message":"Unable to fetch data from kibana collector"}  
> > {"type":"error","@timestamp":"2019-01-17T17:14:36Z","tags":["warning","stats-collection"],"pid":295,"level":"error","error":{"message":"Authentication Exception","name":"Error","stack":"Authentication Exception :: {\"path\":\"/.kibana/doc/config%3A6.4.2\",\"query\":{},\"statusCode\":401,\"response\":\"Unauthorized\",\"wwwAuthenticateDirective\":\"Basic realm=\\\"Search Guard\\\"\"}\n at respond (/opt/kibana/node\_modules/elasticsearch/src/lib/transport.js:307:15)\n at checkRespForFailure (/opt/kibana/node\_modules/elasticsearch/src/lib/transport.js:266:7)\n at HttpConnector.\<anonymous\> (/opt/kibana/node\_modules/elasticsearch/src/lib/connectors/http.js:159:7)\n at IncomingMessage.bound (/opt/kibana/node\_modules/elasticsearch/node\_modules/lodash/dist/lodash.js:729:21)\n at emitNone (events.js:111:20)\n at IncomingMessage.emit (events.js:208:7)\n at endReadableNT (\_stream\_readable.js:1064:12)\n at \_combinedTickCallback (internal/process/next\_tick.js:138:11)\n at process.\_tickCallback (internal/process/next\_tick.js:180:9)"},"message":"Authentication Exception"}  
> > {"type":"log","@timestamp":"2019-01-17T17:14:36Z","tags":["warning","stats-collection"],"pid":295,"message":"Unable to fetch data from kibana\_settings collector"}  
> > {"type":"error","@timestamp":"2019-01-17T17:14:36Z","tags":["warning","stats-collection"],"pid":295,"level":"error","error":{"message":"Authentication Exception","name":"Error","stack":"Authentication Exception :: {\"path\":\"/.reporting-\*/\_search\",\"query\":{\"filter\_path\":\"hits.total,aggregations.jobTypes.buckets,aggregations.objectTypes.buckets,aggregations.layoutTypes.buckets,aggregations.statusTypes.buckets\"},\"body\":\"{\\\"size\\\":0,\\\"aggs\\\":{\\\"jobTypes\\\":{\\\"terms\\\":{\\\"field\\\":\\\"jobtype\\\",\\\"size\\\":2}},\\\"objectTypes\\\":{\\\"terms\\\":{\\\"field\\\":\\\"meta.objectType.keyword\\\",\\\"size\\\":3}},\\\"layoutTypes\\\":{\\\"terms\\\":{\\\"field\\\":\\\"meta.layout.keyword\\\",\\\"size\\\":3}},\\\"statusTypes\\\":{\\\"terms\\\":{\\\"field\\\":\\\"status\\\",\\\"size\\\":4}}}}\",\"statusCode\":401,\"response\":\"Unauthorized\",\"wwwAuthenticateDirective\":\"Basic realm=\\\"Search Guard\\\"\"}\n at respond (/opt/kibana/node\_modules/elasticsearch/src/lib/transport.js:307:15)\n at checkRespForFailure (/opt/kibana/node\_modules/elasticsearch/src/lib/transport.js:266:7)\n at HttpConnector.\<anonymous\> (/opt/kibana/node\_modules/elasticsearch/src/lib/connectors/http.js:159:7)\n at IncomingMessage.bound (/opt/kibana/node\_modules/elasticsearch/node\_modules/lodash/dist/lodash.js:729:21)\n at emitNone (events.js:111:20)\n at IncomingMessage.emit (events.js:208:7)\n at endReadableNT (\_stream\_readable.js:1064:12)\n at \_combinedTickCallback (internal/process/next\_tick.js:138:11)\n at process.\_tickCallback (internal/process/next\_tick.js:180:9)"},"message":"Authentication Exception"}  
> > {"type":"log","@timestamp":"2019-01-17T17:14:36Z","tags":["warning","stats-collection"],"pid":295,"message":"Unable to fetch data from reporting collector"}
> > 
> > \* Other installed Elasticsearch or Kibana plugins, if any  
> > none
> > 
> > --  
> > You received this message because you are subscribed to the Google Groups "Search Guard Community Forum" group.  
> > To unsubscribe from this group and stop receiving emails from it, send an email to search-guard+unsubscribe@googlegroups.com.  
> > To post to this group, send email to search-guard@googlegroups.com.  
> > To view this discussion on the web visit [https://groups.google.com/d/msgid/search-guard/05bb786c-b751-420e-9718-ad02c513e225%40googlegroups.com\](https://groups.google.com/d/msgid/search-guard/05bb786c-b751-420e-9718-ad02c513e225%40googlegroups.com%5C).  
> > For more options, visit [https://groups.google.com/d/optout\](https://groups.google.com/d/optout%5C).  
> > \<config\_sg\_sh.txt\>\<elasticsearch.yml\>\<config.yml\>

---

<div class="post-metadata">

**Author:** ![Natalie\_Goldman](https://avatars.discourse-cdn.com/v4/letter/n/e95f7d/32.png) [@Natalie\_Goldman](https://forum.search-guard.com/u/Natalie_Goldman)\
**Post date:** [January 17, 2019, 10:39pm UTC](https://forum.search-guard.com/t/not-executing-initial-sgadmin/1288/3 "2019-01-17T22:39:09Z")

</div>

> Dear Search Guard Community,

> 

> I am trying to install the Search Guard Plugin to elasticstack products running with/on a docker container and my final aim is to automate this partly with a script (attached) and some commands in the dockerfile.

> My problem:

> If I run sgadmin with the script this very classic error message appears:

> 

> "Search Guard Admin v6
> 
> Will connect to localhost:9300
> 
> ERR: Seems there is no Elasticsearch running on localhost:9300 - Will exit"

> 

> If I execute sgadmin a second time (manually) in the container (exact parameters given in the script), the following message appears:

> 

> Will connect to localhost:9300 … done
> 
> Unable to check whether cluster is sane: Cannot authenticate null  
> Connected as CN=kirk.localhost,OU=Ops,O=localhost, Inc.,DC=localhost  
> ERR: CN=kirk.localhost,OU=Ops,O=localhost, Inc.,DC=localhost is not an admin user  
> Seems you use a client certificate but this one is not registered as admin\_dn  
> Make sure elasticsearch.yml on all nodes contains:  
> searchguard.authcz.admin\_dn:
> 
> - “CN=kirk.localhost,OU=Ops,O=localhost, Inc.,DC=localhost”

> 

> So both messages are mentioned in your documentation [https://docs.search-guard.com/latest/troubleshooting-sgadmin.html](https://docs.search-guard.com/latest/troubleshooting-sgadmin.html) and as far as I understand I did list `searchguard.authcz.admin_dn in my elasticsearch.yml and "kirk" is my amdin, because I declared "admin: true2 -right?!`

> ` `

> `Considering the elastic logs, there are "issues" with kibana and x-pack, but if I configure kibana (right now uncommented in the script) I still can't execute sg_admin (bellow). `

> 

> I would be absolutly greatful for any answer. Thank you for Search Guard and your answersanyways \<3

> 

> * * *

> When asking questions, please provide the following information:

> 

> - Search Guard and Elasticsearch version

> search-guard-6:6.4.2-23.1, elasticsearchversion 6.4.2

> 

> - Installed and used enterprise modules, if any

> none

> - JVM version and operating system version

> openjdk version “1.8.0\_181”  
> OpenJDK Runtime Environment (build 1.8.0\_181-8u181-b13-0ubuntu0.16.04.1-b13)  
> OpenJDK 64-Bit Server VM (build 25.181-b13, mixed mode) running in a docker container

> 

> - Search Guard configuration files

> attached

> 

> - Elasticsearch log messages on debug level

> 

> {“type”:“log”,“@timestamp”:“2019-01-17T17:14:26Z”,“tags”:[“warning”,“stats-collection”],“pid”:295,“message”:“Unable to fetch data from reporting collector”}  
> {“type”:“error”,“@timestamp”:“2019-01-17T17:14:36Z”,“tags”:[“warning”,“stats-collection”],“pid”:295,“level”:“error”,“error”:{“message”:“Authentication Exception”,“name”:“Error”,“stack”:“Authentication Exception :: {"path":"/.kibana/\_search","query":{"ignore\_unavailable":true,"filter\_path":"aggregations.types.buckets"},"body":"{\"size\":0,\"query\":{\"terms\":{\"type\":[\"dashboard\",\"visualization\",\"search\",\"index-pattern\",\"graph-workspace\",\"timelion-sheet\"]}},\"aggs\":{\"types\":{\"terms\":{\"field\":\"type\",\"size\":6}}}}","statusCode":401,"response":"Unauthorized","wwwAuthenticateDirective":"Basic realm=\"Search Guard\""}\n at respond (/opt/kibana/node\_modules/elasticsearch/src/lib/transport.js:307:15)\n at checkRespForFailure (/opt/kibana/node\_modules/elasticsearch/src/lib/transport.js:266:7)\n at HttpConnector. (/opt/kibana/node\_modules/elasticsearch/src/lib/connectors/http.js:159:7)\n at IncomingMessage.bound (/opt/kibana/node\_modules/elasticsearch/node\_modules/lodash/dist/lodash.js:729:21)\n at emitNone (events.js:111:20)\n at IncomingMessage.emit (events.js:208:7)\n at endReadableNT (\_stream\_readable.js:1064:12)\n at \_combinedTickCallback (internal/process/next\_tick.js:138:11)\n at process.\_tickCallback (internal/process/next\_tick.js:180:9)”},“message”:“Authentication Exception”}  
> {“type”:“log”,“@timestamp”:“2019-01-17T17:14:36Z”,“tags”:[“warning”,“stats-collection”],“pid”:295,“message”:“Unable to fetch data from kibana collector”}  
> {“type”:“error”,“@timestamp”:“2019-01-17T17:14:36Z”,“tags”:[“warning”,“stats-collection”],“pid”:295,“level”:“error”,“error”:{“message”:“Authentication Exception”,“name”:“Error”,“stack”:“Authentication Exception :: {"path":"/.kibana/doc/config%3A6.4.2","query":{},"statusCode":401,"response":"Unauthorized","wwwAuthenticateDirective":"Basic realm=\"Search Guard\""}\n at respond (/opt/kibana/node\_modules/elasticsearch/src/lib/transport.js:307:15)\n at checkRespForFailure (/opt/kibana/node\_modules/elasticsearch/src/lib/transport.js:266:7)\n at HttpConnector. (/opt/kibana/node\_modules/elasticsearch/src/lib/connectors/http.js:159:7)\n at IncomingMessage.bound (/opt/kibana/node\_modules/elasticsearch/node\_modules/lodash/dist/lodash.js:729:21)\n at emitNone (events.js:111:20)\n at IncomingMessage.emit (events.js:208:7)\n at endReadableNT (\_stream\_readable.js:1064:12)\n at \_combinedTickCallback (internal/process/next\_tick.js:138:11)\n at process.\_tickCallback (internal/process/next\_tick.js:180:9)”},“message”:“Authentication Exception”}  
> {“type”:“log”,“@timestamp”:“2019-01-17T17:14:36Z”,“tags”:[“warning”,“stats-collection”],“pid”:295,“message”:“Unable to fetch data from kibana\_settings collector”}  
> {“type”:“error”,“@timestamp”:“2019-01-17T17:14:36Z”,“tags”:[“warning”,“stats-collection”],“pid”:295,“level”:“error”,“error”:{“message”:“Authentication Exception”,“name”:“Error”,“stack”:“Authentication Exception :: {"path":"/.reporting-\*/\_search","query":{"filter\_path":"hits.total,aggregations.jobTypes.buckets,aggregations.objectTypes.buckets,aggregations.layoutTypes.buckets,aggregations.statusTypes.buckets"},"body":"{\"size\":0,\"aggs\":{\"jobTypes\":{\"terms\":{\"field\":\"jobtype\",\"size\":2}},\"objectTypes\":{\"terms\":{\"field\":\"meta.objectType.keyword\",\"size\":3}},\"layoutTypes\":{\"terms\":{\"field\":\"meta.layout.keyword\",\"size\":3}},\"statusTypes\":{\"terms\":{\"field\":\"status\",\"size\":4}}}}","statusCode":401,"response":"Unauthorized","wwwAuthenticateDirective":"Basic realm=\"Search Guard\""}\n at respond (/opt/kibana/node\_modules/elasticsearch/src/lib/transport.js:307:15)\n at checkRespForFailure (/opt/kibana/node\_modules/elasticsearch/src/lib/transport.js:266:7)\n at HttpConnector. (/opt/kibana/node\_modules/elasticsearch/src/lib/connectors/http.js:159:7)\n at IncomingMessage.bound (/opt/kibana/node\_modules/elasticsearch/node\_modules/lodash/dist/lodash.js:729:21)\n at emitNone (events.js:111:20)\n at IncomingMessage.emit (events.js:208:7)\n at endReadableNT (\_stream\_readable.js:1064:12)\n at \_combinedTickCallback (internal/process/next\_tick.js:138:11)\n at process.\_tickCallback (internal/process/next\_tick.js:180:9)”},“message”:“Authentication Exception”}  
> {“type”:“log”,“@timestamp”:“2019-01-17T17:14:36Z”,“tags”:[“warning”,“stats-collection”],“pid”:295,“message”:“Unable to fetch data from reporting collector”}

> 

> - Other installed Elasticsearch or Kibana plugins, if any

> none

> **···**
>
> Am Donnerstag, 17. Januar 2019 18:46:28 UTC+1 schrieb Natalie Goldman:

---

<div class="post-metadata">

**Author:** ![Natalie\_Goldman](https://avatars.discourse-cdn.com/v4/letter/n/e95f7d/32.png) [@Natalie\_Goldman](https://forum.search-guard.com/u/Natalie_Goldman)\
**Post date:** [January 17, 2019, 10:48pm UTC](https://forum.search-guard.com/t/not-executing-initial-sgadmin/1288/4 "2019-01-17T22:48:10Z")

</div>

It worked out! Thank you so, so much! To escape the / was the main issue in the script… I totally overlooked that. THANK YOU!

> **···**
>
> Am Donnerstag, 17. Januar 2019 23:39:09 UTC+1 schrieb Natalie Goldman:
> 
> > Am Donnerstag, 17. Januar 2019 18:46:28 UTC+1 schrieb Natalie Goldman:
> > 
> > > Dear Search Guard Community,
> 
> > >
> 
> > > I am trying to install the Search Guard Plugin to elasticstack products running with/on a docker container and my final aim is to automate this partly with a script (attached) and some commands in the dockerfile.
> 
> > > My problem:
> 
> > > If I run sgadmin with the script this very classic error message appears:
> 
> > >
> 
> > > "Search Guard Admin v6
> > > 
> > > Will connect to localhost:9300
> > > 
> > > ERR: Seems there is no Elasticsearch running on localhost:9300 - Will exit"
> 
> > >
> 
> > > If I execute sgadmin a second time (manually) in the container (exact parameters given in the script), the following message appears:
> 
> > >
> 
> > > Will connect to localhost:9300 … done
> > > 
> > > Unable to check whether cluster is sane: Cannot authenticate null  
> > > Connected as CN=kirk.localhost,OU=Ops,O=localhost, Inc.,DC=localhost  
> > > ERR: CN=kirk.localhost,OU=Ops,O=localhost, Inc.,DC=localhost is not an admin user  
> > > Seems you use a client certificate but this one is not registered as admin\_dn  
> > > Make sure elasticsearch.yml on all nodes contains:  
> > > searchguard.authcz.admin\_dn:
> > > 
> > > - “CN=kirk.localhost,OU=Ops,O=localhost, Inc.,DC=localhost”
> 
> > >
> 
> > > So both messages are mentioned in your documentation [https://docs.search-guard.com/latest/troubleshooting-sgadmin.html](https://docs.search-guard.com/latest/troubleshooting-sgadmin.html) and as far as I understand I did list `searchguard.authcz.admin_dn in my elasticsearch.yml and "kirk" is my amdin, because I declared "admin: true2 -right?!`
> 
> > > ` `
> 
> > > `Considering the elastic logs, there are "issues" with kibana and x-pack, but if I configure kibana (right now uncommented in the script) I still can't execute sg_admin (bellow). `
> 
> > >
> 
> > > I would be absolutly greatful for any answer. Thank you for Search Guard and your answersanyways \<3
> 
> > >
> 
> > > * * *
> 
> > > When asking questions, please provide the following information:
> 
> > >
> 
> > > - Search Guard and Elasticsearch version
> 
> > > search-guard-6:6.4.2-23.1, elasticsearchversion 6.4.2
> 
> > >
> 
> > > - Installed and used enterprise modules, if any
> 
> > > none
> 
> > > - JVM version and operating system version
> 
> > > openjdk version “1.8.0\_181”  
> > > OpenJDK Runtime Environment (build 1.8.0\_181-8u181-b13-0ubuntu0.16.04.1-b13)  
> > > OpenJDK 64-Bit Server VM (build 25.181-b13, mixed mode) running in a docker container
> 
> > >
> 
> > > - Search Guard configuration files
> 
> > > attached
> 
> > >
> 
> > > - Elasticsearch log messages on debug level
> 
> > >
> 
> > > {“type”:“log”,“@timestamp”:“2019-01-17T17:14:26Z”,“tags”:[“warning”,“stats-collection”],“pid”:295,“message”:“Unable to fetch data from reporting collector”}  
> > > {“type”:“error”,“@timestamp”:“2019-01-17T17:14:36Z”,“tags”:[“warning”,“stats-collection”],“pid”:295,“level”:“error”,“error”:{“message”:“Authentication Exception”,“name”:“Error”,“stack”:“Authentication Exception :: {"path":"/.kibana/\_search","query":{"ignore\_unavailable":true,"filter\_path":"aggregations.types.buckets"},"body":"{\"size\":0,\"query\":{\"terms\":{\"type\":[\"dashboard\",\"visualization\",\"search\",\"index-pattern\",\"graph-workspace\",\"timelion-sheet\"]}},\"aggs\":{\"types\":{\"terms\":{\"field\":\"type\",\"size\":6}}}}","statusCode":401,"response":"Unauthorized","wwwAuthenticateDirective":"Basic realm=\"Search Guard\""}\n at respond (/opt/kibana/node\_modules/elasticsearch/src/lib/transport.js:307:15)\n at checkRespForFailure (/opt/kibana/node\_modules/elasticsearch/src/lib/transport.js:266:7)\n at HttpConnector. (/opt/kibana/node\_modules/elasticsearch/src/lib/connectors/http.js:159:7)\n at IncomingMessage.bound (/opt/kibana/node\_modules/elasticsearch/node\_modules/lodash/dist/lodash.js:729:21)\n at emitNone (events.js:111:20)\n at IncomingMessage.emit (events.js:208:7)\n at endReadableNT (\_stream\_readable.js:1064:12)\n at \_combinedTickCallback (internal/process/next\_tick.js:138:11)\n at process.\_tickCallback (internal/process/next\_tick.js:180:9)”},“message”:“Authentication Exception”}  
> > > {“type”:“log”,“@timestamp”:“2019-01-17T17:14:36Z”,“tags”:[“warning”,“stats-collection”],“pid”:295,“message”:“Unable to fetch data from kibana collector”}  
> > > {“type”:“error”,“@timestamp”:“2019-01-17T17:14:36Z”,“tags”:[“warning”,“stats-collection”],“pid”:295,“level”:“error”,“error”:{“message”:“Authentication Exception”,“name”:“Error”,“stack”:“Authentication Exception :: {"path":"/.kibana/doc/config%3A6.4.2","query":{},"statusCode":401,"response":"Unauthorized","wwwAuthenticateDirective":"Basic realm=\"Search Guard\""}\n at respond (/opt/kibana/node\_modules/elasticsearch/src/lib/transport.js:307:15)\n at checkRespForFailure (/opt/kibana/node\_modules/elasticsearch/src/lib/transport.js:266:7)\n at HttpConnector. (/opt/kibana/node\_modules/elasticsearch/src/lib/connectors/http.js:159:7)\n at IncomingMessage.bound (/opt/kibana/node\_modules/elasticsearch/node\_modules/lodash/dist/lodash.js:729:21)\n at emitNone (events.js:111:20)\n at IncomingMessage.emit (events.js:208:7)\n at endReadableNT (\_stream\_readable.js:1064:12)\n at \_combinedTickCallback (internal/process/next\_tick.js:138:11)\n at process.\_tickCallback (internal/process/next\_tick.js:180:9)”},“message”:“Authentication Exception”}  
> > > {“type”:“log”,“@timestamp”:“2019-01-17T17:14:36Z”,“tags”:[“warning”,“stats-collection”],“pid”:295,“message”:“Unable to fetch data from kibana\_settings collector”}  
> > > {“type”:“error”,“@timestamp”:“2019-01-17T17:14:36Z”,“tags”:[“warning”,“stats-collection”],“pid”:295,“level”:“error”,“error”:{“message”:“Authentication Exception”,“name”:“Error”,“stack”:“Authentication Exception :: {"path":"/.reporting-\*/\_search","query":{"filter\_path":"hits.total,aggregations.jobTypes.buckets,aggregations.objectTypes.buckets,aggregations.layoutTypes.buckets,aggregations.statusTypes.buckets"},"body":"{\"size\":0,\"aggs\":{\"jobTypes\":{\"terms\":{\"field\":\"jobtype\",\"size\":2}},\"objectTypes\":{\"terms\":{\"field\":\"meta.objectType.keyword\",\"size\":3}},\"layoutTypes\":{\"terms\":{\"field\":\"meta.layout.keyword\",\"size\":3}},\"statusTypes\":{\"terms\":{\"field\":\"status\",\"size\":4}}}}","statusCode":401,"response":"Unauthorized","wwwAuthenticateDirective":"Basic realm=\"Search Guard\""}\n at respond (/opt/kibana/node\_modules/elasticsearch/src/lib/transport.js:307:15)\n at checkRespForFailure (/opt/kibana/node\_modules/elasticsearch/src/lib/transport.js:266:7)\n at HttpConnector. (/opt/kibana/node\_modules/elasticsearch/src/lib/connectors/http.js:159:7)\n at IncomingMessage.bound (/opt/kibana/node\_modules/elasticsearch/node\_modules/lodash/dist/lodash.js:729:21)\n at emitNone (events.js:111:20)\n at IncomingMessage.emit (events.js:208:7)\n at endReadableNT (\_stream\_readable.js:1064:12)\n at \_combinedTickCallback (internal/process/next\_tick.js:138:11)\n at process.\_tickCallback (internal/process/next\_tick.js:180:9)”},“message”:“Authentication Exception”}  
> > > {“type”:“log”,“@timestamp”:“2019-01-17T17:14:36Z”,“tags”:[“warning”,“stats-collection”],“pid”:295,“message”:“Unable to fetch data from reporting collector”}
> 
> > >
> 
> > > - Other installed Elasticsearch or Kibana plugins, if any
> 
> > > none
