ALF-1966 - Inbound email supports STARTTLS by default - however this requires Java + SSL configuration to be done to work

Updated to latest SubEtha lib and added three new configuration properties.

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@30913 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Mark Rogers
2011-10-03 12:07:55 +00:00
parent a72f483ebf
commit 9687430000
4 changed files with 72 additions and 9 deletions

View File

@@ -33,6 +33,15 @@
<property name="allowedSenders">
<value>${email.server.allowed.senders}</value>
</property>
<property name="enableTLS">
<value>${email.server.enableTLS}</value>
</property>
<property name="hideTLS">
<value>${email.server.hideTLS}</value>
</property>
<property name="requireTLS">
<value>${email.server.requireTLS}</value>
</property>
<property name="emailService">
<ref bean="EmailService" />
</property>

View File

@@ -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=
# 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

View File

@@ -47,6 +47,9 @@ public abstract class EmailServer extends AbstractLifecycleBean
private int maxConnections;
private Set<String> blockedSenders;
private Set<String> 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;
}
}

View File

@@ -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