iEntry 10th Anniversary Forum Rules Search
WebProWorld
Register FAQ Calendar Mark Forums Read
Web Programming Discussion Forum Working with an API? Developing a plugin? Writing a Mod or script for your favorite blog, Web 2.0 site or Forum? Welcome.

Share Thread: & Tags

Share Thread:

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 05-17-2009, 04:51 PM
WebProWorld Pro
 
Join Date: Jan 2008
Posts: 294
Tech Manager RepRank 1
Smile Create Your Own Security Logs

Here is a tutorial I wrote about creating a custom security log using PHP. It includes definitions for all the terms, $_SERVER, REMOTE_ADDR, REQUEST_METHOD, PHP_SELF, QUERY_STRING,REQUEST_TIME fopen, fclose, fwrite, etc., an explanation for the function/script and the complete finished code with instructions on how to use it.

Create Your Own Security Logs
__________________
I use Country IP Blocks as added security for my networks and servers.
Reply With Quote
  #2 (permalink)  
Old 05-18-2009, 11:55 AM
danlefree's Avatar
WebProWorld Pro
 
Join Date: Jun 2005
Location: Seattle
Posts: 266
danlefree RepRank 4danlefree RepRank 4danlefree RepRank 4danlefree RepRank 4
Default Re: Create Your Own Security Logs

The script could be useful for auditing login attempts and other application-level tasks, however, relying upon one's own PHP-generated logs for all activity would add significant overhead for each page request and defeat the purpose of existing log analysis tools.
__________________
Dan LeFree | Product Manager (Linux VPS Hosting) | Owner/Operator (Web development, marketing)
Reply With Quote
  #3 (permalink)  
Old 05-18-2009, 12:16 PM
WebProWorld Pro
 
Join Date: Jan 2008
Posts: 294
Tech Manager RepRank 1
Default Re: Create Your Own Security Logs

Quote:
Originally Posted by danlefree View Post
The script could be useful for auditing login attempts and other application-level tasks, however, relying upon one's own PHP-generated logs for all activity would add significant overhead for each page request and defeat the purpose of existing log analysis tools.
It really depends on how much data you are logging. Based on the limited amount of data in this tutorial the overhead is slight not significant. There are many log analysis tools that provide an excellent resource for viewing and interpreting log data. However, many webmasters and site owners do not have access to their logs or want to be able to monitor specific types of traffic.

Thank you for responding.
__________________
I use Country IP Blocks as added security for my networks and servers.
Reply With Quote
  #4 (permalink)  
Old 05-18-2009, 12:50 PM
wige's Avatar
Moderator
WebProWorld Moderator
 
Join Date: Jun 2006
Location: United States
Posts: 2,648
wige RepRank 9wige RepRank 9wige RepRank 9wige RepRank 9wige RepRank 9wige RepRank 9wige RepRank 9wige RepRank 9wige RepRank 9wige RepRank 9wige RepRank 9
Default Re: Create Your Own Security Logs

The one drawback to this method that I see (other than the above mentioned overhead) is that this script requires that the malicious user attempt to access a dynamic page that has the scripting enabled. If you are not able to add custom PHP code to error documents, this system would be almost useless. In addition, it creates a blind spot for images, scripts, media files, libraries and dynamic includes and other potential avenues of attack.

Generally speaking, if you have access to .htaccess, I would lean more toward creating a custom security log with a custom entry in the .htaccess file that will record the pertinent information. This method will allow all access attempts to be recorded with minimal overhead. The following .htaccess directive will generate a log similar to that explained in the tutorial. The log file will be created at /location/log.txt.
Code:
LogFormat "%h|%t|\"%r\"|%>s" security
CustomLog /location/log.txt security
__________________
The best way to learn anything, is to question everything.
Reply With Quote
  #5 (permalink)  
Old 05-18-2009, 12:54 PM
WebProWorld Pro
 
Join Date: Jan 2008
Posts: 294
Tech Manager RepRank 1
Default Re: Create Your Own Security Logs

I agree with you Wige. Good post. However, your .htaccess directive is not going to work on every system. Again we get into configuration differences, whether .htaccess is available to the site owner, etc.

Quote:
you must have access to your virtual host configuration because the CustomLog and LogFormat directives can’t be specified in the .htaccess file but only at server config or virtual host level.
Source

I have tested your solution and received errors. I have not tested the solution mentioned in the quote above. But will do so.

The best solution is to have all log entries available, and use log analysis tools as mentioned by danlefree.
__________________
I use Country IP Blocks as added security for my networks and servers.

Last edited by Tech Manager; 05-18-2009 at 01:10 PM. Reason: clarification
Reply With Quote
  #6 (permalink)  
Old 05-21-2009, 02:53 PM
zbatia's Avatar
WebProWorld Pro
 
Join Date: Jul 2003
Location: Baltimore, MD
Posts: 130
zbatia RepRank 1
Default Re: Create Your Own Security Logs

After trying various add-on scripts I found that "The best solution is to have all log entries available, and use log analysis tools" as it was mentioned above. I'd recommend the inexpensive but comprehensive and easy-to-interpret tool:
Easy Web Traffic Analysis. Understanding Web Site Visitors and SEO. Web Analytics for Business Owners. Get better ROI!
I use it successfully for the last 1 year. I love auto-reporting feature since I am busy and can forget to download the report for comparison with previous weeks.
__________________
The Cyber Teacher
http://www.rtek2000.com
http://www.800-webdesign.com/web-master-links.html -Free Web Master's Resources
_________________
Reply With Quote
Reply

  WebProWorld > Webmaster, IT and Security Discussion > Web Programming Discussion Forum

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
ASP programmer wanted to create security image supernatural_247 Services for Sale/Hire 2 10-26-2005 02:02 PM
A Fox In the Logs WPW_Feedbot Marketing Strategies Discussion Forum 0 01-26-2005 11:00 PM
Dial-up logs on by itself jawn_tech Internet Security Discussion Forum 6 11-03-2004 12:21 PM
Firewall Logs mushroom Internet Security Discussion Forum 3 06-23-2004 05:16 AM
Web Logs ajpaulus Marketing Strategies Discussion Forum 6 04-03-2004 02:35 AM


All times are GMT -4. The time now is 01:11 AM.



Search Engine Optimization by vBSEO 3.3.0