block the spam on ur servers , secure ur server from sending spam

Discussion in 'Site & Server Administration' started by SPARKS MAN, May 24, 2008.

  1. #1
    AS we know sending spam with large number not allow for almost server and data centers'

    so that if a site Ip send any spam
    the hosting or data center will close this site until paying an amount of many
    to the hosting as a penalty in order to re open this site

    to avoids this on ur server
    this steps will close the spam :-

    1) On the SSH write :
        pico /etc/exim.conf
    PHP:
    search for :
     spamd_address = 127.0.0.1 783
    PHP:
    above add :
     log_selector = +arguments +subject
    PHP:
    so that totally became :
     log_selector = +arguments +subject
    spamd_address = 127.0.0.1 783 
    PHP:
    and then execute these two instruction on SSH
     service exim restart
    service cpanel restart
    PHP:
    2) Install a (spamdconf ) from cpanel add-ons

    3)From Tweak settings do the following:
    1.
    The maximum each domain can send out per hour (0 is unlimited) Set it to number between (1 and 100 )
    2.Check the following
    • Prevent the user "nobody" from sending out mail to remote addresses (PHP and CGI scripts generally run as nobody if you are not using PHPSuexec and Suexec respectively.) ·
    • SpamAssassin Spam Filter
    • Horde Webmail
    • Mailman
    • SpamAssassin Spam Box delivery for messages marked as spam (user configurable)
    • SquirrelMail Webmail
    3.Un check the BoxTrapper Spam Trap

    4) install a CSF on ur server

    wget http://www.configserver.com/free/csf.tgz  
        tar -zxvf csf.tgz  
    cd csf
    sh install.sh
    PHP:

    And Don’t forget to set
    LF_SCRIPT_ALERT = 1
    On
    csf.conf file

    5) cave the peril 744 permeation :
    chmod 755 /usr/bin/perl
    PHP:


    6) Blocking spam through php script by using nobody:-

    From SSH write
    service exim stop   
    PHP:

    and

    pico /usr/sbin/sendmail
    PHP:

    Change the file contain with 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);
    PHP:


    Then save the file sendmail
    And change its permissions by
    chmod +x /usr/sbin/sendmail
    PHP:



    5) Create a log file to register ur customer trying in order to alert them:
    touch /var/log/spam_log
    PHP:
     chmod 0777 /var/log/spam_log
    PHP:


    6) start the ( exim):

    service exim start
    PHP:
    Or
     /etc/init.d/exim start
    PHP:


    And don’t forget to keep updating the Apache and PHP to latest version

    glade to help in any question

     
    SPARKS MAN, May 24, 2008 IP