Class SaslV0RejectionHandler

java.lang.Object
io.netty.channel.ChannelHandlerAdapter
io.netty.channel.ChannelInboundHandlerAdapter
io.netty.channel.ChannelDuplexHandler
io.kroxylicious.proxy.internal.SaslV0RejectionHandler
All Implemented Interfaces:
io.netty.channel.ChannelHandler, io.netty.channel.ChannelInboundHandler, io.netty.channel.ChannelOutboundHandler

public class SaslV0RejectionHandler extends io.netty.channel.ChannelDuplexHandler
Short circuit respond with an error code if we encounter a SASL v0 handshake, logging a meaningful warning and closing the connection. The handler deregisters itself on the first RPC that is neither an API_VERSIONS request nor a v0 SASL handshake as we presume we have successfully progressed beyond SASL authentication.

The proxy currently does not support v0 SASL handshakes where the client sends through SASL messages without framing them using the Kafka protocol. Support for this is ancient, Kafka 4.0.0 preserved this mechanism due to a decision to support common clients from 4 years prior to the release (python-kafka). We have also encountered a client (kaf) that configures sarama to use v0 by default. These interactions resulted in an esoteric looking exception in the proxy when we attempted to decode the SASL frame as a kafka protocol RPC. So this handler is intended to make it fail early with a clear signal in the proxy logs and response that we can't handle SASL v0.

  • Nested Class Summary

    Nested classes/interfaces inherited from interface io.netty.channel.ChannelHandler

    io.netty.channel.ChannelHandler.Sharable
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    channelRead(io.netty.channel.ChannelHandlerContext ctx, Object msg)
     

    Methods inherited from class io.netty.channel.ChannelDuplexHandler

    bind, close, connect, deregister, disconnect, flush, read, write

    Methods inherited from class io.netty.channel.ChannelInboundHandlerAdapter

    channelActive, channelInactive, channelReadComplete, channelRegistered, channelUnregistered, channelWritabilityChanged, exceptionCaught, userEventTriggered

    Methods inherited from class io.netty.channel.ChannelHandlerAdapter

    ensureNotSharable, handlerAdded, handlerRemoved, isSharable

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface io.netty.channel.ChannelHandler

    handlerAdded, handlerRemoved
  • Constructor Details

    • SaslV0RejectionHandler

      public SaslV0RejectionHandler()
  • Method Details

    • channelRead

      public void channelRead(io.netty.channel.ChannelHandlerContext ctx, Object msg) throws Exception
      Specified by:
      channelRead in interface io.netty.channel.ChannelInboundHandler
      Overrides:
      channelRead in class io.netty.channel.ChannelInboundHandlerAdapter
      Throws:
      Exception