james-server-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From anth...@blackink.net.au (Anthony Buckton)
Subject Immediate 550 responses to illegal sends
Date Thu, 18 Apr 2002 16:39:27 GMT
Hi Guys,

A week or two ago, I downloaded James and started getting into things - including this list,
so I apologise if I am covering old ground.

Over the last few days I have been getting hammered by a pseudo-yahoo user sending thousands
of emails to other @yahoo.com users.
My strategy was to black-hole the emails, yet they still keep coming and my shiny new DSL
link is becoming choked as this guy steps up his operations.

I would like to respond to the guy to inform him that his efforts are now fruitless, but the
senders address is a fake, all I have is his IP and that doesn't respond to incoming connections
:(

On checking how other do this, the recommendation what to respond with a "550" message during
the SMTP connection to let the sender know that their mail is rejected - whilst they're is
connected - preferrably as a response to his RCPT command - before the DATA starts racking
up the byte counters at my ISP. The current Mailet checking and processing architecture doesn't
allow this.

I have been working through the code (I'm checking out Eclipse which shows promise) and have
come up with the following suggestion:

i) config.xml: Incorporates a tag in the <smtpserver> section, I've named <LocalRelated>
which is a boolean and is responsible for setting a "localRelated" boolean in the SMTPHandler
object.


ii) The following code would be executed:

if(localRelated)
{
    MailAddress senderAddress = (MailAddress)state.get(SENDER);
    boolean SenderHostIsLocal
        = mailServer.isLocalServer(recipientAddress.getHost());
    boolean RcptHostIsLocal
        = mailServer.isLocalServer(senderAddress.getHost());
    boolean SenderUserIsLocal
        = mailServer.isLocalUser(recipientAddress.getUser());
    boolean RcptUserIsLocal
        = mailServer.isLocalUser(senderAddress.getUser());

    // check if either the send/recv user+domain are local
    if(!((SenderHostIsLocal && SenderUserIsLocal) ||
          (RcptHostIsLocal && RcptUserIsLocal))) {
        out.println("550 Cannot forward to that address");
        getLogger().error("Sender " + senderAddress 
            + " attempted to relay to " + recipientAddress);
        return;
     }
}
 
(This code would be inserted into doRCPT() method of the SMTPHandler object, most likely AFTER
the AUTH checking code.)

iv) The method "public boolean isLocalUser(String name)" would need to inserted into the MailServer
interface to make the method found in James object accessible by the SMTPHandler.

I realise that this may not meed all of the needs of all of the users - but it could be the
start of some useful "fast spam stopping" tools.

Anthony


--
To unsubscribe, e-mail:   <mailto:james-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:james-dev-help@jakarta.apache.org>


Mime
View raw message