You can block PHP nobody spammers with the following steps. But make sure, you must have Apache 1.3x, PHP 4.3x and Exim. This may work on other systems but we have only tested it on a Cpanel/WHM Red Hat Enterprise system.

  1. At first you have to Login to your server and su – to root.
  2. Turn off exim while we do this so it doesn’t freak out.
    /etc/init.d/exim stop
  3. Backup your original /usr/sbin/sendmail file. On systems using Exim MTA, the sendmail file is just basically a pointer to Exim itself.
    mv /usr/sbin/sendmail /usr/sbin/sendmail.hidden
  4. Create the spam monitoring script for the new sendmail.
    pico /usr/sbin/sendmailPaste in the following:#!/usr/local/bin/perl
    # use strict;
    use Env;
    my $date = `date`;
    chomp $date;
    open (INFO, “>>/var/log/spam_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 – @infon”;
    }
    my $mailprog = ‘/usr/sbin/sendmail.hidden’;
    foreach (@ARGV) {
    $arg=”$arg” . ” $_”;
    }
    open (MAIL,”|$mailprog $arg”) || die “cannot open $mailprog: $!n”;
    while (<STDIN> ) {
    print MAIL;
    }
    close (INFO);
    close (MAIL);
  5. Change the new sendmail permissions
    chmod +x /usr/sbin/sendmail
  6. Create a new log file to keep a history of all mail going out of the server using web scripts
    touch /var/log/spam_logchmod 0777 /var/log/spam_log
  7. Start Exim up again.
    /etc/init.d/exim start
  8. Monitor your spam_log file for spam, try using any form mail or script that uses a mail function – a message board, a contact script.
    tail – f /var/log/spam_log

 

Popular Posts You May Read

Explore more hosting insights, tips and industry updates.

Google and Security of It’s Data Centers

Google secures its hardware in its data centers using methods similar to those followed by…

Exploring-the-Future-of-Web-Hosting-with-AI-Revolutionary-Trends-for-2024

Exploring the Future of Web Hosting with AI- Revolutionary Trends for 2024

Do we all agree that Artificial Intelligence is unquestionably shaping our lives? Absolutely, without a…

Digital-Transformation-Understanding-the-need-for-Fast-SSDs-BLOG

Digital Transformation: Understanding the Need for Fast SSDs

There is a constant push in the digital world to take on new advances in…