Elasticsearch-setup-passwords connection issue

Hello Team,

I tried to run the following command:
./elasticsearch-setup-passwords auto -u "https://XXXXXXX:9200"
But got the following error:
Connection failure to: https://XXXXXXX:9200/_xpack/security/_authenticate?pretty failed: Connection refused (Connection refused)

ERROR: Failed to connect to elasticsearch at https://XXXXXXX:9200/_xpack/security/_authenticate?pretty. Is the URL correct and elasticsearch running?

I would appreciate any advice or hints, thank you in advance!

We can't tell if that endpoint is the correct one to reach, this is something that you set up. In general, you should be able to connect to that endpoint to your elasticsearch instance. What happens when you try reach it via curl or your browser? Does it work? I suppose you did setup TLS/https?

I suppose you did setup TLS/https? ------------->Yes, we did. we are following: Configuring SSL, TLS, and HTTPS to secure Elasticsearch, Kibana, Beats, and Logstash | Elastic Blog for setting SSL/TLS and we are blocked at [2-6-4] .

What happens when you try reach it via curl or your browser? Does it work? -----> No it doesn't. It works when I hit URL without applying SSL/TLS.

No it doesn't. It works when I hit URL without applying SSL/TLS.

I don't understand that. Can you explain?

When we hit URL before configuring SSL/TSL http://XXXXXXX:9200 then it gives output as follows:

{
"name" : "pYwR4IF",
"cluster_name" : "elasticsearch",
"cluster_uuid" : "bR6a2IkVRmCWmqcjRL_ABQ",
"version" : {
"number" : "6.8.6",
"build_flavor" : "default",
"build_type" : "tar",
"build_hash" : "56c6e48",
"build_date" : "2019-04-29T09:05:50.290371Z",
"build_snapshot" : false,
"lucene_version" : "7.7.0",
"minimum_wire_compatibility_version" : "5.6.0",
"minimum_index_compatibility_version" : "5.0.0"
},
"tagline" : "You Know, for Search"
}

after configuring SSL/TSL by these steps Configuring SSL, TLS, and HTTPS to secure Elasticsearch, Kibana, Beats, and Logstash | Elastic Blog
the output will be:
https://XXXXXXX:9200 refused to connect.

Try:

· Checking the connection

· Checking the proxy and the firewall

ERR_CONNECTION_REFUSED

It sounds like your node is failing to start. You need to read the Elasticsearch logs to find out why.

There is nothing getting logged in elasticsearch log but nohup.error has below error:

Exception in thread "main" java.lang.NoClassDefFoundError: Could not initialize class sun.security.util.SignatureFileVerifier
at java.util.jar.JarFile.initializeVerifier(JarFile.java:371)
at java.util.jar.JarFile.ensureInitialization(JarFile.java:615)
at java.util.jar.JavaUtilJarAccessImpl.ensureInitialization(JavaUtilJarAccessImpl.java:69)
at sun.misc.URLClassPath$JarLoader$2.getManifest(URLClassPath.java:991)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:451)
at java.net.URLClassLoader.access$100(URLClassLoader.java:74)
at java.net.URLClassLoader$1.run(URLClassLoader.java:369)
at java.net.URLClassLoader$1.run(URLClassLoader.java:363)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:362)
at java.lang.ClassLoader.loadClass(ClassLoader.java:418)
at java.lang.ClassLoader.loadClass(ClassLoader.java:405)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:355)
at java.lang.ClassLoader.loadClass(ClassLoader.java:351)
at sun.security.jca.ProviderConfig$2.run(ProviderConfig.java:215)
at sun.security.jca.ProviderConfig$2.run(ProviderConfig.java:206)
at java.security.AccessController.doPrivileged(Native Method)
at sun.security.jca.ProviderConfig.doLoadProvider(ProviderConfig.java:206)
at sun.security.jca.ProviderConfig.getProvider(ProviderConfig.java:187)
at sun.security.jca.ProviderList.getProvider(ProviderList.java:233)
at sun.security.jca.ProviderList$ServiceList.tryGet(ProviderList.java:434)
at sun.security.jca.ProviderList$ServiceList.access$200(ProviderList.java:376)
at sun.security.jca.ProviderList$ServiceList$1.hasNext(ProviderList.java:486)
at javax.crypto.SecretKeyFactory.nextSpi(SecretKeyFactory.java:293)
at javax.crypto.SecretKeyFactory.(SecretKeyFactory.java:121)
at javax.crypto.SecretKeyFactory.getInstance(SecretKeyFactory.java:160)
at org.elasticsearch.common.settings.KeyStoreWrapper.createCipher(KeyStoreWrapper.java:299)
at org.elasticsearch.common.settings.KeyStoreWrapper.decrypt(KeyStoreWrapper.java:348)
at org.elasticsearch.bootstrap.Bootstrap.loadSecureSettings(Bootstrap.java:241)
at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:295)
at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:159)
at org.elasticsearch.bootstrap.Elasticsearch.execute(Elasticsearch.java:150)
at org.elasticsearch.cli.EnvironmentAwareCommand.execute(EnvironmentAwareCommand.java:86)
at org.elasticsearch.cli.Command.mainWithoutErrorHandling(Command.java:124)
at org.elasticsearch.cli.Command.main(Command.java:90)
at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:116)
at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:93)
"nohup.error" 38L, 2746C