Hi,
it looks likely there are spam or some account sent a lot of mail,
i want to install a script to track the spam,
it looks kilely i can install a formmail.log to track it,
can anyone tell me more detail of the installing?
thanks
Hi,
it looks likely there are spam or some account sent a lot of mail,
i want to install a script to track the spam,
it looks kilely i can install a formmail.log to track it,
can anyone tell me more detail of the installing?
thanks
Try below one:
mv /usr/sbin/sendmail /usr/sbin/sendmail.act
(==>NOTE: Watch out .. if you, by mistake, repeat this install you will overwrite your real sendmail file ... better you make yet another copy with "cp" under another name.)
pico /usr/sbin/sendmail (paste the below code into it)
chmod +x /usr/sbin/sendmail
echo > /var/log/formmail.log
chmod 777 /var/log/formmail.log
------------------------------------------------------------------------
#!/usr/bin/perl
# use strict;
use Env;
my $date = `date`;
chomp $date;
open (INFO, ">>/var/log/formmail.log") || die "Failed to open file ::$!";
my $uid = $>;
my @info = getpwuid($uid);
if($REMOTE_ADDR) {
print INFO "$date - $REMOTE_ADDR ran $SCRIPT_NAME at $SERVER_NAME \n";
}
else {
print INFO "$date - $PWD - @info\n";
}
my $mailprog = '/usr/sbin/sendmail.act';
foreach (@ARGV) {
$arg="$arg" . " $_";
}
open (MAIL,"|$mailprog $arg") || die "cannot open $mailprog: $!\n";
while (<STDIN> ) {
print MAIL;
}
close (INFO);
close (MAIL);
Refer:- http://forum.swsoft.com/showthread.php?threadid=20031