What about doing it with a Hook for fastfail?
This hook fails the mail command if it is not authenticated. you could
also use the session.isTLSStarted() or session.isRelayingAllowed().

I'm using that hook on a second SMTP Server on port 465 to force
everyone to login.


public class AuthenticatedSMTPOnlyHandler implements MailHook {
        
        public AuthenticatedSMTPOnlyHandler(){
                
        }

        @Override
        public HookResult doMail(SMTPSession session,
          MailAddress adress) {
                //session.isTLSStarted()
                //session.isRelayingAllowed()
                if (session.getUser() == null){
                        return new HookResult(
                          HookReturnCode.DENY,
                          SMTPRetCode.AUTH_REQUIRED,
                          DSNStatus.getStatus(
                           DSNStatus.PERMANENT,
                           DSNStatus.SECURITY_AUTH+
                           " Authentication is required."));
                }
                if(session.getUser().trim().length() == 0){
                        return new HookResult(
                          HookReturnCode.DENY,
                          SMTPRetCode.AUTH_REQUIRED,
                          DSNStatus.getStatus(
                            DSNStatus.PERMANENT,
                            DSNStatus.SECURITY_AUTH+
                            " Authentication is required."));
                }
                return HookResult.ok();
        }
}


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to