Forum Moderators: coopster

Message Too Old, No Replies

Ensure a file is only accessed via CRON

is it possible?

         

henry0

4:57 pm on Jun 20, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I do not know if I really need to be concerned
but is there a way to make sure that a file.php could only be accessed by the CRON calling for it?

It could be useless; if an intruder is already in that dir then the battle is lost!

I am not inclined to set that file away from root because it relies on too many includes, $conn etc...
the rewriting of the application will be a pain in the php :)

HoboTraveler

5:56 pm on Jun 20, 2007 (gmt 0)

10+ Year Member



You could have the script check if it is called through Apache or the CLI.

// exit if the script is called through the server
if ( isset( $_SERVER ) && array_key_exists( 'REQUEST_METHOD', $_SERVER ) )
{
exit();
}

barns101

5:56 pm on Jun 20, 2007 (gmt 0)

10+ Year Member



Would altering the permissions via CHMOD work?

henry0

7:31 pm on Jun 20, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Thanks, sounds like a great idea!

No, we should not chmod the cron called file other than precisely 755

I recently posted a little cron how to with putty
here [webmasterworld.com]