Wiki . Forums . Bugs . Translation . Privacy Policy | Search . Simple . Advanced | Reports . Help | Matrix . 10.x . 11.x . 12.x . 13.x . Future . Recent . Contribs

Bug 7011 - Set php_admin_value upload_tmp_dir per ibay
Summary: Set php_admin_value upload_tmp_dir per ibay
Status: CLOSED FIXED
Alias: None
Product: SME Server 10.X
Classification: SME Server
Component: New Feature Request (show other bugs)
Version: 10.0a1
Hardware: --- ---
: P3 normal
Target Milestone: 10.0a1
Assignee: Stephane de Labrusse
QA Contact: SME Server bug team
URL:
Depends on: 9105
Blocks:
  Show dependency tree / graph
 
Reported: 2012-06-28 06:56 CEST by Michael McCarn
Modified: 2017-03-30 06:33 CEST (History)
8 users (show)

See Also:
Package: e-smith-php
stephdl: code_attached?
stephdl: need_build?
stephdl: review?


Attachments
Changes to 95AddType00PHP2ibays (743 bytes, patch)
2012-06-28 06:56 CEST, Michael McCarn
Details | Diff
patch allowing to set php tmp folder inside ibay (799 bytes, patch)
2012-08-08 22:22 CEST, Jean-Philippe Pialasse
Details | Diff
diff -u ibay-modify.org ibay-modify (554 bytes, patch)
2014-03-07 06:34 CET, Michael McCarn
Details | Diff
Updated patch for /etc/e-smith/events/actions/ibay-modify (685 bytes, patch)
2014-03-07 06:50 CET, Michael McCarn
Details | Diff
/etc/e-smith/events/actions/ibay-modify (684 bytes, patch)
2014-03-09 10:24 CET, Michael McCarn
Details | Diff
/etc/e-smith/templates/etc/httpd/conf/httpd.conf/95AddType00PHP2ibays (777 bytes, patch)
2014-03-09 10:31 CET, Michael McCarn
Details | Diff
ibay-modify_set_perm_tmp_upload_folder.patch (688 bytes, patch)
2014-03-20 16:57 CET, Stephane de Labrusse
Details | Diff
ibay-modify_set_perm_tmp_upload_folder.patch (720 bytes, patch)
2014-03-22 11:10 CET, Stephane de Labrusse
Details | Diff
ibay-modify_set_perm_tmp_upload_folder.patch (719 bytes, patch)
2014-03-22 11:13 CET, Stephane de Labrusse
Details | Diff
20ibay_create_upload_tmp_dir.patch (1017 bytes, patch)
2014-03-23 04:18 CET, Stephane de Labrusse
Details | Diff
e-smith-ibays-2.4.0_addtmpfolder_to_ibays.patch (1.77 KB, patch)
2014-05-04 10:22 CEST, Stephane de Labrusse
Details | Diff
e-smith-php-2.4.0_add_upload_tmp_folder.patch (1006 bytes, patch)
2014-05-04 10:26 CEST, Stephane de Labrusse
Details | Diff
e-smith-ibays-2.4.0_addtmpfolder_to_ibays.patch (3.22 KB, patch)
2015-01-04 16:28 CET, Stephane de Labrusse
Details | Diff
/var/log/messages (4.85 KB, text/plain)
2016-07-06 22:04 CEST, Stephane de Labrusse
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Michael McCarn 2012-06-28 06:56:26 CEST
Created attachment 3504 [details]
Changes to 95AddType00PHP2ibays

As php file_upload is on, but the default upload_tmp_dir (/tmp) is not included in the default open_basedir for security reasons, why not create a tmp folder for each ibay and set that as the upload_tmp_dir for each ibay?

In addition to the patch attached for 95AddType00PHP2ibays, we would also need to modify the default ibay skeleton at "/etc/e-smith/skel/ibay" to include a tmp dir.
Comment 96 Terry Fage 2017-03-30 06:33:53 CEST
Released in Alpha 2
Comment 95 Terry Fage 2017-03-08 08:09:09 CET
Released in sme10a2 and as part of other bug verifications rpm ver now at:

[root@sme10a2base ~]# rpm -qa e-smith-php
e-smith-php-2.6.0-4.el7.sme.noarch

[root@sme10a2base ~]# rpm -qa e-smith-ibays
e-smith-ibays-2.6.0-7.el7.sme.noarch

Server-Manager - ibay created called bugs

[root@sme10a2base ~]# ll /var/cache/e-smith/files/ibays/bugs
total 0
drw------- 2 www www 6 Mar  8 17:16 session
drw------- 2 www www 6 Mar  8 17:16 tmp

Can verify that it appears the changes incorporated in this bug fix have resolved this bugs issue.

No errors observed or detected in Logs associated with this bug

Marking verified as released in sme10 alpha2
Comment 94 Jean-Philippe Pialasse 2016-07-07 04:42:57 CEST
(In reply to Stephane de Labrusse from comment #81)
> Created attachment 5596 [details]
> /var/log/messages
> 
> reopened the bug
> 
> I see two problems
> 

I see only one

> in the patch e-smith-ibays-2.6.0-create_tmp_folder_in_ibays.patch
> 
> a) you expect to mkdir and chown in /var/cache/e-smith/files/ibays/
> 
> but you created the directory by 
> 
> /var/cache/e-smith/files/ibay/.cvs_ignore  -->>>> ibay instead of ibays

good catches

fixed.


> 
> 
> b) I don't really like the way you used to create a directory in the rpm, i
> do prefer in the spec file to create the directory, instead to add a
> commented file
> 
> %build 
> %{__mkdir_p} root/var/cache/e-smith/files/ibays
> or
> /bin/mkdir -p root/var/cache/e-smith/files/ibays

as you state, this is a matter of taste. This has been done both ways if you check at the CVS in smeserver.


spec files should be kept simple IMHO.


> 
> see the errors in attachment

thank you  
%changelog
* Wed Jul 06 2016 Jean-Philipe Pialasse <tests@pialasse.com> 2.6.0-7.sme
- fix typo thanks to Stephane de Labrusse [SME: 7011]
- ibay to ibays

/usr/bin/plague-client build e-smith-ibays e-smith-ibays-2_6_0-7_el7_sme sme10
Package e-smith-ibays enqueued.  Job ID: 1335.



for the patches, agree with Daniel, the current attached patches had some errors that never person reviewed, both the cvs mailing list, and the testing are pretty efficient way to catch problems.
Having this bug staying around for 4 years, and one year and half sine the proposed patch shows the lack of interest of people to review the code here, I always have interesting feedback from Charlie when something seems wrong in CVS mailing list.
However, when huge changes are planned and people are aware, the preview process is interesting to find different alternative way.


back to fixed.
Comment 93 RequestedDeletion 2016-07-06 22:53:25 CEST
Anyway, let's get back to the big concerns Stephane made very clear. 'We' need to address those concerns to all satisfaction, for I feel they are perfectly valid.
Comment 92 RequestedDeletion 2016-07-06 22:51:56 CEST
(In reply to Daniel B. from comment #91)
> (In reply to guest from comment #90)
> > 
> > How can I tell what patches are applied if they are not attached to the bug?
> 
> If you really are interested in the code, you can look in CVS. You can
> subscribe to smeserver-cvscommits@lists.sourceforge.net to see every single
> modification to the core.

I am really intersetd, and many patches attached to bugzilla catch my eye and I'll try to review. But I will not subscribe to yet another system (CVS) for I am not interested in it and I am not a developer. I need to be able to review/verify bugs.

> 
> > Why do we need respect a cool down perion for a few days, so that at least
> > an extra pair of eyes are available? How do I know it's available in
> > smeupdates-testing if I am waiting for feedback, just like Stephane did?
> > 
> > IMHO, proposals should be attached to the Bugzilla bug and need to be
> > reviewed. Not simply committ without any heads up or documentation, patch or
> > whatever.
> 
> Yes, I agree that's the best. But we also need to be pragmatic. I also often
> do this myself (push patches without first attaching them here). If we
> wouldn't do this, nothing would be done at all. When we have a stable
> product, yes, we can be very strict about every change being done. But we
> also have to relaxe procedure a bit during early alpha. If we don't, we
> won't ever pass the alpha stage

I am not talking about alpha stage, I am talking about the general procedures that we need to uphold. Exceptions may be possible, but they need to be made VERY clear, also and again in Bugzilla, so it is available to ALL of the community without any deep down burried subscription to any ancient revision control syste.
Comment 91 Daniel B. 2016-07-06 22:45:07 CEST
(In reply to guest from comment #90)
> 
> How can I tell what patches are applied if they are not attached to the bug?

If you really are interested in the code, you can look in CVS. You can subscribe to smeserver-cvscommits@lists.sourceforge.net to see every single modification to the core.

> Why do we need respect a cool down perion for a few days, so that at least
> an extra pair of eyes are available? How do I know it's available in
> smeupdates-testing if I am waiting for feedback, just like Stephane did?
> 
> IMHO, proposals should be attached to the Bugzilla bug and need to be
> reviewed. Not simply committ without any heads up or documentation, patch or
> whatever.

Yes, I agree that's the best. But we also need to be pragmatic. I also often do this myself (push patches without first attaching them here). If we wouldn't do this, nothing would be done at all. When we have a stable product, yes, we can be very strict about every change being done. But we also have to relaxe procedure a bit during early alpha. If we don't, we won't ever pass the alpha stage
Comment 90 RequestedDeletion 2016-07-06 22:35:06 CEST
(In reply to Daniel B. from comment #88)
> (In reply to guest from comment #85)
> 
> > I my view the changes by JPP are not published, and can not be reviewed, let
> > alone the status can be set to fixed.
> 
> The proposed fix is included in version 2.6.0-4 of the e-smith-php package
> (this info was indeed missing). This package is available in
> smeupdates-testing. While it's a good habbit to first attach patch to BZ
> before we commit it, it's also common to push the fix in CVS and rely on the
> verification process to catch mistakes, especially when we're in early
> alpha. If we wouldn't do this, things would just stall and nothing would
> ever be commited.

How can I tell what patches are applied if they are not attached to the bug? Why do we need respect a cool down perion for a few days, so that at least an extra pair of eyes are available? How do I know it's available in smeupdates-testing if I am waiting for feedback, just like Stephane did?

IMHO, proposals should be attached to the Bugzilla bug and need to be reviewed. Not simply committ without any heads up or documentation, patch or whatever.

I feel very strong about this, because following the correct procedure made this distro so secure. Especially with 3rd party 'engines' like PHP.
Comment 89 RequestedDeletion 2016-07-06 22:30:17 CEST
(In reply to Stephane de Labrusse from comment #86)
> Here you can see the work of Jpp
> 
> http://smeserver.cvs.sourceforge.net/viewvc/smeserver/rpms/e-smith-ibays/
> sme10/?sortby=date#dirlist

I do not use CVS, I don't know it and I do not get any change logs and I do not want to use another system. Bugzilla is there for a reason to our community. We are not all developers, but some of us can read some code, and that may help.

Who decided that we do not use Bugzilla anymore to publish proposed patches and wait for thorough review before anything gets committed?
Comment 88 Daniel B. 2016-07-06 22:29:56 CEST
(In reply to guest from comment #85)

> I my view the changes by JPP are not published, and can not be reviewed, let
> alone the status can be set to fixed.

The proposed fix is included in version 2.6.0-4 of the e-smith-php package (this info was indeed missing). This package is available in smeupdates-testing. While it's a good habbit to first attach patch to BZ before we commit it, it's also common to push the fix in CVS and rely on the verification process to catch mistakes, especially when we're in early alpha. If we wouldn't do this, things would just stall and nothing would ever be commited.
Comment 87 RequestedDeletion 2016-07-06 22:24:36 CEST
(In reply to Stephane de Labrusse from comment #86)
> (In reply to guest from comment #85)
>  
> > I my view the changes by JPP are not published, and can not be reviewed, let
> > alone the status can be set to fixed.
> 
> I have a bad habit to attach my patch to bugzilla, but in fact you cannot be
> sure to see the last one.
> 
> Here you can see the work of Jpp
> 
> http://smeserver.cvs.sourceforge.net/viewvc/smeserver/rpms/e-smith-ibays/
> sme10/?sortby=date#dirlist

It's not a habit. It is the correct procedure to attache patches to the bug. Hence we have a bugzilla system and attachment to be reviewed. It has always been this way, and it should stay this way. Otherwise any fool can commit something. Out careful procedure of publishing patches BEFORE any kind of commit has been around since the beginning of contribs.org in 2007
Comment 86 Stephane de Labrusse 2016-07-06 22:20:52 CEST
(In reply to guest from comment #85)
 
> I my view the changes by JPP are not published, and can not be reviewed, let
> alone the status can be set to fixed.

I have a bad habit to attach my patch to bugzilla, but in fact you cannot be sure to see the last one.

Here you can see the work of Jpp

http://smeserver.cvs.sourceforge.net/viewvc/smeserver/rpms/e-smith-ibays/sme10/?sortby=date#dirlist
Comment 85 RequestedDeletion 2016-07-06 22:18:14 CEST
(In reply to Daniel B. from comment #84)
> (In reply to guest from comment #82)
> > We have procedures and we have to follow them.
> 
> And this is what is happening right now: a solution has be proposed and
> commited, and the verification must now be done by someone else. Stephane
> found issues while doing the verification so the bug is now reopened

I my view the changes by JPP are not published, and can not be reviewed, let alone the status can be set to fixed. A simple change log and no documentation and 'personal' ideas do not qualify the Quality Assurance we have upheld all these years.

No review, no feedback => no fix. These are CORE e-smith/smeserver packages we are talking about, not a contrib.
Comment 84 Daniel B. 2016-07-06 22:13:14 CEST
(In reply to guest from comment #82)
> We have procedures and we have to follow them.

And this is what is happening right now: a solution has be proposed and commited, and the verification must now be done by someone else. Stephane found issues while doing the verification so the bug is now reopened
Comment 83 RequestedDeletion 2016-07-06 22:11:56 CEST
(In reply to guest from comment #82)
> I agree, and changes to core e-smith/smeserver packages should be reviewed
> as we have always done, before any bug is set to fixed.
> 
> The usage of 'I want' and 'I do not want' in comments to a 'fix' are not an
> argument at all. It's team work with feedback and carefully constructing the
> best solution.
> 
> We have procedures and we have to follow them.

To be very clear, there is no 'I' in the word 'Team'.
Comment 82 RequestedDeletion 2016-07-06 22:09:25 CEST
(In reply to Stephane de Labrusse from comment #81)
> Created attachment 5596 [details]
> /var/log/messages
> 
> reopened the bug
> 
> I see two problems
> 
> in the patch e-smith-ibays-2.6.0-create_tmp_folder_in_ibays.patch
> 
> a) you expect to mkdir and chown in /var/cache/e-smith/files/ibays/
> 
> but you created the directory by 
> 
> /var/cache/e-smith/files/ibay/.cvs_ignore  -->>>> ibay instead of ibays
> 
> 
> b) I don't really like the way you used to create a directory in the rpm, i
> do prefer in the spec file to create the directory, instead to add a
> commented file
> 
> %build 
> %{__mkdir_p} root/var/cache/e-smith/files/ibays
> or
> /bin/mkdir -p root/var/cache/e-smith/files/ibays
> 
> see the errors in attachment

I agree, and changes to core e-smith/smeserver packages should be reviewed as we have always done, before any bug is set to fixed.

The usage of 'I want' and 'I do not want' in comments to a 'fix' are not an argument at all. It's team work with feedback and carefully constructing the best solution.

We have procedures and we have to follow them.
Comment 81 Stephane de Labrusse 2016-07-06 22:04:51 CEST
Created attachment 5596 [details]
/var/log/messages

reopened the bug

I see two problems

in the patch e-smith-ibays-2.6.0-create_tmp_folder_in_ibays.patch

a) you expect to mkdir and chown in /var/cache/e-smith/files/ibays/

but you created the directory by 

/var/cache/e-smith/files/ibay/.cvs_ignore  -->>>> ibay instead of ibays


b) I don't really like the way you used to create a directory in the rpm, i do prefer in the spec file to create the directory, instead to add a commented file

%build 
%{__mkdir_p} root/var/cache/e-smith/files/ibays
or
/bin/mkdir -p root/var/cache/e-smith/files/ibays

see the errors in attachment
Comment 80 Jean-Philippe Pialasse 2016-06-26 19:47:31 CEST
fixed 

%changelog
* Sun Jun 26 2016 Jean-Philipe Pialasse <tests@pialasse.com> 2.6.0-4.sme
- clean daily session and tmp folders [SME: 9626]
- updated path for ibays' session and tmp folders to /var/cache

* Thu Jun 23 2016 Jean-Philipe Pialasse <tests@pialasse.com> 2.6.0-3.sme
- add tmp folder to ibays [SME: 7011]
- add session folder to ibays [SME: 9620]
- change global session folder from /tmp to /var/lib/php/session/ [SME: 139]


two reasons for the prop :

- I do not want php to be able to upload or have access to any tmp dir : disabled 
- I want to set /tmp as temp folder because the php application has been poorly coded and wants /tmp

an alternative would be as you explain, I need to point to a fast access location.

but I agree that it will mostly stays at enabled.
Comment 79 Daniel B. 2016-06-23 19:17:01 CEST
(In reply to Daniel B. from comment #78)
> The PHPTmpDir prop name is still misleading (PHPUsePrivateTmpDir would be
> more explicit).

Thinking a bit more about it, I don't even see a reason to have this prop at all. Lets just use the private tmp dir. I see no reason at all to be able to disable this. The only reason I could see to have a prop like this would be to specify an absolute path to a big/fast dedicated storage if we need to work with huge tmp files. But that's such a corner case that I don't think we should bother with.

Reopening
Comment 78 Daniel B. 2016-06-23 08:32:59 CEST
None of the points I've made in Comment 59 have been addressed:

I still think sessions and tmp should not be in the backup path. We have no immediate plan to add chroot capability. If we do one day, we'll be able to work on this. /tmp/ibays/ibayname/ and /var/lib/php/session/ibayname would be way better

There's no cleanup routine for those new directories, so temporary files will accumulate here.

The PHPTmpDir prop name is still misleading (PHPUsePrivateTmpDir would be more explicit).

I see no where how the new tmp and sessions dir are created. Should they be manually created by the admin ?

The same concerns are also valid for Bug 9620
Comment 77 Jean-Philippe Pialasse 2016-06-23 06:55:00 CEST
fixed in 
/usr/bin/plague-client build e-smith-php e-smith-php-2_6_0-3_el7_sme sme10
Package e-smith-php enqueued.  Job ID: 1298.

%changelog
* Thu Jun 23 2016 Jean-Philipe Pialasse <tests@pialasse.com> 2.6.0-3.sme
- add tmp folder to ibays [SME: 7011]
- add session folder to ibays [SME: 9620]
- change global session folder from /tmp to /var/lib/php/session/ [SME: 139]
Comment 76 Stephane de Labrusse 2015-06-29 17:31:43 CEST
(In reply to Daniel B. from comment #75)
> I do'nt think
> there's anything to verify for now

yes we have to verify that the rpm is built without the patch
Comment 75 Daniel B. 2015-06-29 14:44:25 CEST
Reopening, this is not fixed, the proposed change has just been reverted as it requires som emore work, and shouldn't block 9.1 release. I do'nt think there's anything to verify for now
Comment 74 Stephane de Labrusse 2015-06-29 13:56:15 CEST
* Mon Jun 29 2015 stephane de Labrusse <stephdl@de-labrusse.fr> 2.4.0-5
- revert the e-smith-php-2.4.0_add_upload_tmp_folder.patch [SME: 7011]

/usr/bin/plague-client build e-smith-php e-smith-php-2_4_0-5_el6_sme sme9
Package e-smith-php enqueued.  Job ID: 299.

please verify also e-smith-php
Comment 73 Stephane de Labrusse 2015-06-29 13:42:50 CEST
set resolved fixed by daniel

e-smith-ibay-2.4-13
294: e-smith-ibays-2.4.0-13.el6.sme  (finished)

please verify that bug
Comment 72 Stephane de Labrusse 2015-06-23 21:14:41 CEST
this bug gets a patch in the version e-smith-ibay-2.4-12 ->e-smith-ibays-2.4.0_addtmpfolder_to_ibays.patch

that patch is released in smeupdates-testing and stop us to release an iso for sme9

what can i do

revert the patch and let it in cvs ?
Comment 71 Jean-Philippe Pialasse 2015-02-27 22:49:21 CET
(In reply to Stephane de Labrusse from comment #64)
> (In reply to Unnilennium from comment #60)
> > yes we have to create a rotuine to clean these folder. However, a routine
> > exist to clean the /tmp folder, and creating a per ibay tmp dir in /tmp 
> > would need a routine to create the ibay folder after each cleanup.
> > 
> > we should also add a tmp folder in the template for ibay creation and a
> > migrate script to create it in existing ibays, alternatively a script in
> > ibay-modify and/or ibay-create could be an extra option to create it chmod
> > it and (in case anybody delete it, or rights need to be updated etc.)
> 
> where is the cleaned routine for the temp folder ?

/etc/cron.daily/tmpwatch 
/etc/cron.daily/tmpwatch-formmagick 



(In reply to Stephane de Labrusse from comment #65)
> we could stick to the purpose of that new feature
> http://php.net/manual/en/ini.core.php#ini.upload-tmp-dir
> 
> a)Choose the good name for the property
> we could rename the ibay property to UploadTmpDir instead of PHPTmpDir

we should stick to the real name : "UploadTmpDir" or to something that is meaningful "TmpDirStatus"

> 
> b)Clean the tmp folder of the ibay
> Indeed we need to clean the tmp folder in the ibay, can you share some
> thoughts on how to do that.

tmpwatch, we just have to create one more routine in cron for all ibays

> 
> c)The path of the folder need to be decided
> 
> -If we keep the ibay directory for the tmp folder, we may need to disable
> that tmp directory in the backup routine.
> 
> -If we choose any other cases(/tmp, or /var/tmp), we need to adapt the
> openbasedir
> 
> what could be the best

I really suggest to keep everything in the ibay. It should not be that hard to exclude /home/e-smith/files/ibays/*/{tmp,session} for backup. Keeping everything here, could help latter if we plan a something with a jailroot on the ibay... then we will just have to add bin etc... folders. Some php piece of software might rely on binaries, and it could become a good practice to have a jail with only the wanted binaries there, rather than having /bin added in the php base root. Also it oculd be great to grant a users only access to this ibay with ssh, sftp or scp. I know this is a totally different subject, however, this is to show that having it there could helps for more NFR.


> 
> d)Create a specific folder for the PHP session
> daniel is also speaking about the php session that he would set also

good point from Daniel, I vote to have it also in the ibay folder.

> 
> (In reply to Daniel B. from comment #61)
> > I don't understand why it's more desirable to have temp files in
> > /home/e-smith/files. If we want isolation, we can create a /tmp/ibays/<my
> > super ibay>/{tmp,session} for example, and include this in the default
> > open_basedir for each ibay
> 
> do we need another bug to track it ?
> 
> we simply need to add this for example
> 
>  php_admin_value session.save_path /var/lib/phpMyAdmin/tmp

we might need to fork this bug 

> 
> e)Status enabled or disabled by default
> UploadTmpDir_or_PHPTmpDir enabled or disabled by default ?
> if we set that property disabled by default, can we add that option in the
> panel of the relevant ibay ?

as the current status is "broken" ... there is two way to understand this :
- user from sme7 and before are waiting to have it working by default as it was this way
- broken is currently similar from disabled, it is more secure to keep it as disabled if admins are not aware of the change.

Moreover, it could be all disabled,  or only already existing as disabled and new ibays with enabled.

I would vote for disabled by default and also for migration.
Comment 70 RequestedDeletion 2015-02-05 09:35:22 CET
Based on comment #69, set target milestone. Release from master bug 8813
Comment 69 Daniel B. 2015-02-05 08:11:59 CET
(In reply to Stephane de Labrusse from comment #68)
> next weeks I'm on holidays, I will try to give a go on it

There're design issues which should be solved before being coded (see Comment 59). IMHO, this should be removed from 9.1 master bug.
Comment 68 Stephane de Labrusse 2015-02-05 07:48:49 CET
next weeks I'm on holidays, I will try to give a go on it
Comment 67 RequestedDeletion 2015-02-05 07:15:22 CET
This bug has been idle for a while. It should either be fixed or removed from master bug as a blocking issue for next ISO, and target milestone set to future.
Comment 66 RequestedDeletion 2015-01-25 13:16:09 CET
Attach to master bug #8813
Comment 65 Stephane de Labrusse 2015-01-17 23:29:02 CET
we could stick to the purpose of that new feature
http://php.net/manual/en/ini.core.php#ini.upload-tmp-dir

a)Choose the good name for the property
we could rename the ibay property to UploadTmpDir instead of PHPTmpDir

b)Clean the tmp folder of the ibay
Indeed we need to clean the tmp folder in the ibay, can you share some thoughts on how to do that.

c)The path of the folder need to be decided

-If we keep the ibay directory for the tmp folder, we may need to disable that tmp directory in the backup routine.

-If we choose any other cases(/tmp, or /var/tmp), we need to adapt the openbasedir

what could be the best

d)Create a specific folder for the PHP session
daniel is also speaking about the php session that he would set also

(In reply to Daniel B. from comment #61)
> I don't understand why it's more desirable to have temp files in
> /home/e-smith/files. If we want isolation, we can create a /tmp/ibays/<my
> super ibay>/{tmp,session} for example, and include this in the default
> open_basedir for each ibay

do we need another bug to track it ?

we simply need to add this for example

 php_admin_value session.save_path /var/lib/phpMyAdmin/tmp

e)Status enabled or disabled by default
UploadTmpDir_or_PHPTmpDir enabled or disabled by default ?
if we set that property disabled by default, can we add that option in the panel of the relevant ibay ?
Comment 64 Stephane de Labrusse 2015-01-17 23:06:49 CET
(In reply to Unnilennium from comment #60)
> yes we have to create a rotuine to clean these folder. However, a routine
> exist to clean the /tmp folder, and creating a per ibay tmp dir in /tmp 
> would need a routine to create the ibay folder after each cleanup.
> 
> we should also add a tmp folder in the template for ibay creation and a
> migrate script to create it in existing ibays, alternatively a script in
> ibay-modify and/or ibay-create could be an extra option to create it chmod
> it and (in case anybody delete it, or rights need to be updated etc.)

where is the cleaned routine for the temp folder ?
Comment 63 Jean-Philippe Pialasse 2015-01-16 18:35:25 CET
(In reply to Daniel B. from comment #61)
> (In reply to Unnilennium from comment #60)
> > > - Having temp files under /home/e-smith/files is questionable. I'd rather
> > > put it under /tmp or /var/tmp. In any case temp files shouldn't be backed up
> > 
> > the purpose of this I think is to isolate every ibay from other part of the
> > server. This way with the php base dir nothing should be outside of the ibay
> > folder, or the less possible.
> 
> I don't understand why it's more desirable to have temp files in
> /home/e-smith/files. If we want isolation, we can create a /tmp/ibays/<my
> super ibay>/{tmp,session} for example, and include this in the default
> open_basedir for each ibay


> 
> > > - Right now, uploads in ibays using PHP scripts is disabled (because /tmp is
> > > not in open_basedir), and must be explicitly enabled for it to work.
> > > Switching this might not be desirable as it could silently bring security
> > > issues
> > 
> > indeed, that's the point of having an ibay tmp dir that is not the main /tmp
> > dir.
> 
> Having upload enabled by default, even for existing system where it wasn't
> isn't something we should do.

ok I get it, so we could disable the tmp dir by default.
Comment 62 Jean-Philippe Pialasse 2015-01-16 18:29:58 CET
(In reply to Unnilennium from comment #60)
> (In reply to Daniel B. from comment #59)
> > OK, so, here's a few notes I've made to Stephane yesterday:
> > 
> > - PHPTmpDir (the prop) is either enabled or disabled, this name is
> > misleading as it'd suggest to take an absolute path as value
> 
> initially I have written something where  it could also be a personalized
> path.
> see : http://bugs.contribs.org/attachment.cgi?id=3524

 forget this one, I think I have dreamt it.

I just think this is easier to have the same name for the property than the actual php option, for endusers. However, I understand your point.
Comment 61 Daniel B. 2015-01-16 18:27:37 CET
(In reply to Unnilennium from comment #60)
> > - Having temp files under /home/e-smith/files is questionable. I'd rather
> > put it under /tmp or /var/tmp. In any case temp files shouldn't be backed up
> 
> the purpose of this I think is to isolate every ibay from other part of the
> server. This way with the php base dir nothing should be outside of the ibay
> folder, or the less possible.

I don't understand why it's more desirable to have temp files in /home/e-smith/files. If we want isolation, we can create a /tmp/ibays/<my super ibay>/{tmp,session} for example, and include this in the default open_basedir for each ibay

> > - Right now, uploads in ibays using PHP scripts is disabled (because /tmp is
> > not in open_basedir), and must be explicitly enabled for it to work.
> > Switching this might not be desirable as it could silently bring security
> > issues
> 
> indeed, that's the point of having an ibay tmp dir that is not the main /tmp
> dir.

Having upload enabled by default, even for existing system where it wasn't isn't something we should do.
Comment 60 Jean-Philippe Pialasse 2015-01-16 18:23:02 CET
(In reply to Daniel B. from comment #59)
> OK, so, here's a few notes I've made to Stephane yesterday:
> 
> - PHPTmpDir (the prop) is either enabled or disabled, this name is
> misleading as it'd suggest to take an absolute path as value

initially I have written something where  it could also be a personalized path.
see : http://bugs.contribs.org/attachment.cgi?id=3524


> 
> - Having temp files under /home/e-smith/files is questionable. I'd rather
> put it under /tmp or /var/tmp. In any case temp files shouldn't be backed up

the purpose of this I think is to isolate every ibay from other part of the server. This way with the php base dir nothing should be outside of the ibay folder, or the less possible.

> 
> - If we choose to put temp files elsewhere than /tmp or /var/tmp we probably
> also need to provide some cleanup routine (like tmpwatch), at least easily
> accessible if not enabled on a default setup

yes we have to create a rotuine to clean these folder. However, a routine exist to clean the /tmp folder, and creating a per ibay tmp dir in /tmp  would need a routine to create the ibay folder after each cleanup.

we should also add a tmp folder in the template for ibay creation and a migrate script to create it in existing ibays, alternatively a script in ibay-modify and/or ibay-create could be an extra option to create it chmod it and (in case anybody delete it, or rights need to be updated etc.)

> 
> - Right now, uploads in ibays using PHP scripts is disabled (because /tmp is
> not in open_basedir), and must be explicitly enabled for it to work.
> Switching this might not be desirable as it could silently bring security
> issues

indeed, that's the point of having an ibay tmp dir that is not the main /tmp dir.
Comment 59 Daniel B. 2015-01-16 14:31:21 CET
OK, so, here's a few notes I've made to Stephane yesterday:

- PHPTmpDir (the prop) is either enabled or disabled, this name is misleading as it'd suggest to take an absolute path as value

- Having temp files under /home/e-smith/files is questionable. I'd rather put it under /tmp or /var/tmp. In any case temp files shouldn't be backed up

- If we choose to put temp files elsewhere than /tmp or /var/tmp we probably also need to provide some cleanup routine (like tmpwatch), at least easily accessible if not enabled on a default setup

- Right now, uploads in ibays using PHP scripts is disabled (because /tmp is not in open_basedir), and must be explicitly enabled for it to work. Switching this might not be desirable as it could silently bring security issues
Comment 58 Stephane de Labrusse 2015-01-16 14:20:59 CET
$ cvs diff
? e-smith-ibays-2.4.0
? e-smith-ibays-2.4.0-13.el6.sme.src.rpm
? e-smith-ibays-2.4.0.bz7011
? e-smith-ibays-2_4_0-13_el6_sme
cvs diff: Diffing .
Index: e-smith-ibays.spec
===================================================================
RCS file: /cvsroot/smeserver/rpms/e-smith-ibays/sme9/e-smith-ibays.spec,v
retrieving revision 1.15
diff -r1.15 e-smith-ibays.spec
39c39
< - Add an upload_tmp_folder setting by db command [sme: 7011]
---
> - Add an upload_tmp_folder setting by db command [SME: 7011]
45c45
< - Add an upload_tmp_folder setting by db command [sme: 7011]
---
> - Add an upload_tmp_folder setting by db command [SME: 7011]


thanks terry, correction pushed to cvs, but rpm not built because daniel did some valid remarks on IRC yesterday.

please daniel, can you write our discussion of yesterday... merci par avance.
Comment 57 Terry Fage 2015-01-16 09:22:46 CET
Stephane

See comments 51 and comment 54

I am not sure if I am reading this right but here goes, Can you edit the patch etc, I think that is where it is, so that the correct format/syntax for the bug reference is present, is it case sensitive?.

Currently: [sme: 7011] - [SME: 8400]

Using Ians wonderful tool, it is showing as having an issue:
http://wellsi.homeip.net/rnotes/sme9/9bugreport.html - tab to "Changelog Errors"
Comment 56 Stephane de Labrusse 2015-01-12 22:10:55 CET
Well for this bug i need to import a new tar ball in the build sysstem because i want to add in the skel of the ibay a 'tmp' folder

Does a kind developer with build access can do it or the other solution I have is to push my patch to cvs in which I have done a '.cvsignore', made to create the folder 'tmp' in the ibay skel.

My code is workable, i'm only waiting this.
Comment 55 Stephane de Labrusse 2015-01-04 16:28:47 CET
Created attachment 4923 [details]
e-smith-ibays-2.4.0_addtmpfolder_to_ibays.patch

a new patch to create a tmp folder in the I-bay root directory, I'm waiting a build access  to import a new  tarball because we need to add in the skell of the Ibay that tmp folder.
For test purpose I have added a file with one commented line  inside in the patch (last lines) but I guess that it is not good.

still in progress
Comment 54 Stephane de Labrusse 2015-01-04 10:05:03 CET
(In reply to Charlie Brady from comment #53)
> The changelog should be fixed. /tmp is a specific location, and doesn't
> match what you are referring to here.

* Sun Jan 4 2015 stephane de Labrusse <stephdl@de-labrusse.fr> 2.4.0-12.sme
- Add an upload_tmp_folder setting by db command [sme: 7011]
- Thanks to Michael McCarn and Jean-philippe Pialasse
- init-ibays create the folder tmp within all i-bays root directory
- ibay-modify create/chown/chmod the folder tmp within the i-bays root directory
Comment 53 Charlie Brady 2015-01-04 03:47:42 CET
(In reply to Stephane de Labrusse from comment #52)
> yes charlie in 
> 
> /home/e-smith/files/ibays/IBAYNAME/tmp

The changelog should be fixed. /tmp is a specific location, and doesn't match what you are referring to here.
Comment 52 Stephane de Labrusse 2015-01-04 00:35:56 CET
yes charlie in 

/home/e-smith/files/ibays/IBAYNAME/tmp
Comment 51 Charlie Brady 2015-01-04 00:34:00 CET
I see an addition to the changelog referring to creation of /tmp. The /tmp directory already exists, and isn't created here. Do you mean 'tmp' within the i-bay root directory?

 %changelog
+* Sun Jan 4 2015 stephane de Labrusse <stephdl@de-labrusse.fr> 2.4.0-12.sme
+- Add an upload_tmp_folder setting by db command [sme: 7011]
+- Thanks to Michael McCarn and Jean-philippe Pialasse
+- the folder /tmp is created by the event init-ibays
+- the event ibay-modify create/chown/chmod the folder /tmp
+
Comment 50 RequestedDeletion 2014-12-09 01:48:47 CET
Please update status and progress. Believed to fixed by another bug report.
Comment 49 Stephane de Labrusse 2014-05-08 01:31:56 CEST
two patches pushed to cvs
Comment 48 Ian Wells 2014-05-07 16:44:54 CEST
(In reply to Stephane de Labrusse from comment #47)
> Sorry if I ask one more time but I do not want to misunderstand or create
> problems later.

Great to ask questions.
 
> If I push to CVS the two patches (e-smith-php and e-smith-ibays for
> concerned packages) and if we do later modifications with a rpm built,
> either we will have the two patches built (of course i'm happy) or worse we
> will have just one rpm built (either e-smith-php or e-smith-ibays). 

As we are at RC1 at the moment, there should be no more code changes.
If there happens to be an emergency code change needed to e-smith-php ore-smith-ibays then the spec file can comment out the patch and just apply the emergency patch.

> Push patch with modifications of spec file for building  packages.

This one.

Your changes will be in CVS, can be reviewed and tested. However won't go into this ISO. 

Note: I and other members of updatesteam should remember to keep it in smetest.
Comment 47 Stephane de Labrusse 2014-05-07 11:55:34 CEST
(In reply to Ian Wells from comment #46)
> My preference is to focus on getting 9.0 out and avoid adding any more code
> now.
> 
> You should push the changes to CVS and the code needs a review.
> 
> Once it is reviewed it can be in the testing repos and will be released when
> verified - possibly straight after 9.0 is released.

Sorry if I ask one more time but I do not want to misunderstand or create problems later.

If I push to CVS the two patches (e-smith-php and e-smith-ibays for concerned packages) and if we do later modifications with a rpm built, either we will have the two patches built (of course i'm happy) or worse we will have just one rpm built (either e-smith-php or e-smith-ibays). 

That situation could be a mess :)

So what do you suggest I should do ?

Push patches without modifications of spec file (in order to record each patch)
Push patch with modifications of spec file for building  packages.

Thank for your patience.
Comment 46 Ian Wells 2014-05-06 14:18:10 CEST
My preference is to focus on getting 9.0 out and avoid adding any more code now.

You should push the changes to CVS and the code needs a review.

Once it is reviewed it can be in the testing repos and will be released when verified - possibly straight after 9.0 is released.
Comment 45 Stephane de Labrusse 2014-05-06 10:32:31 CEST
I prefer these changes are tested and released sooner (I mean about my bug and yours) since  there is few sme9 yet. For sme9.1 we will have many (I hope) more server on earth, and thus more risks.

Furthermore people use the openbasedir set to /tmp when they want to use php applications and it is really not safe.

So Go!

my 2c
Comment 44 Ian Wells 2014-05-06 10:26:39 CEST
A decision is needed to approve this for 9.0RC1 or move this to 9.1Alpha1 (like my in-progress backup changes).
Comment 43 Stephane de Labrusse 2014-05-04 10:42:55 CEST
Hi

I would your review on the two patchs I gave, they are not pushed to CVS, I'm waiting your review


* creation of tmp folder in /etc/e-smith/skel/ibay/tmp

I have used a file with comments to create the folder with a patch since i cannot roll a new tar.xz package. If you think that an empty file is not the good method, please roll a new tar.xz with the empty folder.

I have kept the method of michael to create the the tmp folder with ibay-modify. If the sysadmin will remove it then we will create it again automatically by a signal-event. 


* for existing Ibay (before the new rpm)

I planned to add a script in the %post section of the e-smith-ibays.spec file because charlie stated that my solution of a migrate fragment was not good (comment 35). After some  considerations I made my script.

%post
# added to create tmp folder for bug 7011
for folder_ibay in $(ls /home/e-smith/files/ibays/)
do
/bin/mkdir -p /home/e-smith/files/ibays/$folder_ibay/tmp
/bin/chmod -R 700 /home/e-smith/files/ibays/$folder_ibay/tmp
/bin/chown -R www:www /home/e-smith/files/ibays/$folder_ibay/tmp
done
Comment 42 Stephane de Labrusse 2014-05-04 10:26:27 CEST
Created attachment 4636 [details]
e-smith-php-2.4.0_add_upload_tmp_folder.patch

patch to write to the /etc/httpd/conf/httpd.conf the path to the temp folder of the ibay if cgi/php AND PHPTmpDir are enabled

php_admin_value upload_tmp_dir /home/e-smith/files/ibays/ibay_name/tmp
Comment 41 Stephane de Labrusse 2014-05-04 10:22:24 CEST
Created attachment 4635 [details]
e-smith-ibays-2.4.0_addtmpfolder_to_ibays.patch

patch to add tmp_folder settings to /etc/e-smith/events/actions/ibay-modify

-creation of /home/e-smith/files/ibays/ibay_name/tmp if PHPBaseDir eq 'enabled' (default is yes) and tmp folder doesn't exist
-set permissions on /home/e-smith/files/ibays/ibay_name/tmp www:www 700
Comment 40 Ian Wells 2014-03-30 18:19:21 CEST
This did not make Beta 4. 

It needs a final review and decision to release before or after 9.0
Comment 39 Ian Wells 2014-03-24 12:02:12 CET
(In reply to Stephane de Labrusse from comment #38)
> which level of severity i should use ?
> 
> 
> gentle
> stern
> harsh
> cruel
> brutal

I normally select either Cruel or Brutal.
However I would not expect to remove all the issues, just use it as good advice to think about, and then decide what to do.

Remember that making any changes may introduce more errors.
Comment 38 Stephane de Labrusse 2014-03-24 11:52:04 CET
which level of severity i should use ?


gentle
stern
harsh
cruel
brutal
Comment 37 Ian Wells 2014-03-23 20:06:58 CET
(In reply to Stephane de Labrusse from comment #30)
> Looks fine for me, waiting your review of code if we can do better or
> different.

You could try to see what Perl Critic says

http://search.cpan.org/~thaljef/Perl-Critic-1.121/lib/Perl/Critic.pm

online version
http://perl-critic.stacka.to/

I prefer using ActivePerl's GUI version


Our code tends not to do well, and there is no set standard yet from SME Server, but seeing the comments that it gives can help.

Note: Only make changes related to your code in your patch. If there is a need to modify other code in the same file based on PerlCritic or reviewer comments then that should be a separate patch file. 
In other words code improvements not related to the bug should not be in the same patch file as the functional changes.
Comment 36 Stephane de Labrusse 2014-03-23 11:26:05 CET
(In reply to Charlie Brady from comment #35)
> Unless there is a very good reason otherwise, migrate fragments should do
> nothing except alter database values. This code should probably be in the
> ibay-modify script.

Thanks for your answer charlie.

The major issue i see with the ibay-modify script is because it is asked to force the upload_tmp_dir for all ibays and therefore all ibays created before don't have the tmp folder before to be modified by the ibay-modify script on an event.

So ibays created before can't use the new feature upload_tmp_dir and thus the interest to have a migrate fragment to create the tmp folder if don't exist for old ibay. 

For all other ibay each time you use ibay-modify the tmp folder will be created.

If  the upload_tmp_dir is not set to enabled by default, then we could avoid to create a migrate fragment for old ibays


please i need some guidances if you think there is another way to do it
Comment 35 Charlie Brady 2014-03-23 11:00:23 CET
(In reply to Stephane de Labrusse from comment #34)
> Created attachment 4547 [details]
> 20ibay_create_upload_tmp_dir.patch
> 
> see comment 33, this patch is a migrate fragment to create the tmp folder in
> each ibay if it doesn't exist.

Unless there is a very good reason otherwise, migrate fragments should do nothing except alter database values. This code should probably be in the ibay-modify script.
Comment 34 Stephane de Labrusse 2014-03-23 04:18:47 CET
Created attachment 4547 [details]
20ibay_create_upload_tmp_dir.patch

see comment 33, this patch is a migrate fragment to create the tmp folder in each ibay if it doesn't exist.
Comment 33 Stephane de Labrusse 2014-03-23 02:51:07 CET
Hi Jpp

i would have some comments on a behaviour wanted by you.

You wanted to set the upload_tmp_dir to enabled by default but now for ibay created before this new setting, the tmp folder is not created in the 'home/e-smith/files/ibayname' and of course we have errors against phpbasedir restrictions.

Should we do a migrate fragment to create the tmp folder in each Ibays which existed before ?
Comment 32 Stephane de Labrusse 2014-03-23 01:29:30 CET
i have added an empty folder 'tmp' in the skel of ibay
(/etc/e-smith/skel/ibay). After that i did a 'diff -Nur' to get a
workable patch to create a RPM, but the patch gets no mention of this
empty folder.

How can we add this empty folder tmp in /etc/e-smith/skel/ibay, is it
possible to add it directly through CVS in the .xv archive ?
Comment 31 Stephane de Labrusse 2014-03-22 11:13:55 CET
Created attachment 4546 [details]
ibay-modify_set_perm_tmp_upload_folder.patch

i have just modified the comment
 ##chmod 0700 root:www if tmp folder exists in the ibay
to
 ##chmod 0700 www:www if tmp folder exists in the ibay
Comment 30 Stephane de Labrusse 2014-03-22 11:10:26 CET
Created attachment 4545 [details]
ibay-modify_set_perm_tmp_upload_folder.patch

the patch is done to set permissions in the ibay if the tmp folder exists.

like required by Jpp permissions are set for www:www and u+rwx (0700)

tested with folders and files in ibay/tmp and a wordpress installed to see how it works in a real situation of uploading files.

if upload_tmp_folder is disabled, i have errors with phpbasedir, if enabled i have no errors and i can upload files.

Looks fine for me, waiting your review of code if we can do better or different.
Comment 29 Ian Wells 2014-03-22 10:39:16 CET
Stephane will complete this for Beta 4
Comment 28 Stephane de Labrusse 2014-03-20 17:13:59 CET
(In reply to Stephane de Labrusse from comment #27)
 > any comments are welcome.
folder are set with good permissions but not files :)
Work in progress
Comment 27 Stephane de Labrusse 2014-03-20 16:57:29 CET
Created attachment 4540 [details]
ibay-modify_set_perm_tmp_upload_folder.patch

Patch to set permissions to tmp_upload_folder if created in the path of ibays folders

eg:
if the folder /home/e-smith/files/ibays/dolibarr/tmp exists 

then
uid='root' or 'admin' ##set above in the file
guid='www'

chown $uid,$guid , $tmp_upload_folder
chmod 0770, $tmp_upload_folder

any comments are welcome.
Comment 26 Jean-Philippe Pialasse 2014-03-11 07:02:12 CET
the tmp folder should be www:www u+rwx only.

regarding this ,so one more modification needed to set that.
Comment 25 Stephane de Labrusse 2014-03-09 14:36:10 CET
(In reply to Michael McCarn from comment #23)
> > Set UserAccess=wr-group-rd-everyone
> db accounts setprop test UserAccess wr-group-rd-everyone
> signal-event ibay-modify test
> ls -ld /home/e-smith/files/ibays/test/tmp
> drwxrwsr-x 2 admin www 4096 Mar  9 13:53 /home/e-smith/files/ibays/test/tmp
> 
> > Change the ibay's 'Group' setting:
> db accounts setprop test Group users
> signal-event ibay-modify test
> ls -ld /home/e-smith/files/ibays/test/tmp
> drwxrwsr-x 2 admin users 4096 Mar  9 13:53 /home/e-smith/files/ibays/test/tmp

reading the link you gave about php security

Set upload_tmp_dir to a folder that is:

-outside the document root of your web site -> OK
-not readable or writable by any other system users ->permissions above let the ability to read the content to users, maybe we could change permissions.

do you have tested in real conditions with a wordpress installed to see if you can upload files ?
Comment 24 Stephane de Labrusse 2014-03-09 13:54:39 CET
Hi mickael

in the bug 8239 i have used a phpinfo file to see behaviour, maybe you should do the same, especially with permissions modified, maybe this can help you.

-----------------------------------------------------------------------
in order to test php otions you can upload or write a file php.php in the html folder of your ibay with this content. After you can use your browser to display it http://the_right_url/ibaysname/php.php

<?php     
 phpinfo();     
?>
----------------------------------------------------------------------
Comment 23 Michael McCarn 2014-03-09 12:09:44 CET
(In reply to Ian Wells from comment #21)
> I have not checked the permissions that are on the proposed ibay tmp dir.

I did some testing on the permissions set on the new tmp folder using the latest versions of the proposed patches:

> Create ibay named 'test' using default server-manager settings
db accounts getprop test UserAccess
wr-admin-rd-group
ls -ld /home/e-smith/files/ibays/test/tmp
drwxr-s--- 2 admin www 4096 Mar  9 13:53 /home/e-smith/files/ibays/test/tmp

> Set  UserAccess=wr-group-rd-group
db accounts setprop test UserAccess wr-group-rd-group
signal-event ibay-modify test
ls -ld /home/e-smith/files/ibays/test/tmp
drwxrws--- 2 admin www 4096 Mar  9 13:53 /home/e-smith/files/ibays/test/tmp

> Set UserAccess=wr-group-rd-everyone
db accounts setprop test UserAccess wr-group-rd-everyone
signal-event ibay-modify test
ls -ld /home/e-smith/files/ibays/test/tmp
drwxrwsr-x 2 admin www 4096 Mar  9 13:53 /home/e-smith/files/ibays/test/tmp

> Change the ibay's 'Group' setting:
db accounts setprop test Group users
signal-event ibay-modify test
ls -ld /home/e-smith/files/ibays/test/tmp
drwxrwsr-x 2 admin users 4096 Mar  9 13:53 /home/e-smith/files/ibays/test/tmp
Comment 22 Michael McCarn 2014-03-09 10:57:44 CET
(In reply to Ian Wells from comment #21)

> reading that it implies that all ibays should have a tmp, including all
> existing ibays. Then the db variable switches between the two possible tmp
> dirs, but defaulting to the ibay one.
Yes, that's what I've tried to configure

> I have not checked the permissions that are on the proposed ibay tmp dir.
Permissions for the entire ibay are set later in ibay-modify according to the accounts db settings for UserAccess for each ibay.  

The new tmp dir gets its permissions set as long as it is within the root of the ibay.
Comment 21 Ian Wells 2014-03-09 10:37:51 CET
(In reply to Michael McCarn from comment #16)
> (In reply to Michael McCarn from comment #15)
> 
> Talking to myself...
> 
> Based on this page at phpsec.org I think defaulting to ibay-specific tmp
> folders increases overall security:
> 
> http://phpsec.org/projects/phpsecinfo/tests/upload_tmp_dir.html
> > Recommendations
> > 
> > Set upload_tmp_dir to a folder that is:
> > 
> >     outside the document root of your web site
> >     not readable or writable by any other system users

reading that it implies that all ibays should have a tmp, including all existing ibays. Then the db variable switches between the two possible tmp dies, but defaulting to the ibay one.
I have not checked the permissions that are on the proposed ibay tmp dir.
Comment 20 Michael McCarn 2014-03-09 10:33:57 CET
(In reply to Ian Wells from comment #18)
> (In reply to Michael McCarn from comment #15)
> > Comment on attachment 3524 [details]
> > patch allowing to set php tmp folder inside ibay
> 
> Another comment is that the chunk of code could be re-written to make it
> clearer.
> Regarding the tmp directory - what happens if it does not exist?

The modified action for ibay-modify creates the tmp folder if it doesn't exist:
From http://bugs.contribs.org/attachment.cgi?id=4508&action=diff 
> my $tmpdir = $ibay->prop('PHPTmpDir') || "enabled";
> $tmpdir = ("/home/e-smith/files/ibays/" . $ibay->key . "/tmp") if $tmpdir eq > "enabled";
> mkdir "$tmpdir" unless (-d "$tmpdir" || "$tmpdir" eq "disabled");
Comment 19 Michael McCarn 2014-03-09 10:31:00 CET
Created attachment 4509 [details]
/etc/e-smith/templates/etc/httpd/conf/httpd.conf/95AddType00PHP2ibays

- Incorporate Unnilennium's changes, but
- Default to local tmp folder for each ibay
Comment 18 Ian Wells 2014-03-09 10:27:27 CET
(In reply to Michael McCarn from comment #15)
> Comment on attachment 3524 [details]
> patch allowing to set php tmp folder inside ibay

Another comment is that the chunk of code could be re-written to make it clearer.
Regarding the tmp directory - what happens if it does not exist?
Comment 17 Michael McCarn 2014-03-09 10:24:21 CET
Created attachment 4508 [details]
/etc/e-smith/events/actions/ibay-modify

Default to local tmp folder for each ibay
Comment 16 Michael McCarn 2014-03-09 10:17:46 CET
(In reply to Michael McCarn from comment #15)

Talking to myself...

Based on this page at phpsec.org I think defaulting to ibay-specific tmp folders increases overall security:

http://phpsec.org/projects/phpsecinfo/tests/upload_tmp_dir.html
> Recommendations
> 
> Set upload_tmp_dir to a folder that is:
> 
>     outside the document root of your web site
>     not readable or writable by any other system users
Comment 15 Michael McCarn 2014-03-09 09:53:47 CET
Comment on attachment 3524 [details]
patch allowing to set php tmp folder inside ibay

Can anyone who knows more about PHP & Apache security than I do comment on the implications of defaulting to a local tmp folder for each ibay vs defaulting to the system tmp folder?

That is, are we better using Unnilennium's proposed logic (default to current behavior):
> my $tmpdir = $ibay->prop('PHPTmpDir')
>                  || "disabled";

Or is it more secure to reverse the logic (default to local tmp folder for each ibay):
> my $tmpdir = $ibay->prop('PHPTmpDir')
>                  || "enabled";
Comment 14 Ian Wells 2014-03-07 11:43:58 CET
(In reply to Stephane de Labrusse from comment #12)
> once created the tmp folder for the ibay is not removed when the PHPTmpDir
> is set to disabled.
> is it what we want ?

once created, do not remove.
the admin can remove if needed.

unless for some reason it could have significant files left in it.
Comment 13 Stephane de Labrusse 2014-03-07 11:41:18 CET
(In reply to Ian Wells from comment #11)
> This could be tried on SME 9.
> 
> Note: please ensure that the default behaviour is not affected.

Well i have used and tested the patch proposed by Jpp http://bugs.contribs.org/attachment.cgi?id=3524 and mccarn http://bugs.contribs.org/attachment.cgi?id=4502

all is ok and workable however i would to know about the comments #12

i will propose a global patch in bug 8239 except if you prefer an individual patch for this bug.
Comment 12 Stephane de Labrusse 2014-03-07 11:23:55 CET
once created the tmp folder for the ibay is not removed when the PHPTmpDir is set to disabled.
is it what we want ?
Comment 11 Ian Wells 2014-03-07 08:32:00 CET
This could be tried on SME 9.

Note: please ensure that the default behaviour is not affected.
Comment 10 Michael McCarn 2014-03-07 06:50:47 CET
Created attachment 4502 [details]
Updated patch for /etc/e-smith/events/actions/ibay-modify

Updated to behave correctly if PHPTmpDir is set to 'enabled'.
Comment 9 Michael McCarn 2014-03-07 06:34:52 CET
Created attachment 4501 [details]
diff -u ibay-modify.org ibay-modify

Here's a patch to /etc/e-smith/events/actions/ibay-modify that creates a tmp folder during an ibay-modify or ibay-create event.

Rights on the folder are set later in the event according to the rights selected in the ibay configuration.
Comment 8 Stephane de Labrusse 2014-02-25 14:10:12 CET
Comment on attachment 3524 [details]
patch allowing to set php tmp folder inside ibay

edited to see it through a diff file. I hope this patch can interest some people...i mean it is valuable.
Comment 7 Jean-Philippe Pialasse 2013-05-20 21:07:47 CEST
Hi ,

the patch is to add the ability to set tmp dir per ibay
http://bugs.contribs.org/attachment.cgi?id=3524 is the good one
I think the diff does not work for patch files

for the package :
# rpm -qf /etc/e-smith/templates/etc/httpd/conf/httpd.conf/95AddType00PHP2ibays
e-smith-php-2.2.0-6.el5.sme


this is a first step , but I would ( if it is ok with SME design, add template to create ibay tmp folder)

It could be done of two ways :
- first by adding a tmp in /etc/e-smith/skel/ibay/, but it won't add a tmp folder to already existing ibays 
- second by adding a script to events ibay-create, ibay-modify ...  to create / delete tmp folder depending of the value of db key .

Charlie any advice ?
Comment 6 chris burnat 2013-05-19 00:17:39 CEST
The patch to use is patch allowing to set php tmp folder inside ibay (799 bytes, text/plain) 2012-08-08 22:22 MDT, Unnilennium. Correct?  Why no diff available?
Thanks.
Comment 5 chris burnat 2013-05-17 20:58:57 CEST
(In reply to Unnilennium from comment #4)
> flag code attached added

JP, could you provide detail of relevant package so that we can progress to a build. There is a (new) toggle for package top RHS.
Thanks.
Comment 4 Jean-Philippe Pialasse 2012-08-08 22:31:02 CEST
flag code attached added
Comment 3 Jean-Philippe Pialasse 2012-08-08 22:22:25 CEST
Created attachment 3524 [details]
patch allowing to set php tmp folder inside ibay

this version allow
 - enabled
to add the default tmp directory path inside the ibay 
 - disabled or blanck
to deactivate the directive (default)
 - custom path
to design a custom tmp folder , inside the phpbasedir or it will not work


should we add a scirpt inside event ibay-modify to create the folder tmp with the good rights ?
Comment 2 Smitro 2012-07-07 01:43:17 CEST
I've implemented this method and it works! It's a great feature to add.
Comment 1 Jonathan 2012-06-29 10:06:54 CEST
This seems like a good suggestion to me.