mirror of
https://github.com/honeymoose/OpenSearch.git
synced 2025-02-06 04:58:50 +00:00
Fix API change in SecurityNetty4Transport
Original commit: elastic/x-pack-elasticsearch@f152fb1813
This commit is contained in:
parent
b86c2e6e18
commit
65bac10eed
@ -12,6 +12,7 @@ import io.netty.channel.ChannelOutboundHandlerAdapter;
|
||||
import io.netty.channel.ChannelPromise;
|
||||
import io.netty.handler.ssl.SslHandler;
|
||||
import org.apache.logging.log4j.message.ParameterizedMessage;
|
||||
import org.elasticsearch.ExceptionsHelper;
|
||||
import org.elasticsearch.common.inject.Inject;
|
||||
import org.elasticsearch.common.inject.internal.Nullable;
|
||||
import org.elasticsearch.common.io.stream.NamedWriteableRegistry;
|
||||
@ -26,6 +27,7 @@ import org.elasticsearch.xpack.security.transport.filter.IPFilter;
|
||||
|
||||
import javax.net.ssl.SSLEngine;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.net.InetSocketAddress;
|
||||
import java.net.SocketAddress;
|
||||
|
||||
@ -74,9 +76,10 @@ public class SecurityNetty4Transport extends Netty4Transport {
|
||||
|
||||
@Override
|
||||
protected void onException(Channel channel, Exception e) {
|
||||
String reason = ExceptionsHelper.detailedMessage(e);
|
||||
if (!lifecycle.started()) {
|
||||
// just close and ignore - we are already stopped and just need to make sure we release all resources
|
||||
disconnectFromNodeChannel(channel, e);
|
||||
disconnectFromNodeChannel(channel, reason);
|
||||
} else if (isNotSslRecordException(e)) {
|
||||
if (logger.isTraceEnabled()) {
|
||||
logger.trace(
|
||||
@ -84,21 +87,21 @@ public class SecurityNetty4Transport extends Netty4Transport {
|
||||
} else {
|
||||
logger.warn("received plaintext traffic on an encrypted channel, closing connection {}", channel);
|
||||
}
|
||||
disconnectFromNodeChannel(channel, e);
|
||||
disconnectFromNodeChannel(channel, reason);
|
||||
} else if (isCloseDuringHandshakeException(e)) {
|
||||
if (logger.isTraceEnabled()) {
|
||||
logger.trace(new ParameterizedMessage("connection {} closed during ssl handshake", channel), e);
|
||||
} else {
|
||||
logger.warn("connection {} closed during handshake", channel);
|
||||
}
|
||||
disconnectFromNodeChannel(channel, e);
|
||||
disconnectFromNodeChannel(channel, reason);
|
||||
} else if (isReceivedCertificateUnknownException(e)) {
|
||||
if (logger.isTraceEnabled()) {
|
||||
logger.trace(new ParameterizedMessage("client did not trust server's certificate, closing connection {}", channel), e);
|
||||
} else {
|
||||
logger.warn("client did not trust this server's certificate, closing connection {}", channel);
|
||||
}
|
||||
disconnectFromNodeChannel(channel, e);
|
||||
disconnectFromNodeChannel(channel, reason);
|
||||
} else {
|
||||
super.onException(channel, e);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user