NetAdminTools.com
 
SignalQ Sites:
NetAdminTools - Coprolite - NoNIC - SpotBridge - NAW
RoboCoop - AreWeDown - SolarPower - SysAdminTools
Xfig - Gold Loaf - GeekPapa - FixGMC - MCJ - FixRambler
Categories:
GNU/Linux | Homebrew designs | Perl | Administration | Backup/Recovery | Bugs/Fixes | Certification | Database | Email | File/Print | Hardware | Information Grab Bag | Interoperability | GNU/Linux ABCs | Monitoring | Name Resolution | Network Services | Networking | Remote Control | Security | Desktop | Web | BSD | Solaris | GIAGD | REALbasic

Last 30 Days | Last 60 Days | Last 90 Days | All Articles | RSS | Hail Support


Categories:
·GNU/Linux
·Homebrew designs
·Perl
·Administration
·Backup/Recovery
·Bugs/Fixes
·Certification
·Database
·Email
·File/Print
·Hardware
·Information Grab Bag
·Interoperability
·GNU/Linux ABCs
·Monitoring
·Name Resolution
·Network Services
·Networking
·Remote Control
·Security
·Desktop
·Web
·BSD
·Solaris
·GIAGD
·REALbasic
·All Categories


Protecting your site from particular IP addresses w/ Apache
Topic: Web   Posted:2001-09-09
Printer Friendly: Print

spacerspacer
If a particular user is abusing your Apache web server, it is quite easy to deny access to your site. We found (with our ISP) that the easiest is to put an entry in the .htaccess file in the root of the directory you want to protect:
deny from xxx.xxx.xxx.xxx
Where xxx.xxx.xxx.xxx is the offending users IP address. At NetAdminTools, we are usually quite forgiving, but we had an obnoxious client using Offline Explorer that was causing us performance problems and polluting our logs. The problem with mirroring, is that cross links aren't always dealt with correctly, so you end up with nasty loops. Once we denied access, though, we had to clean up our logs so our stats weren't skewed and our logs didn't use up all of our web space. We wrote a little shell script called cln.sh that contains:
perl -i remlns.txt access_log
perl -i remlns.txt error_log

Then, we simply run:
sh cln.sh
and presto, all references from the offending user are gone and our logs are useful again.

The script remlns.txt is discussed in this article. It just matches two distinguishing features of the line (text1 or text2) and removes the line if either feature matches. Make a backup of your logs first if they are important and test on a non-production box, etc.





Please read our Terms of Use
Microsoft, Windows, Windows XP, Windows 2003, Windows 2000, and NT are either trademarks or registered trademarks of Microsoft Corporation. NetAdminTools.com is not affiliated with Microsoft Corporation. Linux is a registered trademark of Linus Torvalds, and refers to the Linux kernel. The operating system of most distributions that contain the Linux kernel is GNU/Linux. All logos and trademarks in this site are property of their respective owner. Copyright 1997-2008 NetAdminTools.com

Created by:
MCJ
MCJ CMS