diff --git a/config/alfresco/subsystems/email/InboundSMTP/inboundSMTP-context.xml b/config/alfresco/subsystems/email/InboundSMTP/inboundSMTP-context.xml index 23c442d68c..cdb4cb1ace 100755 --- a/config/alfresco/subsystems/email/InboundSMTP/inboundSMTP-context.xml +++ b/config/alfresco/subsystems/email/InboundSMTP/inboundSMTP-context.xml @@ -33,6 +33,15 @@ ${email.server.allowed.senders} + + ${email.server.enableTLS} + + + ${email.server.hideTLS} + + + ${email.server.requireTLS} + diff --git a/config/alfresco/subsystems/email/InboundSMTP/inboundSMTP.properties b/config/alfresco/subsystems/email/InboundSMTP/inboundSMTP.properties index e94f63c2ab..a0d565ce96 100755 --- a/config/alfresco/subsystems/email/InboundSMTP/inboundSMTP.properties +++ b/config/alfresco/subsystems/email/InboundSMTP/inboundSMTP.properties @@ -3,12 +3,19 @@ # - See the subsystem configuration for descriptions of the properties # +# User to use if there is no match to a person in alfresco email.inbound.unknownUser=anonymous email.inbound.enabled=true - email.server.enabled=false email.server.port=25 email.server.connections.max=3 email.server.domain=alfresco.com email.server.allowed.senders=.* -email.server.blocked.senders= \ No newline at end of file +email.server.blocked.senders= + +# Set this to true to accept TLS but not announce it when the EHLO is called. +email.server.hideTLS=false +# Set this to false to turn off TLS, The server will not allow TLS. +email.server.enableTLS=true +# Set this to true to require TLS +email.server.requireTLS=false \ No newline at end of file diff --git a/source/java/org/alfresco/email/server/EmailServer.java b/source/java/org/alfresco/email/server/EmailServer.java index c229d8d72f..3839199c43 100644 --- a/source/java/org/alfresco/email/server/EmailServer.java +++ b/source/java/org/alfresco/email/server/EmailServer.java @@ -47,6 +47,9 @@ public abstract class EmailServer extends AbstractLifecycleBean private int maxConnections; private Set blockedSenders; private Set allowedSenders; + private boolean hideTLS = false; + private boolean enableTLS = true; + private boolean requireTLS = false; private EmailService emailService; @@ -326,4 +329,38 @@ public abstract class EmailServer extends AbstractLifecycleBean System.err.println("\t configLocation - spring xml configs with EmailServer related beans (emailServer, emailServerConfiguration, emailService)"); } + /** Hide the TLS (Trusted Login Session) option + * + * @param hideTLS + */ + public void setHideTLS(boolean hideTLS) + { + this.hideTLS = hideTLS; + } + + public boolean isHideTLS() + { + return hideTLS; + } + + public void setEnableTLS(boolean enableTLS) + { + this.enableTLS = enableTLS; + } + + public boolean isEnableTLS() + { + return enableTLS; + } + + public void setRequireTLS(boolean requireTLS) + { + this.requireTLS = requireTLS; + } + + public boolean isRequireTLS() + { + return requireTLS; + } + } diff --git a/source/java/org/alfresco/email/server/impl/subetha/SubethaEmailServer.java b/source/java/org/alfresco/email/server/impl/subetha/SubethaEmailServer.java index 62cfc184a3..8ce2ca15ae 100644 --- a/source/java/org/alfresco/email/server/impl/subetha/SubethaEmailServer.java +++ b/source/java/org/alfresco/email/server/impl/subetha/SubethaEmailServer.java @@ -35,7 +35,6 @@ import org.subethamail.smtp.MessageHandlerFactory; import org.subethamail.smtp.RejectException; import org.subethamail.smtp.TooMuchDataException; import org.subethamail.smtp.server.SMTPServer; -import org.subethamail.smtp.server.io.DeferredFileOutputStream; /** * @since 2.2 @@ -58,6 +57,11 @@ public class SubethaEmailServer extends EmailServer serverImpl.setPort(getPort()); serverImpl.setHostName(getDomain()); serverImpl.setMaxConnections(getMaxConnections()); + + serverImpl.setHideTLS(isHideTLS()); + serverImpl.setEnableTLS(isEnableTLS()); + serverImpl.setRequireTLS(isRequireTLS()); + serverImpl.start(); log.info("Inbound SMTP Email Server has started successfully, on hostName:" + getDomain() + "port:" + getPort()); } @@ -131,12 +135,12 @@ public class SubethaEmailServer extends EmailServer } finally { - // DH: As per comments in ETHREEOH-2252, I am very concerned about the need to do the clear() here. - // If this message is stateful (as it must be, given the API) then the need to clear - // the list of delivery recipients ('deliveries') implies that Subetha is re-using - // the instance. - // Later versions of Subetha appear to define the behaviour better. Un upgrade of - // the library would be a good idea. +// // DH: As per comments in ETHREEOH-2252, I am very concerned about the need to do the clear() here. +// // If this message is stateful (as it must be, given the API) then the need to clear +// // the list of delivery recipients ('deliveries') implies that Subetha is re-using +// // the instance. +// // Later versions of Subetha appear to define the behaviour better. Un upgrade of +// // the library would be a good idea. deliveries.clear(); } // See ALFCOM-3165: Support multiple recipients for inbound Subetha email messages @@ -210,6 +214,12 @@ public class SubethaEmailServer extends EmailServer public void resetState() { } + + @Override + public void done() + { + + } }; class Delivery