Ban bots (ISPConfig 3)

Discussion in 'General' started by scottrill2, Aug 29, 2012.

  1. scottrill2

    scottrill2 Member

    Hello all,

    I am letting my brother in law run a non-profit club website for US military folk. His site has been slowing. From the logs one of the main culprits is a bot/spider from China called Baidu. I have blocked it using robots.txt but it doesn't heed the disallow.

    Anyway, he has several gigabytes usage per month just from Baidu and some Russian bot. Oddly enough, all these bots from overseas combined don't take up the same bandwidth as this Baidu and russian bot are using lol

    His military folks could very well be overseas but they do NOT need to find the site via search engine. And since my server is mainly family and friends site I want to block out these bots server wide, rather than altering .htaccess files on each site.

    So I read this page:

    http://searchenginewatch.com/article/2067357/Bye-bye-Crawler-Blocking-the-Parasites

    The article mentions adding the following info to my httpd.conf file which I can find simple enough.

    Code:
    SetEnvIfNoCase User-Agent "^Baiduspider" bad_bots
    SetEnvIfNoCase User-Agent "^Sogou" bad_bots
    SetEnvIf Remote_Addr "212\.100\.254\.105" bad_bot
    
    Order allow,deny
    Allow from all
    
    Deny from env=bad_bots
    But httpd.conf is currently empty. Is there a different file I should put the info into for ISPConfig 3?

    Are there any better suggestions for banning these bots?

    Thanks as always folks,

    Scott
     
  2. fbartels

    fbartels New Member

    The httpd.conf is only used in a stock apache installation, in most cases this default configuration file is even overridden by distribution dependent config files (for example in Debian). If you want your code to be executed in every site you also have to add it to every vhost.

    The best way to do this is to create a customer vhost.conf.master (copy it from /usr/local/ispconfig/server/conf to /usr/local/ispconfig/server/conf-custom and do your changes).

    After that you have to manually "resave" every vhost for the file to be recreated. Else you could use the remote api to recreate the file for every vhost. The following post suggests the needed steps:
    http://www.howtoforge.com/forums/showthread.php?t=56195

    Regards Felix

    Overthinking this, there is a way simpler way to achieve this. As the new information is static (doenst need to be changed for every host) you could also create a file inside /etc/apache/conf.d with the needed input. This also affects all vhosts.

    Here is the needed layout of the file:
     
    Last edited: Aug 29, 2012
  3. scottrill2

    scottrill2 Member

    Thanks

    Hello fbartels,

    Thanks for the reply. Two quick questions:

    1. Can I call this file anything I want? i.e. (banned-bots.conf)

    2. Do I have to tell any other apache file to include this file or will it be automatic?


    Thasnks again for the reply.

    Scott
     
  4. fbartels

    fbartels New Member

    When you have a look into /etc/apache2/conf.d you will already find other files like "charset" and "phpmyadmin.conf", so you can basically name it how you want it.

    There is also no extra include necessary as this is already done in apache.conf.
     

Share This Page