apacheemailjamesflooding

Apache james STMP Flooding


I want to use James as a relay to handle incoming email and put them in a system through webservice. It works fine. BUT I want to handle an eventual flood created by a misconfiguration of the program that sends email to this server... Is there anyway to configure a management of a temporary "banned" status for sender of this email or for destination of this email ?

Thanks


Solution

  • the use of SMPT HOOK is useful here, i just wrote one

    public class SMTPFloodProtectionHook implements RcptHook {
    [...]
    @Override
    public HookResult doRcpt(SMTPSession session, MailAddress sender, MailAddress rcpt) {
        if (checkFloodSender(sender) || checkFloodReceiver(rcpt))
            return HookResult.deny();
        return HookResult.ok();
    }
    

    and modify smtpserver.conf

        <!-- The configuration handler chain -->
        <handlerchain>
    
            <handler class="org.domain.atgov.incomingevent.email.SMTPFloodProtectionHook" />
    

    it denies faster than using mailet.