vesselescape
IS-IT--Management
Looking for some feedback (General Discussion) to try and resolve a security issue on our remote (virtual) webserver.
*nux box running Apache (latest) with PHP 4.2.2 Located on remote webserver.
PHP admin interface designed to allow authorized (password and username hard coded in php) users to upload photos to server.
As part of upload, the upload directory is created via php code based on info contained in a mysql db (related to a given record) Related graphics files and directory created are both deleted if record contained in db is deleted via php admin interface. All works well.
Here is the rub. If the files are uploaded with chmod of 755
the admin interface works great. But the webmaster cannot modify or delete the files directly via ftp, or ssh telnet as the uid for the files uploaded by php and the uid for the webmaster accessing the server via ftp (or telnet) do no match. Ergo, access denied when trying to chmod or unlink the files or directories directly. At least, this is what we think is happening. If the files are uploaded via php (and directories created) as chmod 777 Webmaster can do whatever he wants, but so could anyone else with access to the server.
The code is too much to upload here for specific answers, what I hope for is a general discussion as to how to deal with this question, maybe a glaring error we are making in our assumptions, or anything else that may get the light bulb to come on.
Have read the disussions and factoids in the php_man re: safe_ mode (off in our case) chmod, uploads. and anything else that seems to relate. Being more of a network admin type rather than a php weenie. I am hoping you all can shed some new light on the question.
Will keep a close eye on the thread, and provide anymore info you might require for further discussion.
Thanks,
David ONeill
*nux box running Apache (latest) with PHP 4.2.2 Located on remote webserver.
PHP admin interface designed to allow authorized (password and username hard coded in php) users to upload photos to server.
As part of upload, the upload directory is created via php code based on info contained in a mysql db (related to a given record) Related graphics files and directory created are both deleted if record contained in db is deleted via php admin interface. All works well.
Here is the rub. If the files are uploaded with chmod of 755
the admin interface works great. But the webmaster cannot modify or delete the files directly via ftp, or ssh telnet as the uid for the files uploaded by php and the uid for the webmaster accessing the server via ftp (or telnet) do no match. Ergo, access denied when trying to chmod or unlink the files or directories directly. At least, this is what we think is happening. If the files are uploaded via php (and directories created) as chmod 777 Webmaster can do whatever he wants, but so could anyone else with access to the server.
The code is too much to upload here for specific answers, what I hope for is a general discussion as to how to deal with this question, maybe a glaring error we are making in our assumptions, or anything else that may get the light bulb to come on.
Have read the disussions and factoids in the php_man re: safe_ mode (off in our case) chmod, uploads. and anything else that seems to relate. Being more of a network admin type rather than a php weenie. I am hoping you all can shed some new light on the question.
Will keep a close eye on the thread, and provide anymore info you might require for further discussion.
Thanks,
David ONeill