FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.

» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > Redhat > Fedora SELinux Support

LinkBack Thread Tools
Old 10-03-2011, 04:29 PM
Scott Gifford
Default Relabeling PHP uploads when they are moved into place

PHP uploads files into a temporary directory, where they are given the label "httpd_tmp_t". *When a PHP script processes them, it calls*move_uploaded_file*to move the newly uploaded file into its final location. *This function does some validity checks, then does a rename(2) from the temporary location to the location passwd to move_uploaded_file.

The problem is that after the rename, the file still retains its original label, "httpd_tmp_t". *That makes it inconsistent with files and directories which weren't uploaded, and requires some policy gymnastics to take into account that anything that could have been uploaded might have the "httpd_tmp_t" type.

I am wondering if there is some good way to automatically relabel this file when it is renamed?
I would like for the PHP application to work on SELinux and non-SELinux systems, so I would prefer not to make calls out to SELinux-specific scripts and programs (like restorecon). *What I would really like is some configuration option that would just relabel files according to their destination when they are rename(2)'d, but that may be asking too much. *:-)

Thanks for any advice,

selinux mailing list

Thread Tools

All times are GMT. The time now is 03:08 PM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org