initial commit of file from CVS for smeserver-php on Sat Mar 23 15:31:58 AEDT 2024
This commit is contained in:
36
root/etc/e-smith/db/accounts/migrate/20ibay-php
Normal file
36
root/etc/e-smith/db/accounts/migrate/20ibay-php
Normal file
@@ -0,0 +1,36 @@
|
||||
{
|
||||
my %old2new = (
|
||||
UpMaxFileSize => "UploadMaxFilesize",
|
||||
PHPUploadMaxFilesize => "UploadMaxFilesize",
|
||||
PHPPostMaxSize => "PostMaxSize",
|
||||
PHPMaxExecutionTime => "MaxExecutionTime",
|
||||
PHPMemoryLimit => "MemoryLimit",
|
||||
PHPAllowUrlfOpen => "AllowUrlFopen",
|
||||
PHPFileUpload => "FileUpload",
|
||||
PHPDisabledFunctions => "DisabledFunctions",
|
||||
PHPAutoPrependFile => "AutoPrependFile",
|
||||
PHPCustomPool => "CustomPool",
|
||||
PHPMaxInputTime => "MaxInputTime",
|
||||
MaxExecTime => "MaxExecutionTime",
|
||||
);
|
||||
|
||||
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);
|
||||
}
|
||||
for my $key (qw(MemoryLimit UploadMaxFilesize PostMaxSize MaxExecutionTime))
|
||||
{
|
||||
next unless (defined $ibay->prop($key));
|
||||
my $value = $DB->get_prop_and_delete($ibay->key, $key) if ($ibay->prop($key) eq "disabled");
|
||||
next unless $key eq "MaxExecutionTime";
|
||||
$DB->set_prop($ibay->key,MaxExecutionTime,0) if ($ibay->prop($key) eq "unlimited");
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
@@ -0,0 +1 @@
|
||||
enabled
|
1
root/etc/e-smith/db/configuration/defaults/php-fpm/type
Normal file
1
root/etc/e-smith/db/configuration/defaults/php-fpm/type
Normal file
@@ -0,0 +1 @@
|
||||
service
|
@@ -0,0 +1 @@
|
||||
Off
|
1
root/etc/e-smith/db/configuration/defaults/php/status
Normal file
1
root/etc/e-smith/db/configuration/defaults/php/status
Normal file
@@ -0,0 +1 @@
|
||||
enabled
|
1
root/etc/e-smith/db/configuration/defaults/php/type
Normal file
1
root/etc/e-smith/db/configuration/defaults/php/type
Normal file
@@ -0,0 +1 @@
|
||||
service
|
@@ -0,0 +1 @@
|
||||
enabled
|
@@ -0,0 +1 @@
|
||||
service
|
@@ -0,0 +1 @@
|
||||
Off
|
1
root/etc/e-smith/db/configuration/defaults/php55/type
Normal file
1
root/etc/e-smith/db/configuration/defaults/php55/type
Normal file
@@ -0,0 +1 @@
|
||||
configuration
|
@@ -0,0 +1 @@
|
||||
enabled
|
@@ -0,0 +1 @@
|
||||
service
|
@@ -0,0 +1 @@
|
||||
Off
|
1
root/etc/e-smith/db/configuration/defaults/php56/type
Normal file
1
root/etc/e-smith/db/configuration/defaults/php56/type
Normal file
@@ -0,0 +1 @@
|
||||
configuration
|
@@ -0,0 +1 @@
|
||||
enabled
|
@@ -0,0 +1 @@
|
||||
service
|
@@ -0,0 +1 @@
|
||||
Off
|
1
root/etc/e-smith/db/configuration/defaults/php70/type
Normal file
1
root/etc/e-smith/db/configuration/defaults/php70/type
Normal file
@@ -0,0 +1 @@
|
||||
configuration
|
@@ -0,0 +1 @@
|
||||
enabled
|
@@ -0,0 +1 @@
|
||||
service
|
@@ -0,0 +1 @@
|
||||
Off
|
1
root/etc/e-smith/db/configuration/defaults/php71/type
Normal file
1
root/etc/e-smith/db/configuration/defaults/php71/type
Normal file
@@ -0,0 +1 @@
|
||||
configuration
|
@@ -0,0 +1 @@
|
||||
enabled
|
@@ -0,0 +1 @@
|
||||
service
|
@@ -0,0 +1 @@
|
||||
Off
|
1
root/etc/e-smith/db/configuration/defaults/php72/type
Normal file
1
root/etc/e-smith/db/configuration/defaults/php72/type
Normal file
@@ -0,0 +1 @@
|
||||
configuration
|
@@ -0,0 +1 @@
|
||||
enabled
|
@@ -0,0 +1 @@
|
||||
service
|
@@ -0,0 +1 @@
|
||||
Off
|
1
root/etc/e-smith/db/configuration/defaults/php73/type
Normal file
1
root/etc/e-smith/db/configuration/defaults/php73/type
Normal file
@@ -0,0 +1 @@
|
||||
configuration
|
@@ -0,0 +1 @@
|
||||
enabled
|
@@ -0,0 +1 @@
|
||||
service
|
@@ -0,0 +1 @@
|
||||
Off
|
1
root/etc/e-smith/db/configuration/defaults/php74/type
Normal file
1
root/etc/e-smith/db/configuration/defaults/php74/type
Normal file
@@ -0,0 +1 @@
|
||||
configuration
|
@@ -0,0 +1 @@
|
||||
enabled
|
@@ -0,0 +1 @@
|
||||
service
|
@@ -0,0 +1 @@
|
||||
Off
|
1
root/etc/e-smith/db/configuration/defaults/php80/type
Normal file
1
root/etc/e-smith/db/configuration/defaults/php80/type
Normal file
@@ -0,0 +1 @@
|
||||
configuration
|
@@ -0,0 +1 @@
|
||||
enabled
|
@@ -0,0 +1 @@
|
||||
service
|
@@ -0,0 +1 @@
|
||||
Off
|
1
root/etc/e-smith/db/configuration/defaults/php81/type
Normal file
1
root/etc/e-smith/db/configuration/defaults/php81/type
Normal file
@@ -0,0 +1 @@
|
||||
configuration
|
@@ -0,0 +1 @@
|
||||
enabled
|
@@ -0,0 +1 @@
|
||||
service
|
@@ -0,0 +1 @@
|
||||
Off
|
1
root/etc/e-smith/db/configuration/defaults/php82/type
Normal file
1
root/etc/e-smith/db/configuration/defaults/php82/type
Normal file
@@ -0,0 +1 @@
|
||||
configuration
|
@@ -0,0 +1 @@
|
||||
enabled
|
@@ -0,0 +1 @@
|
||||
service
|
@@ -0,0 +1 @@
|
||||
Off
|
1
root/etc/e-smith/db/configuration/defaults/php83/type
Normal file
1
root/etc/e-smith/db/configuration/defaults/php83/type
Normal file
@@ -0,0 +1 @@
|
||||
configuration
|
6
root/etc/e-smith/db/configuration/migrate/PhpMagicQuotes
Normal file
6
root/etc/e-smith/db/configuration/migrate/PhpMagicQuotes
Normal file
@@ -0,0 +1,6 @@
|
||||
{
|
||||
|
||||
$DB->get_prop_and_delete ('php', 'MagicQuotes');
|
||||
|
||||
}
|
||||
|
28
root/etc/e-smith/events/actions/php-pool-customs
Normal file
28
root/etc/e-smith/events/actions/php-pool-customs
Normal file
@@ -0,0 +1,28 @@
|
||||
#!/usr/bin/perl -w
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use File::Path qw(make_path remove_tree);
|
||||
use esmith::ConfigDB;
|
||||
use esmith::util;
|
||||
|
||||
my $pool_db = esmith::ConfigDB->open_ro('php') || esmith::ConfigDB->create('php');
|
||||
|
||||
foreach my $pool ($pool_db->get_all_by_prop(type => 'pool')){
|
||||
my $status = $pool->prop('status') || 'enabled';
|
||||
next unless ($status eq 'enabled');
|
||||
my $key = $pool->key;
|
||||
my @dirs = ( "/var/log/php/$key",
|
||||
"/var/lib/php/$key/session",
|
||||
"/var/lib/php/$key/wsdlcache",
|
||||
"/var/lib/php/$key/opcache",
|
||||
"/var/lib/php/$key/tmp" );
|
||||
for (@dirs){
|
||||
esmith::util::chownFile("root", "www", $_) if -e $_;
|
||||
make_path( $_, {
|
||||
owner => 'root',
|
||||
group => 'www'
|
||||
}) unless -e $_;
|
||||
}
|
||||
chmod 0770, @dirs;
|
||||
}
|
52
root/etc/e-smith/events/actions/php-pool-dirs
Normal file
52
root/etc/e-smith/events/actions/php-pool-dirs
Normal file
@@ -0,0 +1,52 @@
|
||||
#!/usr/bin/perl -w
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use esmith::AccountsDB;
|
||||
use File::Path qw(make_path remove_tree);
|
||||
use esmith::util;
|
||||
|
||||
my $a = esmith::AccountsDB->open_ro || die "Couldn't open the accounts database\n";
|
||||
|
||||
my $event = shift;
|
||||
my $apool = shift;
|
||||
|
||||
my @pools = (defined $apool && $a->get($apool) ) ? map { $a->get($_); } $apool : ( $a->get_all_by_prop(type => "ibay" ) , $a->get_all_by_prop(type => "share" ));# unless $acc;
|
||||
|
||||
foreach my $acc (@pools){
|
||||
my $pool = $acc->key;
|
||||
my $type = $acc->prop('type');
|
||||
my $dyn = 'disabled';
|
||||
if ( $type eq "ibay") {
|
||||
$dyn = $acc->prop('CgiBin') || 'disabled';
|
||||
}
|
||||
else {
|
||||
$dyn = $acc->prop('DynamicContent') || 'disabled';
|
||||
}
|
||||
|
||||
if ($dyn =~ m/^enabled|on|1|yes$/ && $event ne 'share-delete' && $event ne 'ibay-delete'){
|
||||
my @dirs = ( "/var/log/php/$pool",
|
||||
"/var/lib/php/$pool/session",
|
||||
"/var/lib/php/$pool/wsdlcache",
|
||||
"/var/lib/php/$pool/opcache",
|
||||
"/var/lib/php/$pool/tmp" );
|
||||
# create dir if does not exist; set owner and group if create it
|
||||
# does not change ownership if folder already exists
|
||||
for (@dirs){
|
||||
esmith::util::chownFile("root", "www", $_) if -e $_;
|
||||
make_path( $_, {
|
||||
owner => 'root',
|
||||
group => 'www'
|
||||
}) unless -e $_;
|
||||
}
|
||||
chmod 0770, @dirs;
|
||||
}
|
||||
}
|
||||
|
||||
if ( defined $event && defined $apool && ($event eq 'share-delete' || $event eq 'ibay-delete') ) {
|
||||
my $acc = $a->get($apool);
|
||||
die "$apool not found in the account database\n" unless $acc;
|
||||
remove_tree( "/var/log/php/$apool",
|
||||
"/var/lib/php/$apool" );
|
||||
}
|
||||
|
11
root/etc/e-smith/templates-default/template-begin-ini
Normal file
11
root/etc/e-smith/templates-default/template-begin-ini
Normal file
@@ -0,0 +1,11 @@
|
||||
;------------------------------------------------------------
|
||||
; !!DO NOT MODIFY THIS FILE!!
|
||||
;
|
||||
; Manual changes will be lost when this file is regenerated.
|
||||
;
|
||||
; Please read the developer's guide, which is available
|
||||
; at http://www.contribs.org/development/
|
||||
;
|
||||
; Copyright (C) 1999-2006 Mitel Networks Corporation
|
||||
;------------------------------------------------------------
|
||||
|
@@ -0,0 +1 @@
|
||||
PERMS=0755
|
@@ -0,0 +1,2 @@
|
||||
TEMPLATE_PATH="/etc/php-fpm.conf"
|
||||
MORE_DATA={ PHP_VERSION => 70, FPM_POOL_DIR => "/etc/opt/remi/php70/php-fpm.d" }
|
@@ -0,0 +1,2 @@
|
||||
TEMPLATE_PATH="/etc/php-fpm.d/custom.conf"
|
||||
MORE_DATA={ PHP_VERSION => 70 }
|
@@ -0,0 +1,2 @@
|
||||
TEMPLATE_PATH="/etc/php-fpm.d/ibays.conf"
|
||||
MORE_DATA={ PHP_VERSION => 70 }
|
@@ -0,0 +1,2 @@
|
||||
TEMPLATE_PATH="/etc/php-fpm.d/www.conf"
|
||||
MORE_DATA={ PHP_VERSION => 70 }
|
@@ -0,0 +1,2 @@
|
||||
TEMPLATE_PATH="/etc/php.ini"
|
||||
MORE_DATA={ PHP_VERSION => 70, INCLUDE_PATH => ".:/opt/remi/php70/root/usr/share/pear:/opt/remi/php70/root/usr/share/php:/usr/share/php:/usr/share/pear", EXTENSION_DIR => "/opt/remi/php70/root/usr/lib64/php/modules" }
|
@@ -0,0 +1,2 @@
|
||||
TEMPLATE_PATH="/etc/sysconfig/php-fpm"
|
||||
MORE_DATA={ PHP_VERSION => 70 }
|
@@ -0,0 +1,2 @@
|
||||
TEMPLATE_PATH="/etc/php-fpm.conf"
|
||||
MORE_DATA={ PHP_VERSION => 71, FPM_POOL_DIR => "/etc/opt/remi/php71/php-fpm.d" }
|
@@ -0,0 +1,2 @@
|
||||
TEMPLATE_PATH="/etc/php-fpm.d/custom.conf"
|
||||
MORE_DATA={ PHP_VERSION => 71 }
|
@@ -0,0 +1,2 @@
|
||||
TEMPLATE_PATH="/etc/php-fpm.d/ibays.conf"
|
||||
MORE_DATA={ PHP_VERSION => 71 }
|
@@ -0,0 +1,2 @@
|
||||
TEMPLATE_PATH="/etc/php-fpm.d/www.conf"
|
||||
MORE_DATA={ PHP_VERSION => 71 }
|
@@ -0,0 +1,2 @@
|
||||
TEMPLATE_PATH="/etc/php.ini"
|
||||
MORE_DATA={ PHP_VERSION => 71, INCLUDE_PATH => ".:/opt/remi/php70/root/usr/share/pear:/opt/remi/php71/root/usr/share/php:/usr/share/php:/usr/share/pear", EXTENSION_DIR => "/opt/remi/php71/root/usr/lib64/php/modules" }
|
@@ -0,0 +1,2 @@
|
||||
TEMPLATE_PATH="/etc/sysconfig/php-fpm"
|
||||
MORE_DATA={ PHP_VERSION => 71 }
|
@@ -0,0 +1,3 @@
|
||||
TEMPLATE_PATH="/etc/php.ini"
|
||||
MORE_DATA={ PHP_VERSION => 72, INCLUDE_PATH => ".:/opt/remi/php72/root/usr/share/pear:/opt/remi/php72/root/usr/share/php:/usr/share/php:/usr/share/pear", EXTENSION_DIR => "/opt/remi/php72/root/usr/lib64/php/modules" }
|
||||
|
@@ -0,0 +1,2 @@
|
||||
TEMPLATE_PATH="/etc/php.ini"
|
||||
MORE_DATA={ PHP_VERSION => 73, INCLUDE_PATH => ".:/opt/remi/php73/root/usr/share/pear:/opt/remi/php73/root/usr/share/php:/usr/share/php:/usr/share/pear", EXTENSION_DIR => "/opt/remi/php73/root/usr/lib64/php/modules" }
|
@@ -0,0 +1,2 @@
|
||||
TEMPLATE_PATH="/etc/php.ini"
|
||||
MORE_DATA={ PHP_VERSION => 74, INCLUDE_PATH => ".:/opt/remi/php74/root/usr/share/pear:/opt/remi/php74/root/usr/share/php:/usr/share/php:/usr/share/pear", EXTENSION_DIR => "/opt/remi/php74/root/usr/lib64/php/modules" }
|
@@ -0,0 +1 @@
|
||||
MORE_DATA={ PHP_VERSION => 80, INCLUDE_PATH => ".:/opt/remi/php80/root/usr/share/pear:/opt/remi/php80/root/usr/share/php:/usr/share/php:/usr/share/pear", EXTENSION_DIR => "/opt/remi/php80/root/usr/lib64/php/modules" }
|
@@ -0,0 +1 @@
|
||||
MORE_DATA={ PHP_VERSION => 81, INCLUDE_PATH => ".:/opt/remi/php81/root/usr/share/pear:/opt/remi/php81/root/usr/share/php:/usr/share/php:/usr/share/pear", EXTENSION_DIR => "/opt/remi/php81/root/usr/lib64/php/modules" }
|
@@ -0,0 +1 @@
|
||||
MORE_DATA={ PHP_VERSION => 82, INCLUDE_PATH => ".:/opt/remi/php82/root/usr/share/pear:/opt/remi/php82/root/usr/share/php:/usr/share/php:/usr/share/pear", EXTENSION_DIR => "/opt/remi/php82/root/usr/lib64/php/modules" }
|
@@ -0,0 +1 @@
|
||||
MORE_DATA={ PHP_VERSION => 83, INCLUDE_PATH => ".:/opt/remi/php83/root/usr/share/pear:/opt/remi/php83/root/usr/share/php:/usr/share/php:/usr/share/pear", EXTENSION_DIR => "/opt/remi/php83/root/usr/lib64/php/modules" }
|
2
root/etc/e-smith/templates.metadata/etc/php-fpm.conf
Normal file
2
root/etc/e-smith/templates.metadata/etc/php-fpm.conf
Normal file
@@ -0,0 +1,2 @@
|
||||
TEMPLATE_PATH="/etc/php-fpm.conf"
|
||||
MORE_DATA={ PHP_VERSION => '', FPM_POOL_DIR => "/etc/php-fpm.d" }
|
@@ -0,0 +1,2 @@
|
||||
TEMPLATE_PATH="/etc/php-fpm.d/custom.conf"
|
||||
MORE_DATA={ PHP_VERSION => '' }
|
@@ -0,0 +1,2 @@
|
||||
TEMPLATE_PATH="/etc/php-fpm.d/ibays.conf"
|
||||
MORE_DATA={ PHP_VERSION => '' }
|
@@ -0,0 +1,2 @@
|
||||
TEMPLATE_PATH="/etc/php-fpm.d/www.conf"
|
||||
MORE_DATA={ PHP_VERSION => '' }
|
2
root/etc/e-smith/templates.metadata/etc/php.ini
Normal file
2
root/etc/e-smith/templates.metadata/etc/php.ini
Normal file
@@ -0,0 +1,2 @@
|
||||
TEMPLATE_PATH="/etc/php.ini"
|
||||
MORE_DATA={ PHP_VERSION => '', INCLUDE_PATH => ".:/usr/share/php:/usr/share/pear", EXTENSION_DIR => "" }
|
@@ -0,0 +1,2 @@
|
||||
TEMPLATE_PATH="/etc/php.ini"
|
||||
MORE_DATA={ PHP_VERSION => 55, INCLUDE_PATH => ".:/opt/remi/php55/root/usr/share/pear:/opt/remi/php55/root/usr/share/php:/usr/share/php:/usr/share/pear", EXTENSION_DIR => "/opt/remi/php55/root/usr/lib64/php/modules" }
|
@@ -0,0 +1,2 @@
|
||||
TEMPLATE_PATH="/etc/php-fpm.conf"
|
||||
MORE_DATA={ PHP_VERSION => 56, FPM_POOL_DIR => "/opt/remi/php56/root/etc/php-fpm.d" }
|
@@ -0,0 +1,2 @@
|
||||
TEMPLATE_PATH="/etc/php-fpm.d/custom.conf"
|
||||
MORE_DATA={ PHP_VERSION => 56 }
|
@@ -0,0 +1,2 @@
|
||||
TEMPLATE_PATH="/etc/php-fpm.d/ibays.conf"
|
||||
MORE_DATA={ PHP_VERSION => 56 }
|
@@ -0,0 +1,2 @@
|
||||
TEMPLATE_PATH="/etc/php-fpm.d/www.conf"
|
||||
MORE_DATA={ PHP_VERSION => 56 }
|
@@ -0,0 +1,2 @@
|
||||
TEMPLATE_PATH="/etc/php.ini"
|
||||
MORE_DATA={ PHP_VERSION => 56, INCLUDE_PATH => ".:/opt/remi/php56/root/usr/share/pear:/opt/remi/php56/root/usr/share/php:/usr/share/php:/usr/share/pear", EXTENSION_DIR => "/opt/remi/php56/root/usr/lib64/php/modules" }
|
@@ -0,0 +1,2 @@
|
||||
TEMPLATE_PATH="/etc/sysconfig/php-fpm"
|
||||
MORE_DATA={ PHP_VERSION => 56 }
|
@@ -0,0 +1,8 @@
|
||||
|
||||
for VER in php php55 php56 php70 php71 php72 php73 php74 php80 php81 php82 php83; do
|
||||
/usr/sbin/tmpwatch -umc --nodirs -q 7d /var/lib/php/$VER/tmp
|
||||
/usr/sbin/tmpwatch -umc --nodirs -q 7d /var/lib/php/$VER/opcache
|
||||
/usr/sbin/tmpwatch -umc --nodirs -q 7d /var/lib/php/$VER/wsdlcache
|
||||
/usr/sbin/tmpwatch -umc --nodirs -q 7d /var/lib/php/$VER/opcache
|
||||
done
|
||||
|
@@ -0,0 +1,14 @@
|
||||
{
|
||||
use esmith::AccountsDB;
|
||||
my $a = esmith::AccountsDB->open_ro || die "Couldn't open the accounts database\n";
|
||||
foreach my $ibay ($a->get_all_by_prop(type => 'ibay')){
|
||||
next unless (($ibay->prop('CgiBin') || 'disabled') =~ m/^enabled|on|yes|1$/);
|
||||
my $key = $ibay->key;
|
||||
$OUT .=_EOF;
|
||||
/usr/sbin/tmpwatch -umc --nodirs -q 7d /var/lib/php/$key/tmp
|
||||
/usr/sbin/tmpwatch -umc --nodirs -q 7d /var/lib/php/$key/opcache
|
||||
/usr/sbin/tmpwatch -umc --nodirs -q 7d /var/lib/php/$key/wsdlcache
|
||||
/usr/sbin/tmpwatch -umc --nodirs -q 7d /var/lib/php/$key/opcache
|
||||
_EOF
|
||||
}
|
||||
}
|
@@ -0,0 +1,14 @@
|
||||
{
|
||||
use esmith::AccountsDB;
|
||||
my $a = esmith::AccountsDB->open_ro || die "Couldn't open the accounts database\n";
|
||||
foreach my $share ($a->get_all_by_prop(type => 'share')){
|
||||
next unless (($share->prop('DynamicContent') || 'disabled') =~ m/^enabled|on|yes|1$/);
|
||||
my $key = $share->key;
|
||||
$OUT .=_EOF;
|
||||
/usr/sbin/tmpwatch -umc --nodirs -q 7d /var/lib/php/$key/tmp
|
||||
/usr/sbin/tmpwatch -umc --nodirs -q 7d /var/lib/php/$key/opcache
|
||||
/usr/sbin/tmpwatch -umc --nodirs -q 7d /var/lib/php/$key/wsdlcache
|
||||
/usr/sbin/tmpwatch -umc --nodirs -q 7d /var/lib/php/$key/opcache
|
||||
_EOF
|
||||
}
|
||||
}
|
@@ -0,0 +1,17 @@
|
||||
{
|
||||
$phpModule = $php{phpModule} || 'disabled';
|
||||
# default we return with nothing activated
|
||||
return "#PHP mod is disabled by default, please use PHP-fpm" unless (exists $php{status} and $php{status} eq "enabled" and $phpModule eq "enabled");
|
||||
|
||||
use esmith::php;
|
||||
our $PHPVersion = PHPdefault(1);
|
||||
my $phpMR = substr($PHPVersion,0,1) || '';
|
||||
#php7 software collection libphp72.so
|
||||
return "LoadModule php$\{phpMR\}_module modules/libphp$PHPVersion.so\n" if (-r "/usr/lib64/httpd/modules/libphp$PHPVersion.so");
|
||||
#php5 software collection libphp56-php5.so
|
||||
return "LoadModule php$\{phpMR\}_module modules/libphp$PHPVersion-php$phpMR.so\n" if (-r "/usr/lib64/httpd/modules/libphp$PHPVersion-php$phpMR.so");
|
||||
# else we default to base php
|
||||
return "LoadModule php5_module modules/libphp5.so" if ( -r "/usr/lib/httpd/modules/libphp5.so" ||
|
||||
-r "/usr/lib64/httpd/modules/libphp5.so" );
|
||||
return "#no PHP module found";
|
||||
}
|
@@ -0,0 +1,6 @@
|
||||
{
|
||||
$fastcgi_mod = 'mod_proxy_fcgi';
|
||||
$OUT .=<<_EOF;
|
||||
LoadModule proxy_fcgi_module modules/mod_proxy_fcgi.so
|
||||
_EOF
|
||||
}
|
@@ -0,0 +1,10 @@
|
||||
{
|
||||
return "" unless (defined $php{'status'} and $php{'status'} eq 'enabled');
|
||||
|
||||
my @directives = qw(
|
||||
index.htm index.html index.shtml index.cgi
|
||||
index.php index.phtml
|
||||
);
|
||||
|
||||
$OUT = "DirectoryIndex @directives\n";
|
||||
}
|
@@ -0,0 +1,15 @@
|
||||
{
|
||||
return "" unless (exists $php{status} and $php{status} eq "enabled");
|
||||
|
||||
$OUT =<<HERE;
|
||||
|
||||
<IfModule mod_php5.c>
|
||||
AddIcon /icons/php.gif .phps .php .phtml
|
||||
</IfModule>
|
||||
|
||||
<IfModule mod_php7.c>
|
||||
AddIcon /icons/php.gif .phps .php .phtml
|
||||
</IfModule>
|
||||
|
||||
HERE
|
||||
}
|
@@ -0,0 +1,35 @@
|
||||
{
|
||||
$OUT = '';
|
||||
|
||||
use esmith::DomainsDB;
|
||||
|
||||
my $db = esmith::DomainsDB->open_ro;
|
||||
unless ($db){
|
||||
warn "Couldn't open domains DB in VirtualHosts template fragment";
|
||||
return;
|
||||
}
|
||||
|
||||
my @vhosts = $db->get_all_by_prop('type' => 'vhost');
|
||||
foreach my $vhost (@vhosts) {
|
||||
my $templatePath = $vhost->prop('TemplatePath') || 'WebAppVirtualHost';
|
||||
foreach my $port ($httpPort, $httpsPort){
|
||||
my %virtualHost = (
|
||||
ipAddress => '0.0.0.0',
|
||||
port => $port,
|
||||
localAccess => $localAccess,
|
||||
externalSSLAccess => $externalSSLAccess,
|
||||
domain => $vhost,
|
||||
httpPort => $httpPort,
|
||||
httpsPort => $httpsPort
|
||||
);
|
||||
|
||||
$OUT .= esmith::templates::processTemplate (
|
||||
{
|
||||
MORE_DATA => \%virtualHost,
|
||||
TEMPLATE_PATH =>
|
||||
"/etc/httpd/conf/httpd.conf/$templatePath",
|
||||
OUTPUT_TYPE => 'string',
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,92 @@
|
||||
{
|
||||
use esmith::php;
|
||||
my $status = $php{status} || 'disabled';
|
||||
if ($status eq 'enabled')
|
||||
{
|
||||
use esmith::AccountsDB;
|
||||
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')
|
||||
{
|
||||
$OUT .= "\n<Directory /home/e-smith/files/ibays/" . $ibay->key . "/html>\n";
|
||||
# configuration to enable php-fpm for the ibay
|
||||
my $version = PhpFpmVersionToUse($ibay);
|
||||
if ($fastcgi_mod eq 'mod_proxy_fcgi')
|
||||
{
|
||||
my $name = lc $key;
|
||||
my $FilesMathes = ( ($ibay->prop('AllowPHTML') || $defaultPHPproperties{'AllowPHTML'}) eq 'enabled' ) ? '(xml|phtml|html|htm|php|phar)': '(phar|php)';
|
||||
|
||||
$OUT .=<<"_EOF";
|
||||
SetEnvIf Authorization "(.*)" HTTP_AUTHORIZATION=\$1
|
||||
<FilesMatch \\.$FilesMathes\$>
|
||||
<If "-f \%\{SCRIPT_FILENAME\}">
|
||||
SetHandler "proxy:unix:/var/run/php-fpm/php$version-$name.sock|fcgi://localhost"
|
||||
</If>
|
||||
</FilesMatch>
|
||||
_EOF
|
||||
}
|
||||
else
|
||||
{
|
||||
my $FilesMathes = ( ($ibay->prop('AllowPHTML') || $defaultPHPproperties{'AllowPHTML'}) eq 'enabled' ) ? '.xml .phtml .html .htm ': '';
|
||||
$OUT .= " AddType application/x-httpd-php .php .phar $FilesMathes\n";
|
||||
$OUT .= " AddType application/x-httpd-php-source .phps\n";
|
||||
|
||||
# the following block is only in case phpmodule is enabled.
|
||||
if (exists $php{status} and $php{status} eq "enabled" and $phpModule eq "enabled")
|
||||
{
|
||||
my $allow_url_fopen = $properties{'AllowUrlFopen'} || $defaultPHPproperties{'AllowUrlFopen'} ;
|
||||
my $memoryLimit = $properties{'MemoryLimit'} || $defaultPHPproperties{'MemoryLimit'};
|
||||
my $upmaxfileSize = $properties{'UploadMaxFilesize'} || $defaultPHPproperties{'UploadMaxFilesize'};
|
||||
my $postmaxSize = $properties{'PostMaxSize'} || $defaultPHPproperties{'PostMaxSize'};
|
||||
my $file_upload = $properties{'FileUpload'} || $defaultPHPproperties{'FileUpload'};
|
||||
my $maxexecutionTime = (defined $properties{'MaxExecutionTime'}) ? $properties{'MaxExecutionTime'} : $defaultPHPproperties{'MaxExecutionTime'};
|
||||
my $max_input_time = (defined $properties{'MaxInputTime'}) ? $properties{'MaxInputTime'} : $defaultPHPproperties{'MaxInputTime'};
|
||||
my $display_errors = $properties{'DisplayErrors'} || 'off';
|
||||
my $error_reporting = $properties{'ErrorReporting'} || 'E_ALL & ~E_NOTICE & ~E_DEPRECATED & ~E_STRICT';
|
||||
|
||||
$maxexecutionTime = '0' if $maxexecutionTime eq 'unlimited';
|
||||
$file_upload = ($file_upload =~ m/^1|yes|on|enabled$/) ? 'on' : 'off';
|
||||
$allow_url_fopen = ($allow_url_fopen =~ m/^1|yes|on|enabled$/) ? 'on' : 'off';
|
||||
$display_errors = ($display_errors =~ m/^1|yes|on|enabled$/) ? 'on' : 'off';
|
||||
$error_reporting = ($error_reporting eq 'E_ALL & ~E_NOTICE & ~E_DEPRECATED & ~E_STRICT') ? '; default error_reporting' : "php_value[error_reporting] = $error_reporting";
|
||||
|
||||
$OUT .= " php_admin_flag allow_url_fopen $allow_url_fopen\n";
|
||||
$OUT .= " php_admin_value memory_limit $memoryLimit\n";
|
||||
$OUT .= " php_admin_value upload_max_filesize $upmaxfileSize\n";
|
||||
$OUT .= " php_admin_value post_max_size $postmaxSize\n" ;
|
||||
$OUT .= " php_admin_flag file_upload $file_upload\n";
|
||||
$OUT .= " php_admin_value max_input_time $max_input_time\n";
|
||||
$OUT .= " php_admin_value max_execution_time $maxexecutionTime\n";
|
||||
$OUT .= " php_flag display_errors $display_errors\n";
|
||||
$OUT .= " $error_reporting\n";
|
||||
|
||||
# Set upload_tmp_dir and sys_temp_dir where php can upload files or write tmp files
|
||||
$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
|
||||
$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')
|
||||
|| ("/home/e-smith/files/ibays/$key/");
|
||||
$basedir .= ":/var/lib/php/$key/";
|
||||
$basedir .= ":/usr/share/php/:/usr/share/pear/";
|
||||
if ( -d "/opt/remi/php$version/root/usr/share/pear/" && -d "/opt/remi/php$version/root/usr/share/php/")
|
||||
{
|
||||
$basedir .= ":/opt/remi/php$version/root/usr/share/pear/:/opt/remi/php$version/root/usr/share/php/";
|
||||
}
|
||||
$OUT .= " php_admin_value open_basedir $basedir\n";
|
||||
}
|
||||
}
|
||||
$OUT .= "</Directory>\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,9 @@
|
||||
{
|
||||
use esmith::DomainsDB;
|
||||
# Convert the passed hash for the domain object back into an object.
|
||||
$domain = bless \%domain, 'esmith::DB::db::Record';
|
||||
|
||||
# Make scalars from some of the properties of the domain
|
||||
$virtualHost = $domain->key;
|
||||
$OUT = "";
|
||||
}
|
@@ -0,0 +1 @@
|
||||
ServerName {$virtualHost}
|
@@ -0,0 +1,13 @@
|
||||
ServerAlias {
|
||||
|
||||
use esmith::HostsDB;
|
||||
use esmith::DomainsDB;
|
||||
my $hdb = esmith::HostsDB->open_ro();
|
||||
my %domains = map { $_->key => 1 } esmith::DomainsDB->open_ro->domains;
|
||||
my @hosts = grep {
|
||||
my $h = $_;
|
||||
($h->prop('HostType') eq 'Self') && !$domains{$h->key}
|
||||
} $hdb->get_hosts_by_domain($virtualHost);
|
||||
$OUT = join " ", map { $_->key } @hosts;
|
||||
}
|
||||
|
@@ -0,0 +1,28 @@
|
||||
{
|
||||
my $ssl = $domain->prop('RequireSSL') || 'disabled';
|
||||
my $auth = $domain->prop('Authentication') || 'none';
|
||||
|
||||
if ($httpsPort eq $port){
|
||||
$OUT .= " SSLEngine on\n";
|
||||
}
|
||||
elsif (($ssl =~ m/^enabled|yes|on|1$/i) || ($auth =~ /^LemonLDAP/)){
|
||||
$OUT .=<<'EOF';
|
||||
RewriteEngine on
|
||||
RewriteCond %{REQUEST_URI} !^/.well-known/acme-challenge/.*
|
||||
RewriteRule ^/(.*|$) https://%{HTTP_HOST}/$1 [L,R]
|
||||
|
||||
EOF
|
||||
}
|
||||
elsif ($ssl =~ m#/#){
|
||||
$OUT .= " RewriteEngine on\n";
|
||||
foreach my $loc (split(/[;,]/, $ssl)){
|
||||
$OUT .= " # Rewriting $loc to use SSL\n";
|
||||
$loc =~ s#^/##;
|
||||
$OUT .= " RewriteRule ^/$loc(/.*|\$) https://%\{HTTP_HOST\}/$loc\$1 \[L,R\]\n";
|
||||
}
|
||||
}
|
||||
else{
|
||||
$OUT .= '';
|
||||
}
|
||||
}
|
||||
|
@@ -0,0 +1,8 @@
|
||||
{
|
||||
$OUT =<<'HERE';
|
||||
RewriteEngine on
|
||||
RewriteCond %{REQUEST_METHOD} ^(TRACE|TRACK)
|
||||
RewriteRule .* - [F]
|
||||
HERE
|
||||
}
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user