# Can't init searchguard after new certificates

**URL:** <https://forum.search-guard.com/t/cant-init-searchguard-after-new-certificates/1346>\
**Category:** Search Guard\
**Created:** [March 1, 2019, 3:19pm UTC](https://forum.search-guard.com/t/cant-init-searchguard-after-new-certificates/1346 "2019-03-01T15:19:54Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Tudor\_Rogojanu](https://avatars.discourse-cdn.com/v4/letter/t/5fc32e/32.png) [@Tudor\_Rogojanu](https://forum.search-guard.com/u/Tudor_Rogojanu)\
**Post date:** [March 1, 2019, 3:19pm UTC](https://forum.search-guard.com/t/cant-init-searchguard-after-new-certificates/1346/1 "2019-03-01T15:19:54Z")

</div>

Hello,

I have ES 6.0.0 and SG 6-6.0.0-17.beta1 running on a server for more than a year. It’s just a small demo that i play with from time to time, so nobody else has access to it. I had no problems with it for a long time.

I noticed this week that i can’t login anymore. I haven’t done any changes to ES or SG for more than a year. After some debugging it seemed to be because of the old certificates, so i downloaded the new demo certificates. But when i run  
./sgadmin.sh -cd …/sgconfig/ -icl -nhnv -cacert root-ca.pem -cert kirk.pem -key kirk-key.pem

``

it says

Search Guard Admin v6  
Will connect to localhost:9300 … done  
Connected as CN=kirk,OU=client,O=client,L=test,C=de  
Contacting elasticsearch cluster ‘searchguard\_demo’ and wait for YELLOW clusterstate …  
ERR: Timed out while waiting for a green or yellow cluster state.

``

Running

./sgadmin.sh -cn searchguard\_demo -cd …/sgconfig/ -nhnv -cacert root-ca.pem -cert kirk.pem -key kirk-key.pem --accept-red-cluster

``

results in

Search Guard Admin v6  
Will connect to localhost:9300 … done  
Connected as CN=kirk,OU=client,O=client,L=test,C=de  
Contacting elasticsearch cluster ‘searchguard\_demo’ …  
Clustername: searchguard\_demo  
Clusterstate: RED  
Number of nodes: 1  
Number of data nodes: 1  
searchguard index already exists, so we do not need to create one.  
ERR: searchguard index state is RED.  
Populate config from /usr/share/elasticsearch/plugins/search-guard-6/sgconfig  
Will update ‘config’ with …/sgconfig/sg\_config.yml  
FAIL: Configuration for ‘config’ failed because of UnavailableShardsException[[searchguard][0] primary shard is not active Timeout: [1m], request: [BulkShardRequest [[searchguard][0]] containing [index {[searchguard][sg][config], source[n/a, actual length: [3.2kb], max length: 2kb]}] and a refresh]]  
Will update ‘roles’ with …/sgconfig/sg\_roles.yml  
FAIL: Configuration for ‘roles’ failed because of UnavailableShardsException[[searchguard][0] primary shard is not active Timeout: [1m], request: [BulkShardRequest [[searchguard][0]] containing [index {[searchguard][sg][roles], source[n/a, actual length: [3.6kb], max length: 2kb]}] and a refresh]]  
Will update ‘rolesmapping’ with …/sgconfig/sg\_roles\_mapping.yml  
FAIL: Configuration for ‘rolesmapping’ failed because of UnavailableShardsException[[searchguard][0] primary shard is not active Timeout: [1m], request: [BulkShardRequest [[searchguard][0]] containing [index {[searchguard][sg][rolesmapping], source[{“rolesmapping”:“eyJzZ19hbGxfYWNjZXNzIjp7InJlYWRvbmx5Ijp0cnVlLCJiYWNrZW5kcm9sZXMiOlsiYWRtaW4iXX0sInNnX2xvZ3N0YXNoIjp7ImJhY2tlbmRyb2xlcyI6WyJsb2dzdGFzaCJdfSwic2dfa2liYW5hX3NlcnZlciI6eyJyZWFkb25seSI6dHJ1ZSwidXNlcnMiOlsia2liYW5hc2VydmVyIl19LCJzZ19raWJhbmFfdXNlciI6eyJiYWNrZW5kcm9sZXMiOlsia2liYW5hdXNlciJdfSwic2dfcmVhZGFsbCI6eyJyZWFkb25seSI6dHJ1ZSwiYmFja2VuZHJvbGVzIjpbInJlYWRhbGwiXX0sInNnX21hbmFnZV9zbmFwc2hvdHMiOnsicmVhZG9ubHkiOnRydWUsImJhY2tlbmRyb2xlcyI6WyJzbmFwc2hvdHJlc3RvcmUiXX0sInNnX293bl9pbmRleCI6eyJ1c2VycyI6WyIqIl19fQ==”}]}] and a refresh]]  
Will update ‘internalusers’ with …/sgconfig/sg\_internal\_users.yml  
FAIL: Configuration for ‘internalusers’ failed because of UnavailableShardsException[[searchguard][0] primary shard is not active Timeout: [1m], request: [BulkShardRequest [[searchguard][0]] containing [index {[searchguard][sg][internalusers], source[{“internalusers”:“eyJhZG1pbiI6eyJyZWFkb25seSI6dHJ1ZSwiaGFzaCI6IiQyYSQxMiRWY0NEZ2gyTkRrMDdKR04wcmpHYk0uQWQ0MXFWUi9ZRkpjZ0hwMFVHbnM1SkR5bXYuLlRPRyIsInJvbGVzIjpbImFkbWluIl19LCJsb2dzdGFzaCI6eyJyZWFkb25seSI6dHJ1ZSwiaGFzaCI6IiQyYSQxMiR1MVNoUjRsNHVCUzNVdjU5UGEyeTUuMXVRdVpCclp0bU5mcUIzaU0vLmpMMFhvVjlzZ2hTMiIsInJvbGVzIjpbImxvZ3N0YXNoIl19LCJraWJhbmFzZXJ2ZXIiOnsicmVhZG9ubHkiOnRydWUsImhhc2giOiIkMmEkMTIkNEFjZ0F0M3h3T1dhZEE1czVibEw2ZXYzOU9YRE5obU9lc0VvbzMzZVp0cnEyTjBZclUzSC4ifSwia2liYW5hcm8iOnsicmVhZG9ubHkiOnRydWUsImhhc2giOiIkMmEkMTIkSkpTWE5mVG93ejdVdTV0dFhmZVlwZVlFMGFyQUN2Y3dsUEJTdEIxRi5NSTdmMFU5WjRER0MiLCJyb2xlcyI6WyJraWJhbmF1c2VyIiwicmVhZGFsbCJdfSwicmVhZGFsbCI6eyJoYXNoIjoiJDJhJDEyJGFlNHljd3p3dkx0Wnh3WjgyUm1pRXVuQmJJUGlBbUdaZHVCQWpLTjBUWGR3UUZ0Q3dBUnoyIiwicm9sZXMiOlsicmVhZGFsbCJdfSwic25hcHNob3RyZXN0b3JlIjp7Imhhc2giOiIkMnkkMTIkRHB3bWV0SEt3Z1lub3JiZ2R2T1JDZW52NE5BSzhjUFVnOEFJNnB4TEN1V2YvQUxjMC52N1ciLCJyb2xlcyI6WyJzbmFwc2hvdHJlc3RvcmUiXX19”}]}] and a refresh]]  
Will update ‘actiongroups’ with …/sgconfig/sg\_action\_groups.yml  
FAIL: Configuration for ‘actiongroups’ failed because of UnavailableShardsException[[searchguard][0] primary shard is not active Timeout: [1m], request: [BulkShardRequest [[searchguard][0]] containing [index {[searchguard][sg][actiongroups], source[n/a, actual length: [2.6kb], max length: 2kb]}] and a refresh]]  
FAIL: Expected 1 nodes to return response, but got only 0  
Done with failures

``

The yml config is

searchguard.ssl.transport.pemkey\_filepath: esnode-key.pem  
searchguard.ssl.transport.pemtrustedcas\_filepath: root-ca.pem  
searchguard.ssl.transport.enforce\_hostname\_verification: false  
searchguard.ssl.http.enabled: false  
searchguard.ssl.http.pemcert\_filepath: esnode.pem  
searchguard.ssl.http.pemkey\_filepath: esnode-key.pem  
searchguard.ssl.http.pemtrustedcas\_filepath: root-ca.pem  
searchguard.allow\_unsafe\_democertificates: true  
searchguard.allow\_default\_init\_sgindex: true  
searchguard.authcz.admin\_dn:

- CN=kirk,OU=client,O=client,L=test, C=de

searchguard.audit.type: internal\_elasticsearch  
searchguard.enable\_snapshot\_restore\_privilege: true  
searchguard.check\_snapshot\_restore\_write\_privileges: true  
searchguard.restapi.roles\_enabled: [“sg\_all\_access”]  
cluster.name: searchguard\_demo  
discovery.zen.minimum\_master\_nodes: 1  
node.max\_local\_storage\_nodes: 3

``

ES logs just say:

[ERROR][c.f.s.a.BackendRegistry] Not yet initialized (you may need to run sgadmin)

``

Java is 1.8.0\_151, OS is Debian GNU/Linux 8.7 (jessie).

Thank you

[sgadmin\_diag\_trace\_2019-Mar-01\_15-34-38.txt](https://forum.search-guard.com/uploads/short-url/eC92qpMp1Q5PSg6XjnWfuWeezzC.txt) (9.21 MB)

---

<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:** [March 4, 2019, 11:44pm UTC](https://forum.search-guard.com/t/cant-init-searchguard-after-new-certificates/1346/2 "2019-03-04T23:44:41Z")

</div>

Probably the easiest thing you can do is to download a recent ES version (like 6.6.1), install current Search Guard (24.1) with the demo installer and copy over certificates and configuration (selectively) to your 6.0.0 cluster. Even better would be the other way around because 6.0.0 with 17.beta1 is out of date. Make sure you replace all certificates inside the config/ folder and those you use with sgadmin.

In recent versions of Search Guard there is a --accept-red-cluster command line option for sgadmin to deal with "red" clusters.

> **···**
>
> > Am 01.03.2019 um 05:41 schrieb Tudor Rogojanu \<tudro2001@gmail.com\>:
> > 
> > Hello,
> > 
> > I have ES 6.0.0 and SG 6-6.0.0-17.beta1 running on a server for more than a year. It's just a small demo that i play with from time to time, so nobody else has access to it. I had no problems with it for a long time.
> > 
> > I noticed this week that i can't login anymore. I haven't done any changes to ES or SG for more than a year. After some debugging it seemed to be because of the old certificates, so i downloaded the new demo certificates. But when i run  
> > ./sgadmin.sh -cd ../sgconfig/ -icl -nhnv -cacert root-ca.pem -cert kirk.pem -key kirk-key.pem  
> > it says  
> > Search Guard Admin v6  
> > Will connect to localhost:9300 ... done  
> > Connected as CN=kirk,OU=client,O=client,L=test,C=de  
> > Contacting elasticsearch cluster 'searchguard\_demo' and wait for YELLOW clusterstate ...  
> > ERR: Timed out while waiting for a green or yellow cluster state.
> > 
> > The yml config is  
> > searchguard.ssl.transport.pemkey\_filepath: esnode-key.pem  
> > searchguard.ssl.transport.pemtrustedcas\_filepath: root-ca.pem  
> > searchguard.ssl.transport.enforce\_hostname\_verification: false  
> > searchguard.ssl.http.enabled: false  
> > searchguard.ssl.http.pemcert\_filepath: esnode.pem  
> > searchguard.ssl.http.pemkey\_filepath: esnode-key.pem  
> > searchguard.ssl.http.pemtrustedcas\_filepath: root-ca.pem  
> > searchguard.allow\_unsafe\_democertificates: true  
> > searchguard.allow\_default\_init\_sgindex: true  
> > searchguard.authcz.admin\_dn:  
> > &nbsp;&nbsp;- CN=kirk,OU=client,O=client,L=test, C=de
> > 
> > searchguard.audit.type: internal\_elasticsearch  
> > searchguard.enable\_snapshot\_restore\_privilege: true  
> > searchguard.check\_snapshot\_restore\_write\_privileges: true  
> > searchguard.restapi.roles\_enabled: ["sg\_all\_access"]  
> > cluster.name: searchguard\_demo  
> > discovery.zen.minimum\_master\_nodes: 1  
> > node.max\_local\_storage\_nodes: 3
> > 
> > ES logs just say:  
> > [ERROR][c.f.s.a.BackendRegistry] Not yet initialized (you may need to run sgadmin)
> > 
> > Java is 1.8.0\_151, OS is Debian GNU/Linux 8.7 (jessie).
> > 
> > Thank you
> > 
> > --  
> > 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/561908d0-6909-4127-92cd-30a282ed5abb%40googlegroups.com\](https://groups.google.com/d/msgid/search-guard/561908d0-6909-4127-92cd-30a282ed5abb%40googlegroups.com%5C).  
> > For more options, visit [https://groups.google.com/d/optout\](https://groups.google.com/d/optout%5C).

---

<div class="post-metadata">

**Author:** ![Tudor\_Rogojanu](https://avatars.discourse-cdn.com/v4/letter/t/5fc32e/32.png) [@Tudor\_Rogojanu](https://forum.search-guard.com/u/Tudor_Rogojanu)\
**Post date:** [March 5, 2019, 5:50am UTC](https://forum.search-guard.com/t/cant-init-searchguard-after-new-certificates/1346/3 "2019-03-05T05:50:52Z")

</div>

Ok, thank you for the info. I hope for an easier solution than this ☹

I’ve aleardy run it with `--accept-red-cluster. It's in my first message. Unfortunately, it doesn't work: `  
`primary shard is not active`

```auto

```

```auto

```

```Thank

```

vineri, 1 martie 2019, 15:41:26 UTC+2, Tudor Rogojanu a scris:

> **···**
>
> > Hello,
> 
> > 
> 
> > I have ES 6.0.0 and SG 6-6.0.0-17.beta1 running on a server for more than a year. It’s just a small demo that i play with from time to time, so nobody else has access to it. I had no problems with it for a long time.
> 
> > 
> 
> > I noticed this week that i can’t login anymore. I haven’t done any changes to ES or SG for more than a year. After some debugging it seemed to be because of the old certificates, so i downloaded the new demo certificates. But when i run  
> > ./sgadmin.sh -cd …/sgconfig/ -icl -nhnv -cacert root-ca.pem -cert kirk.pem -key kirk-key.pem
> 
> > ``
> 
> > it says
> 
> > Search Guard Admin v6  
> > Will connect to localhost:9300 … done  
> > Connected as CN=kirk,OU=client,O=client,L=test,C=de  
> > Contacting elasticsearch cluster ‘searchguard\_demo’ and wait for YELLOW clusterstate …  
> > ERR: Timed out while waiting for a green or yellow cluster state.
> 
> > ``
> 
> > 
> 
> > Running
> 
> > ./sgadmin.sh -cn searchguard\_demo -cd …/sgconfig/ -nhnv -cacert root-ca.pem -cert kirk.pem -key kirk-key.pem --accept-red-cluster
> 
> > ``
> 
> > results in
> 
> > Search Guard Admin v6  
> > Will connect to localhost:9300 … done  
> > Connected as CN=kirk,OU=client,O=client,L=test,C=de  
> > Contacting elasticsearch cluster ‘searchguard\_demo’ …  
> > Clustername: searchguard\_demo  
> > Clusterstate: RED  
> > Number of nodes: 1  
> > Number of data nodes: 1  
> > searchguard index already exists, so we do not need to create one.  
> > ERR: searchguard index state is RED.  
> > Populate config from /usr/share/elasticsearch/plugins/search-guard-6/sgconfig  
> > Will update ‘config’ with …/sgconfig/sg\_config.yml  
> > FAIL: Configuration for ‘config’ failed because of UnavailableShardsException[[searchguard][0] primary shard is not active Timeout: [1m], request: [BulkShardRequest [[searchguard][0]] containing [index {[searchguard][sg][config], source[n/a, actual length: [3.2kb], max length: 2kb]}] and a refresh]]  
> > Will update ‘roles’ with …/sgconfig/sg\_roles.yml  
> > FAIL: Configuration for ‘roles’ failed because of UnavailableShardsException[[searchguard][0] primary shard is not active Timeout: [1m], request: [BulkShardRequest [[searchguard][0]] containing [index {[searchguard][sg][roles], source[n/a, actual length: [3.6kb], max length: 2kb]}] and a refresh]]  
> > Will update ‘rolesmapping’ with …/sgconfig/sg\_roles\_mapping.yml  
> > FAIL: Configuration for ‘rolesmapping’ failed because of UnavailableShardsException[[searchguard][0] primary shard is not active Timeout: [1m], request: [BulkShardRequest [[searchguard][0]] containing [index {[searchguard][sg][rolesmapping], source[{“rolesmapping”:“eyJzZ19hbGxfYWNjZXNzIjp7InJlYWRvbmx5Ijp0cnVlLCJiYWNrZW5kcm9sZXMiOlsiYWRtaW4iXX0sInNnX2xvZ3N0YXNoIjp7ImJhY2tlbmRyb2xlcyI6WyJsb2dzdGFzaCJdfSwic2dfa2liYW5hX3NlcnZlciI6eyJyZWFkb25seSI6dHJ1ZSwidXNlcnMiOlsia2liYW5hc2VydmVyIl19LCJzZ19raWJhbmFfdXNlciI6eyJiYWNrZW5kcm9sZXMiOlsia2liYW5hdXNlciJdfSwic2dfcmVhZGFsbCI6eyJyZWFkb25seSI6dHJ1ZSwiYmFja2VuZHJvbGVzIjpbInJlYWRhbGwiXX0sInNnX21hbmFnZV9zbmFwc2hvdHMiOnsicmVhZG9ubHkiOnRydWUsImJhY2tlbmRyb2xlcyI6WyJzbmFwc2hvdHJlc3RvcmUiXX0sInNnX293bl9pbmRleCI6eyJ1c2VycyI6WyIqIl19fQ==”}]}] and a refresh]]  
> > Will update ‘internalusers’ with …/sgconfig/sg\_internal\_users.yml  
> > FAIL: Configuration for ‘internalusers’ failed because of UnavailableShardsException[[searchguard][0] primary shard is not active Timeout: [1m], request: [BulkShardRequest [[searchguard][0]] containing [index {[searchguard][sg][internalusers], source[{“internalusers”:“eyJhZG1pbiI6eyJyZWFkb25seSI6dHJ1ZSwiaGFzaCI6IiQyYSQxMiRWY0NEZ2gyTkRrMDdKR04wcmpHYk0uQWQ0MXFWUi9ZRkpjZ0hwMFVHbnM1SkR5bXYuLlRPRyIsInJvbGVzIjpbImFkbWluIl19LCJsb2dzdGFzaCI6eyJyZWFkb25seSI6dHJ1ZSwiaGFzaCI6IiQyYSQxMiR1MVNoUjRsNHVCUzNVdjU5UGEyeTUuMXVRdVpCclp0bU5mcUIzaU0vLmpMMFhvVjlzZ2hTMiIsInJvbGVzIjpbImxvZ3N0YXNoIl19LCJraWJhbmFzZXJ2ZXIiOnsicmVhZG9ubHkiOnRydWUsImhhc2giOiIkMmEkMTIkNEFjZ0F0M3h3T1dhZEE1czVibEw2ZXYzOU9YRE5obU9lc0VvbzMzZVp0cnEyTjBZclUzSC4ifSwia2liYW5hcm8iOnsicmVhZG9ubHkiOnRydWUsImhhc2giOiIkMmEkMTIkSkpTWE5mVG93ejdVdTV0dFhmZVlwZVlFMGFyQUN2Y3dsUEJTdEIxRi5NSTdmMFU5WjRER0MiLCJyb2xlcyI6WyJraWJhbmF1c2VyIiwicmVhZGFsbCJdfSwicmVhZGFsbCI6eyJoYXNoIjoiJDJhJDEyJGFlNHljd3p3dkx0Wnh3WjgyUm1pRXVuQmJJUGlBbUdaZHVCQWpLTjBUWGR3UUZ0Q3dBUnoyIiwicm9sZXMiOlsicmVhZGFsbCJdfSwic25hcHNob3RyZXN0b3JlIjp7Imhhc2giOiIkMnkkMTIkRHB3bWV0SEt3Z1lub3JiZ2R2T1JDZW52NE5BSzhjUFVnOEFJNnB4TEN1V2YvQUxjMC52N1ciLCJyb2xlcyI6WyJzbmFwc2hvdHJlc3RvcmUiXX19”}]}] and a refresh]]  
> > Will update ‘actiongroups’ with …/sgconfig/sg\_action\_groups.yml  
> > FAIL: Configuration for ‘actiongroups’ failed because of UnavailableShardsException[[searchguard][0] primary shard is not active Timeout: [1m], request: [BulkShardRequest [[searchguard][0]] containing [index {[searchguard][sg][actiongroups], source[n/a, actual length: [2.6kb], max length: 2kb]}] and a refresh]]  
> > FAIL: Expected 1 nodes to return response, but got only 0  
> > Done with failures
> 
> > ``
> 
> > 
> 
> > 
> 
> > The yml config is
> 
> > searchguard.ssl.transport.pemkey\_filepath: esnode-key.pem  
> > searchguard.ssl.transport.pemtrustedcas\_filepath: root-ca.pem  
> > searchguard.ssl.transport.enforce\_hostname\_verification: false  
> > searchguard.ssl.http.enabled: false  
> > searchguard.ssl.http.pemcert\_filepath: esnode.pem  
> > searchguard.ssl.http.pemkey\_filepath: esnode-key.pem  
> > searchguard.ssl.http.pemtrustedcas\_filepath: root-ca.pem  
> > searchguard.allow\_unsafe\_democertificates: true  
> > searchguard.allow\_default\_init\_sgindex: true  
> > searchguard.authcz.admin\_dn:
> > 
> > - CN=kirk,OU=client,O=client,L=test, C=de
> > 
> > searchguard.audit.type: internal\_elasticsearch  
> > searchguard.enable\_snapshot\_restore\_privilege: true  
> > searchguard.check\_snapshot\_restore\_write\_privileges: true  
> > searchguard.restapi.roles\_enabled: [“sg\_all\_access”]  
> > cluster.name: searchguard\_demo  
> > discovery.zen.minimum\_master\_nodes: 1  
> > node.max\_local\_storage\_nodes: 3
> 
> > ``
> 
> > 
> 
> > ES logs just say:
> 
> > [ERROR][c.f.s.a.BackendRegistry] Not yet initialized (you may need to run sgadmin)
> 
> > ``
> 
> > 
> 
> > Java is 1.8.0\_151, OS is Debian GNU/Linux 8.7 (jessie).
> 
> > Thank you

---

<div class="post-metadata">

**Author:** ![cstaley](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.search-guard.com/cstaley/32/463_2.png) [@cstaley](https://forum.search-guard.com/u/cstaley)\
**Post date:** [April 24, 2019, 1:41pm UTC](https://forum.search-guard.com/t/cant-init-searchguard-after-new-certificates/1346/4 "2019-04-24T13:41:53Z")

</div>

Maybe you turned off shard allocation during the update. If so please enable shard allocation again with `sgadmin -esa` option

---

<div class="post-metadata">

**Author:** ![cstaley](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.search-guard.com/cstaley/32/463_2.png) [@cstaley](https://forum.search-guard.com/u/cstaley)\
**Post date:** [April 24, 2019, 5:43pm UTC](https://forum.search-guard.com/t/cant-init-searchguard-after-new-certificates/1346/5 "2019-04-24T17:43:20Z")

</div>

Assigned @cstaley on April 24, 2019, 5:43pm UTC


