sentora / sentora-core

Sentora is a web hosting control panel written in PHP for *NIX
GNU General Public License v3.0
653 stars 444 forks source link

Suggestion for OnDaemonRun.hook.php #88

Open Rakhmanov opened 10 years ago

Rakhmanov commented 10 years ago

Hello fellow Developers! I was working on installation option for FPM PHP on Centora 7. Centora 7 has yum version that allow it for out of box deployment. My soulution worked perfectly except, when it needs to generate new vhost without forking the file directly. The OnDaemonRun.hook.php is not capatible with apache 2.4, this why Its already being modified by installation sctipt on Centos 7 to work which is bad way to implement.

if ( ctrl_options::GetSystemOption( 'use_openbase' ) == "true" || ctrl_options::GetSystemOption( 'use_suhosin' ) == "true") { $line .=''. fs_filehandler::NewLine(); if ( $rowvhost[ 'vh_obasedir_in' ] <> 0 ) { $line .= 'php_admin_value open_basedir "' . ctrl_options::GetSystemOption( 'hosted_dir' ) . $vhostuser[ 'username' ] . "/public_html" . $rowvhost[ 'vh_directory_vc' ] . ctrl_options::GetSystemOption( 'openbase_seperator' ) . ctrl_options::GetSystemOption( 'openbase_temp' ) . '"'. fs_filehandler::NewLine(); } if ( $rowvhost[ 'vh_suhosin_in' ] <> 0 ) { $line .= ctrl_options::GetSystemOption( 'suhosin_value' ) . fs_filehandler::NewLine(); } $line .=''. fs_filehandler::NewLine(); }

Can i make changes and suggest a merge or its better to make it together? I dont want to put all this time forking only to find out its not the direction project is taking.

5050 commented 10 years ago

I I tryed to edit your post to have correct code display unsuccessfully. I tryed ``` , [code], < addr >, < pre >, none seems to work! :-(

But it is ok below:

                if ( ctrl_options::GetSystemOption( 'use_openbase' ) == "true" || ctrl_options::GetSystemOption( 'use_suhosin' ) == "true") {
                $line .='<IfModule  mod_php5.c>'. fs_filehandler::NewLine();
                    if ( $rowvhost[ 'vh_obasedir_in' ] <> 0 ) {
                        $line .= 'php_admin_value open_basedir "' . ctrl_options::GetSystemOption( 'hosted_dir' ) . $vhostuser[ 'username' ] . "/public_html" . $rowvhost[ 'vh_directory_vc' ] . ctrl_options::GetSystemOption( 'openbase_seperator' ) . ctrl_options::GetSystemOption( 'openbase_temp' ) . '"'. fs_filehandler::NewLine();
                    }
                     if ( $rowvhost[ 'vh_suhosin_in' ] <> 0 ) {
                        $line .= ctrl_options::GetSystemOption( 'suhosin_value' ) . fs_filehandler::NewLine();
                    }
                $line .='</IfModule>'. fs_filehandler::NewLine();
                }

About vhost definition, I will read and try to understand where is the problem : we did not noticed here until now. Can you explain better what is the problem ? -> you wrote Centora 7 : is it CentOs 7 ? -> your fix may silently skip open_basedir and suhosin : with current configuration of zPanel/Sentora, they must not be disabled, except for very special case under master admin responsability : server not shared, software installed and users all trusted.

About static files, I did not though about them (they are historical), but I'm not sure why is may be better to make them really static without any php code.

I will get a look for error pages, but the predefined directory for these files is really _erropages with underscore prefix !

TGates71 commented 10 years ago

I prefer the 'static' pages to include php as they can be customized a lot better to match your hosting company and integrate with your site: http://www.mach-hosting.com/ -=- http://cp.mach-hosting.com/etc/static/errorpages/404.html and they work just fine for all hosted accounts. Not too mention the use of the 'Error Pages Editor' module I made so user's can customize them right inside the panel to match their site also.

Rakhmanov commented 10 years ago
  1. Reasoning behind this suggestion is that when installing php-fpm each php files location has to be declared to be properly redirected. So each folder for those "static files" needs to be written in vhost configs. PHP has adopted the fpm in the core and its clearly way better way to implement when structure allows. We can make those pages to be generated from database somehow. I need think more on possible solving.

Example: For main sentora files ProxyPassMatch ^/(..php(/.)?)$ fcgi://127.0.0.1:9000/etc/sentora/panel/$1

And for each vhost record of existing domain ProxyPassMatch ^/(.*.php)$ fcgi://127.0.0.1:9000/var/sentora/hostdata/zadmin/public_html/fiatstyle_com/$1

  1. Yes its CentOS 7 x64 sorry for confusion.

I will write more, really glad to see such alive response! I will continue to thinking and make some solutions.

TGates71 commented 10 years ago

Ok, I think I see where you are going. Error pages do not fall under this since they get copied to the user's hosting space. The others, like bandwidth exceeded, over limit, etc are written into the vhost file when somebody's account is exceeded hence no more access to their site files. (I also have these customized like my error pages.) Redirected I think is where I am getting confused since the user's vhost(s) entries get changed to point to the static files if exceeded, etc. locking their site down. (so if somebody tries 'theirdomain.com/sitehere.php' it will throw a 404 rather than showing the file 'sitehere.php' if the user tries to bypass their restriction. There is no 'redirect' as their vhost now points to the proper 'locking' page/folder. So, in short, the user's site root entry in the vhost is re-written to point directly at the specific static page's folder. Or I just do not get what you are meaning LOL