Wiki . Forums . Bugs . Translation . Privacy Policy | Search . Simple . Advanced | Reports . Help | Matrix . 10.x . 11.x . 12.x . 13.x . Future . Recent . Contribs

Bug 8316 - Add more PHP settings by db command
Summary: Add more PHP settings by db command
Status: CLOSED FIXED
Alias: None
Product: SME Server 10.X
Classification: SME Server
Component: New Feature Request (show other bugs)
Version: ---
Hardware: --- ---
: P3 normal
Target Milestone: ---
Assignee: SME Server bug team
QA Contact: SME Server bug team
URL:
Depends on: 8239
Blocks:
  Show dependency tree / graph
 
Reported: 2014-04-07 14:15 CEST by Stephane de Labrusse
Modified: 2021-03-10 06:13 CET (History)
6 users (show)

See Also:
Package: smeserver-ibays
tests: code_attached+


Attachments
e-smith-ibays-2.2.0_add_php_values_and_SSLRequireSSL.patch (2.36 KB, patch)
2014-04-07 15:41 CEST, Stephane de Labrusse
Details | Diff
e-smith-ibays-2.2.0_add_php_values_and_SSLRequireSSL.patch (2.44 KB, patch)
2014-04-08 12:59 CEST, Stephane de Labrusse
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Stephane de Labrusse 2014-04-07 14:15:49 CEST
+++ This bug was initially created as a clone of Bug #8239 +++

 i saw that ian have made a new option SSLRequireSSL (bug 882) and i have used it to add this directive if the SSL ibay option is set to enabled. it is done to enhance the security.

If the redirection fail to https, then the access is forbidden. Here the code change

my $ssldb = $properties{'SSL'} || "disabled";
if (("$sslRequireSSL" eq 'enabled') || ("$ssldb" eq 'enabled'))
        {
            $OUT .="    SSLRequireSSL\n";
        }

Further more i would add a php setting (php_admin_flag allow_url_fopen on) used by many programs which need to allow php to download remote files. We could set this option either directly in the php.ini or by a template custom. I propose that this option needs to be in the hand of the admin.
It is more secure than allow it for the whole server and more flexible and easy when it is done per ibay through the server-manager.


If you think this work is valuable we could add more php settings to the ibay, i mean :
 
php_admin_flag allow_url_fopen on
php_admin_value memory_limit
php_admin_value upload_max_filesize
php_admin_value post_max_size
php_admin_value max_execution_time
Comment 13 Jean-Philippe Pialasse 2021-03-10 06:13:43 CET
has been added in SME10 via php-fpm
Comment 12 Jean-Philippe Pialasse 2017-11-16 16:11:16 CET
this was a discussion on SME8
it could be important to add more settings available as needed by more and more php apps.

the patch here need to be adapted for SME10 and changes already done. Maybe some new values could be added

also this might be worked closely with php fpm integration
Comment 11 Stephane de Labrusse 2014-05-08 02:52:54 CEST
do we backport for sme8 the patch e-smith-ibays-2.2.0_add_php_values_and_SSLRequireSSL.patch ?
Comment 10 Ian Wells 2014-04-08 20:25:45 CEST
(In reply to Stephane de Labrusse from comment #9)
> Charlie, i understand what you are meaning with your example, but maybe it
> is valuable to have 'one' convention of code like ian has suggested.
> 
> if you look what i wrote i didn't use one style but several between "" or ''.

This should be followed up on DevInfo:

I see two issues:

For new code let's try to do our best, but there is no coding standard for SME Server at the moment. So it is not a requirement to follow Perl::Critic, but please *consider* it and make an active choice to implement or ignore it.

We should put developer hours where it has the most impact, so there is no need to re-write code just to remove the number of warnings from Perl::Critic instead fixing our 1000 bug backlog or improving automated testing or moving to Mojolicious would be more productive.
Comment 9 Stephane de Labrusse 2014-04-08 14:31:09 CEST
Charlie, i understand what you are meaning with your example, but maybe it is valuable to have 'one' convention of code like ian has suggested.

if you look what i wrote i didn't use one style but several between "" or ''.
Comment 8 Charlie Brady 2014-04-08 13:36:03 CEST
(In reply to Ian Wells from comment #3)

> +    my $ssldb = $properties{'SSL'} || "disabled";
> can be a literal, i.e. 'disabled' or 'unlimited' or 'enabled'

Yes, can be, but doesn't need to be. The difference between "disabled" and 'disabled' seldom matters.

This is the justification for such pedantry:

  Don't use double-quotes or qq// if your string doesn't require
  interpolation. This saves the interpreter a bit of work and it
  lets the reader know that you really did intend the string to be literal.

See:

http://search.cpan.org/dist/Perl-Critic/lib/Perl/Critic/Policy/ValuesAndExpressions/ProhibitInterpolationOfLiterals.pm

Did anyone think we didn't mean "disabled" to be literal? Is there any measurable difference in the work done by the interpreter? No, I didn't think so...
Comment 7 Charlie Brady 2014-04-08 13:30:58 CEST
(In reply to Stephane de Labrusse from comment #4)

> Do I need to rewrite 'MY CHANGE' to something that Perl::critic would have ?

No!
Comment 6 Stephane de Labrusse 2014-04-08 12:59:32 CEST
Created attachment 4588 [details]
e-smith-ibays-2.2.0_add_php_values_and_SSLRequireSSL.patch

New syntax as suggested by ian
Comment 5 Ian Wells 2014-04-08 12:23:50 CEST
(In reply to Stephane de Labrusse from comment #4)
> (In reply to Ian Wells from comment #3)
> 
> > There are also many bad examples in the existing code but let's try to not
> > add to the issues.
> 
> obviously  i took examples from the existent code, and it uses "" in many
> ways.
> 
> Do I need to rewrite 'MY CHANGE' to something that Perl::critic would have ?
> 
> If yes i could do the same thing for the bug 8239. 

I would prefer SME9 to have the better code as it is the active branch. It may be best to leave SME8 with the same code as SME9.
Comment 4 Stephane de Labrusse 2014-04-08 11:06:52 CEST
(In reply to Ian Wells from comment #3)

> There are also many bad examples in the existing code but let's try to not
> add to the issues.

obviously  i took examples from the existent code, and it uses "" in many ways.

Do I need to rewrite 'MY CHANGE' to something that Perl::critic would have ?

If yes i could do the same thing for the bug 8239. 

I agree with you charlie, let's see what happen with bug 8239 we are not hurry :)
Comment 3 Ian Wells 2014-04-07 16:09:27 CEST
(In reply to Charlie Brady from comment #2)
> (In reply to Stephane de Labrusse from comment #1)
> 
> > if you are agreed i could push to CVS
> 
> I don't support any change here until the SME9 peer is verified.

Whilst the SME 9 version is being verified here are some minor points:

As a good example the existing code has a line like:
$OUT .= "    Options +Indexes\n" if ($indexes eq 'enabled');

In this case "" is needed due to the \n
The literal string at the end only has single quotes i.e. 'enabled'
The equality is the variable and the literal if ($indexes eq 'enabled')


In the added code that format, which Perl::Critc would like, is not followed.

+    my $ssldb = $properties{'SSL'} || "disabled";
can be a literal, i.e. 'disabled' or 'unlimited' or 'enabled'

+        if ("$ssldb" eq 'enabled')
can be ($ssldb eq 'enabled')


There are also many bad examples in the existing code but let's try to not add to the issues.
Comment 2 Charlie Brady 2014-04-07 16:07:11 CEST
(In reply to Stephane de Labrusse from comment #1)

> if you are agreed i could push to CVS

I don't support any change here until the SME9 peer is verified.
Comment 1 Stephane de Labrusse 2014-04-07 15:41:54 CEST
Created attachment 4586 [details]
e-smith-ibays-2.2.0_add_php_values_and_SSLRequireSSL.patch

a patch to add some new PHP settings to ibays

[root@sme8dev64-2 ~]# db accounts setprop planet AllowUrlfOpen enabled
[root@sme8dev64-2 ~]# db accounts setprop planet MemoryLimit 256M     
[root@sme8dev64-2 ~]# db accounts setprop planet UpMaxFileSize 64M
[root@sme8dev64-2 ~]# db accounts setprop planet PostMaxSize 128M 
[root@sme8dev64-2 ~]# db accounts setprop planet MaxExecTime 300 
[root@sme8dev64-2 ~]# signal-event ibay-modify planet

M equal MB
time is in seconds without units, set 'unlimited' when you want to have the '0' value which mean unlimited in httpd.conf
AllowUrlfOpen : enabled/disabled

i saw that the bug 882 didn't be back-ported to sme8 therefore i have just added a 'SSLRequireSSL' if the existent option 'SSL' is enabled.

what i have tested

-verified in /etc/httpd/conf/httpd.conf that changes are written.
-verified with a file php.info that settings are interpreted by php
-no errors in /var/log/messages

if you are agreed i could push to CVS