/[smeserver]/rpms/smeserver-php/sme10/smeserver-php-3.0.0-bz11452-bz5759.patch
ViewVC logotype

Annotation of /rpms/smeserver-php/sme10/smeserver-php-3.0.0-bz11452-bz5759.patch

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.1 - (hide annotations) (download)
Tue Mar 16 06:01:40 2021 UTC (3 years, 8 months ago) by jpp
Branch: MAIN
CVS Tags: smeserver-php-3_0_0-45_el7_sme, smeserver-php-3_0_0-48_el7_sme, smeserver-php-3_0_0-37_el7_sme, smeserver-php-3_0_0-38_el7_sme, smeserver-php-3_0_0-40_el7_sme, smeserver-php-3_0_0-43_el7_sme, smeserver-php-3_0_0-46_el7_sme, smeserver-php-3_0_0-41_el7_sme, smeserver-php-3_0_0-44_el7_sme, smeserver-php-3_0_0-47_el7_sme, smeserver-php-3_0_0-39_el7_sme, smeserver-php-3_0_0-42_el7_sme, smeserver-php-3_0_0-35_el7_sme, smeserver-php-3_0_0-36_el7_sme, smeserver-php-3_0_0-33_el7_sme, smeserver-php-3_0_0-34_el7_sme, smeserver-php-3_0_0-32_el7_sme, HEAD
* Tue Mar 16 2021 Jean-Philippe Pialasse <tests@pialasse.com> 3.0.0-32.sme
- add /usr/share/pear and /usr/share/php to basedir [SME: 5759]
- fix last big differences between module setting and fpm [SME: 11452]

1 jpp 1.1 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
2     --- smeserver-php-3.0.0.old/root/etc/e-smith/db/accounts/migrate/20ibay-php 2021-03-16 00:26:20.889000000 -0400
3     +++ smeserver-php-3.0.0/root/etc/e-smith/db/accounts/migrate/20ibay-php 2021-03-16 01:59:53.230000000 -0400
4     @@ -11,6 +11,7 @@
5     PHPAutoPrependFile => "AutoPrependFile",
6     PHPCustomPool => "CustomPool",
7     PHPMaxInputTime => "MaxInputTime",
8     + MaxExecTime => "MaxExecutionTime",
9     );
10    
11     foreach my $ibay ($DB->get_all_by_prop(type => 'ibay'))
12     @@ -22,6 +23,13 @@
13     next if (defined $ibay->prop($old2new{$key}) );
14     $DB->set_prop($ibay->key, $old2new{$key}, $value);
15     }
16     + for my $key (qw(MemoryLimit UploadMaxFilesize PostMaxSize MaxExecutionTime))
17     + {
18     + next unless (defined $ibay->prop($key));
19     + my $value = $DB->get_prop_and_delete($ibay->key, $key) if ($ibay->prop($key) eq "disabled");
20     + next unless $key eq "MaxExecutionTime";
21     + $DB->set_prop($ibay->key,MaxExecutionTime,0) if ($ibay->prop($key) eq "unlimited");
22     + }
23    
24     }
25     }
26     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
27     --- smeserver-php-3.0.0.old/root/etc/e-smith/templates/etc/httpd/conf/httpd.conf/95AddType00PHP2ibays 2021-03-16 00:26:20.895000000 -0400
28     +++ smeserver-php-3.0.0/root/etc/e-smith/templates/etc/httpd/conf/httpd.conf/95AddType00PHP2ibays 2021-03-16 01:59:52.746000000 -0400
29     @@ -1,4 +1,5 @@
30     {
31     + use esmith::php;
32     my $status = $php{status} || 'disabled';
33     if ($status eq 'enabled')
34     {
35     @@ -13,12 +14,11 @@
36     {
37     $OUT .= "\n<Directory /home/e-smith/files/ibays/" . $ibay->key . "/html>\n";
38     # configuration to enable php-fpm for the ibay
39     + my $version = PhpFpmVersionToUse($ibay);
40     if ($fastcgi_mod eq 'mod_proxy_fcgi')
41     {
42     - use esmith::php;
43     - my $version = PhpFpmVersionToUse($ibay);
44     my $name = lc $key;
45     - my $FilesMathes = ( ($ibay->prop('AllowPHTML') || 'disabled') eq 'enabled' ) ? '(xml|phtml|html|htm|php|phar)': '(phar|php)';
46     + my $FilesMathes = ( ($ibay->prop('AllowPHTML') || $defaultPHPproperties{'AllowPHTML'}) eq 'enabled' ) ? '(xml|phtml|html|htm|php|phar)': '(phar|php)';
47    
48     $OUT .=<<"_EOF";
49     SetEnvIf Authorization "(.*)" HTTP_AUTHORIZATION=\$1
50     @@ -29,25 +29,33 @@
51     </FilesMatch>
52     _EOF
53     }
54     - else
55     + else
56     {
57     - $OUT .= " AddType application/x-httpd-php .php .phtml\n";
58     + my $FilesMathes = ( ($ibay->prop('AllowPHTML') || $defaultPHPproperties{'AllowPHTML'}) eq 'enabled' ) ? '.xml .phtml .html .htm ': '';
59     + $OUT .= " AddType application/x-httpd-php .php .phar $FilesMathes\n";
60     $OUT .= " AddType application/x-httpd-php-source .phps\n";
61    
62     # the following block is only in case phpmodule is enabled.
63     if (exists $php{status} and $php{status} eq "enabled" and $phpModule eq "enabled")
64     {
65     - my $allowurlfopen = $properties{'AllowUrlfOpen'} || 'disabled';
66     - my $memoryLimit = $properties{'MemoryLimit'} || 'disabled';
67     - my $upmaxfileSize = $properties{'UploadMaxFilesize'} || 'disabled';
68     - my $postmaxSize = $properties{'PostMaxSize'} || 'disabled';
69     - my $maxexecutionTime = $properties{'MaxExecTime'} || 'disabled';
70     - $maxexecutionTime = '0' if $maxexecutionTime eq 'unlimited';
71     - $OUT .= " php_admin_flag allow_url_fopen on\n" if ($allowurlfopen eq 'enabled');
72     - $OUT .= " php_admin_value memory_limit $memoryLimit\n" if ($memoryLimit ne 'disabled');
73     - $OUT .= " php_admin_value upload_max_filesize $upmaxfileSize\n" if ($upmaxfileSize ne 'disabled');
74     - $OUT .= " php_admin_value post_max_size $postmaxSize\n" if ($postmaxSize ne 'disabled');
75     - $OUT .= " php_admin_value max_execution_time $maxexecutionTime\n" if ($maxexecutionTime ne 'disabled');
76     + my $allow_url_fopen = $properties{'AllowUrlfOpen'} || $defaultPHPproperties{'AllowUrlfOpen'} ;
77     + my $memoryLimit = $properties{'MemoryLimit'} || $defaultPHPproperties{'MemoryLimit'};
78     + my $upmaxfileSize = $properties{'UploadMaxFilesize'} || $defaultPHPproperties{'UploadMaxFilesize'};
79     + my $postmaxSize = $properties{'PostMaxSize'} || $defaultPHPproperties{'PostMaxSize'};
80     + my $file_upload = $properties{'FileUpload'} || $defaultPHPproperties{'FileUpload'};
81     + my $maxexecutionTime = (defined $properties{'MaxExecutionTime'}) ? $properties{'MaxExecutionTime'} : $defaultPHPproperties{'MaxExecutionTime'};
82     + my $max_input_time = (defined $properties{'MaxInputTime'}) ? $properties{'MaxInputTime'} : $defaultPHPproperties{'MaxInputTime'};
83     + $maxexecutionTime = '0' if $maxexecutionTime eq 'unlimited';
84     + $file_upload = ($file_upload =~ m/^1|yes|on|enabled$/) ? 'on' : 'off';
85     + $allow_url_fopen = ($allow_url_fopen =~ m/^1|yes|on|enabled$/) ? 'on' : 'off';
86     +
87     + $OUT .= " php_admin_flag allow_url_fopen $allow_url_fopen\n";
88     + $OUT .= " php_admin_value memory_limit $memoryLimit\n";
89     + $OUT .= " php_admin_value upload_max_filesize $upmaxfileSize\n";
90     + $OUT .= " php_admin_value post_max_size $postmaxSize\n" ;
91     + $OUT .= " php_admin_flag file_upload $file_upload\n";
92     + $OUT .= " php_admin_value max_input_time $max_input_time\n";
93     + $OUT .= " php_admin_value max_execution_time $maxexecutionTime\n";
94    
95     # Set upload_tmp_dir and sys_temp_dir where php can upload files or write tmp files
96     $tmpdir= "/var/lib/php/$key/tmp";
97     @@ -61,8 +69,12 @@
98     # Set the sandbox within which PHP is confined to play
99     my $basedir = $ibay->prop('PHPBaseDir')
100     || ("/home/e-smith/files/ibays/$key/");
101     - $basedir = $tmpdir . ":" . $basedir unless ($tmpdir eq 'disabled' || ! -d $tmpdir);
102     - $basedir = $sessdir . ":" . $basedir unless ($sessdir eq 'disabled' || ! -d $sessdir);
103     + $basedir .= ":/var/lib/php/$key/";
104     + $basedir .= ":/usr/share/php/:/usr/share/pear/";
105     + if ( -d "/opt/remi/php$version/root/usr/share/pear/" && -d "/opt/remi/php$version/root/usr/share/php/")
106     + {
107     + $basedir .= ":/opt/remi/php$version/root/usr/share/pear/:/opt/remi/php$version/root/usr/share/php/";
108     + }
109     $OUT .= " php_admin_value open_basedir $basedir\n";
110     }
111     }
112     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
113     --- smeserver-php-3.0.0.old/root/etc/e-smith/templates/etc/php-fpm.d/ibays.conf/10Ibays 2021-03-16 00:26:20.891000000 -0400
114     +++ smeserver-php-3.0.0/root/etc/e-smith/templates/etc/php-fpm.d/ibays.conf/10Ibays 2021-03-16 01:59:53.487000000 -0400
115     @@ -12,26 +12,24 @@
116     my $key = $ibay->key;
117     my $name = lc $key;
118     my $pool_name = 'php' . $version . '-' . $name;
119     - my $memory_limit = $ibay->prop('MemoryLimit') || '128M';
120     - my $max_execution_time = $ibay->prop('MaxExecutionTime') || '30';
121     - my $max_input_time = $ibay->prop('MaxInputTime') || '60';
122     - my $allow_url_fopen = $ibay->prop('AllowUrlFopen') || 'disabled';
123     - my $post_max_size = $ibay->prop('PostMaxSize') || '20M';
124     - my $upload_max_filesize = $ibay->prop('UploadMaxFilesize') || '10M';
125     - my $file_upload = $ibay->prop('FileUpload') || 'enabled';
126     - my $open_basedir = $ibay->prop('PHPBaseDir') || '/home/e-smith/files/ibays/' . $key .
127     - ':/var/lib/php/' . $key;
128     - my $disabled_functions = (defined $ibay->prop('DisabledFunctions')) ? $ibay->prop('DisabledFunctions') : 'system,show_source,' .
129     - 'symlink,exec,dl,shell_exec,' .
130     - 'passthru,phpinfo,' .
131     - 'escapeshellarg,escapeshellcmd';
132     - my $autoprepend = $ibay->prop('AutoPrependFile') || 'enabled';
133     + my $memory_limit = $ibay->prop('MemoryLimit') || $defaultPHPproperties{'MemoryLimit'};
134     + my $max_execution_time = (defined $ibay->prop('MaxExecutionTime') ) ? $ibay->prop('MaxExecutionTime') : $defaultPHPproperties{'MaxExecutionTime'};
135     + my $max_input_time = (defined $ibay->prop('MaxInputTime'))? $ibay->prop('MaxInputTime') : $defaultPHPproperties{'MaxInputTime'};
136     + my $allow_url_fopen = $ibay->prop('AllowUrlFopen') || $defaultPHPproperties{'AllowUrlfOpen'};
137     + my $post_max_size = $ibay->prop('PostMaxSize') || $defaultPHPproperties{'PostMaxSize'};
138     + my $upload_max_filesize = $ibay->prop('UploadMaxFilesize') || $defaultPHPproperties{'UploadMaxFilesize'};
139     + my $file_upload = $ibay->prop('FileUpload') || $defaultPHPproperties{'FileUpload'};
140     + my $open_basedir = $ibay->prop('PHPBaseDir') || '/home/e-smith/files/ibays/' . $key . '/',
141     + ':/var/lib/php/' . $key . '/';
142     +
143     + my $disabled_functions = (defined $ibay->prop('DisabledFunctions')) ? $ibay->prop('DisabledFunctions') : $defaultPHPproperties{'DisabledFunctions'};
144     + my $autoprepend = $ibay->prop('AutoPrependFile') || $defaultPHPproperties{'AutoPrependFile'};
145     my $MailForceSender = $ibay->prop('MailForceSender') || "$name\@$DomainName"; # TODO => check ibay associated domains.
146     - my $limitExtensions = ( ($ibay->prop('AllowPHTML') || 'disabled') eq 'enabled' ) ? "security.limit_extensions= .php .htm .html .phar .phtml .xml " : "";
147     + my $limitExtensions = ( ($ibay->prop('AllowPHTML') || $defaultPHPproperties{'AllowPHTML'} ) eq 'enabled' ) ? "security.limit_extensions= .php .htm .html .phar .phtml .xml " : "";
148    
149     # Format vars
150     my $autoprep = ( $autoprepend eq "disabled") ? "" : "/usr/share/php/auth_translation.php";
151     - my $autoprepath = ( $autoprepend eq "disabled") ? "" : ",/usr/share/php/";
152     + my $autoprepath = ( -d "/opt/remi/php$version/root/usr/share/pear/" && -d "/opt/remi/php$version/root/usr/share/php/" ) ? ":/usr/share/php/:/usr/share/pear/:/opt/remi/php$version/root/usr/share/pear/:/opt/remi/php$version/root/usr/share/php/" : ":/usr/share/php/:/usr/share/pear/";
153     $file_upload = ($file_upload =~ m/^1|yes|on|enabled$/) ? 'on' : 'off';
154     $allow_url_fopen = ($allow_url_fopen =~ m/^1|yes|on|enabled$/) ? 'on' : 'off';
155     $disabled_functions = join(', ', split /[,;:]/, $disabled_functions);
156     diff -Nur --no-dereference smeserver-php-3.0.0.old/root/usr/share/perl5/vendor_perl/esmith/php.pm smeserver-php-3.0.0/root/usr/share/perl5/vendor_perl/esmith/php.pm
157     --- smeserver-php-3.0.0.old/root/usr/share/perl5/vendor_perl/esmith/php.pm 2021-03-16 00:26:20.868000000 -0400
158     +++ smeserver-php-3.0.0/root/usr/share/perl5/vendor_perl/esmith/php.pm 2021-03-16 01:59:53.000000000 -0400
159     @@ -8,7 +8,27 @@
160     our $BASEPHP = 54;
161    
162     our @ISA = qw(Exporter);
163     -our @EXPORT = qw( listPHPVersionFPM listPHPVersionShort listPHPVersionHash listPHPVersionHashShort PHPdefault VersionToUse PhpFpmVersionToUse);
164     +our @EXPORT = qw( listPHPVersionFPM listPHPVersionShort listPHPVersionHash listPHPVersionHashShort PHPdefault PHPbase VersionToUse PhpFpmVersionToUse $defaultdisabledfunc %defaultPHPproperties);
165     +
166     +our $defaultdisabledfunc='system,show_source,' .
167     + 'symlink,exec,dl,shell_exec,' .
168     + 'passthru,phpinfo,' .
169     + 'escapeshellarg,escapeshellcmd';
170     +my $configdb = esmith::ConfigDB->open_ro or die "Could not open accounts db";
171     +our %defaultPHPproperties = (
172     + MemoryLimit => '128M',
173     + MaxExecutionTime => '30',
174     + MaxInputTime => '60',
175     + AllowUrlFopen => 'disabled',
176     + PostMaxSize => '20M',
177     + UploadMaxFilesize => '10M',
178     + FileUpload => 'enabled',
179     + PHPBaseDir => '/home/e-smith/files/ibays/$key:/var/lib/php/$key',
180     + DisabledFunctions => $defaultdisabledfunc,
181     + MailForceSender => "admin@".$configdb->get_value('DomainName'),
182     + AllowPHTML => 'disabled',
183     + AutoPrependFile => 'enabled',
184     +);
185    
186     =head1 NAME
187    
188     @@ -164,6 +184,14 @@
189     return $PHPVersion;
190     }
191    
192     +=head2 PHPbase
193     +return the php base, i.e. 54 for php-fpm provided by CentOS 7.
194     +
195     +=cut
196     +sub PHPbase {
197     + return $BASEPHP;
198     +}
199     +
200     =head2 VersionToUse
201     argument 1 : output from $account->get('ibayname') or similar (shares,custom)
202     it is expected to find in this entry a property PHPVersion

admin@koozali.org
ViewVC Help
Powered by ViewVC 1.2.1 RSS 2.0 feed