On Fri, 2004-01-09 at 10:05, Carlton L. Whitmore wrote:

I'm using the root user to access the file so rights aren't an issue. 

    Actually it is an issue because PHP is not running with root privileges (at least I hope you haven't changed it and made it run with root privileges; that would be a _bad_ thing).  The reason why only root can access your syslog file is because it contains very specific information about what is running on your machine.  If the syslog file would be readable by all users on your machine then a clever user could gain root access by exploiting something that he/she found in the syslogfile.  It's usually not a good idea to publish the contents of your syslog file to the world accessable via HTTP either.  However if you want to throw caution to the wind keep reading...

I want to display the file thru a webserver. I'd like the page to
refresh so I can watch the activity coming in from my SonicWall router.
I don't mind watching all the activity coming in on that syslog file,
maybe later I can limit what is displayed.

    Ok, so we know that the PHP process does not have access to your syslog file because the file is read-only/write-only by root _and_ read-only by users who are in the root group:

-rw-r-----    1 root     adm          1285 Jan  9 06:00 /var/log/syslog

    I assume you are running PHP as an apache module and apache is running as user "apache" on your system.  So check to see if the apache user is in the root group (the command is "group apache").  If the command only returns "apache" (which it should) then it means that the apache user is only part of the "apache" group on your system.  What you could do is add the apache user to the root group but please understand you are creating a big security hole here.  When joe hacker comes along and notices this he can trick your apache server to run command on your machine with root privileges.  Not a good thing...
    Another, less intrusive, way to do this is to create a cron job (as root) that executes every minutes and copies the contents of the syslog file into another file, readable by the apache user, and displaying the contents of that file on your webpage.  The downside to this is that you will have a 1 minute delay in the information you see on the webpage.
    Hope this helped...

-Pete

-- 
perl -e 'print pack("H*", "70766572746573406E79632E72722E636F6D0A")'

Attachment: signature.asc
Description: This is a digitally signed message part

Reply via email to