You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@james.apache.org by bt...@apache.org on 2022/12/05 03:32:54 UTC

[james-project] branch master updated: JAMES-3788 Prevent NPE upon data-races when receiving PROXY command (#1344)

This is an automated email from the ASF dual-hosted git repository.

btellier pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/james-project.git


The following commit(s) were added to refs/heads/master by this push:
     new a647049c5f JAMES-3788 Prevent NPE upon data-races when receiving PROXY command (#1344)
a647049c5f is described below

commit a647049c5ff1cc0605e13e3cbc72dda691e5c3e6
Author: Benoit TELLIER <bt...@linagora.com>
AuthorDate: Mon Dec 5 10:32:49 2022 +0700

    JAMES-3788 Prevent NPE upon data-races when receiving PROXY command (#1344)
    
    SMTP protocol handlers runs in a dedicated executor
    while HAProxy was running directly on the event loop.
    
    There was thus a chance that the processing of the
    HAProxy message to be processed before channel
    information be correctly setted up resulting on a NPE
    eventually closing the whole connection.
    
    We move HA Proxy message handling on the same thread
    that connection information set up which prevents
    this data race.
---
 .../netty/AbstractChannelPipelineFactory.java      |  8 +-
 .../netty/BasicChannelInboundHandler.java          | 45 +++++++++++
 .../protocols/netty/HAProxyMessageHandler.java     | 93 ----------------------
 .../apache/james/protocols/netty/NettyServer.java  |  5 --
 .../apache/james/imapserver/netty/IMAPServer.java  | 12 +--
 .../lib/netty/AbstractConfigurableAsyncServer.java |  7 --
 .../lib/AbstractConfigurableAsyncServerTest.java   |  4 -
 .../apache/james/lmtpserver/netty/LMTPServer.java  | 13 ---
 .../managesieveserver/netty/ManageSieveServer.java | 11 ---
 .../apache/james/pop3server/netty/POP3Server.java  |  6 --
 .../apache/james/smtpserver/netty/SMTPServer.java  |  7 --
 11 files changed, 47 insertions(+), 164 deletions(-)

diff --git a/protocols/netty/src/main/java/org/apache/james/protocols/netty/AbstractChannelPipelineFactory.java b/protocols/netty/src/main/java/org/apache/james/protocols/netty/AbstractChannelPipelineFactory.java
index 98a20e6f19..4263d7d27f 100644
--- a/protocols/netty/src/main/java/org/apache/james/protocols/netty/AbstractChannelPipelineFactory.java
+++ b/protocols/netty/src/main/java/org/apache/james/protocols/netty/AbstractChannelPipelineFactory.java
@@ -68,7 +68,6 @@ public abstract class AbstractChannelPipelineFactory<C extends SocketChannel> ex
 
         if (proxyRequired) {
             pipeline.addLast(HandlerConstants.PROXY_HANDLER, new HAProxyMessageDecoder());
-            pipeline.addLast("proxyInformationHandler", createProxyHandler());
         }
 
         // Add the text line decoder which limit the max line length, don't strip the delimiter and use CRLF as delimiter
@@ -78,7 +77,7 @@ public abstract class AbstractChannelPipelineFactory<C extends SocketChannel> ex
         pipeline.addLast(HandlerConstants.CHUNK_HANDLER, new ChunkedWriteHandler());
         pipeline.addLast(HandlerConstants.TIMEOUT_HANDLER, new TimeoutHandler(timeout));
 
-        pipeline.addLast(eventExecutorGroup, HandlerConstants.CORE_HANDLER, createHandler());
+        pipeline.addLast(HandlerConstants.CORE_HANDLER, createHandler());
     }
 
     
@@ -89,9 +88,4 @@ public abstract class AbstractChannelPipelineFactory<C extends SocketChannel> ex
      */
     protected abstract ChannelInboundHandlerAdapter createHandler();
 
-    /**
-     * @return A handler that set HAProxy information on the underlying protocol objects.
-     */
-    protected abstract ChannelInboundHandlerAdapter createProxyHandler();
-
 }
diff --git a/protocols/netty/src/main/java/org/apache/james/protocols/netty/BasicChannelInboundHandler.java b/protocols/netty/src/main/java/org/apache/james/protocols/netty/BasicChannelInboundHandler.java
index e2b515371f..55573f2833 100644
--- a/protocols/netty/src/main/java/org/apache/james/protocols/netty/BasicChannelInboundHandler.java
+++ b/protocols/netty/src/main/java/org/apache/james/protocols/netty/BasicChannelInboundHandler.java
@@ -21,6 +21,8 @@ package org.apache.james.protocols.netty;
 import static org.apache.james.protocols.api.ProtocolSession.State.Connection;
 
 import java.io.Closeable;
+import java.net.InetSocketAddress;
+import java.net.SocketAddress;
 import java.nio.channels.ClosedChannelException;
 import java.util.Deque;
 import java.util.LinkedList;
@@ -33,6 +35,7 @@ import org.apache.james.protocols.api.Protocol;
 import org.apache.james.protocols.api.ProtocolSession;
 import org.apache.james.protocols.api.ProtocolSessionImpl;
 import org.apache.james.protocols.api.ProtocolTransport;
+import org.apache.james.protocols.api.ProxyInformation;
 import org.apache.james.protocols.api.Response;
 import org.apache.james.protocols.api.handler.ConnectHandler;
 import org.apache.james.protocols.api.handler.DisconnectHandler;
@@ -48,6 +51,8 @@ import io.netty.channel.Channel;
 import io.netty.channel.ChannelHandlerContext;
 import io.netty.channel.ChannelInboundHandlerAdapter;
 import io.netty.handler.codec.TooLongFrameException;
+import io.netty.handler.codec.haproxy.HAProxyMessage;
+import io.netty.handler.codec.haproxy.HAProxyProxiedProtocol;
 import io.netty.util.AttributeKey;
 
 /**
@@ -145,12 +150,25 @@ public class BasicChannelInboundHandler extends ChannelInboundHandlerAdapter imp
     }
 
 
+    private static String retrieveIp(ChannelHandlerContext ctx) {
+        SocketAddress remoteAddress = ctx.channel().remoteAddress();
+        if (remoteAddress instanceof InetSocketAddress) {
+            InetSocketAddress address = (InetSocketAddress) remoteAddress;
+            return address.getAddress().getHostAddress();
+        }
+        return remoteAddress.toString();
+    }
+
     /**
      * Call the {@link LineHandler} 
      */
     @SuppressWarnings({ "unchecked", "rawtypes" })
     @Override
     public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception {
+        if (msg instanceof HAProxyMessage) {
+            handleHAProxyMessage(ctx, (HAProxyMessage) msg);
+            return;
+        }
         ChannelInboundHandlerAdapter override = behaviourOverrides.peekFirst();
         if (override != null) {
             override.channelRead(ctx, msg);
@@ -184,6 +202,33 @@ public class BasicChannelInboundHandler extends ChannelInboundHandlerAdapter imp
         }
     }
 
+    private void handleHAProxyMessage(ChannelHandlerContext ctx, HAProxyMessage haproxyMsg) throws Exception {
+        ProtocolSession pSession = (ProtocolSession) ctx.channel().attr(SESSION_ATTRIBUTE_KEY).get();
+        if (haproxyMsg.proxiedProtocol().equals(HAProxyProxiedProtocol.TCP4) || haproxyMsg.proxiedProtocol().equals(HAProxyProxiedProtocol.TCP6)) {
+
+            ProxyInformation proxyInformation = new ProxyInformation(
+                new InetSocketAddress(haproxyMsg.sourceAddress(), haproxyMsg.sourcePort()),
+                new InetSocketAddress(haproxyMsg.destinationAddress(), haproxyMsg.destinationPort()));
+            LOGGER.info("Connection from {} runs through {} proxy", haproxyMsg.sourceAddress(), haproxyMsg.destinationAddress());
+
+            if (pSession != null) {
+                pSession.setProxyInformation(proxyInformation);
+
+                // Refresh MDC info to account for proxying
+                MDCBuilder boundMDC = mdcContextFactory.onBound(protocol, ctx);
+                boundMDC.addToContext("proxy.source", proxyInformation.getSource().toString());
+                boundMDC.addToContext("proxy.destination", proxyInformation.getDestination().toString());
+                boundMDC.addToContext("proxy.ip", retrieveIp(ctx));
+                pSession.setAttachment(MDC_ATTRIBUTE_KEY, boundMDC, Connection);
+            }
+        } else {
+            throw new IllegalArgumentException("Only TCP4/TCP6 are supported when using PROXY protocol.");
+        }
+
+        haproxyMsg.release();
+        super.channelReadComplete(ctx);
+    }
+
 
     /**
      * Cleanup the channel
diff --git a/protocols/netty/src/main/java/org/apache/james/protocols/netty/HAProxyMessageHandler.java b/protocols/netty/src/main/java/org/apache/james/protocols/netty/HAProxyMessageHandler.java
deleted file mode 100644
index cb294c73c3..0000000000
--- a/protocols/netty/src/main/java/org/apache/james/protocols/netty/HAProxyMessageHandler.java
+++ /dev/null
@@ -1,93 +0,0 @@
-/****************************************************************
- * Licensed to the Apache Software Foundation (ASF) under one   *
- * or more contributor license agreements.  See the NOTICE file *
- * distributed with this work for additional information        *
- * regarding copyright ownership.  The ASF licenses this file   *
- * to you under the Apache License, Version 2.0 (the            *
- * "License"); you may not use this file except in compliance   *
- * with the License.  You may obtain a copy of the License at   *
- *                                                              *
- *   http://www.apache.org/licenses/LICENSE-2.0                 *
- *                                                              *
- * Unless required by applicable law or agreed to in writing,   *
- * software distributed under the License is distributed on an  *
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY       *
- * KIND, either express or implied.  See the License for the    *
- * specific language governing permissions and limitations      *
- * under the License.                                           *
- ****************************************************************/
-
-package org.apache.james.protocols.netty;
-
-import static org.apache.james.protocols.api.ProtocolSession.State.Connection;
-import static org.apache.james.protocols.netty.BasicChannelInboundHandler.MDC_ATTRIBUTE_KEY;
-
-import java.net.InetSocketAddress;
-import java.net.SocketAddress;
-
-import org.apache.james.protocols.api.CommandDetectionSession;
-import org.apache.james.protocols.api.Protocol;
-import org.apache.james.protocols.api.ProtocolSession;
-import org.apache.james.protocols.api.ProxyInformation;
-import org.apache.james.util.MDCBuilder;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import io.netty.channel.ChannelHandlerContext;
-import io.netty.channel.ChannelInboundHandlerAdapter;
-import io.netty.handler.codec.haproxy.HAProxyMessage;
-import io.netty.handler.codec.haproxy.HAProxyProxiedProtocol;
-import io.netty.util.AttributeKey;
-
-public class HAProxyMessageHandler extends ChannelInboundHandlerAdapter {
-    private static final Logger LOGGER = LoggerFactory.getLogger(HAProxyMessageHandler.class);
-    private static final AttributeKey<CommandDetectionSession> SESSION_ATTRIBUTE_KEY = AttributeKey.valueOf("session");
-
-    private static String retrieveIp(ChannelHandlerContext ctx) {
-        SocketAddress remoteAddress = ctx.channel().remoteAddress();
-        if (remoteAddress instanceof InetSocketAddress) {
-            InetSocketAddress address = (InetSocketAddress) remoteAddress;
-            return address.getAddress().getHostAddress();
-        }
-        return remoteAddress.toString();
-    }
-
-    protected final Protocol protocol;
-    private final ProtocolMDCContextFactory mdcContextFactory;
-
-    public HAProxyMessageHandler(Protocol protocol, ProtocolMDCContextFactory mdcContextFactory) {
-        this.protocol = protocol;
-        this.mdcContextFactory = mdcContextFactory;
-    }
-
-    @Override
-    public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception {
-        if (msg instanceof HAProxyMessage) {
-            HAProxyMessage haproxyMsg = (HAProxyMessage) msg;
-
-            ProtocolSession pSession = (ProtocolSession) ctx.channel().attr(SESSION_ATTRIBUTE_KEY).get();
-            if (haproxyMsg.proxiedProtocol().equals(HAProxyProxiedProtocol.TCP4) || haproxyMsg.proxiedProtocol().equals(HAProxyProxiedProtocol.TCP6)) {
-
-                ProxyInformation proxyInformation = new ProxyInformation(
-                    new InetSocketAddress(haproxyMsg.sourceAddress(), haproxyMsg.sourcePort()),
-                    new InetSocketAddress(haproxyMsg.destinationAddress(), haproxyMsg.destinationPort()));
-                pSession.setProxyInformation(proxyInformation);
-
-                LOGGER.info("Connection from {} runs through {} proxy", haproxyMsg.sourceAddress(), haproxyMsg.destinationAddress());
-                // Refresh MDC info to account for proxying
-                MDCBuilder boundMDC = mdcContextFactory.onBound(protocol, ctx);
-                boundMDC.addToContext("proxy.source", proxyInformation.getSource().toString());
-                boundMDC.addToContext("proxy.destination", proxyInformation.getDestination().toString());
-                boundMDC.addToContext("proxy.ip", retrieveIp(ctx));
-                pSession.setAttachment(MDC_ATTRIBUTE_KEY, boundMDC, Connection);
-            } else {
-                throw new IllegalArgumentException("Only TCP4/TCP6 are supported when using PROXY protocol.");
-            }
-
-            haproxyMsg.release();
-            super.channelReadComplete(ctx);
-        } else {
-            super.channelRead(ctx, msg);
-        }
-    }
-}
diff --git a/protocols/netty/src/main/java/org/apache/james/protocols/netty/NettyServer.java b/protocols/netty/src/main/java/org/apache/james/protocols/netty/NettyServer.java
index 6bafa394ec..d6c16e4537 100644
--- a/protocols/netty/src/main/java/org/apache/james/protocols/netty/NettyServer.java
+++ b/protocols/netty/src/main/java/org/apache/james/protocols/netty/NettyServer.java
@@ -134,11 +134,6 @@ public class NettyServer extends AbstractAsyncServer {
             protected ChannelInboundHandlerAdapter createHandler() {
                 return createCoreHandler();
             }
-
-            @Override
-            protected ChannelInboundHandlerAdapter createProxyHandler() {
-                return new HAProxyMessageHandler(protocol, new ProtocolMDCContextFactory.Standard());
-            }
         };
 
     }
diff --git a/server/protocols/protocols-imap4/src/main/java/org/apache/james/imapserver/netty/IMAPServer.java b/server/protocols/protocols-imap4/src/main/java/org/apache/james/imapserver/netty/IMAPServer.java
index e517687aba..073db65280 100644
--- a/server/protocols/protocols-imap4/src/main/java/org/apache/james/imapserver/netty/IMAPServer.java
+++ b/server/protocols/protocols-imap4/src/main/java/org/apache/james/imapserver/netty/IMAPServer.java
@@ -235,11 +235,6 @@ public class IMAPServer extends AbstractConfigurableAsyncServer implements ImapC
                 return createCoreHandler();
             }
 
-            @Override
-            protected ChannelInboundHandlerAdapter createProxyHandler() {
-                return new HAProxyMessageHandler();
-            }
-
             @Override
             public void initChannel(Channel channel) {
                 ChannelPipeline pipeline = channel.pipeline();
@@ -250,7 +245,7 @@ public class IMAPServer extends AbstractConfigurableAsyncServer implements ImapC
 
                 if (proxyRequired) {
                     pipeline.addLast(HandlerConstants.PROXY_HANDLER, new HAProxyMessageDecoder());
-                    pipeline.addLast("proxyInformationHandler", createProxyHandler());
+                    pipeline.addLast("proxyInformationHandler", new HAProxyMessageHandler());
                 }
 
                 // Add the text line decoder which limit the max line length,
@@ -300,11 +295,6 @@ public class IMAPServer extends AbstractConfigurableAsyncServer implements ImapC
             .build();
     }
 
-    @Override
-    protected ChannelInboundHandlerAdapter createProxyHandler() {
-        return new HAProxyMessageHandler();
-    }
-
     @Override
     protected ChannelHandlerFactory createFrameHandlerFactory() {
         return new SwitchableLineBasedFrameDecoderFactory(maxLineLength);
diff --git a/server/protocols/protocols-library/src/main/java/org/apache/james/protocols/lib/netty/AbstractConfigurableAsyncServer.java b/server/protocols/protocols-library/src/main/java/org/apache/james/protocols/lib/netty/AbstractConfigurableAsyncServer.java
index 96b97b92fb..76e8152a6b 100644
--- a/server/protocols/protocols-library/src/main/java/org/apache/james/protocols/lib/netty/AbstractConfigurableAsyncServer.java
+++ b/server/protocols/protocols-library/src/main/java/org/apache/james/protocols/lib/netty/AbstractConfigurableAsyncServer.java
@@ -452,8 +452,6 @@ public abstract class AbstractConfigurableAsyncServer extends AbstractAsyncServe
 
     protected abstract ChannelInboundHandlerAdapter createCoreHandler();
 
-    protected abstract ChannelInboundHandlerAdapter createProxyHandler();
-
     @Override
     protected AbstractChannelPipelineFactory createPipelineFactory() {
         return new AbstractSSLAwareChannelPipelineFactory<>(getTimeout(), connectionLimit, connPerIP,
@@ -464,11 +462,6 @@ public abstract class AbstractConfigurableAsyncServer extends AbstractAsyncServe
             protected ChannelInboundHandlerAdapter createHandler() {
                 return AbstractConfigurableAsyncServer.this.createCoreHandler();
             }
-
-            @Override
-            protected ChannelInboundHandlerAdapter createProxyHandler() {
-                return AbstractConfigurableAsyncServer.this.createProxyHandler();
-            }
         };
     }
     
diff --git a/server/protocols/protocols-library/src/test/java/org/apache/james/protocols/lib/AbstractConfigurableAsyncServerTest.java b/server/protocols/protocols-library/src/test/java/org/apache/james/protocols/lib/AbstractConfigurableAsyncServerTest.java
index c72878c2b6..0536a6beca 100644
--- a/server/protocols/protocols-library/src/test/java/org/apache/james/protocols/lib/AbstractConfigurableAsyncServerTest.java
+++ b/server/protocols/protocols-library/src/test/java/org/apache/james/protocols/lib/AbstractConfigurableAsyncServerTest.java
@@ -109,10 +109,6 @@ class AbstractConfigurableAsyncServerTest {
             return null;
         }
 
-        @Override
-        protected ChannelInboundHandlerAdapter createProxyHandler() {
-            throw new NotImplementedException();
-        }
 
         // test accessors
 
diff --git a/server/protocols/protocols-lmtp/src/main/java/org/apache/james/lmtpserver/netty/LMTPServer.java b/server/protocols/protocols-lmtp/src/main/java/org/apache/james/lmtpserver/netty/LMTPServer.java
index a92da42c83..fcf15a105e 100644
--- a/server/protocols/protocols-lmtp/src/main/java/org/apache/james/lmtpserver/netty/LMTPServer.java
+++ b/server/protocols/protocols-lmtp/src/main/java/org/apache/james/lmtpserver/netty/LMTPServer.java
@@ -33,10 +33,8 @@ import org.apache.james.protocols.lib.netty.AbstractProtocolAsyncServer;
 import org.apache.james.protocols.lmtp.LMTPConfiguration;
 import org.apache.james.protocols.netty.AbstractChannelPipelineFactory;
 import org.apache.james.protocols.netty.ChannelHandlerFactory;
-import org.apache.james.protocols.netty.HAProxyMessageHandler;
 import org.apache.james.protocols.netty.LineDelimiterBasedChannelHandlerFactory;
 import org.apache.james.protocols.smtp.SMTPProtocol;
-import org.apache.james.protocols.smtp.core.SMTPMDCContextFactory;
 import org.apache.james.smtpserver.ExtendedSMTPSession;
 import org.apache.james.smtpserver.netty.SMTPChannelInboundHandler;
 import org.slf4j.Logger;
@@ -155,17 +153,6 @@ public class LMTPServer extends AbstractProtocolAsyncServer implements LMTPServe
         return new SMTPChannelInboundHandler(transport, lmtpMetrics);
     }
 
-    @Override
-    protected ChannelInboundHandlerAdapter createProxyHandler() {
-        SMTPProtocol transport = new SMTPProtocol(getProtocolHandlerChain(), lmtpConfig) {
-            @Override
-            public ProtocolSession newSession(ProtocolTransport transport) {
-                return new ExtendedSMTPSession(lmtpConfig, transport);
-            }
-        };
-        return new HAProxyMessageHandler(transport, new SMTPMDCContextFactory());
-    }
-
     @Override
     protected Class<? extends HandlersPackage> getCoreHandlersPackage() {
         return CoreCmdHandlerLoader.class;
diff --git a/server/protocols/protocols-managesieve/src/main/java/org/apache/james/managesieveserver/netty/ManageSieveServer.java b/server/protocols/protocols-managesieve/src/main/java/org/apache/james/managesieveserver/netty/ManageSieveServer.java
index dc4f41df1c..93ab6ab22c 100644
--- a/server/protocols/protocols-managesieve/src/main/java/org/apache/james/managesieveserver/netty/ManageSieveServer.java
+++ b/server/protocols/protocols-managesieve/src/main/java/org/apache/james/managesieveserver/netty/ManageSieveServer.java
@@ -28,7 +28,6 @@ import java.util.Optional;
 import org.apache.commons.configuration2.HierarchicalConfiguration;
 import org.apache.commons.configuration2.ex.ConfigurationException;
 import org.apache.commons.configuration2.tree.ImmutableNode;
-import org.apache.commons.lang3.NotImplementedException;
 import org.apache.james.managesieve.transcode.ManageSieveProcessor;
 import org.apache.james.protocols.lib.netty.AbstractConfigurableAsyncServer;
 import org.apache.james.protocols.netty.AbstractChannelPipelineFactory;
@@ -90,11 +89,6 @@ public class ManageSieveServer extends AbstractConfigurableAsyncServer implement
         return new ManageSieveChannelUpstreamHandler(manageSieveProcessor, getEncryption(), maxLineLength);
     }
 
-    @Override
-    protected ChannelInboundHandlerAdapter createProxyHandler() {
-        throw new NotImplementedException();
-    }
-
     @Override
     protected AbstractChannelPipelineFactory createPipelineFactory() {
 
@@ -105,11 +99,6 @@ public class ManageSieveServer extends AbstractConfigurableAsyncServer implement
                 return createCoreHandler();
             }
 
-            @Override
-            protected ChannelInboundHandlerAdapter createProxyHandler() {
-                throw new NotImplementedException();
-            }
-
             @Override
             public void initChannel(Channel channel) {
                 ChannelPipeline pipeline = channel.pipeline();
diff --git a/server/protocols/protocols-pop3/src/main/java/org/apache/james/pop3server/netty/POP3Server.java b/server/protocols/protocols-pop3/src/main/java/org/apache/james/pop3server/netty/POP3Server.java
index 90a1118b9d..87bc8341f8 100644
--- a/server/protocols/protocols-pop3/src/main/java/org/apache/james/pop3server/netty/POP3Server.java
+++ b/server/protocols/protocols-pop3/src/main/java/org/apache/james/pop3server/netty/POP3Server.java
@@ -27,7 +27,6 @@ import org.apache.james.protocols.netty.AbstractChannelPipelineFactory;
 import org.apache.james.protocols.netty.AllButStartTlsLineChannelHandlerFactory;
 import org.apache.james.protocols.netty.BasicChannelInboundHandler;
 import org.apache.james.protocols.netty.ChannelHandlerFactory;
-import org.apache.james.protocols.netty.HAProxyMessageHandler;
 import org.apache.james.protocols.netty.ProtocolMDCContextFactory;
 import org.apache.james.protocols.pop3.POP3Protocol;
 
@@ -90,11 +89,6 @@ public class POP3Server extends AbstractProtocolAsyncServer implements POP3Serve
         return new BasicChannelInboundHandler(new ProtocolMDCContextFactory.Standard(), protocol, getEncryption(), false);
     }
 
-    @Override
-    protected ChannelInboundHandlerAdapter createProxyHandler() {
-        return new HAProxyMessageHandler(protocol, new ProtocolMDCContextFactory.Standard());
-    }
-
     @Override
     protected Class<? extends HandlersPackage> getCoreHandlersPackage() {
         return CoreCmdHandlerLoader.class;
diff --git a/server/protocols/protocols-smtp/src/main/java/org/apache/james/smtpserver/netty/SMTPServer.java b/server/protocols/protocols-smtp/src/main/java/org/apache/james/smtpserver/netty/SMTPServer.java
index c9dc5acdeb..93c5902ddb 100644
--- a/server/protocols/protocols-smtp/src/main/java/org/apache/james/smtpserver/netty/SMTPServer.java
+++ b/server/protocols/protocols-smtp/src/main/java/org/apache/james/smtpserver/netty/SMTPServer.java
@@ -40,10 +40,8 @@ import org.apache.james.protocols.lib.netty.AbstractProtocolAsyncServer;
 import org.apache.james.protocols.netty.AbstractChannelPipelineFactory;
 import org.apache.james.protocols.netty.AllButStartTlsLineChannelHandlerFactory;
 import org.apache.james.protocols.netty.ChannelHandlerFactory;
-import org.apache.james.protocols.netty.HAProxyMessageHandler;
 import org.apache.james.protocols.smtp.SMTPConfiguration;
 import org.apache.james.protocols.smtp.SMTPProtocol;
-import org.apache.james.protocols.smtp.core.SMTPMDCContextFactory;
 import org.apache.james.smtpserver.CoreCmdHandlerLoader;
 import org.apache.james.smtpserver.ExtendedSMTPSession;
 import org.apache.james.smtpserver.jmx.JMXHandlersLoader;
@@ -390,11 +388,6 @@ public class SMTPServer extends AbstractProtocolAsyncServer implements SMTPServe
         return new SMTPChannelInboundHandler(transport, getEncryption(), proxyRequired, smtpMetrics);
     }
 
-    @Override
-    protected ChannelInboundHandlerAdapter createProxyHandler() {
-        return new HAProxyMessageHandler(transport, new SMTPMDCContextFactory());
-    }
-
     @Override
     protected Class<? extends HandlersPackage> getCoreHandlersPackage() {
         return CoreCmdHandlerLoader.class;


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@james.apache.org
For additional commands, e-mail: notifications-help@james.apache.org