store | blogs | forums | twitter | facebook | wiki | mailing lists | downloads | support portal
Atomic Secure Linux
It is currently Sun May 19, 2013 7:03 pm

» Feed - Atomicorp

All times are UTC - 5 hours [ DST ]




Post new topic Reply to topic Share/Bookmark  [ 6 posts ] 
Author Message
 Post subject: Crude reputation idea
Unread postPosted: Thu Aug 28, 2008 4:23 pm 
Offline
Forum Regular
Forum Regular

Joined: Sun Nov 20, 2005 4:16 pm
Posts: 183
Location: Right Behind You!
I had a thought that a very basic reputation system could be set up using qmail-scanner and qgreylist. Here is the thought:

1) Have qmail-scanner increment the number in a file for the number of times a class C hits the delete threshold.

2) Add an additional check to qgreylist for that file, and if it reached a configurable threshold, 5.7.1 the email

3) Add a cleanup function that runs every hour and removes files that haven't been written to in 24 hours.

I'm making a stab at #1, but running into issues. I've added the following at around line 3770 (the delete section), but it isn't kicking out the files at all. Sigh. Anyone see any reason why this wouldn't generate a file and then increment a number inside of it?

Code:
          #Add in spamhits to greylisting files
          my ( $a, $b, $c, $d ) = $ENV{'TCPREMOTEIP'};

          my $bl_file = "/var/qmail/blacklist/$a.$b.$c";
          open (FILE, "+>>" . $bl_file);
          flock(FILE, 2);

          seek FILE, 0, 0;
          my @file_contents = <FILE>;
          truncate FILE, 0;

          my $counterVar;

          if ($file_contents[0] =~ /^(\d+)$/)
          {
             $counterVar = $1;
          }
          else
          {
             $counterVar = 'COUNTER ERROR';  # the regular expression didn't match
          }

          $counterVar++;

          print FILE $counterVar;
          close (FILE);

_________________
-Andy


Top
 Profile  
 
 Post subject:
Unread postPosted: Thu Aug 28, 2008 4:28 pm 
Offline
Atomicorp Staff - Site Admin
Atomicorp Staff - Site Admin

Joined: Wed Dec 31, 1969 8:00 pm
Posts: 7418
Location: earth
so it never writes to the filehandle you're opening in FILE at all? Or is it just not writing your variable to it?


Top
 Profile  
 
 Post subject:
Unread postPosted: Thu Aug 28, 2008 4:54 pm 
Offline
Forum Regular
Forum Regular

Joined: Sun Nov 20, 2005 4:16 pm
Posts: 183
Location: Right Behind You!
Not creating the file. Dir perms are 777 at the moment. The only thing I can think of is that $ENV{'TCPREMOTEIP'} isn't doing what I think it is doing, and I should be looking elsewhere for the IP of the sender.

_________________
-Andy


Top
 Profile  
 
 Post subject:
Unread postPosted: Thu Aug 28, 2008 11:57 pm 
Offline
Atomicorp Staff - Site Admin
Atomicorp Staff - Site Admin

Joined: Wed Dec 31, 1969 8:00 pm
Posts: 7418
Location: earth
is it even changing the timestamp on the file? Just to double check I'd throw a little debug output into FILE. Im not sure your array is actually getting populated like that. Normally I throw the output out of a file read into a while loop, and assign it to a variable with $foo = $_; and then do my string compare off that.


Top
 Profile  
 
 Post subject:
Unread postPosted: Fri Aug 29, 2008 9:56 am 
Offline
Forum Regular
Forum Regular

Joined: Sun Nov 20, 2005 4:16 pm
Posts: 183
Location: Right Behind You!
The dir is empty, and it should be creating a file named the first three octets of the sending IP. Inside the file should only be the number of times that IP has hit the delete threshold. Kinda like how qgreylist has the files, just with a counter inside. :)

I'll change it to a static filename and see if I get anything in there if I get some time today. That will isolate that part of the code, since I really think that is what is causing the issues.

_________________
-Andy


Top
 Profile  
 
 Post subject:
Unread postPosted: Fri Aug 29, 2008 2:17 pm 
Offline
Atomicorp Staff - Site Admin
Atomicorp Staff - Site Admin

Joined: Wed Dec 31, 1969 8:00 pm
Posts: 7418
Location: earth
Yeah I'd throw some debug bits in there before and after it to trap it. If its not creating the file in the first place either its not getting the right path, or a permissions problem


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic Share/Bookmark  [ 6 posts ] 

» Feed - Atomicorp

All times are UTC - 5 hours [ DST ]


Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group