#1  
Old 9th November 2011, 06:09
erosbk erosbk is offline
Senior Member
 
Join Date: Mar 2011
Posts: 337
Thanks: 49
Thanked 36 Times in 30 Posts
Default www moved, change open_basedir

I need to add this to default open_base dir value:

/userdata/www/[website_domain]/web:/userdata/www/[website_domain]/tmp:/userdata/www/clients/client[client_id]/web[website_id]/web:/userdata/www/clients/client[client_id]/web[website_id]/tmp

"/var/www" has been moved to "/userdata/www"

"/var/www" is now a symlink to "/userdata/www/"

So, I need to add "/userdata/" too in open_basedir, but I want to keep path as /var/www (with this, I can rollback always to original folders).

As I could test, [client_id] and [website_id] are not available to be used to define paths in open_basedir box... so, how can I implement this variables? or it is something else that I could use?

Thanks in advance!
Reply With Quote
Sponsored Links
  #2  
Old 9th November 2011, 12:26
till till is offline
Super Moderator
 
Join Date: Apr 2005
Location: Lüneburg, Germany
Posts: 37,015
Thanks: 840
Thanked 5,652 Times in 4,461 Posts
Default

The placeholders [client_id] and [website_id] are replaced in the open_basedir string, so you can use them in the field under System > Server Config > Web to define the open_basedir path preset for the websites.
__________________
Till Brehm
--
Get ISPConfig support and the ISPConfig 3 manual from ispconfig.org.
Reply With Quote
  #3  
Old 9th November 2011, 15:46
erosbk erosbk is offline
Senior Member
 
Join Date: Mar 2011
Posts: 337
Thanks: 49
Thanked 36 Times in 30 Posts
Default

Thanks Till,

I tried to use those variables in the path for open_basedir, but are not being replaced when writted to site file.. they are writted as \[client_id\].

If you need, I will post here tonight the entire string that I am trying to use for open_basedir

(I don't want to change sitepath option /var/www for /data/www, I want it to remain as /var/www/)
Reply With Quote
  #4  
Old 9th November 2011, 15:51
till till is offline
Super Moderator
 
Join Date: Apr 2005
Location: Lüneburg, Germany
Posts: 37,015
Thanks: 840
Thanked 5,652 Times in 4,461 Posts
Default

There seem to be a misunderstanding. Placeholders can be used under System > server config > web as they get replaced when a new web gets created (and the filed is filled the first time) and not when the file gets written to disk. You can not use placeholders in the website options under Sites > Website > Options as this field contains the result of the replacement, so the string in that field is the final path which is written to disk after the placeholders have been replaced. So dont add any placeholders there.

Quote:
(I don't want to change sitepath option /var/www for /data/www, I want it to remain as /var/www/)
There is no need to change any openbasedir settings for existing sites for that. Just add a symlink in the filesystem.
__________________
Till Brehm
--
Get ISPConfig support and the ISPConfig 3 manual from ispconfig.org.
Reply With Quote
  #5  
Old 9th November 2011, 15:54
erosbk erosbk is offline
Senior Member
 
Join Date: Mar 2011
Posts: 337
Thanks: 49
Thanked 36 Times in 30 Posts
Default

Oh, I am using a symlink ln:/var/www pointing to dir:/data/www/

So, I don't need to change anything? if a site use as path /data/www, open_basedir will allow everything if I don't specify /data/www as allowed path?

thanks for all your help
Reply With Quote
  #6  
Old 9th November 2011, 15:59
till till is offline
Super Moderator
 
Join Date: Apr 2005
Location: Lüneburg, Germany
Posts: 37,015
Thanks: 840
Thanked 5,652 Times in 4,461 Posts
Default

Yes, a symlink should be enough.
__________________
Till Brehm
--
Get ISPConfig support and the ISPConfig 3 manual from ispconfig.org.
Reply With Quote
The Following User Says Thank You to till For This Useful Post:
erosbk (9th November 2011)
  #7  
Old 13th December 2011, 05:50
erosbk erosbk is offline
Senior Member
 
Join Date: Mar 2011
Posts: 337
Thanks: 49
Thanked 36 Times in 30 Posts
Default

Quote:
Originally Posted by till View Post
There seem to be a misunderstanding. Placeholders can be used under System > server config > web as they get replaced when a new web gets created (and the filed is filled the first time) and not when the file gets written to disk. You can not use placeholders in the website options under Sites > Website > Options as this field contains the result of the replacement, so the string in that field is the final path which is written to disk after the placeholders have been replaced. So dont add any placeholders there.


There is no need to change any openbasedir settings for existing sites for that. Just add a symlink in the filesystem.
Till, in System > Server Config > Web, I am trying to use placeholders [client_id], [website_id] in "PHP open_basedir", but the only placeholders working are [website_path] and [website_domain], both of them are not usefull for what I need.

As I could see, if I don't specify /userdata/clients/clientX/webY/web in php_openbasedir, sites doesn't work because path /userdata/.../ is not allowed by open_basedir... I have a symlink /var/www -> /userdata/www/. Sites works if I access them using /var/www...

So, I need to add in PHP open_basedir the following path to default path:
/userdata/clients/[client_id]/[website_id]/web and /userdata/clients/[client_id]/[website_id]/tmp

Could you guide me how to work with this? which file do I have to change to allow client_id and website_id placeholders in PHP open_basedir under System > Server Config > Web ?

As always, sorry for my bad english, and thanks in advance
Reply With Quote
  #8  
Old 13th December 2011, 06:03
erosbk erosbk is offline
Senior Member
 
Join Date: Mar 2011
Posts: 337
Thanks: 49
Thanked 36 Times in 30 Posts
 
Default

Should be enough to modify interface/web/sites/web_domain_edit.php as below to add client_id and website_id as placeholders? do I have to modify too interface/lib/plugins/sites_web_domain_plugin.inc.php?

Code:
                // Get configuration for the web system
                $app->uses("getconf");
                $web_rec = $app->tform->getDataRecord($this->id);
                $web_config = $app->getconf->get_server_config(intval($web_rec["server_id"]),'web');
                $document_root = str_replace("[website_id]",$this->id,$web_config["website_path"]);
                $document_root = str_replace("[website_idhash_1]",$this->id_hash($page_form->id,1),$document_root);
                $document_root = str_replace("[website_idhash_2]",$this->id_hash($page_form->id,1),$document_root);
                $document_root = str_replace("[website_idhash_3]",$this->id_hash($page_form->id,1),$document_root);
                $document_root = str_replace("[website_idhash_4]",$this->id_hash($page_form->id,1),$document_root);

                // get the ID of the client
                if($_SESSION["s"]["user"]["typ"] != 'admin' && !$app->auth->has_clients($_SESSION['s']['user']['userid'])) {
                        $client_group_id = $_SESSION["s"]["user"]["default_group"];
                        $client = $app->db->queryOneRecord("SELECT client_id FROM sys_group WHERE sys_group.groupid = $client_group_id");
                        $client_id = intval($client["client_id"]);
                } else {
                        //$client_id = intval($this->dataRecord["client_group_id"]);
                        $client = $app->db->queryOneRecord("SELECT client_id FROM sys_group WHERE sys_group.groupid = ".intval($this->dataRecord["client_group_id"]));
                        $client_id = intval($client["client_id"]);
                }

                // Set the values for document_root, system_user and system_group
                $system_user = $app->db->quote('web'.$this->id);
                $system_group = $app->db->quote('client'.$client_id);
                $document_root = str_replace("[client_id]",$client_id,$document_root);
                $document_root = str_replace("[client_idhash_1]",$this->id_hash($client_id,1),$document_root);
                $document_root = str_replace("[client_idhash_2]",$this->id_hash($client_id,2),$document_root);
                $document_root = str_replace("[client_idhash_3]",$this->id_hash($client_id,3),$document_root);
                $document_root = str_replace("[client_idhash_4]",$this->id_hash($client_id,4),$document_root);
                $document_root = $app->db->quote($document_root);

# BOC
                $php_open_basedir = str_replace("[client_id]",$client_id,$web_config["php_open_basedir"]);
                $php_open_basedir = str_replace("[website_id]",$this->id,$web_config["php_open_basedir"]);
# EOC
                $php_open_basedir = str_replace("[website_path]",$document_root,$web_config["php_open_basedir"]);
                $php_open_basedir = $app->db->quote(str_replace("[website_domain]",$web_rec['domain'],$php_open_basedir));
                $htaccess_allow_override = $app->db->quote($web_config["htaccess_allow_override"]);

                $sql = "UPDATE web_domain SET system_user = '$system_user', system_group = '$system_group', document_root = '$document_root', allow_override = '$htaccess_allow_override', php_open_basedir = '$php_open_basedir'  WHERE dom$
                $app->db->query($sql);
Thanks in advance

Last edited by erosbk; 13th December 2011 at 06:15.
Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
squirrelmail and postfix witoszek General 12 1st December 2009 19:07
Security problem 2 ???? the revenge :) albertux Installation/Configuration 2 22nd September 2009 19:44
Mail Log Question - Is This Normal gwiz Installation/Configuration 7 12th September 2009 04:09
550 Sender verify failed Allen15 Installation/Configuration 11 13th February 2009 15:02
Problem recieving mail webstergd Installation/Configuration 19 16th December 2005 13:08


All times are GMT +2. The time now is 09:17.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.