# \[c.f.s.a.r.AuthenticatingRestFilter\] \[node1\] Not yet initialized (you may need to run sgctl)

**URL:** <https://forum.search-guard.com/t/c-f-s-a-r-authenticatingrestfilter-node1-not-yet-initialized-you-may-need-to-run-sgctl/2433>\
**Category:** Search Guard\
**Created:** [April 17, 2023, 10:05pm UTC](https://forum.search-guard.com/t/c-f-s-a-r-authenticatingrestfilter-node1-not-yet-initialized-you-may-need-to-run-sgctl/2433 "2023-04-17T22:05:42Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![landon\_jt](https://avatars.discourse-cdn.com/v4/letter/l/a183cd/32.png) [@landon\_jt](https://forum.search-guard.com/u/landon_jt)\
**Post date:** [April 17, 2023, 10:05pm UTC](https://forum.search-guard.com/t/c-f-s-a-r-authenticatingrestfilter-node1-not-yet-initialized-you-may-need-to-run-sgctl/2433/1 "2023-04-17T22:05:43Z")

</div>

ElasticSearch Version: elasticsearch-8.6.2-1.x86\_64  
Logstash Version: logstash-oss-8.6.2-1.x86\_64  
Kibana Version: kibana-8.6.2-1.x86\_64  
Searchguard Version:

- search-guard-flx-elasticsearch-plugin-1.1.1-es-8.6.2.zip
- search-guard-flx-kibana-plugin-1.1.0-es-8.6.2.zip

OS: Red Hat Enterprise Linux release 8.4 (Ootpa)

Issue:  
I’m trying to install searchguard from the steps listed here

> **[Search Guard Installation](https://docs.search-guard.com/latest/search-guard-installation#initializing-search-guard)**
>
> Step by step instructions for setting up Search Guard on a new or existing Elastcsearch cluster.

In the “Initializing Searchguard” steps, I go to the [Using sgctl | Security for Elasticsearch | Search Guard](https://docs.search-guard.com/latest/sgctl-overview) and then click “Basic Usage”

I’m currently on the “Connection Settings” step and trying to run the connect  
sh sgctl-1.1.0.sh connect [elasticsearch.myhost.com](http://elasticsearch.myhost.com) --cert /etc/kibana/server.crt --key /etc/kibana/server.key --ca-cert /etc/kibana/root.crt --insecure -c node1 --debug

Search Guard not initialized (SG11). See [Basic Usage | Security for Elasticsearch | Search Guard](https://docs.search-guard.com/latest/sgctl)  
Server is unavailable: Service Unavailable  
com.floragunn.searchguard.sgctl.SgctlException: Server is unavailable: Service Unavailable  
at com.floragunn.searchguard.sgctl.commands.ConnectingCommand.getClient(ConnectingCommand.java:131)  
at com.floragunn.searchguard.sgctl.commands.Connect.call(Connect.java:37)  
at com.floragunn.searchguard.sgctl.commands.Connect.call(Connect.java:29)  
at picocli.CommandLine.executeUserObject(CommandLine.java:1953)  
at picocli.CommandLine.access$1300(CommandLine.java:145)  
at picocli.CommandLine$RunLast.executeUserObjectOfLastSubcommandWithSameParent(CommandLine.java:2352)  
at picocli.CommandLine$RunLast.handle(CommandLine.java:2346)  
at picocli.CommandLine$RunLast.handle(CommandLine.java:2311)  
at picocli.CommandLine$AbstractParseResultHandler.execute(CommandLine.java:2179)  
at picocli.CommandLine.execute(CommandLine.java:2078)  
at com.floragunn.searchguard.sgctl.SgctlTool.exec(SgctlTool.java:63)  
at com.floragunn.searchguard.sgctl.SgctlTool.main(SgctlTool.java:58)  
Caused by: com.floragunn.searchguard.sgctl.client.ServiceUnavailableException: Service Unavailable  
at com.floragunn.searchguard.sgctl.client.SearchGuardRestClient$Response.checkStatus(SearchGuardRestClient.java:421)  
at com.floragunn.searchguard.sgctl.client.SearchGuardRestClient$Response.parseResponseBy(SearchGuardRestClient.java:396)  
at com.floragunn.searchguard.sgctl.client.SearchGuardRestClient.authInfo(SearchGuardRestClient.java:84)  
at com.floragunn.searchguard.sgctl.commands.ConnectingCommand.getClient(ConnectingCommand.java:119)

The steps say at this point I should be connected to the service, but I keep getting the above error message.

The elasticsearch-cluster.log prints out the message  
[ERROR][c.f.s.a.r.AuthenticatingRestFilter] [node1] Not yet initialized (you may need to run sgctl)

elasticsearch.yml (with the hostname changed and the comments removed)  
cluster.name: elastic-cluster  
node.name: node1  
path.data: /data/elasticsearch  
path.logs: /var/log/elasticsearch  
network.host: [elasticsearch.myhost.com](http://elasticsearch.myhost.com)  
http.port: 9200

xpack.security.enabled: false  
ingest.geoip.downloader.enabled: false  
discovery.type: single-node  
search.max\_buckets: 20000000

searchguard.disabled: false

searchguard.enterprise\_modules\_enabled: false

searchguard.ssl.transport.pemkey\_filepath: server.key  
searchguard.ssl.transport.pemcert\_filepath: server.crt  
searchguard.ssl.transport.pemtrustedcas\_filepath: root.crt  
searchguard.ssl.transport.enforce\_hostname\_verification: false  
searchguard.ssl.transport.resolve\_hostname: false

searchguard.ssl.http.enabled: true  
searchguard.ssl.http.pemkey\_filepath: server.key  
searchguard.ssl.http.pemcert\_filepath: server.crt  
searchguard.ssl.http.pemtrustedcas\_filepath: root.crt

searchguard.authcz.admin\_dn:

- “CN=\*.myhost.com,OU=Domain Control Validated”  
searchguard.nodes\_dn:
- “CN=\*.myhost.com”  
searchguard.restapi.roles\_enabled: [“SGS\_ALL\_ACCESS”]

Does anyone know what I missed when trying to initialize SearchGuard?  
Thanks for your help

---

<div class="post-metadata">

**Author:** ![nils](https://avatars.discourse-cdn.com/v4/letter/n/d6d6ee/32.png) [@nils](https://forum.search-guard.com/u/nils)\
**Post date:** [April 18, 2023, 11:59am UTC](https://forum.search-guard.com/t/c-f-s-a-r-authenticatingrestfilter-node1-not-yet-initialized-you-may-need-to-run-sgctl/2433/2 "2023-04-18T11:59:05Z")

</div>

Hello!

> [@landon\_jt](#):
>
> sh sgctl-1.1.0.sh connect [elasticsearch.myhost.com](http://elasticsearch.myhost.com) --cert /etc/kibana/server.crt --key /etc/kibana/server.key --ca-cert /etc/kibana/root.crt --insecure -c node1 --debug

`/etc/kibana/server.crt` sounds a bit weird for two reasons:

- The path mentions kibana. However, we are connecting here to the underlying Elasticsearch
- You need to use a so-called admin client certificate. This is not just any client certificate, but it must be specially recognized. One way of doing so is to configure the DNs of all admin certificates in elasticsearch.yml. You also posted this snippet:

```auto
searchguard.authcz.admin_dn:
 - “CN=*.myhost.com,OU=Domain Control Validated”

```

Note that this is not a valid configuration, as the `admin_dn` setting does not allow wildcards. See the docs here:

> **[Configuring TLS](https://docs.search-guard.com/latest/configuring-tls#configuring-admin-certificates)**
>
> Search Guard TLS configuration settings for the REST and the transport layer. Extended security options for hostname verification and DNS lookups.

---

<div class="post-metadata">

**Author:** ![landon\_jt](https://avatars.discourse-cdn.com/v4/letter/l/a183cd/32.png) [@landon\_jt](https://forum.search-guard.com/u/landon_jt)\
**Post date:** [April 18, 2023, 5:52pm UTC](https://forum.search-guard.com/t/c-f-s-a-r-authenticatingrestfilter-node1-not-yet-initialized-you-may-need-to-run-sgctl/2433/3 "2023-04-18T17:52:51Z")

</div>

Thanks for your help!

The /etc/kibana and /etc/elasticsearch are duplicates of each other so I was using the same one.

I’ll try finding a different cert though that doesn’t use the wildcard for the admin. I’ll let you know how it goes.

Out of curiosity though, did SearchGuard 7 (with ELK7) used to use wildcard admin certs? I used to have an ELK7 system that had the above settings for admin\_dn and it seemed to work.

---

<div class="post-metadata">

**Author:** ![landon\_jt](https://avatars.discourse-cdn.com/v4/letter/l/a183cd/32.png) [@landon\_jt](https://forum.search-guard.com/u/landon_jt)\
**Post date:** [April 18, 2023, 11:26pm UTC](https://forum.search-guard.com/t/c-f-s-a-r-authenticatingrestfilter-node1-not-yet-initialized-you-may-need-to-run-sgctl/2433/4 "2023-04-18T23:26:05Z")

</div>

I tried to use the demo certificates from the zip in this link

> **[Download demo certificates](https://docs.search-guard.com/latest/tls-download-certificates)**
>
> How to download and install the Search Guard demo certificates for quickly setting up a PoC.

and put them into /etc/elasticsearch/config folder. Then I changed my elasticsearch.yml to this

cluster.name: elastic-cluster

node.name: node1

path.data: /data/elasticsearch

path.logs: /var/log/elasticsearch

network.host: localhost

http.port: 9200

xpack.security.enabled: false  
ingest.geoip.downloader.enabled: false  
discovery.type: single-node  
search.max\_buckets: 20000000

searchguard.disabled: false

searchguard.enterprise\_modules\_enabled: false

searchguard.ssl.transport.pemkey\_filepath: config/esnode.pem  
searchguard.ssl.transport.pemcert\_filepath: config/esnode-key.pem  
searchguard.ssl.transport.pemtrustedcas\_filepath: config/root-ca.pem  
searchguard.ssl.transport.enforce\_hostname\_verification: false  
searchguard.ssl.transport.resolve\_hostname: false

searchguard.ssl.http.enabled: true  
searchguard.ssl.http.pemkey\_filepath: config/esnode.pem  
searchguard.ssl.http.pemcert\_filepath: config/esnode-key.pem  
searchguard.ssl.http.pemtrustedcas\_filepath: config/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.restapi.roles\_enabled: [“SGS\_ALL\_ACCESS”]

However, now elasticsearch is showing an error that says  
Caused by: java.security.cert.CertificateParsingException: signed fields invalid  
at sun.security.x509.X509CertImpl.parse(X509CertImpl.java:1806) ~[?:?]  
at sun.security.x509.X509CertImpl.(X509CertImpl.java:183) ~[?:?]  
at sun.security.provider.X509Factory.parseX509orPKCS7Cert(X509Factory.java:481) ~[?:?]  
at sun.security.provider.X509Factory.engineGenerateCertificates(X509Factory.java:366) ~[?:?]  
at java.security.cert.CertificateFactory.generateCertificates(CertificateFactory.java:478) ~[?:?]  
at com.floragunn.searchguard.support.PemKeyReader.loadCertificatesFromFile(PemKeyReader.java:196) ~[?:?]  
at com.floragunn.searchguard.ssl.DefaultSearchGuardKeyStore.initTransportSSLConfig(DefaultSearchGuardKeyStore.java:340) ~[?:?]  
at com.floragunn.searchguard.ssl.DefaultSearchGuardKeyStore.initSSLConfig(DefaultSearchGuardKeyStore.java:222) ~[?:?]  
at com.floragunn.searchguard.ssl.DefaultSearchGuardKeyStore.(DefaultSearchGuardKeyStore.java:143) ~[?:?]  
at com.floragunn.searchguard.ssl.SearchGuardSSLPlugin.(SearchGuardSSLPlugin.java:219) ~[?:?]  
at com.floragunn.searchguard.SearchGuardPlugin.(SearchGuardPlugin.java:256) ~[?:?]  
at jdk.internal.reflect.DirectConstructorHandleAccessor.newInstance(DirectConstructorHandleAccessor.java:67) ~[?:?]  
at java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:500) ~[?:?]  
at java.lang.reflect.Constructor.newInstance(Constructor.java:484) ~[?:?]  
at org.elasticsearch.plugins.PluginsService.loadPlugin(PluginsService.java:609) ~[elasticsearch-8.6.2.jar:?]  
… 9 more

I made sure the certs were owned by elasticsearch.elasticsearch user and ran dos2unix just in case.

Am I doing something wrong with the demo certs?

Another question I have is that after I resolve the cert issue what sgctl command can I run to initialize everything?

The demo link says to run

```auto
./sgctl.sh update-config ...

but the previous links were saying to run

./sgctl.sh connect ...
```

---

<div class="post-metadata">

**Author:** ![nils](https://avatars.discourse-cdn.com/v4/letter/n/d6d6ee/32.png) [@nils](https://forum.search-guard.com/u/nils)\
**Post date:** [April 20, 2023, 10:47am UTC](https://forum.search-guard.com/t/c-f-s-a-r-authenticatingrestfilter-node1-not-yet-initialized-you-may-need-to-run-sgctl/2433/5 "2023-04-20T10:47:04Z")

</div>

> [@landon\_jt](#):
>
> Caused by: java.security.cert.CertificateParsingException: signed fields invalid

Can you give a bit more log context for the exceptions? Is a file or configuration key managed?

> [@landon\_jt](#):
>
> The demo link says to run
> 
> ```auto
> ./sgctl.sh update-config ...
> 
> but the previous links were saying to run
> 
> ./sgctl.sh connect ...
> 
> ```

Initially, you have to execute `sgctl connect` once in order to create its connection profile. Afterwards, you can use the other commands.

---

<div class="post-metadata">

**Author:** ![landon\_jt](https://avatars.discourse-cdn.com/v4/letter/l/a183cd/32.png) [@landon\_jt](https://forum.search-guard.com/u/landon_jt)\
**Post date:** [April 20, 2023, 4:31pm UTC](https://forum.search-guard.com/t/c-f-s-a-r-authenticatingrestfilter-node1-not-yet-initialized-you-may-need-to-run-sgctl/2433/6 "2023-04-20T16:31:24Z")

</div>

The full stacktrace is when using the demo certificates is the following. I get this stacktrace when starting up the elasticsearch service.

[2023-04-20T09:05:15,191][INFO][o.e.n.Node] [node1] JVM home [/usr/share/elasticsearch/jdk], using bundled JDK [true]  
[2023-04-20T09:05:15,192][INFO][o.e.n.Node] [node1] JVM arguments [-Des.networkaddress.cache.ttl=60, -Des.networkaddress.cache.negative.ttl=10, -Djava.security.manager=allow, -XX:+AlwaysPreTouch, -Xss1m, -Djava.awt.headless=true, -Dfile.encoding=UTF-8, -Djna.nosys=true, -XX:-OmitStackTraceInFastThrow, -Dio.netty.noUnsafe=true, -Dio.netty.noKeySetOptimization=true, -Dio.netty.recycler.maxCapacityPerThread=0, -Dlog4j.shutdownHookEnabled=false, -Dlog4j2.disable.jmx=true, -Dlog4j2.formatMsgNoLookups=true, -Djava.locale.providers=SPI,COMPAT, --add-opens=java.base/java.io=ALL-UNNAMED, -XX:+UseG1GC, -Djava.io.tmpdir=/var/log/elasticsearch, -XX:+HeapDumpOnOutOfMemoryError, -XX:+ExitOnOutOfMemoryError, -XX:HeapDumpPath=/var/lib/elasticsearch, -XX:ErrorFile=/var/log/elasticsearch/hs\_err\_pid%p.log, -Xlog:gc\*,gc+age=trace,safepoint:file=/var/log/elasticsearch/gc.log:utctime,pid,tags:filecount=32,filesize=64m, -Djna.tmpdir=/var/lib/elasticsearch/tmp, -Xms7861m, -Xmx7861m, -XX:MaxDirectMemorySize=4123000832, -XX:G1HeapRegionSize=4m, -XX:InitiatingHeapOccupancyPercent=30, -XX:G1ReservePercent=15, -Des.distribution.type=rpm, --module-path=/usr/share/elasticsearch/lib, --add-modules=[jdk.net](http://jdk.net), -Djdk.module.main=org.elasticsearch.server]  
[2023-04-20T09:05:16,682][INFO][c.a.c.i.j.JacksonVersion] [node1] Package versions: jackson-annotations=2.13.2, jackson-core=2.13.2, jackson-databind=2.13.2.2, jackson-dataformat-xml=2.13.2, jackson-datatype-jsr310=2.13.2, azure-core=1.27.0, Troubleshooting version conflicts: [https://aka.ms/azsdk/java/dependency/troubleshoot](https://aka.ms/azsdk/java/dependency/troubleshoot)  
[2023-04-20T09:05:18,044][INFO][c.f.s.SearchGuardPlugin] [node1] ES Config path is /etc/elasticsearch  
[2023-04-20T09:05:18,140][INFO][c.f.s.s.DefaultSearchGuardKeyStore] [node1] JVM supports TLSv1.3  
[2023-04-20T09:05:18,143][INFO][c.f.s.s.DefaultSearchGuardKeyStore] [node1] Config directory is /etc/elasticsearch/, from there the key- and truststore files are resolved relatively  
[2023-04-20T09:05:18,261][ERROR][o.e.b.Elasticsearch] [node1] fatal exception while booting Elasticsearch  
java.lang.IllegalStateException: failed to load plugin class [com.floragunn.searchguard.SearchGuardPlugin]  
at org.elasticsearch.plugins.PluginsService.loadPlugin(PluginsService.java:618) ~[elasticsearch-8.6.2.jar:?]  
at org.elasticsearch.plugins.PluginsService.loadBundle(PluginsService.java:493) ~[elasticsearch-8.6.2.jar:?]  
at org.elasticsearch.plugins.PluginsService.loadBundles(PluginsService.java:290) ~[elasticsearch-8.6.2.jar:?]  
at org.elasticsearch.plugins.PluginsService.(PluginsService.java:159) ~[elasticsearch-8.6.2.jar:?]  
at org.elasticsearch.plugins.PluginsService.lambda$getPluginsServiceCtor$14(PluginsService.java:645) ~[elasticsearch-8.6.2.jar:?]  
at org.elasticsearch.node.Node.(Node.java:415) ~[elasticsearch-8.6.2.jar:?]  
at org.elasticsearch.node.Node.(Node.java:322) ~[elasticsearch-8.6.2.jar:?]  
at org.elasticsearch.bootstrap.Elasticsearch$2.(Elasticsearch.java:214) ~[elasticsearch-8.6.2.jar:?]  
at org.elasticsearch.bootstrap.Elasticsearch.initPhase3(Elasticsearch.java:214) ~[elasticsearch-8.6.2.jar:?]  
at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:67) ~[elasticsearch-8.6.2.jar:?]  
Caused by: java.lang.reflect.InvocationTargetException  
at jdk.internal.reflect.DirectConstructorHandleAccessor.newInstance(DirectConstructorHandleAccessor.java:79) ~[?:?]  
at java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:500) ~[?:?]  
at java.lang.reflect.Constructor.newInstance(Constructor.java:484) ~[?:?]  
at org.elasticsearch.plugins.PluginsService.loadPlugin(PluginsService.java:609) ~[elasticsearch-8.6.2.jar:?]  
… 9 more  
Caused by: org.elasticsearch.ElasticsearchSecurityException: Error while initializing transport SSL layer from PEM: java.security.cert.CertificateParsingException: signed fields invalid  
at com.floragunn.searchguard.ssl.DefaultSearchGuardKeyStore.initTransportSSLConfig(DefaultSearchGuardKeyStore.java:367) ~[?:?]  
at com.floragunn.searchguard.ssl.DefaultSearchGuardKeyStore.initSSLConfig(DefaultSearchGuardKeyStore.java:222) ~[?:?]  
at com.floragunn.searchguard.ssl.DefaultSearchGuardKeyStore.(DefaultSearchGuardKeyStore.java:143) ~[?:?]  
at com.floragunn.searchguard.ssl.SearchGuardSSLPlugin.(SearchGuardSSLPlugin.java:219) ~[?:?]  
at com.floragunn.searchguard.SearchGuardPlugin.(SearchGuardPlugin.java:256) ~[?:?]  
at jdk.internal.reflect.DirectConstructorHandleAccessor.newInstance(DirectConstructorHandleAccessor.java:67) ~[?:?]  
at java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:500) ~[?:?]  
at java.lang.reflect.Constructor.newInstance(Constructor.java:484) ~[?:?]  
at org.elasticsearch.plugins.PluginsService.loadPlugin(PluginsService.java:609) ~[elasticsearch-8.6.2.jar:?]  
… 9 more  
Caused by: java.security.cert.CertificateParsingException: signed fields invalid  
at sun.security.x509.X509CertImpl.parse(X509CertImpl.java:1806) ~[?:?]  
at sun.security.x509.X509CertImpl.(X509CertImpl.java:183) ~[?:?]  
at sun.security.provider.X509Factory.parseX509orPKCS7Cert(X509Factory.java:481) ~[?:?]  
at sun.security.provider.X509Factory.engineGenerateCertificates(X509Factory.java:366) ~[?:?]  
at java.security.cert.CertificateFactory.generateCertificates(CertificateFactory.java:478) ~[?:?]  
at com.floragunn.searchguard.support.PemKeyReader.loadCertificatesFromFile(PemKeyReader.java:196) ~[?:?]  
at com.floragunn.searchguard.ssl.DefaultSearchGuardKeyStore.initTransportSSLConfig(DefaultSearchGuardKeyStore.java:340) ~[?:?]  
at com.floragunn.searchguard.ssl.DefaultSearchGuardKeyStore.initSSLConfig(DefaultSearchGuardKeyStore.java:222) ~[?:?]  
at com.floragunn.searchguard.ssl.DefaultSearchGuardKeyStore.(DefaultSearchGuardKeyStore.java:143) ~[?:?]  
at com.floragunn.searchguard.ssl.SearchGuardSSLPlugin.(SearchGuardSSLPlugin.java:219) ~[?:?]  
at com.floragunn.searchguard.SearchGuardPlugin.(SearchGuardPlugin.java:256) ~[?:?]  
at jdk.internal.reflect.DirectConstructorHandleAccessor.newInstance(DirectConstructorHandleAccessor.java:67) ~[?:?]  
at java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:500) ~[?:?]  
at java.lang.reflect.Constructor.newInstance(Constructor.java:484) ~[?:?]  
at org.elasticsearch.plugins.PluginsService.loadPlugin(PluginsService.java:609) ~[elasticsearch-8.6.2.jar:?]  
… 9 more

When I tried using my own certs (the ones with the wildcard), I don’t get this error, but then I get the error with the wildcard. For now, I’m going to either generate a new non wildcard cert just for admin usage or see if I can find a different cert (although I’m still curious about the demo certs).

I’m not sure what “file or configuration key managed” means. What information can I give to help determine this?

Thanks!

---

<div class="post-metadata">

**Author:** ![nils](https://avatars.discourse-cdn.com/v4/letter/n/d6d6ee/32.png) [@nils](https://forum.search-guard.com/u/nils)\
**Post date:** [April 21, 2023, 6:08am UTC](https://forum.search-guard.com/t/c-f-s-a-r-authenticatingrestfilter-node1-not-yet-initialized-you-may-need-to-run-sgctl/2433/7 "2023-04-21T06:08:46Z")

</div>

> [@landon\_jt](#):
>
> searchguard.ssl.http.pemkey\_filepath: config/esnode.pem  
> searchguard.ssl.http.pemcert\_filepath: config/esnode-key.pem

> [@landon\_jt](#):
>
> searchguard.ssl.transport.pemkey\_filepath: config/esnode.pem  
> searchguard.ssl.transport.pemcert\_filepath: config/esnode-key.pem

You have flipped the file types in both cases here. The `esnode-key.pem` file needs to be specified for `pemkey_filepath` and the `esnode.pem` needs to be specified for `pemcert_filepath`.

---

<div class="post-metadata">

**Author:** ![landon\_jt](https://avatars.discourse-cdn.com/v4/letter/l/a183cd/32.png) [@landon\_jt](https://forum.search-guard.com/u/landon_jt)\
**Post date:** [April 21, 2023, 9:12pm UTC](https://forum.search-guard.com/t/c-f-s-a-r-authenticatingrestfilter-node1-not-yet-initialized-you-may-need-to-run-sgctl/2433/8 "2023-04-21T21:12:01Z")

</div>

Thanks! After switching those values I am able to get the demo certificates to work. I was able to run the sgctl connect and the sgctl update-config (though I wasn’t able to load the default sg\_frontend\_multi\_tenancy.yml file. I just removed it for now). I can continue setting up the rest of ELK now.

Once I am able to get the new non-demo certificates without wildcards I will try with those. Thanks for your help again!

---

<div class="post-metadata">

**Author:** ![landon\_jt](https://avatars.discourse-cdn.com/v4/letter/l/a183cd/32.png) [@landon\_jt](https://forum.search-guard.com/u/landon_jt)\
**Post date:** [May 4, 2023, 6:06pm UTC](https://forum.search-guard.com/t/c-f-s-a-r-authenticatingrestfilter-node1-not-yet-initialized-you-may-need-to-run-sgctl/2433/10 "2023-05-04T18:06:23Z")

</div>

Finally got back to this. I’m trying to use custom certificates that we were using for an installation of ELK/SG7, but I’m still getting the same error as I was before using the demo certs on ELK8.6.2. This is a different system than the one I was using earlier, so there are no saved connection settings with the demo certs.

path.data: /var/lib/elasticsearch  
path.logs: /var/log/elasticsearch  
network.host: 0.0.0.0  
http.port: 9200  
xpack.security.enabled: false  
xpack.security.transport.ssl.enabled: false

ingest.geoip.downloader.enabled: false  
discovery.type: single-node  
search.max\_buckets: 20000000

searchguard.ssl.transport.enforce\_hostname\_verification: false  
searchguard.ssl.transport.resolve\_hostname: false

searchguard.ssl.http.enabled: true  
searchguard.ssl.http.clientauth\_mode: NONE

searchguard.ssl.http.keystore\_alias: myalias  
searchguard.ssl.http.keystore\_password: mypass  
searchguard.ssl.http.truststore\_password: mypass  
searchguard.ssl.http.keystore\_filepath: mykeystore.keystore  
searchguard.ssl.http.truststore\_filepath: mytruststore.truststore

searchguard.ssl.transport.keystore\_alias: myalias  
searchguard.ssl.transport.keystore\_password: mypass  
searchguard.ssl.transport.truststore\_password: mypass  
searchguard.ssl.transport.keystore\_filepath: mykeystore.keystore  
searchguard.ssl.transport.truststore\_filepath: mytruststore.truststore

searchguard.authcz.admin\_dn:  
- “[emailAddress=my.email@thecompany.com](mailto:emailAddress=my.email@thecompany.com),CN=client,OU=myclient,O=mycompany,L=MyCity,ST=California,C=US”  
searchguard.nodes\_dn:

- “CN=thecn,O=mycompany,L=MyCity,ST=California,C=US”  
searchguard.restapi.roles\_enabled: [“sgs\_all\_access”]

The subject of the client.us.cer matches the searchguard.authcz.admin\_dn  
openssl x509 -in client.us.cer -text -noout -text -subject -nameopt RFC2253 | grep subject  
subject= [emailAddress=my.email@thecompany.com](mailto:emailAddress=my.email@thecompany.com),CN=client,OU=myclient,O=mycompany,L=MyCity,ST=California,C=US

Note: The values of the subject of the client.us.cer and the searchguard.authcz.admin\_dn match, but I had to change them to post this for sensitive data.

The prod-ca.pem is root + intermediate cert.

The command I am trying to run is  
sh sgctl-1.1.0.sh connect --cert client.us.cer --key client.us.nopass.key -h [elasticsearch.myhost.us](http://elasticsearch.myhost.us) --ca-cert prod-ca.pem --debug

When running the above I get the same error  
Server is unavailable: Service Unavailable  
com.floragunn.searchguard.sgctl.SgctlException: Server is unavailable: Service Unavailable  
at com.floragunn.searchguard.sgctl.commands.ConnectingCommand.getClient(ConnectingCommand.java:131)  
at com.floragunn.searchguard.sgctl.commands.Connect.call(Connect.java:37)  
at com.floragunn.searchguard.sgctl.commands.Connect.call(Connect.java:29)  
at picocli.CommandLine.executeUserObject(CommandLine.java:1953)  
at picocli.CommandLine.access$1300(CommandLine.java:145)  
at picocli.CommandLine$RunLast.executeUserObjectOfLastSubcommandWithSameParent(CommandLine.java:2352)  
at picocli.CommandLine$RunLast.handle(CommandLine.java:2346)  
at picocli.CommandLine$RunLast.handle(CommandLine.java:2311)  
at picocli.CommandLine$AbstractParseResultHandler.execute(CommandLine.java:2179)  
at picocli.CommandLine.execute(CommandLine.java:2078)  
at com.floragunn.searchguard.sgctl.SgctlTool.exec(SgctlTool.java:63)  
at com.floragunn.searchguard.sgctl.SgctlTool.main(SgctlTool.java:58)  
Caused by: com.floragunn.searchguard.sgctl.client.ServiceUnavailableException: Service Unavailable  
at com.floragunn.searchguard.sgctl.client.SearchGuardRestClient$Response.checkStatus(SearchGuardRestClient.java:421)  
at com.floragunn.searchguard.sgctl.client.SearchGuardRestClient$Response.parseResponseBy(SearchGuardRestClient.java:396)  
at com.floragunn.searchguard.sgctl.client.SearchGuardRestClient.authInfo(SearchGuardRestClient.java:84)  
at com.floragunn.searchguard.sgctl.commands.ConnectingCommand.getClient(ConnectingCommand.java:119)  
… 11 more

and the elasticsearch only prints out the message  
[2023-05-04T11:05:12,704][ERROR][c.f.s.a.r.AuthenticatingRestFilter] [myhost] Not yet initialized (you may need to run sgctl)

---

<div class="post-metadata">

**Author:** ![landon\_jt](https://avatars.discourse-cdn.com/v4/letter/l/a183cd/32.png) [@landon\_jt](https://forum.search-guard.com/u/landon_jt)\
**Post date:** [May 5, 2023, 2:03am UTC](https://forum.search-guard.com/t/c-f-s-a-r-authenticatingrestfilter-node1-not-yet-initialized-you-may-need-to-run-sgctl/2433/11 "2023-05-05T02:03:04Z")

</div>

We made some more changes for the elasticsearch.yml

cluster.name: elastic-cluster  
node.name: node-1  
path.data: /data/elasticsearch  
path.logs: /var/log/elasticsearch  
network.host: 0.0.0.0  
http.port: 9200  
xpack.security.enabled: false  
xpack.security.transport.ssl.enabled: false  
xpack.security.autoconfiguration.enabled: false  
ingest.geoip.downloader.enabled: false  
discovery.type: single-node  
search.max\_buckets: 20000000  
searchguard.ssl.transport.enforce\_hostname\_verification: false  
searchguard.ssl.transport.resolve\_hostname: false  
searchguard.ssl.http.enabled: true  
searchguard.ssl.http.clientauth\_mode: NONE  
searchguard.ssl.http.keystore\_alias: myalias  
searchguard.ssl.http.keystore\_password: mypass  
searchguard.ssl.http.truststore\_password: mypass  
searchguard.ssl.http.keystore\_filepath: mykeystore.keystore  
searchguard.ssl.http.truststore\_filepath: mytruststore.truststore  
searchguard.ssl.transport.keystore\_alias: myalias  
searchguard.ssl.transport.keystore\_password: mypass  
searchguard.ssl.transport.truststore\_password: mypass  
searchguard.ssl.transport.keystore\_filepath: mykeystore.keystore  
searchguard.ssl.transport.truststore\_filepath: mytruststore.truststore  
searchguard.allow\_default\_init\_sgindex: true  
searchguard.authcz.admin\_dn:

- “[emailAddress=my.email@thecompany.com](mailto:emailAddress=my.email@thecompany.com),CN=client,OU=myclient,O=mycompany,L=MyCity,ST=California,C=US”  
searchguard.nodes\_dn:
- “CN=thecn,O=mycompany,L=MyCity,ST=California,C=US”  
searchguard.restapi.roles\_enabled: [“SGS\_ALL\_ACCESS”]

## and now we are getting this issue

## HTTP/1.1 401 Unauthorized Content-Type: text/plain Unauthorized

Server rejected request as unauthorized. Please check the client certificate.  
com.floragunn.searchguard.sgctl.SgctlException: Server rejected request as unauthorized. Please check the client certificate.  
at com.floragunn.searchguard.sgctl.commands.ConnectingCommand.getClient(ConnectingCommand.java:133)  
at com.floragunn.searchguard.sgctl.commands.Connect.call(Connect.java:37)  
at com.floragunn.searchguard.sgctl.commands.Connect.call(Connect.java:29)  
at picocli.CommandLine.executeUserObject(CommandLine.java:1953)  
at picocli.CommandLine.access$1300(CommandLine.java:145)  
at picocli.CommandLine$RunLast.executeUserObjectOfLastSubcommandWithSameParent(CommandLine.java:2352)  
at picocli.CommandLine$RunLast.handle(CommandLine.java:2346)  
at picocli.CommandLine$RunLast.handle(CommandLine.java:2311)  
at picocli.CommandLine$AbstractParseResultHandler.execute(CommandLine.java:2179)  
at picocli.CommandLine.execute(CommandLine.java:2078)  
at com.floragunn.searchguard.sgctl.SgctlTool.exec(SgctlTool.java:63)  
at com.floragunn.searchguard.sgctl.SgctlTool.main(SgctlTool.java:58)  
Caused by: com.floragunn.searchguard.sgctl.client.UnauthorizedException: Unauthorized  
at com.floragunn.searchguard.sgctl.client.SearchGuardRestClient$Response.checkStatus(SearchGuardRestClient.java:429)  
at com.floragunn.searchguard.sgctl.client.SearchGuardRestClient$Response.parseResponseBy(SearchGuardRestClient.java:396)  
at com.floragunn.searchguard.sgctl.client.SearchGuardRestClient.authInfo(SearchGuardRestClient.java:84)  
at com.floragunn.searchguard.sgctl.commands.ConnectingCommand.getClient(ConnectingCommand.java:119)

and the elastic log prints out  
Authentication failed for admin from [request=/, directIpAddress=, originatingIpAddress=, clientCertSubject=null]

---

<div class="post-metadata">

**Author:** ![landon\_jt](https://avatars.discourse-cdn.com/v4/letter/l/a183cd/32.png) [@landon\_jt](https://forum.search-guard.com/u/landon_jt)\
**Post date:** [May 5, 2023, 7:03pm UTC](https://forum.search-guard.com/t/c-f-s-a-r-authenticatingrestfilter-node1-not-yet-initialized-you-may-need-to-run-sgctl/2433/12 "2023-05-05T19:03:11Z")

</div>

The issue was that I needed to change the following in elasticsearch.yml

searchguard.ssl.http.clientauth\_mode: OPTIONAL

---

<div class="post-metadata">

**Author:** ![system](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.search-guard.com/system/32/1870_2.png) [@system](https://forum.search-guard.com/u/system)\
**Post date:** [May 26, 2023, 7:03pm UTC](https://forum.search-guard.com/t/c-f-s-a-r-authenticatingrestfilter-node1-not-yet-initialized-you-may-need-to-run-sgctl/2433/13 "2023-05-26T19:03:42Z")

</div>

Closed on May 26, 2023, 7:03pm UTC

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