Re: ANNOUNCE: qrblcheck -- rbl checking for .qmail

2000-11-06 Thread Jon Rust

Looks good... I tried not play with the original rblcheck as much as
possible. Thanks for the tips, I'll roll them in when I get a chance.

My plan is to rewrite the whole mess to make it a bit more
coherent (not that rblcheck wasn't, but the combo of my code and his
isn't the cleanest, and there's extra stuff in there that doesn't need
to be).

jon

On Mon, Nov 06, 2000 at 03:25:33PM +, Tullio Andreatta wrote:
 I'm not an experienced C programmer, so feedback is welcome and
 encouraged.
 
 Using dynamic allocated memory to store static data is not so good.
 Since we know RBL domains at compile time, how about ...
 
   struct rbl {
 char *site;
 unsigned int rating;
   } rblsites[] = {
 { "rbl.maps.vix.com", 16},
 { "dul.maps.vix.com", 8},
 { "relays.mail-abuse.org", 4},
 { "outputs.orbs.org", 2},
 { "relays.orbs.org", 1},
 { NULL, 0 }
   };
 
   struct rbl *ptr;
 
 ... and ...
 
   rblfiltered = 0;
   for (ptr = rblsites; ptr-site != NULL; ptr++)
   {
 if (max_rating = ptr-rating)
 {
   response = rblcheck(a, ptr-site, txt);
   if (response)
 rbfiltered += ptr-rating;
 }
   }
 
   return rbfiltered;
 }
 
 ... ?



Re: ANNOUNCE: qrblcheck -- rbl checking for .qmail

2000-11-03 Thread Robert J Adams

Jon,

Does this work for you? I was trying to get it up and running, didn't work,
so I added a few debugging printf's and noticed that it looks up

Domain: 0.0.2.151.relays.orbs.org

For each message no matter what's in the "Received" line..

I also wanted to say thanks for starting the development on this.. I was
looking for something like this!


-j


- Original Message -
From: "Jon Rust" [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Thursday, November 02, 2000 1:08 PM
Subject: ANNOUNCE: qrblcheck -- rbl checking for .qmail


 I took rblcheck and added some extra code to read a message from stdin,
 find the IP of the last relay. It then compares a rating, based on
 running lookups against various RBL-style lists, against the value
 supplied on the command line. These mods make it suitable to be used in
 a .qmail file.

 In other words, it looks for the first instance of this type of line:

Received: from mail.domain.com (HELO domain.com) (12.34.56.78)

 It will grab the IP in ()'s and feed it into the rblcheck routine
 written by Edward Marshall. The rblcheck routine(s) has been modified to
 return a value based on which list(s) matched. Namely:

rbl.maps.vix.com  = 16
dul.maps.vix.com  = 8
   relays.mail-abuse.org  = 4
outputs.orbs.org  = 2
 relays.orbs.org  = 1

 Add all values of lists that matched together, and compare it to the
 value supplied on the command line. If the returned value is less than
 or equal to the command line value, qrblcheck returns code 0, which
 tells qmail to continue delivery. If the value is greater than that
 supplied on the command line, qrblcheck returns 100 which tells qmail to
 stop all deliveries and return the message.

 If, for whatever reason, no IP was found, qrblcheck returns 0 (mail is
 accepted).

 EXAMPLE:

 Putting "|qrblcheck 15" on the first line of your .qmail file will block
 any mail that matches rbl.maps.vix.com. Instead, using "|qrblcheck 1"
 will reject mail that matches all the lists except for relays.orbs.org.

 Download the source at

http://jon.rusts.net/qrblcheck.c

 I'm not an experienced C programmer, so feedback is welcome and
 encouraged. The biggest problem I see right now is that it will match
 bogus IP's... like 999.999.999.999, but I don't see how that would work
 it's way into headers written by qmail. Regardless, I do plan on
 implementing some sort of trap for this.

 It successfully compiles on FreeBSD 4.x, but can't be sure it will on
 any other system.

 Hopefully this will be useful to someone.

 jon







Re: ANNOUNCE: qrblcheck -- rbl checking for .qmail

2000-11-03 Thread Jon Rust

On Fri, Nov 03, 2000 at 02:48:22PM -0500, Robert J Adams wrote:
 Jon,
 
 Does this work for you? I was trying to get it up and running, didn't work,
 so I added a few debugging printf's and noticed that it looks up
 
 Domain: 0.0.2.151.relays.orbs.org
 
 For each message no matter what's in the "Received" line..

Hmmm... very odd. No, it's working fine here. I can pipe your entire
message through it and get a result of 0. Then I can change the IP in
the first Received: from header to 127.0.0.3 and it gets a rating of 10.

Send me a copy of what the headers look like on your system. Can't
really think of anything else. :-/

 I also wanted to say thanks for starting the development on this.. I was
 looking for something like this!

Well thanks. Be better if it actually worked for ya.

jon



Re: ANNOUNCE: qrblcheck -- rbl checking for .qmail

2000-11-03 Thread Jon Rust

Robert,

I have reproduced your problem... err my problem. I'm looking into it
now.

jon



Re: ANNOUNCE: qrblcheck -- rbl checking for .qmail

2000-11-03 Thread Jon Rust

All fixed. Please try it out now and tell me what you think.

Jon



ANNOUNCE: qrblcheck -- rbl checking for .qmail

2000-11-02 Thread Jon Rust

I took rblcheck and added some extra code to read a message from stdin,
find the IP of the last relay. It then compares a rating, based on
running lookups against various RBL-style lists, against the value
supplied on the command line. These mods make it suitable to be used in
a .qmail file.

In other words, it looks for the first instance of this type of line:

   Received: from mail.domain.com (HELO domain.com) (12.34.56.78)

It will grab the IP in ()'s and feed it into the rblcheck routine
written by Edward Marshall. The rblcheck routine(s) has been modified to
return a value based on which list(s) matched. Namely:

   rbl.maps.vix.com  = 16
   dul.maps.vix.com  = 8
  relays.mail-abuse.org  = 4
   outputs.orbs.org  = 2
relays.orbs.org  = 1

Add all values of lists that matched together, and compare it to the
value supplied on the command line. If the returned value is less than
or equal to the command line value, qrblcheck returns code 0, which
tells qmail to continue delivery. If the value is greater than that
supplied on the command line, qrblcheck returns 100 which tells qmail to
stop all deliveries and return the message.

If, for whatever reason, no IP was found, qrblcheck returns 0 (mail is
accepted).

EXAMPLE:

Putting "|qrblcheck 15" on the first line of your .qmail file will block
any mail that matches rbl.maps.vix.com. Instead, using "|qrblcheck 1"
will reject mail that matches all the lists except for relays.orbs.org.

Download the source at 

   http://jon.rusts.net/qrblcheck.c

I'm not an experienced C programmer, so feedback is welcome and
encouraged. The biggest problem I see right now is that it will match
bogus IP's... like 999.999.999.999, but I don't see how that would work
it's way into headers written by qmail. Regardless, I do plan on
implementing some sort of trap for this.

It successfully compiles on FreeBSD 4.x, but can't be sure it will on
any other system.

Hopefully this will be useful to someone.

jon