diff -Nur --no-dereference smeserver-php-3.0.0.old/root/etc/e-smith/db/accounts/migrate/20ibay-php smeserver-php-3.0.0/root/etc/e-smith/db/accounts/migrate/20ibay-php --- smeserver-php-3.0.0.old/root/etc/e-smith/db/accounts/migrate/20ibay-php 1969-12-31 19:00:00.000000000 -0500 +++ smeserver-php-3.0.0/root/etc/e-smith/db/accounts/migrate/20ibay-php 2021-03-08 03:35:18.218000000 -0500 @@ -0,0 +1,28 @@ +{ + my %old2new = ( + UpMaxFileSize => "UploadMaxFilesize", + PHPUploadMaxFilesize => "UploadMaxFilesize", + PHPPostMaxSize => "PostMaxSize", + PHPMaxExecutionTime => "MaxExecutionTime", + PHPMemoryLimit => "MemoryLimit", + PHPAllowUrlFopen => "AllowUrlFopen", + PHPFileUpload => "FileUpload", + PHPDisabledFunctions => "DisabledFunctions", + PHPAutoPrependFile => "AutoPrependFile", + PHPCustomPool => "CustomPool", + PHPMaxInputTime => "MaxInputTime", + ); + + foreach my $ibay ($DB->get_all_by_prop(type => 'ibay')) + { + for my $key (keys %old2new) + { + next unless (defined $ibay->prop($key)); + my $value = $DB->get_prop_and_delete($ibay->key, $key); + next if (defined $ibay->prop($old2new{$key}) ); + $DB->set_prop($ibay->key, $old2new{$key}, $value); + } + + } +} + diff -Nur --no-dereference smeserver-php-3.0.0.old/root/etc/e-smith/templates/etc/httpd/conf/httpd.conf/95AddType00PHP2ibays smeserver-php-3.0.0/root/etc/e-smith/templates/etc/httpd/conf/httpd.conf/95AddType00PHP2ibays --- smeserver-php-3.0.0.old/root/etc/e-smith/templates/etc/httpd/conf/httpd.conf/95AddType00PHP2ibays 2021-03-08 02:59:22.560000000 -0500 +++ smeserver-php-3.0.0/root/etc/e-smith/templates/etc/httpd/conf/httpd.conf/95AddType00PHP2ibays 2021-03-08 03:25:56.753000000 -0500 @@ -6,6 +6,7 @@ my $adb = esmith::AccountsDB->open_ro(); foreach my $ibay ($adb->ibays) { + my %properties = $ibay->props; my $key = $ibay->key; local $dynamicContent = $ibay->prop('CgiBin') || 'disabled'; if ($dynamicContent eq 'enabled') @@ -37,16 +38,26 @@ # the following block is only in case phpmodule is enabled. if (exists $php{status} and $php{status} eq "enabled" and $phpModule eq "enabled") { + my $allowurlfopen = $properties{'AllowUrlfOpen'} || 'disabled'; + my $memoryLimit = $properties{'MemoryLimit'} || 'disabled'; + my $upmaxfileSize = $properties{'UploadMaxFilesize'} || 'disabled'; + my $postmaxSize = $properties{'PostMaxSize'} || 'disabled'; + my $maxexecutionTime = $properties{'MaxExecTime'} || 'disabled'; + $maxexecutionTime = '0' if $maxexecutionTime eq 'unlimited'; + $OUT .= " php_admin_flag allow_url_fopen on\n" if ($allowurlfopen eq 'enabled'); + $OUT .= " php_admin_value memory_limit $memoryLimit\n" if ($memoryLimit ne 'disabled'); + $OUT .= " php_admin_value upload_max_filesize $upmaxfileSize\n" if ($upmaxfileSize ne 'disabled'); + $OUT .= " php_admin_value post_max_size $postmaxSize\n" if ($postmaxSize ne 'disabled'); + $OUT .= " php_admin_value max_execution_time $maxexecutionTime\n" if ($maxexecutionTime ne 'disabled'); + # Set upload_tmp_dir and sys_temp_dir where php can upload files or write tmp files - my $tmpdir = $ibay->prop('PHPTmpDir') || 'enabled'; - $tmpdir = ("/var/cache/e-smith/files/ibays/$key/tmp") if $tmpdir eq 'enabled'; - $OUT .= " php_admin_value upload_tmp_dir $tmpdir\n" unless ($tmpdir eq 'disabled' || ! -d $tmpdir); - $OUT .= " php_admin_value sys_temp_dir $tmpdir\n" unless ($tmpdir eq 'disabled' || ! -d $tmpdir); + $tmpdir= "/var/lib/php/$key/tmp"; + $OUT .= " php_admin_value upload_tmp_dir $tmpdir\n"; + $OUT .= " php_admin_value sys_temp_dir $tmpdir\n"; # Set the session folder where php can store its session instead of in global dir - my $sessdir = $ibay->prop('PHPSessionDir') || 'enabled'; - $sessdir = ("/var/cache/e-smith/files/ibays/$key/session") if $sessdir eq 'enabled'; - $OUT .= " php_admin_value session.save_path $sessdir\n" unless ($sessdir eq 'disabled' || ! -d $sessdir); + $sessdir = "/var/lib/php/$key/session"; + $OUT .= " php_admin_value session.save_path $sessdir\n"; # Set the sandbox within which PHP is confined to play my $basedir = $ibay->prop('PHPBaseDir') diff -Nur --no-dereference smeserver-php-3.0.0.old/root/etc/e-smith/templates/etc/php-fpm.d/ibays.conf/10Ibays smeserver-php-3.0.0/root/etc/e-smith/templates/etc/php-fpm.d/ibays.conf/10Ibays --- smeserver-php-3.0.0.old/root/etc/e-smith/templates/etc/php-fpm.d/ibays.conf/10Ibays 2021-03-08 02:59:22.556000000 -0500 +++ smeserver-php-3.0.0/root/etc/e-smith/templates/etc/php-fpm.d/ibays.conf/10Ibays 2021-03-08 03:35:34.225000000 -0500 @@ -7,25 +7,25 @@ foreach my $ibay ($a->get_all_by_prop(type => 'ibay')){ my $version = PhpFpmVersionToUse($ibay); my $dynamic = $ibay->prop('CgiBin') || 'disabled'; - my $custom = $ibay->prop('PHPCustomPool') || undef; + my $custom = $ibay->prop('CustomPool') || undef; next unless ($dynamic eq 'enabled' && $version eq $PHP_VERSION && !$custom); my $key = $ibay->key; my $name = lc $key; my $pool_name = 'php' . $version . '-' . $name; - my $memory_limit = $ibay->prop('PHPMemoryLimit') || '128M'; - my $max_execution_time = $ibay->prop('PHPMaxExecutionTime') || '30'; - my $max_input_time = $ibay->prop('PHPMaxInputTime') || '60'; - my $allow_url_fopen = $ibay->prop('PHPAllowUrlFopen') || 'disabled'; - my $post_max_size = $ibay->prop('PHPPostMaxSize') || '10M'; - my $upload_max_filesize = $ibay->prop('PHPUploadMaxFilesize') || '10M'; - my $file_upload = $ibay->prop('PHPFileUpload') || 'enabled'; + my $memory_limit = $ibay->prop('MemoryLimit') || '128M'; + my $max_execution_time = $ibay->prop('MaxExecutionTime') || '30'; + my $max_input_time = $ibay->prop('MaxInputTime') || '60'; + my $allow_url_fopen = $ibay->prop('AllowUrlFopen') || 'disabled'; + my $post_max_size = $ibay->prop('PostMaxSize') || '20M'; + my $upload_max_filesize = $ibay->prop('UploadMaxFilesize') || '10M'; + my $file_upload = $ibay->prop('FileUpload') || 'enabled'; my $open_basedir = $ibay->prop('PHPBaseDir') || '/home/e-smith/files/ibays/' . $key . ':/var/lib/php/' . $key; - my $disabled_functions = $ibay->prop('PHPDisabledFunctions') || 'system,show_source,' . + my $disabled_functions = (defined $ibay->prop('DisabledFunctions')) ? $ibay->prop('DisabledFunctions') : 'system,show_source,' . 'symlink,exec,dl,shell_exec,' . 'passthru,phpinfo,' . 'escapeshellarg,escapeshellcmd'; - my $autoprepend = $ibay->prop('PHPAutoPrependFile') || 'enabled'; + my $autoprepend = $ibay->prop('AutoPrependFile') || 'enabled'; my $MailForceSender = $ibay->prop('MailForceSender') || "$name\@$DomainName"; # TODO => check ibay associated domains. my $limitExtensions = ( ($ibay->prop('AllowPHTML') || 'disabled') eq 'enabled' ) ? "security.limit_extensions= .php .htm .html .phar .phtml .xml " : "";