Skip to content

Commit 80b5deb

Browse files
author
Marius Cramer
committed
Merge branch 'stable-3.0.5' of /home/git/repositories/pixcept/ispconfig3 into stable-3.0.5
2 parents 30848e2 + 8133de0 commit 80b5deb

File tree

7 files changed

+195
-60
lines changed

7 files changed

+195
-60
lines changed

server/conf/apache_apps.vhost.master

Lines changed: 26 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -4,38 +4,46 @@
44
# for the ISPConfig apps vhost
55
######################################################
66

7-
{vhost_port_listen} Listen {apps_vhost_port}
8-
# NameVirtualHost *:{apps_vhost_port}
7+
{tmpl_var name='vhost_port_listen'} Listen {tmpl_var name='apps_vhost_port'}
8+
# NameVirtualHost *:{tmpl_var name='apps_vhost_port'}
99

10-
<VirtualHost {apps_vhost_ip}:{apps_vhost_port}>
10+
<VirtualHost {tmpl_var name='apps_vhost_ip'}:{tmpl_var name='apps_vhost_port'}>
1111
ServerAdmin webmaster@localhost
12-
{apps_vhost_servername}
12+
{tmpl_var name='apps_vhost_servername'}
1313

1414
<FilesMatch "\.ph(p3?|tml)$">
1515
SetHandler None
1616
</FilesMatch>
1717

1818
<IfModule mod_php5.c>
19-
DocumentRoot {apps_vhost_dir}
19+
DocumentRoot {tmpl_var name='apps_vhost_dir'}
2020
AddType application/x-httpd-php .php
21-
<Directory {apps_vhost_dir}>
22-
Options FollowSymLinks
23-
AllowOverride None
24-
Order allow,deny
25-
Allow from all
21+
<Directory {tmpl_var name='apps_vhost_dir'}>
22+
Options FollowSymLinks
23+
AllowOverride None
24+
{tmpl_if name='apache_version' op='>' value='2.2' format='version'}
25+
Require all granted
26+
{tmpl_else}
27+
Order allow,deny
28+
Allow from all
29+
{/tmpl_if}
2630
</Directory>
2731
</IfModule>
2832

2933
<IfModule mod_fcgid.c>
30-
DocumentRoot {apps_vhost_dir}
34+
DocumentRoot {tmpl_var name='apps_vhost_dir'}
3135
SuexecUserGroup ispapps ispapps
32-
<Directory {apps_vhost_dir}>
33-
Options Indexes FollowSymLinks MultiViews +ExecCGI
34-
AllowOverride AuthConfig Indexes Limit Options FileInfo
35-
AddHandler fcgid-script .php
36-
FCGIWrapper {apps_vhost_basedir}/php-fcgi-scripts/apps/.php-fcgi-starter .php
37-
Order allow,deny
38-
Allow from all
36+
<Directory {tmpl_var name='apps_vhost_dir'}>
37+
Options Indexes FollowSymLinks MultiViews +ExecCGI
38+
AllowOverride AuthConfig Indexes Limit Options FileInfo
39+
AddHandler fcgid-script .php
40+
FCGIWrapper {tmpl_var name='apps_vhost_basedir'}/php-fcgi-scripts/apps/.php-fcgi-starter .php
41+
{tmpl_if name='apache_version' op='>' value='2.2' format='version'}
42+
Require all granted
43+
{tmpl_else}
44+
Order allow,deny
45+
Allow from all
46+
{/tmpl_if}
3947
</Directory>
4048
</IfModule>
4149

server/conf/apache_ispconfig.conf.master

Lines changed: 52 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -8,61 +8,100 @@ CustomLog "| /usr/local/ispconfig/server/scripts/vlogger -s access.log -t \"%Y%m
88

99
<Directory /var/www/clients>
1010
AllowOverride None
11-
Order Deny,Allow
12-
Deny from all
11+
{tmpl_if name='apache_version' op='>' value='2.2' format='version'}
12+
Require all deny
13+
{tmpl_else}
14+
Order Deny,Allow
15+
Deny from all
16+
{/tmpl_if}
1317
</Directory>
1418

1519
# Do not allow access to the root file system of the server for security reasons
1620
<Directory />
1721
AllowOverride None
18-
Order Deny,Allow
19-
Deny from all
22+
{tmpl_if name='apache_version' op='>' value='2.2' format='version'}
23+
Require all deny
24+
{tmpl_else}
25+
Order Deny,Allow
26+
Deny from all
27+
{/tmpl_if}
2028
</Directory>
2129

2230
<Directory /var/www/conf>
2331
AllowOverride None
24-
Order Deny,Allow
25-
Deny from all
32+
{tmpl_if name='apache_version' op='>' value='2.2' format='version'}
33+
Require all deny
34+
{tmpl_else}
35+
Order Deny,Allow
36+
Deny from all
37+
{/tmpl_if}
2638
</Directory>
2739

2840
# Except of the following directories that contain website scripts
2941
<Directory /usr/share/phpmyadmin>
42+
{tmpl_if name='apache_version' op='>' value='2.2' format='version'}
43+
Require all granted
44+
{tmpl_else}
3045
Order allow,deny
3146
Allow from all
47+
{/tmpl_if}
3248
</Directory>
3349

3450
<Directory /usr/share/phpMyAdmin>
51+
{tmpl_if name='apache_version' op='>' value='2.2' format='version'}
52+
Require all granted
53+
{tmpl_else}
3554
Order allow,deny
3655
Allow from all
56+
{/tmpl_if}
3757
</Directory>
3858

3959
<Directory /usr/share/squirrelmail>
60+
{tmpl_if name='apache_version' op='>' value='2.2' format='version'}
61+
Require all granted
62+
{tmpl_else}
4063
Order allow,deny
4164
Allow from all
65+
{/tmpl_if}
4266
</Directory>
4367

4468
# Allow access to mailman on OpenSuSE
4569
<Directory /usr/lib/mailman/cgi-bin>
46-
AllowOverride All
47-
order allow,deny
48-
allow from all
70+
{tmpl_if name='apache_version' op='>' value='2.2' format='version'}
71+
Require all granted
72+
{tmpl_else}
73+
Order allow,deny
74+
Allow from all
75+
{/tmpl_if}
4976
</Directory>
5077

5178
<Directory /usr/lib/mailman/icons>
52-
order allow,deny
53-
allow from all
79+
{tmpl_if name='apache_version' op='>' value='2.2' format='version'}
80+
Require all granted
81+
{tmpl_else}
82+
Order allow,deny
83+
Allow from all
84+
{/tmpl_if}
5485
</Directory>
5586

5687
<Directory /var/lib/mailman/archives/>
5788
Options +FollowSymLinks
58-
order allow,deny
59-
allow from all
89+
{tmpl_if name='apache_version' op='>' value='2.2' format='version'}
90+
Require all granted
91+
{tmpl_else}
92+
Order allow,deny
93+
Allow from all
94+
{/tmpl_if}
6095
</Directory>
6196

6297
# allow path to awstats and alias for awstats icons
6398
<Directory /usr/share/awstats>
99+
{tmpl_if name='apache_version' op='>' value='2.2' format='version'}
100+
Require all granted
101+
{tmpl_else}
64102
Order allow,deny
65103
Allow from all
104+
{/tmpl_if}
66105
</Directory>
67106

68107
Alias /awstats-icon "/usr/share/awstats/icon"

server/conf/vhost.conf.master

Lines changed: 47 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
11

22
<Directory {tmpl_var name='web_basedir'}/{tmpl_var name='domain'}>
33
AllowOverride None
4+
{tmpl_if name='apache_version' op='>' value='2.2' format='version'}
5+
Require all deny
6+
{tmpl_else}
47
Order Deny,Allow
58
Deny from all
9+
{/tmpl_if}
610
</Directory>
711

812
<tmpl_loop name="vhosts">
@@ -55,8 +59,12 @@
5559
<Directory {tmpl_var name='web_document_root_www'}>
5660
Options FollowSymLinks
5761
AllowOverride <tmpl_var name='allow_override'>
62+
{tmpl_if name='apache_version' op='>' value='2.2' format='version'}
63+
Require all granted
64+
{tmpl_else}
5865
Order allow,deny
5966
Allow from all
67+
{/tmpl_if}
6068
<tmpl_if name='ssi' op='==' value='y'>
6169

6270
# ssi enabled
@@ -66,17 +74,25 @@
6674
</tmpl_if>
6775
<tmpl_if name='php' op='==' value='no'>
6876
<Files ~ '.php[s3-6]{0,1}$'>
77+
{tmpl_if name='apache_version' op='>' value='2.2' format='version'}
78+
Require all denied
79+
{tmpl_else}
6980
Order allow,deny
7081
Deny from all
7182
Allow from none
83+
{/tmpl_if}
7284
</Files>
7385
</tmpl_if>
7486
</Directory>
7587
<Directory {tmpl_var name='web_document_root'}>
7688
Options FollowSymLinks
7789
AllowOverride <tmpl_var name='allow_override'>
90+
{tmpl_if name='apache_version' op='>' value='2.2' format='version'}
91+
Require all granted
92+
{tmpl_else}
7893
Order allow,deny
7994
Allow from all
95+
{/tmpl_if}
8096
<tmpl_if name='ssi' op='==' value='y'>
8197

8298
# ssi enabled
@@ -86,9 +102,13 @@
86102
</tmpl_if>
87103
<tmpl_if name='php' op='==' value='no'>
88104
<Files ~ '.php[s3-6]{0,1}$'>
89-
Order allow,deny
90-
Deny from all
91-
Allow from none
105+
{tmpl_if name='apache_version' op='>' value='2.2' format='version'}
106+
Require all denied
107+
{tmpl_else}
108+
Order allow,deny
109+
Deny from all
110+
Allow from none
111+
{/tmpl_if}
92112
</Files>
93113
</tmpl_if>
94114
</Directory>
@@ -141,8 +161,12 @@
141161
<tmpl_if name='cgi' op='==' value='y'>
142162
# cgi enabled
143163
<Directory {tmpl_var name='document_root'}/cgi-bin>
164+
{tmpl_if name='apache_version' op='>' value='2.2' format='version'}
165+
Require all granted
166+
{tmpl_else}
144167
Order allow,deny
145168
Allow from all
169+
{/tmpl_if}
146170
</Directory>
147171
ScriptAlias /cgi-bin/ <tmpl_var name='document_root'>/cgi-bin/
148172
AddHandler cgi-script .cgi
@@ -189,8 +213,12 @@
189213
Action php5-cgi /php5-cgi
190214
AddHandler php5-cgi .php .php3 .php4 .php5
191215
<Directory {tmpl_var name='cgi_starter_path'}>
192-
Order allow,deny
193-
Allow from all
216+
{tmpl_if name='apache_version' op='>' value='2.2' format='version'}
217+
Require all granted
218+
{tmpl_else}
219+
Order allow,deny
220+
Allow from all
221+
{/tmpl_if}
194222
</Directory>
195223
</tmpl_if>
196224
<tmpl_if name='php' op='==' value='fast-cgi'>
@@ -224,23 +252,35 @@
224252
FCGIWrapper <tmpl_var name='fastcgi_starter_path'><tmpl_var name='fastcgi_starter_script'> .php
225253
Options +ExecCGI
226254
AllowOverride <tmpl_var name='allow_override'>
255+
{tmpl_if name='apache_version' op='>' value='2.2' format='version'}
256+
Require all granted
257+
{tmpl_else}
227258
Order allow,deny
228259
Allow from all
260+
{/tmpl_if}
229261
</Directory>
230262
<Directory {tmpl_var name='web_document_root'}>
231263
AddHandler fcgid-script .php .php3 .php4 .php5
232264
FCGIWrapper <tmpl_var name='fastcgi_starter_path'><tmpl_var name='fastcgi_starter_script'> .php
233265
Options +ExecCGI
234266
AllowOverride <tmpl_var name='allow_override'>
267+
{tmpl_if name='apache_version' op='>' value='2.2' format='version'}
268+
Require all granted
269+
{tmpl_else}
235270
Order allow,deny
236271
Allow from all
272+
{/tmpl_if}
237273
</Directory>
238274
</tmpl_if>
239275
<tmpl_if name='php' op='==' value='php-fpm'>
240276
<IfModule mod_fastcgi.c>
241277
<Directory {tmpl_var name='document_root'}/cgi-bin>
242-
Order allow,deny
243-
Allow from all
278+
{tmpl_if name='apache_version' op='>' value='2.2' format='version'}
279+
Require all granted
280+
{tmpl_else}
281+
Order allow,deny
282+
Allow from all
283+
{/tmpl_if}
244284
</Directory>
245285
AddHandler php5-fcgi .php
246286
Action php5-fcgi /php5-fcgi

server/lib/classes/system.inc.php

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1724,6 +1724,31 @@ function getinitcommand($servicename, $action, $init_script_directory = ''){
17241724
if(substr($init_script_directory, -1) === '/') $init_script_directory = substr($init_script_directory, 0, -1);
17251725
return $init_script_directory.'/'.$servicename.' '.$action;
17261726
}
1727+
1728+
function getapacheversion($get_minor = false) {
1729+
global $app;
1730+
1731+
$cmd = '';
1732+
if($this->is_installed('apache2ctl')) $cmd = 'apache2ctl -v';
1733+
elseif($this->is_installed('apachectl')) $cmd = 'apachectl -v';
1734+
else {
1735+
$app->log("Could not check apache version, apachectl not found.", LOGLEVEL_WARN);
1736+
return '2.2';
1737+
}
1738+
1739+
exec($cmd, $output, $return_var);
1740+
if($return_var != 0 || !$output[0]) {
1741+
$app->log("Could not check apache version, apachectl did not return any data.", LOGLEVEL_WARN);
1742+
return '2.2';
1743+
}
1744+
1745+
if(preg_match('/version:\s*Apache\/(\d+)(\.(\d+)(\.(\d+))*)?(\D|$)/i', $output[0], $matches)) {
1746+
return $matches[1] . (isset($matches[3]) ? '.' . $matches[3] : '') . (isset($matches[5]) && $get_minor == true ? '.' . $matches[5] : '');
1747+
} else {
1748+
$app->log("Could not check apache version, did not find version string in apachectl output.", LOGLEVEL_WARN);
1749+
return '2.2';
1750+
}
1751+
}
17271752

17281753
}
17291754

server/lib/classes/tpl.inc.php

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1109,7 +1109,7 @@ function _arrayBuild ($arr) {
11091109
* @access private
11101110
* @return string used for eval'ing
11111111
*/
1112-
function _parseIf ($varname, $value=null, $op=null, $namespace=null) {
1112+
function _parseIf ($varname, $value=null, $op=null, $namespace=null, $format=null) {
11131113
if (isset($namespace)) $namespace = substr($namespace, 0, -1);
11141114
$comp_str = ''; // used for extended if statements
11151115

@@ -1151,10 +1151,19 @@ function _parseIf ($varname, $value=null, $op=null, $namespace=null) {
11511151
}
11521152
}
11531153
if ($this->OPTIONS['GLOBAL_VARS'] && empty($namespace)) {
1154-
return '(('.$retstr.'[\''.$varname.'\'] !== null) ? '.$retstr.'[\''.$varname.'\'] : $this->_vars[\''.$varname.'\'])'.$comp_str;
1154+
$retstr = '(('.$retstr.'[\''.$varname.'\'] !== null) ? '.$retstr.'[\''.$varname.'\'] : $this->_vars[\''.$varname.'\'])';
1155+
if(isset($format) && isset($value) && $format == 'version') {
1156+
return 'version_compare(' . $retstr . ', \'' . $value . '\', ' . (!empty($op) ? $op : '==') . ')';
1157+
} else {
1158+
return $retstr.$comp_str;
1159+
}
11551160
}
11561161
else {
1157-
return $retstr."['".$varname."']".$comp_str;
1162+
if(isset($format) && isset($value) && $format == 'version') {
1163+
return 'version_compare(' . $retstr."['".$varname."']" . ', \'' . $value . '\', ' . (!empty($op) ? $op : '==') . ')';
1164+
} else {
1165+
return $retstr."['".$varname."']".$comp_str;
1166+
}
11581167
}
11591168
}
11601169

@@ -1330,15 +1339,15 @@ function _parseTag ($args) {
13301339
break;
13311340

13321341
case 'if':
1333-
return '<?php if ('. $this->_parseIf($var, @$value, @$op, @$namespace) .') { ?>'.$newline;
1342+
return '<?php if ('. $this->_parseIf($var, @$value, @$op, @$namespace, @$format) .') { ?>'.$newline;
13341343
break;
13351344

13361345
case 'unless':
1337-
return '<?php if (!'. $this->_parseIf($var, @$value, @$op, @$namespace) .') { ?>'.$newline;
1346+
return '<?php if (!'. $this->_parseIf($var, @$value, @$op, @$namespace, @$format) .') { ?>'.$newline;
13381347
break;
13391348

13401349
case 'elseif':
1341-
return '<?php } elseif ('. $this->_parseIf($var, @$value, @$op, @$namespace) .') { ?>'.$newline;
1350+
return '<?php } elseif ('. $this->_parseIf($var, @$value, @$op, @$namespace, @$format) .') { ?>'.$newline;
13421351
break;
13431352

13441353
case 'loop':

0 commit comments

Comments
 (0)