Author: bago Date: Thu Jul 6 03:46:24 2006 New Revision: 419513 URL: http://svn.apache.org/viewvc?rev=419513&view=rev Log: Add a default hardcoded configuration for the SMTPHandlerChain (JAMES-496). Moved handlerchain xml to its own james-smtphandlerchain.xml file and commented by default. Converted spool repository from dbfile to file (missed by Norman, see JAMES-536)
Added: james/server/branches/v2.3/src/conf/james-smtphandlerchain.xml (with props) Modified: james/server/branches/v2.3/build.xml james/server/branches/v2.3/src/conf/james-config.xml james/server/branches/v2.3/src/java/org/apache/james/smtpserver/SMTPHandlerChain.java Modified: james/server/branches/v2.3/build.xml URL: http://svn.apache.org/viewvc/james/server/branches/v2.3/build.xml?rev=419513&r1=419512&r2=419513&view=diff ============================================================================== --- james/server/branches/v2.3/build.xml (original) +++ james/server/branches/v2.3/build.xml Thu Jul 6 03:46:24 2006 @@ -544,6 +544,9 @@ <zipfileset dir="${conf.dir}" fullpath="conf/james-fetchmail.xml"> <include name="james-fetchmail.xml"/> </zipfileset> + <zipfileset dir="${conf.dir}" fullpath="conf/james-smtphandlerchain.xml"> + <include name="james-smtphandlerchain.xml"/> + </zipfileset> <zipfileset dir="${conf.dir}" fullpath="conf/miResources.xml"> <include name="miResources.xml"/> </zipfileset> Modified: james/server/branches/v2.3/src/conf/james-config.xml URL: http://svn.apache.org/viewvc/james/server/branches/v2.3/src/conf/james-config.xml?rev=419513&r1=419512&r2=419513&view=diff ============================================================================== --- james/server/branches/v2.3/src/conf/james-config.xml (original) +++ james/server/branches/v2.3/src/conf/james-config.xml Thu Jul 6 03:46:24 2006 @@ -3,6 +3,7 @@ <!ENTITY listserverConfig SYSTEM "../conf/james-listmanager.xml"> <!ENTITY listserverStores SYSTEM "../conf/james-liststores.xml"> <!ENTITY fetchmailConfig SYSTEM "../conf/james-fetchmail.xml"> +<!ENTITY smtphandlerchainConfig SYSTEM "../conf/james-smtphandlerchain.xml"> ]> <!-- Configuration file for the ASF James server --> @@ -901,102 +902,13 @@ <heloEhloEnforcement>true</heloEhloEnforcement> --> - <!-- The configuration handler chain --> - <handlerchain> - - <!-- The connect handler configuration --> - <!-- - <handler class="org.apache.james.smtpserver.DNSRBLHandler"> - <rblservers> - <whitelist> query.bondedsender.org </whitelist> - <blacklist> sbl-xbl.spamhaus.org </blacklist> - <blacklist> list.dsbl.org </blacklist> - <blacklist> dul.dnsbl.sorbs.net </blacklist> - <blacklist> relays.ordb.org </blacklist> - </rblservers> - </handler> - --> - - <!-- The command handler configuration --> - <handler command="HELO" class="org.apache.james.smtpserver.HeloCmdHandler"> - <!-- If is set to true helo is only accepted if it can be resolved --> - <!-- - <checkResolvableHelo> false </checkResolvableHelo> - --> - - <!-- If is set to true sender domain will be checked also for clients that --> - <!-- are allowed to relay. Default is false. --> - <!-- - <checkAuthNetworks> false </checkAuthNetworks> - --> - </handler> - <handler command="EHLO" class="org.apache.james.smtpserver.EhloCmdHandler"> - <!-- If is set to true ehlo is only accepted if it can be resolved --> - <!-- - <checkResolvableEhlo> false </checkResolvableEhlo> - --> - - <!-- If is set to true sender domain will be checked also for clients that --> - <!-- are allowed to relay. Default is false. --> - <!-- - <checkAuthNetworks> false </checkAuthNetworks> - --> - </handler> - <handler command="AUTH" class="org.apache.james.smtpserver.AuthCmdHandler"></handler> - <handler command="VRFY" class="org.apache.james.smtpserver.VrfyCmdHandler"></handler> - <handler command="EXPN" class="org.apache.james.smtpserver.ExpnCmdHandler"></handler> - <handler command="MAIL" class="org.apache.james.smtpserver.MailCmdHandler"> - <!-- If is set to true mail is only accepted if the sender contains --> - <!-- a resolvable domain having a valid MX Record or A Record associated! --> - <!-- - <checkValidSenderDomain> false </checkValidSenderDomain> - --> - <!-- If is set to true sender domain from clients that are allowed to --> - <!-- relay will be checked, too. Default is false. --> - <!-- - <checkAuthClients> false </checkAuthClients> - --> - </handler> - <handler command="RCPT" class="org.apache.james.smtpserver.RcptCmdHandler"> - <!-- If is set to a bigger value as 0 you can limit the maximal recipients --> - <!-- per email. Default is set to 0. --> - <!-- - <maxRcpt> 0 </maxRcpt> - --> - - <!-- If is set to a bigger value as 0 you can set the recipients after which --> - <!-- tarpitting get activated. --> - <!-- Tarpitting is a method to insert a small sleep after each rcpt. For more --> - <!-- infos read this: http://www.palomine.net/qmail/tarpit.html . --> - <!-- Default is set to 0 (disabled). --> - <!-- - <tarpitRcptCount> 0 </tarpitRcptCount> - --> - <!-- See timeout in milliseconds to insert after the rcpt. Only is used if --> - <!-- tarpitting is activated. --> - <!-- - <tarpitSleepTime> 5000 </tarpitSleepTime> - --> - </handler> - <handler command="DATA" class="org.apache.james.smtpserver.DataCmdHandler"></handler> - <handler command="RSET" class="org.apache.james.smtpserver.RsetCmdHandler"></handler> - <handler command="HELP" class="org.apache.james.smtpserver.HelpCmdHandler"></handler> - <handler command="QUIT" class="org.apache.james.smtpserver.QuitCmdHandler"></handler> - - <!-- The message handler configuration --> - <!-- - <handler class="org.apache.james.smtpserver.SetMimeHeaderHandler"> - <headername>SPF-test</headername> - <headervalue>passed</headervalue> - </handler> - --> - - <!-- The default message receiving handler --> - <!-- The default behaviour is to put the message in the root processor of --> - <!-- the spooler --> - <handler class="org.apache.james.smtpserver.SendMailHandler"> - </handler> - </handlerchain> + <!-- SMTP Handler Chain customization --> + <!-- Uncomment this and edit james-smtphandlerchain.xml configuration file to --> + <!-- enable the experimental fastfail features. Look at the james-smtphandlerchain.xml --> + <!-- for further informations --> + <!-- + &smtphandlerchainConfig; + --> </handler> </smtpserver> @@ -1071,9 +983,7 @@ <!-- Spool repository configuration --> <!-- The spool repository is the location where incoming mails are temporarily stored --> <!-- before being processed. --> - <!-- <spoolrepository destinationURL="file://var/mail/spool/" type="SPOOL"/> - --> <!-- Alternative spool repository definition for JDBC use --> <!-- @@ -1082,9 +992,9 @@ <!-- Alternative spool repository definition for JDBC use --> <!-- Stores message body in file system, rest in database --> - <!-- TEMPORARY DEFAULT: dbfile using Derby --> + <!-- <spoolrepository destinationURL="dbfile://maildb/spool/spool" type="SPOOL"/> - <!-- TEMPORARY DEFAULT: dbfile using Derby --> + --> <!-- The Mailstore block --> <mailstore> @@ -1123,7 +1033,7 @@ <!-- Set the size threshold for in memory handling of storing operations --> <!-- Default is currently 409600000 due to a bug with mysql and binary stream --> <!-- currently under investigation. Please change this only if you know what --> - <!-- you do. --> + <!-- you do, this is EXPERIMENTAL --> <!-- <inMemorySizeLimit>4096</inMemorySizeLimit> --> @@ -1140,6 +1050,13 @@ <config> <sqlFile>file://conf/sqlResources.xml</sqlFile> <maxcache>1000</maxcache> + <!-- Set the size threshold for in memory handling of storing operations --> + <!-- Default is currently 409600000 due to a bug with mysql and binary stream --> + <!-- currently under investigation. Please change this only if you know what --> + <!-- you do, this is EXPERIMENTAL --> + <!-- + <inMemorySizeLimit>4096</inMemorySizeLimit> + --> </config> </repository> Added: james/server/branches/v2.3/src/conf/james-smtphandlerchain.xml URL: http://svn.apache.org/viewvc/james/server/branches/v2.3/src/conf/james-smtphandlerchain.xml?rev=419513&view=auto ============================================================================== --- james/server/branches/v2.3/src/conf/james-smtphandlerchain.xml (added) +++ james/server/branches/v2.3/src/conf/james-smtphandlerchain.xml Thu Jul 6 03:46:24 2006 @@ -0,0 +1,98 @@ +<!-- The configuration handler chain --> +<!-- Please note that this is EXPERIMENTAL and will be changed in future --> +<!-- releases --> +<handlerchain> + + <!-- The connect handler configuration --> + <!-- + <handler class="org.apache.james.smtpserver.DNSRBLHandler"> + <rblservers> + <whitelist> query.bondedsender.org </whitelist> + <blacklist> sbl-xbl.spamhaus.org </blacklist> + <blacklist> list.dsbl.org </blacklist> + <blacklist> dul.dnsbl.sorbs.net </blacklist> + <blacklist> relays.ordb.org </blacklist> + </rblservers> + </handler> + --> + + <!-- The command handler configuration --> + <handler command="HELO" class="org.apache.james.smtpserver.HeloCmdHandler"> + <!-- If is set to true helo is only accepted if it can be resolved --> + <!-- + <checkResolvableHelo> false </checkResolvableHelo> + --> + + <!-- If is set to true sender domain will be checked also for clients that --> + <!-- are allowed to relay. Default is false. --> + <!-- + <checkAuthNetworks> false </checkAuthNetworks> + --> + </handler> + <handler command="EHLO" class="org.apache.james.smtpserver.EhloCmdHandler"> + <!-- If is set to true ehlo is only accepted if it can be resolved --> + <!-- + <checkResolvableEhlo> false </checkResolvableEhlo> + --> + + <!-- If is set to true sender domain will be checked also for clients that --> + <!-- are allowed to relay. Default is false. --> + <!-- + <checkAuthNetworks> false </checkAuthNetworks> + --> + </handler> + <handler command="AUTH" class="org.apache.james.smtpserver.AuthCmdHandler"></handler> + <handler command="VRFY" class="org.apache.james.smtpserver.VrfyCmdHandler"></handler> + <handler command="EXPN" class="org.apache.james.smtpserver.ExpnCmdHandler"></handler> + <handler command="MAIL" class="org.apache.james.smtpserver.MailCmdHandler"> + <!-- If is set to true mail is only accepted if the sender contains --> + <!-- a resolvable domain having a valid MX Record or A Record associated! --> + <!-- + <checkValidSenderDomain> false </checkValidSenderDomain> + --> + <!-- If is set to true sender domain from clients that are allowed to --> + <!-- relay will be checked, too. Default is false. --> + <!-- + <checkAuthClients> false </checkAuthClients> + --> + </handler> + <handler command="RCPT" class="org.apache.james.smtpserver.RcptCmdHandler"> + <!-- If is set to a bigger value as 0 you can limit the maximal recipients --> + <!-- per email. Default is set to 0. --> + <!-- + <maxRcpt> 0 </maxRcpt> + --> + + <!-- If is set to a bigger value as 0 you can set the recipients after which --> + <!-- tarpitting get activated. --> + <!-- Tarpitting is a method to insert a small sleep after each rcpt. For more --> + <!-- infos read this: http://www.palomine.net/qmail/tarpit.html . --> + <!-- Default is set to 0 (disabled). --> + <!-- + <tarpitRcptCount> 0 </tarpitRcptCount> + --> + <!-- See timeout in milliseconds to insert after the rcpt. Only is used if --> + <!-- tarpitting is activated. --> + <!-- + <tarpitSleepTime> 5000 </tarpitSleepTime> + --> + </handler> + <handler command="DATA" class="org.apache.james.smtpserver.DataCmdHandler"></handler> + <handler command="RSET" class="org.apache.james.smtpserver.RsetCmdHandler"></handler> + <handler command="HELP" class="org.apache.james.smtpserver.HelpCmdHandler"></handler> + <handler command="QUIT" class="org.apache.james.smtpserver.QuitCmdHandler"></handler> + + <!-- The message handler configuration --> + <!-- + <handler class="org.apache.james.smtpserver.SetMimeHeaderHandler"> + <headername>SPF-test</headername> + <headervalue>passed</headervalue> + </handler> + --> + + <!-- The default message receiving handler --> + <!-- The default behaviour is to put the message in the root processor of --> + <!-- the spooler --> + <handler class="org.apache.james.smtpserver.SendMailHandler"> + </handler> +</handlerchain> Propchange: james/server/branches/v2.3/src/conf/james-smtphandlerchain.xml ------------------------------------------------------------------------------ svn:eol-style = native Modified: james/server/branches/v2.3/src/java/org/apache/james/smtpserver/SMTPHandlerChain.java URL: http://svn.apache.org/viewvc/james/server/branches/v2.3/src/java/org/apache/james/smtpserver/SMTPHandlerChain.java?rev=419513&r1=419512&r2=419513&view=diff ============================================================================== --- james/server/branches/v2.3/src/java/org/apache/james/smtpserver/SMTPHandlerChain.java (original) +++ james/server/branches/v2.3/src/java/org/apache/james/smtpserver/SMTPHandlerChain.java Thu Jul 6 03:46:24 2006 @@ -18,13 +18,16 @@ package org.apache.james.smtpserver; import java.util.ArrayList; +import java.util.Enumeration; import java.util.List; import java.util.HashMap; import java.util.Locale; +import java.util.Properties; import org.apache.avalon.framework.configuration.Configurable; import org.apache.avalon.framework.configuration.Configuration; import org.apache.avalon.framework.configuration.ConfigurationException; +import org.apache.avalon.framework.configuration.DefaultConfiguration; import org.apache.avalon.framework.container.ContainerUtil; import org.apache.avalon.framework.logger.AbstractLogEnabled; import org.apache.avalon.framework.logger.LogEnabled; @@ -58,6 +61,32 @@ */ public void configure(Configuration configuration) throws ConfigurationException { addToMap(UnknownCmdHandler.UNKNOWN_COMMAND, unknownHandler); + if(configuration == null || configuration.getChildren("handler") == null || configuration.getChildren("handler").length == 0) { + configuration = new DefaultConfiguration("handlerchain"); + Properties cmds = new Properties(); + cmds.setProperty("AUTH",AuthCmdHandler.class.getName()); + cmds.setProperty("DATA",DataCmdHandler.class.getName()); + cmds.setProperty("EHLO",EhloCmdHandler.class.getName()); + cmds.setProperty("EXPN",ExpnCmdHandler.class.getName()); + cmds.setProperty("HELO",HeloCmdHandler.class.getName()); + cmds.setProperty("HELP",HelpCmdHandler.class.getName()); + cmds.setProperty("MAIL",MailCmdHandler.class.getName()); + cmds.setProperty("NOOP",NoopCmdHandler.class.getName()); + cmds.setProperty("QUIT",QuitCmdHandler.class.getName()); + cmds.setProperty("RCPT" ,RcptCmdHandler.class.getName()); + cmds.setProperty("RSET",RsetCmdHandler.class.getName()); + cmds.setProperty("VRFY",VrfyCmdHandler.class.getName()); + cmds.setProperty("Default SendMailHandler",SendMailHandler.class.getName()); + Enumeration e = cmds.keys(); + while (e.hasMoreElements()) { + String cmdName = (String) e.nextElement(); + String className = cmds.getProperty(cmdName); + DefaultConfiguration cmdConf = new DefaultConfiguration("handler"); + cmdConf.setAttribute("command",cmdName); + cmdConf.setAttribute("class",className); + ((DefaultConfiguration) configuration).addChild(cmdConf); + } + } if(configuration != null) { Configuration[] children = configuration.getChildren("handler"); if ( children != null ) { --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]