Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Suggestion for OnDaemonRun.hook.php #88

Open
Rakhmanov opened this issue Nov 19, 2014 · 4 comments
Open

Suggestion for OnDaemonRun.hook.php #88

Rakhmanov opened this issue Nov 19, 2014 · 4 comments

Comments

@Rakhmanov
Copy link

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.

  • Make build in Capability for 2.4 and PHP-FPM
  • Declare condition for PHP-module specific options! This solution works perfect:
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(); }
  • Lets make (/etc/sentora/panel/etc/static/) pages really statical. Daemon creates this vhost records for all parked, bandwith exceeded, disk exceeded and parked domains. I suggest to make them html files and make them easy to declare. Now they only use php to pull $_SERVER['HTTP_HOST'] variable, which really not that necessary.
  • Error pages dont work. Assuming because we have it writing in the vhosts as _errorpages when its really without underscore.

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
Copy link
Contributor

5050 commented Nov 19, 2014

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
Copy link
Member

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
Copy link
Author

  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
Copy link
Member

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants