ourlil.com

A web site for tutti noi (all of us!)

  • Home
  • About
  • About – sample
  • Healing Christofer – Fun’-Raiser
    • Gallery
  • JP’s Page

Posts Tagged ‘httpd’

How to nuke attackers via httpd.conf?

Tuesday, April 29th, 2008

How to nuke attackers via httpd.conf?That can be accomplished using mod_access “Deny from <envar>” with mod_setenvif testing REQUEST_URI or by using mod_rewrite:

RewriteRule (awstats\.pl¦xmlrpc\.php¦includer\.cgi¦hints\.pl)$ - [F]

Of course, the problem is that you’ll still be wasting bandwidth sending your custom 403 error page to these idiots.A work-around (stay with me here) is to do the following:Create a new subdirectory below web root.Place a custom 403 error page in that subdirectory. Lets call it “403.html” for now. Leave out all the HEAD content, and just put a few characters in this file, so you can recognize it by filesize when fetched — I use just the text “No.”Now create an .htaccess file in that subdirectory that contains the following:

ErrorDocument 403 /path_to_this_subdirectory/403.html
Options +FollowSymLinks
RewriteEngine onRewriteRule !^403\.html$ - [F]

Now, instead of the first code snippet I posted above, use the following in httpd.conf or in your web root .htaccess file:

RewriteRule (awstats\.pl¦xmlrpc\.php¦includer\.cgi¦hints\.pl)$ \
/path_to_subdirectory/$1 [L]

Now when a bad-bot attempts to fetch one of those files, it gets rewritten to the subdirectory. But no files in that subdirectory are allowed to be fetched except for 403.html. So, the 403 error handler is invoked, and returns only a 403-Forbidden server response header and the three-byte response from 403.html, thus minimizing your bandwidth loss.

Tags: apache, httpd, security
Posted in apache, httpd, security | Comments Off

  •  

    February 2012
    S M T W T F S
    « Nov    
     1234
    567891011
    12131415161718
    19202122232425
    26272829  
  • Pages

    • About
    • About – sample
    • Healing Christofer – Fun’-Raiser
      • Gallery
    • JP’s Page
  • Archives

    • November 2011
    • July 2010
    • February 2010
    • November 2009
    • August 2009
    • July 2009
    • June 2009
    • May 2009
    • March 2009
    • February 2009
    • January 2009
    • December 2008
    • October 2008
    • September 2008
    • August 2008
    • July 2008
    • June 2008
    • May 2008
    • April 2008
    • March 2008
    • February 2008
    • December 2007
    • October 2007
    • September 2007
    • August 2007
    • July 2007
    • June 2007
    • May 2007
  • Categories

  • Favorites

    Here're a few sites I like to visit:
    • WPMU.org
    • Holy Shmoly
    • AppleInsider.com
  • Meta

    • Log in
    • Entries RSS
    • Comments RSS
    • WordPress.org

Copyright © 2012 - ourlil.com | Entries (RSS) | Comments (RSS)

WordPress theme designed by web design