This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm whether you accept or reject these cookies being set.

A cookie will be stored in your browser regardless of choice to prevent you being asked this question again. You will be able to change your cookie settings at any time using the link in the footer.

Suhosin, open_basedir restriction, sentora temp folder
#1
Suhosin, open_basedir restriction, sentora temp folder
Hello good people, I'm on Sentora in a Ubuntu 14 64 bits.
I'm using OpenCart + Export / Import tool that uses PHPExcel

I'm having trouble with temp path. I do know what is causing the error, actually it's suhosin protecting accounts passing over its directory. PHPExcel, which is inside an account (customer), is trying to access sentora temporary upload folder.
Well, I also do know how to solve it, better saying I think I know. I just need to change temporary folder path for this customer in specific. Isn't it? But how to do this? Probably using overrhide function just like documentation says here http://docs.sentora.org/?node=64 right? 
I don't know the parameters. 

I just want to set temp folder for Customer X as /var/zpanel/hostdata/X/temp instead of global /var/sentora/temp. 

Can you help me? Above you can see the log file.



2015-06-15 9:48:36 - PHP Warning:  realpath(): open_basedir restriction in effect. File(/tmp) is not within the allowed path(s): (/var/sentora/hostdata/vulcanus/public_html/oc2_vulcanus_com_br:/var/sentora/temp/) in /var/sentora/hostdata/vulcanus/public_html/oc2_vulcanus_com_br/system/PHPExcel/Classes/PHPExcel/Shared/File.php on line 175
2015-06-15 9:48:36 - PHP Warning:  tempnam(): open_basedir restriction in effect. File() is not within the allowed path(s): (/var/sentora/hostdata/vulcanus/public_html/oc2_vulcanus_com_br:/var/sentora/temp/) in /var/sentora/hostdata/vulcanus/public_html/oc2_vulcanus_com_br/system/PHPExcel/Classes/PHPExcel/Writer/Excel2007.php on line 197
2015-06-15 9:48:36 - PHP PHPExcel_Writer_Exception:  Could not close zip file php://output. in /var/sentora/hostdata/vulcanus/public_html/oc2_vulcanus_com_br/system/PHPExcel/Classes/PHPExcel/Writer/Excel2007.php on line 399
Reply
Thanks given by:
#2
RE: Suhosin, open_basedir restriction, sentora temp folder
Hello jntslvdrt,
In order to change the suhosin open_base_dir you need to alter the vhosts entry.

For it not to be overwritten by the Daemon, you need to add a custom vhost entry:
  1. Go to Admin > Module Admin (on Sentora CP).
  2. Select Apache Config (it's the very first option).
  3. Scroll Down to the end of the page and under the Override a Virtual Host Setting choose the website you want.
  4. Now on the text area input: Custom Entry you need to enter the following  :

    Code:
    php_admin_value open_basedir "/var/sentora/hostdata/zadmin/public_html/domain_tld:/var/zpanel/hostdata/X/temp/"


  5. (do not forget to click Save when you are done)
Done Smile
My Sentora Resources
[Module] Mail Quota Count | Vagrant Box with Sentora

[Image: vanguardly-logo-micro.png]
Graphic and Web Design. Development.
www.vanguardly.com


Reply
Thanks given by: jntslvdrt
#3
RE: Suhosin, open_basedir restriction, sentora temp folder
easier solution setup a temp folder under public folder /temp and then drop there a .htaccess that prevent any access.

M B
No support using PM (Auto adding to IGNORE list!), use the forum. 
How to ask
Freelance AWS Certified Architect & SysOps// DevOps

10$ free to start your VPS
Reply
Thanks given by: jntslvdrt , apinto
#4
RE: Suhosin, open_basedir restriction, sentora temp folder
Thanks you both. I think it's a good idea Me.B.

I've overridden but same thing keeps occurring... but that time with right path.
Code I managed in override field:
PHP Code:
php_admin_value open_basedir "/var/sentora/hostdata/vulcanus/public_html/oc2_vulcanus_com_br:/var/sentora/hostdata/vulcanus/temp/" 


Log attached to avoid visual pollution  


Attached Files
.txt   LogA.txt (Size: 946 bytes / Downloads: 12)
Reply
Thanks given by: apinto
#5
RE: Suhosin, open_basedir restriction, sentora temp folder
jntslvdrt actually Me.B solution is better than mine, if it is possible to change.

Regarding your log, are you sure you sure the paths are correct?
By reading that log I can't identify the issue.
My Sentora Resources
[Module] Mail Quota Count | Vagrant Box with Sentora

[Image: vanguardly-logo-micro.png]
Graphic and Web Design. Development.
www.vanguardly.com


Reply
Thanks given by: jntslvdrt
#6
RE: Suhosin, open_basedir restriction, sentora temp folder
Correct me if I'm wrong
/var/sentora/hostdata/vulcanus/public_html/oc2_vulcanus_com_br:/var/sentora/hostdata/vulcanus/temp/
PHP Code:
first:second 

First part is about which directory is authorized to use second, second is about where temp file will be when it's necessary to manage temp file. Right?

So, web files are on /var/sentora/hostdata/vulcanus/public_html/oc2_vulcanus_com_br/ and I wish temp folder were /var/sentora/hostdata/vulcanus/temp/ but it could be /var/sentora/hostdata/vulcanus/public_html/temp/ too

Anyway, log says even /var/sentora/hostdata/vulcanus/temp is not allowed, but it's actually inside "customer" perimeter because it's inside /var/sentora/hostdata/vulcanus/
Reply
Thanks given by:
#7
RE: Suhosin, open_basedir restriction, sentora temp folder
I think there is some confusion here.

Changing php_admin_value_open_basedir will ONLY allow you to execute php files on "/var/sentora/hostdata/X/temp/".
Code:

Code:
php_admin_value open_basedir "/var/sentora/hostdata/zadmin/public_html/domain_tld:/var/sentora/hostdata/X/temp/"

This will NOT CHANGE the temp folder.

You need to know which folder does PHPExcel uses as temp and add that to the php_admin_value open_basedir.
Ideally you should change the script to use the default PHP tempo folder to avoid editing the open_basedir entry.

I've searched for your issue and it is related to PHPExcel and not Sentora/PHP, so you should NOT try to change the server configuration to fit the script (specially considering the server is well configured for security).

- First of all verify if you are using PHPExcel 1.8, there are multiple issues with 1.7 and some of them are related to the temp folder.

The most complete post I've saw about your issue is https://christinedeffaixremy.wordpress.c..._temp_dir/ sadly it is in french, however you should be able to understand.

Good luck Smile
My Sentora Resources
[Module] Mail Quota Count | Vagrant Box with Sentora

[Image: vanguardly-logo-micro.png]
Graphic and Web Design. Development.
www.vanguardly.com


Reply
Thanks given by: jntslvdrt
#8
RE: Suhosin, open_basedir restriction, sentora temp folder
Sorry but I think it's totally doable. I just can't stand the ideia of changing script everytime shit happens.
I've managed to change temp dir.
PHP Code:
php_admin_value upload_tmp_dir "/var/sentora/hostdata/vulcanus/tmp"

php_admin_value open_basedir "/var/sentora/hostdata/vulcanus/public_html/oc2_vulcanus_com_br:/var/sentora/hostdata/vulcanus/tmp/" 

My PHP info shows temp dir set as upload_tmp_dir parameter.
But, let's put in a logical way. I set a custom temp upload directory and I set this directory to be able to run php.

PHPExcel script detect which temp dir is set. You can notice that because log says exactly the directories I've set using php_admin parameters...

I can't understand French but I'll use a translator, later I'll come back
Reply
Thanks given by:
#9
RE: Suhosin, open_basedir restriction, sentora temp folder
SHIIIIIIIIIIIIIIIIIIIIIIIT! I made it!
I just realize that even oc2.vulcanus.com.br (oc2_vulcanus_com_br) being subdomain of vulcanus.com.br one can't access another.
In order to make it work I need to set temp dir anywhere just in or after /var/hostdata/vulcanus/public_html/oc2_vulcanus_com_br/
or /var/hostdata/ACCOUNT/public_html/domain.tld/ or /var/hostdata/ACCOUNT/public_html/sub.domain.tld/


Anywhere different than that like /var/sentora/hostdata/vulcanus/tmp will definitely not work simply because it's not inside domain or subdomain folder.

Sorry for all the trouble, it was caused simply because of me being not able to understand how suhosin/open_basedir works.

Thank you so much guys.
Reply
Thanks given by:
#10
RE: Suhosin, open_basedir restriction, sentora temp folder
(06-17-2015, 09:34 AM)jntslvdrt Wrote: PHPExcel script detect which temp dir is set. You can notice that because log says exactly the directories I've set using php_admin parameters...

Actually the error only tells you what the open_basedir directory is, regardless of what directory PHPExcel is currently using.

Like I told you, the issue is within PHPExcel and not within the server, althou I do understand you not wanting to change a script it is the most correct step is cases like this.



Anyways, glad you could solve the issue Smile
My Sentora Resources
[Module] Mail Quota Count | Vagrant Box with Sentora

[Image: vanguardly-logo-micro.png]
Graphic and Web Design. Development.
www.vanguardly.com


Reply
Thanks given by:


Possibly Related Threads…
Thread Author Replies Views Last Post
Is Sentora dead? rajeevrrs 2 3 ,073 12-17-2022, 09:20 AM
Last Post: TGates
Sentora debug and error files johnnyp 0 1 ,188 10-27-2022, 06:16 PM
Last Post: johnnyp
Transfer Account to another Sentora BenI 1 2 ,632 07-21-2022, 07:19 PM
Last Post: Nigel

Forum Jump:


Users browsing this thread: 1 Guest(s)