@Override protected void initChannel(Channel ch) throws Exception { super.initChannel(ch); ChannelPipeline pipeline = ch.pipeline(); TlsConfig tlsConfig = config.getTlsConfig(); if (tlsConfig.isEnabledForTcp()) { SslHandler sslHandler = tlsConfig.createHandler(true); pipeline.addFirst("tls", sslHandler); } } }
@Override public final void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception { if(SearchGuardSSLNettyTransport.this.lifecycle.started()) { if(cause instanceof DecoderException && cause != null) { cause = cause.getCause(); } errorHandler.logError(cause, false); if(cause instanceof NotSslRecordException) { logger.warn("Someone ({}) speaks transport plaintext instead of ssl, will close the channel", ctx.channel().remoteAddress()); ctx.channel().close(); return; } else if (cause instanceof SSLException) { logger.error("SSL Problem "+cause.getMessage(),cause); ctx.channel().close(); return; } else if (cause instanceof SSLHandshakeException) { logger.error("Problem during handshake "+cause.getMessage()); ctx.channel().close(); return; } } super.exceptionCaught(ctx, cause); } }
protected ChannelHandler getClientChannelInitializer() { return new ClientChannelInitializer(); }
protected ChannelHandler getClientChannelInitializer(DiscoveryNode node) { return new ClientChannelInitializer(); }
protected ChannelHandler getClientChannelInitializer() { return new ClientChannelInitializer(); }
protected ChannelHandler getClientChannelInitializer(DiscoveryNode node) { return new ClientChannelInitializer(); }
@Override protected void initChannel(Channel ch) throws Exception { super.initChannel(ch); ch.pipeline().addFirst("client_ssl_handler", new ClientSSLHandler(sgks, hostnameVerificationEnabled, hostnameVerificationResovleHostName, errorHandler)); }