LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Security
User Name
Password
Linux - Security This forum is for all security related questions.
Questions, tips, system compromises, firewalls, etc. are all included here.

Notices


Reply
  Search this Thread
Old 12-02-2009, 02:38 AM   #1
bcw
LQ Newbie
 
Registered: Dec 2009
Location: California, USA
Distribution: Debian
Posts: 2

Rep: Reputation: 0
safest command-line (not GUI) program to view apache logs?


The Apache 2.2 docs say

Quote:
[...] log files may contain information supplied directly by the client, without escaping. Therefore, it is possible for malicious clients to insert control-characters in the log files, so care must be taken in dealing with raw logs.
However, from Googling around, there seem to be no command-line (non-GUI) programs specifically for viewing possibly-malicious apache logs. Or am I wrong? Until now, I have been using less. Is that ok from a security standpoint?
 
Old 12-02-2009, 03:35 AM   #2
business_kid
LQ Guru
 
Registered: Jan 2006
Location: Ireland
Distribution: Slackware, Slarm64 & Android
Posts: 16,260

Rep: Reputation: 2321Reputation: 2321Reputation: 2321Reputation: 2321Reputation: 2321Reputation: 2321Reputation: 2321Reputation: 2321Reputation: 2321Reputation: 2321Reputation: 2321
yes
 
Old 12-02-2009, 04:21 AM   #3
18Googol2
Member
 
Registered: Oct 2008
Distribution: FreeBSD, RedHat, Centos, Solaris, AIX
Posts: 34

Rep: Reputation: 17
'tail -f' seems to be better.
 
Old 12-02-2009, 04:50 AM   #4
zhjim
Senior Member
 
Registered: Oct 2004
Distribution: Debian Squeeze x86_64
Posts: 1,748
Blog Entries: 11

Rep: Reputation: 233Reputation: 233Reputation: 233
tail -f will only show you the last 10 lines and all new lines coming in. But what if the information you are looking for is above the 10 lines?

(And don't be a smarass and answer with tail -n 20 -f )
 
Old 12-02-2009, 05:36 AM   #5
Web31337
Member
 
Registered: Sep 2009
Location: Russia
Distribution: Gentoo, LFS
Posts: 399
Blog Entries: 71

Rep: Reputation: 65
UNsafe:
Code:
php -r "include('/var/log/httpd/access.log');"
i guess all standard CLI tools would be OK.

Code:
tail -n 500 | less
is for viewing 500 last lines in a console with ability to scroll up and down.

Last edited by Web31337; 12-02-2009 at 05:39 AM.
 
Old 12-02-2009, 07:00 AM   #6
unixfool
Member
 
Registered: May 2005
Location: Northern VA
Distribution: Slackware, Ubuntu, FreeBSD, OpenBSD, OS X
Posts: 782
Blog Entries: 8

Rep: Reputation: 158Reputation: 158
Quote:
Originally Posted by zhjim View Post
tail -f will only show you the last 10 lines and all new lines coming in. But what if the information you are looking for is above the 10 lines?

(And don't be a smarass and answer with tail -n 20 -f )
The man pages are your friend.

I use tail as such:

tail -f -n 100 /var/log/httpd/access_log

Quote:
-f The -f option causes tail to not stop when end of file is reached, but rather to wait for additional data to be appended to the input. The -f option is ignored if the standard input is a pipe, but not if it is a FIFO.
Quote:
-n number The location is number lines.
Quote:
The default starting location is "-n 10", or the last 10 lines of the input.
 
Old 12-03-2009, 11:35 PM   #7
bcw
LQ Newbie
 
Registered: Dec 2009
Location: California, USA
Distribution: Debian
Posts: 2

Original Poster
Rep: Reputation: 0
thanks + a couple questions

thanks for the help, everyone.

Quote:
Originally Posted by Web31337 View Post
UNsafe:
Code:
php -r "include('/var/log/httpd/access.log');"
i guess all standard CLI tools would be OK.
yeah, i can see how that could be a problem. so basically, don't feed the logs into any executable context, right?

i was actually worried more about someone using shell control characters to trick the shell itself into executing another (arbitrary) command. but now that i think about it, unredirected output from programs the shell executes are just sent to the shell's own stdout/stderr, and have no chance to influence the shell's commands (stdin). isn't that right?
 
  


Reply

Tags
apache, command line, logfile, security, tail, viewer



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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Start 'Add/Remove' program GUI from command line j_70 Linux - Software 1 02-08-2008 02:59 PM
GUI to view audit logs mgk720 Linux - Security 3 01-29-2008 07:41 PM
how to use command line program in gui Carunkumar Programming 11 12-13-2007 01:44 PM
How to view command executed via GUI skleung Linux - General 5 07-09-2007 05:32 AM
Command line utlility to view user info like the GUI one? ivj Linux - Newbie 1 07-27-2004 06:44 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Security

All times are GMT -5. The time now is 03:45 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration