HI,I meet problem as title. Let me describe it in detail
Version: OpenSearch 2.3.0
issue:
I plan to use 3 ec2 instances to create opensearch cluster with https. 2 are model node, 1 is data node. I named them as model0, model1 and data. When I finish all the steps and start 3 nodes in turn.Evey of them show the “unable to find valid certification path to requested target” error message.
Here is my opensearch.yml file. Beside that,I write a ssh file to generate all of the *.pem files.
Configuration:
model0 generate.sh file(every shell file has same content):
#!/bin/sh
# Root CA
openssl genrsa -out root-ca-key.pem 2048
openssl req -new -x509 -sha256 -key root-ca-key.pem -subj "/C=CN/ST=shanghai/L=shanghai/O=mycompany/OU=ml/CN=root" -out root-ca.pem -days 3650
# Admin cert
openssl genrsa -out admin-key-temp.pem 2048
openssl pkcs8 -inform PEM -outform PEM -in admin-key-temp.pem -topk8 -nocrypt -v1 PBE-SHA1-3DES -out admin-key.pem
openssl req -new -key admin-key.pem -subj "/C=CN/ST=shanghai/L=shanghai/O=mycompany/OU=ml/CN=admin" -out admin.csr
openssl x509 -req -in admin.csr -CA root-ca.pem -CAkey root-ca-key.pem -CAcreateserial -sha256 -out admin.pem -days 3650
# model0 cert
openssl genrsa -out model0-key-temp.pem 2048
openssl pkcs8 -inform PEM -outform PEM -in model0-key-temp.pem -topk8 -nocrypt -v1 PBE-SHA1-3DES -out model0-key.pem
openssl req -new -key model0-key.pem -subj "/C=CN/ST=shanghai/L=shanghai/O=mycompany/OU=ml/CN=ip-172-31-34-109.ap-northeast-1.compute.internal" -out model0.csr
openssl x509 -req -in model0.csr -CA root-ca.pem -CAkey root-ca-key.pem -CAcreateserial -sha256 -out model0.pem -days 3650
# model1 cert
openssl genrsa -out model1-key-temp.pem 2048
openssl pkcs8 -inform PEM -outform PEM -in model1-key-temp.pem -topk8 -nocrypt -v1 PBE-SHA1-3DES -out model1-key.pem
openssl req -new -key model1-key.pem -subj "/C=CN/ST=shanghai/L=shanghai/O=mycompany/OU=ml/CN=ip-172-31-40-170.ap-northeast-1.compute.internal" -out model1.csr
openssl x509 -req -in model1.csr -CA root-ca.pem -CAkey root-ca-key.pem -CAcreateserial -sha256 -out model1.pem -days 3650
# data cert
openssl genrsa -out data-key-temp.pem 2048
openssl pkcs8 -inform PEM -outform PEM -in data-key-temp.pem -topk8 -nocrypt -v1 PBE-SHA1-3DES -out data-key.pem
openssl req -new -key data-key.pem -subj "/C=CN/ST=shanghai/L=shanghai/O=mycompany/OU=ml/CN=ip-172-31-33-89.ap-northeast-1.compute.internal" -out data.csr
openssl x509 -req -in data.csr -CA root-ca.pem -CAkey root-ca-key.pem -CAcreateserial -sha256 -out data.pem -days 3650
# Cleanup
rm *temp.pem *csr
and opensearch.yml (every yml file is diff in pem file’s name.
example: model0.pem,model1.pem,data.pem) and node.name is diff too.
cluster.name: opensearch-cluster
node.name: model0
node.roles: [ cluster_manager,ml ]
node.processors: 5
path.data: /opt/opensearch-2.3.0/data
path.logs: /opt/opensearch-2.3.0/logs
bootstrap.memory_lock: true
network.host: 0.0.0.0
http.port: 9200
discovery.seed_hosts: ["172.31.33.89", "172.31.34.109", "172.31.40.170"]
cluster.initial_cluster_manager_nodes: ["172.31.33.89", "172.31.34.109", "172.31.40.170"]
gateway.recover_after_nodes: 3
action.destructive_requires_name: true
node.max_local_storage_nodes: 3
plugins.security.ssl.transport.pemcert_filepath: model0.pem
plugins.security.ssl.transport.pemkey_filepath: model0-key.pem
plugins.security.ssl.transport.pemtrustedcas_filepath: root-ca.pem
plugins.security.ssl.transport.enforce_hostname_verification: false
plugins.security.ssl.transport.resolve_hostname: false
plugins.security.ssl.http.enabled: true
plugins.security.ssl.http.pemcert_filepath: model0.pem
plugins.security.ssl.http.pemkey_filepath: model0-key.pem
plugins.security.ssl.http.pemtrustedcas_filepath: root-ca.pem
plugins.security.allow_default_init_securityindex: true
plugins.security.authcz.admin_dn:
- CN=admin,OU=ml,O=mycompany,L=shanghai,ST=shanghai,C=CN
plugins.security.nodes_dn:
- CN=ip-172-31-34-109.ap-northeast-1.compute.internal,OU=ml,O=mycompany,L=shanghai,ST=shanghai,C=CN
- CN=ip-172-31-40-170.ap-northeast-1.compute.internal,OU=ml,O=mycompany,L=shanghai,ST=shanghai,C=CN
- CN=ip-172-31-33-89.ap-northeast-1.compute.internal,OU=ml,O=mycompany,L=shanghai,ST=shanghai,C=CN
plugins.security.audit.type: internal_opensearch
plugins.security.enable_snapshot_restore_privilege: true
plugins.security.check_snapshot_restore_write_privileges: true
plugins.security.restapi.roles_enabled: ["all_access", "security_rest_api_access"]
plugins.security.system_indices.enabled: true
plugins.security.system_indices.indices: [".opendistro-alerting-config", ".opendistro-alerting-alert*", ".opendistro-anomaly-results*", ".opendistro-anomaly-detector*", ".opendistro-anomaly-checkpoints", ".opendistro-anomaly-detection-state", ".opendistro-reports-*", ".opendistro-notifications-*", ".opendistro-notebooks", ".opendistro-asynchronous-search-response*", ".replication-metadata-store"]
the log as below:
[2022-10-29T18:32:50,740][WARN ][o.o.t.TcpTransport ] [model0] exception caught on transport layer [Netty4TcpChannel{localAddress=/172.31.34.109:44104, remoteAddress=/172.31.40.170:9300}], closing connection
io.netty.handler.codec.DecoderException: javax.net.ssl.SSLHandshakeException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
at io.netty.handler.codec.ByteToMessageDecoder.callDecode(ByteToMessageDecoder.java:480) ~[netty-codec-4.1.79.Final.jar:4.1.79.Final]
at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:279) ~[netty-codec-4.1.79.Final.jar:4.1.79.Final]
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379) [netty-transport-4.1.79.Final.jar:4.1.79.Final]
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365) [netty-transport-4.1.79.Final.jar:4.1.79.Final]
at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357) [netty-transport-4.1.79.Final.jar:4.1.79.Final]
at io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1410) [netty-transport-4.1.79.Final.jar:4.1.79.Final]
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379) [netty-transport-4.1.79.Final.jar:4.1.79.Final]
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365) [netty-transport-4.1.79.Final.jar:4.1.79.Final]
at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:919) [netty-transport-4.1.79.Final.jar:4.1.79.Final]
at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:166) [netty-transport-4.1.79.Final.jar:4.1.79.Final]
at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:722) [netty-transport-4.1.79.Final.jar:4.1.79.Final]
at io.netty.channel.nio.NioEventLoop.processSelectedKeysPlain(NioEventLoop.java:623) [netty-transport-4.1.79.Final.jar:4.1.79.Final]
at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:586) [netty-transport-4.1.79.Final.jar:4.1.79.Final]
at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:496) [netty-transport-4.1.79.Final.jar:4.1.79.Final]
at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:997) [netty-common-4.1.79.Final.jar:4.1.79.Final]
at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74) [netty-common-4.1.79.Final.jar:4.1.79.Final]
at java.lang.Thread.run(Thread.java:833) [?:?]
Caused by: javax.net.ssl.SSLHandshakeException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
at sun.security.ssl.Alert.createSSLException(Alert.java:131) ~[?:?]
at sun.security.ssl.TransportContext.fatal(TransportContext.java:371) ~[?:?]
at sun.security.ssl.TransportContext.fatal(TransportContext.java:314) ~[?:?]
at sun.security.ssl.TransportContext.fatal(TransportContext.java:309) ~[?:?]
at sun.security.ssl.CertificateMessage$T13CertificateConsumer.checkServerCerts(CertificateMessage.java:1357) ~[?:?]
at sun.security.ssl.CertificateMessage$T13CertificateConsumer.onConsumeCertificate(CertificateMessage.java:1232) ~[?:?]
at sun.security.ssl.CertificateMessage$T13CertificateConsumer.consume(CertificateMessage.java:1175) ~[?:?]
at sun.security.ssl.SSLHandshake.consume(SSLHandshake.java:396) ~[?:?]
at sun.security.ssl.HandshakeContext.dispatch(HandshakeContext.java:480) ~[?:?]
at sun.security.ssl.SSLEngineImpl$DelegatedTask$DelegatedAction.run(SSLEngineImpl.java:1277) ~[?:?]
at sun.security.ssl.SSLEngineImpl$DelegatedTask$DelegatedAction.run(SSLEngineImpl.java:1264) ~[?:?]
at java.security.AccessController.doPrivileged(AccessController.java:712) ~[?:?]
at sun.security.ssl.SSLEngineImpl$DelegatedTask.run(SSLEngineImpl.java:1209) ~[?:?]
at io.netty.handler.ssl.SslHandler.runDelegatedTasks(SslHandler.java:1549) ~[netty-handler-4.1.79.Final.jar:4.1.79.Final]
at io.netty.handler.ssl.SslHandler.unwrap(SslHandler.java:1395) ~[netty-handler-4.1.79.Final.jar:4.1.79.Final]
at io.netty.handler.ssl.SslHandler.decodeJdkCompatible(SslHandler.java:1236) ~[netty-handler-4.1.79.Final.jar:4.1.79.Final]
at io.netty.handler.ssl.SslHandler.decode(SslHandler.java:1285) ~[netty-handler-4.1.79.Final.jar:4.1.79.Final]
at io.netty.handler.codec.ByteToMessageDecoder.decodeRemovalReentryProtection(ByteToMessageDecoder.java:510) ~[netty-codec-4.1.79.Final.jar:4.1.79.Final]
at io.netty.handler.codec.ByteToMessageDecoder.callDecode(ByteToMessageDecoder.java:449) ~[netty-codec-4.1.79.Final.jar:4.1.79.Final]
... 16 more
Can someone reach out and help me?
Eagerly waiting for a reply~