Commit e78ec10f authored by Marius Burkard's avatar Marius Burkard

- remove support for apache < 2.4

parent 613afed0
......@@ -21,8 +21,7 @@
SetHandler fcgid-script
</FilesMatch>
FCGIWrapper {website_basedir}/php-fcgi-scripts/apps/.php-fcgi-starter .php
Order allow,deny
Allow from all
Require all granted
</Directory>
DirectoryIndex index.php
</IfModule>
......@@ -33,8 +32,7 @@
<Directory {apps_vhost_dir}>
Options +FollowSymLinks
AllowOverride None
Order allow,deny
Allow from all
Require all granted
</Directory>
</IfModule>
......
......@@ -9,13 +9,11 @@ CustomLog "| /usr/local/ispconfig/server/scripts/vlogger -s access.log -t \"%Y%m
<Directory /var/www/clients>
AllowOverride None
Order Deny,Allow
Deny from all
Require all denied
</Directory>
# allow path to awstats and alias for awstats icons
<Directory /usr/share/awstats>
Order allow,deny
Allow from all
Require all granted
</Directory>
Alias /awstats/icon "/usr/share/awstats/htdocs/icon"
......@@ -20,8 +20,7 @@ NameVirtualHost *:{vhost_port}
SetHandler fcgid-script
</FilesMatch>
FCGIWrapper /var/www/php-fcgi-scripts/ispconfig/.php-fcgi-starter .php
Order allow,deny
Allow from all
Require all granted
</Directory>
DirectoryIndex index.php
</IfModule>
......@@ -32,8 +31,7 @@ NameVirtualHost *:{vhost_port}
<Directory /usr/local/ispconfig/interface/web>
Options +FollowSymLinks
AllowOverride None
Order allow,deny
Allow from all
Require all granted
php_value magic_quotes_gpc 0
</Directory>
</IfModule>
......
......@@ -970,20 +970,20 @@ function getapacheversion($get_minor = false) {
elseif(is_installed('apachectl')) $cmd = 'apachectl -v';
else {
ilog("Could not check apache version, apachectl not found.");
return '2.2';
return '2.4';
}
exec($cmd, $output, $return_var);
if($return_var != 0 || !$output[0]) {
ilog("Could not check apache version, apachectl did not return any data.");
return '2.2';
return '2.4';
}
if(preg_match('/version:\s*Apache\/(\d+)(\.(\d+)(\.(\d+))*)?(\D|$)/i', $output[0], $matches)) {
return $matches[1] . (isset($matches[3]) ? '.' . $matches[3] : '') . (isset($matches[5]) && $get_minor == true ? '.' . $matches[5] : '');
} else {
ilog("Could not check apache version, did not find version string in apachectl output.");
return '2.2';
return '2.4';
}
}
......
......@@ -25,12 +25,7 @@
<Directory {tmpl_var name='apps_vhost_dir'}>
Options FollowSymLinks
AllowOverride None
<tmpl_if name='apache_version' op='>' value='2.2' format='version'>
Require all granted
<tmpl_else>
Order allow,deny
Allow from all
</tmpl_if>
</Directory>
</IfModule>
......@@ -40,12 +35,7 @@
<Directory {tmpl_var name='apps_vhost_dir'}>
Options FollowSymLinks
AllowOverride None
<tmpl_if name='apache_version' op='>' value='2.2' format='version'>
Require all granted
<tmpl_else>
Order allow,deny
Allow from all
</tmpl_if>
</Directory>
</IfModule>
......@@ -59,12 +49,7 @@
SetHandler fcgid-script
</FilesMatch>
FCGIWrapper {tmpl_var name='apps_vhost_basedir'}/php-fcgi-scripts/apps/.php-fcgi-starter .php
<tmpl_if name='apache_version' op='>' value='2.2' format='version'>
Require all granted
<tmpl_else>
Order allow,deny
Allow from all
</tmpl_if>
</Directory>
</IfModule>
......
......@@ -27,131 +27,63 @@ CustomLog "| /usr/local/ispconfig/server/scripts/vlogger -s access.log -t \"%Y%m
<Directory /var/www/clients>
AllowOverride None
<tmpl_if name='apache_version' op='>' value='2.2' format='version'>
Require all denied
<tmpl_else>
Order Deny,Allow
Deny from all
</tmpl_if>
</Directory>
# Do not allow access to the root file system of the server for security reasons
<Directory />
Options -Indexes
AllowOverride None
<tmpl_if name='apache_version' op='>' value='2.2' format='version'>
Require all denied
<tmpl_else>
Order Deny,Allow
Deny from all
</tmpl_if>
</Directory>
<Directory /var/www/conf>
AllowOverride None
<tmpl_if name='apache_version' op='>' value='2.2' format='version'>
Require all denied
<tmpl_else>
Order Deny,Allow
Deny from all
</tmpl_if>
</Directory>
# Except of the following directories that contain website scripts
<Directory /usr/share/phpmyadmin>
<tmpl_if name='apache_version' op='>' value='2.2' format='version'>
Require all granted
<tmpl_else>
Order allow,deny
Allow from all
</tmpl_if>
</Directory>
<Directory /usr/share/phpMyAdmin>
<tmpl_if name='apache_version' op='>' value='2.2' format='version'>
Require all granted
<tmpl_else>
Order allow,deny
Allow from all
</tmpl_if>
</Directory>
<Directory /srv/www/htdocs>
<tmpl_if name='apache_version' op='>' value='2.2' format='version'>
Require all granted
<tmpl_else>
Order allow,deny
Allow from all
</tmpl_if>
</Directory>
<Directory /usr/share/squirrelmail>
<tmpl_if name='apache_version' op='>' value='2.2' format='version'>
Require all granted
<tmpl_else>
Order allow,deny
Allow from all
</tmpl_if>
</Directory>
# Allow access to mailman on OpenSuSE
<Directory /usr/lib/mailman/cgi-bin>
<tmpl_if name='apache_version' op='>' value='2.2' format='version'>
Require all granted
<tmpl_else>
Order allow,deny
Allow from all
</tmpl_if>
</Directory>
<Directory /usr/lib/mailman/icons>
<tmpl_if name='apache_version' op='>' value='2.2' format='version'>
Require all granted
<tmpl_else>
Order allow,deny
Allow from all
</tmpl_if>
</Directory>
<Directory /var/lib/mailman/archives/>
Options +FollowSymLinks
<tmpl_if name='apache_version' op='>' value='2.2' format='version'>
Require all granted
<tmpl_else>
Order allow,deny
Allow from all
</tmpl_if>
</Directory>
# allow path to awstats and alias for awstats icons
<Directory /usr/share/awstats>
<tmpl_if name='apache_version' op='>' value='2.2' format='version'>
Require all granted
<tmpl_else>
Order allow,deny
Allow from all
</tmpl_if>
</Directory>
Alias /awstats-icon "/usr/share/awstats/icon"
Alias /.well-known/acme-challenge /usr/local/ispconfig/interface/acme/.well-known/acme-challenge
<Directory /usr/local/ispconfig/interface/acme/.well-known/acme-challenge>
<tmpl_if name='apache_version' op='>' value='2.2' format='version'>
Require all granted
<tmpl_else>
Order allow,deny
Allow from all
</tmpl_if>
<IfModule mpm_itk_module>
AssignUserId www-data www-data
</IfModule>
</Directory>
<tmpl_if name='apache_version' op='<' value='2.4' format='version'>
NameVirtualHost *:80
NameVirtualHost *:443
<tmpl_loop name="ip_adresses">
NameVirtualHost {tmpl_var name="ip_address"}:{tmpl_var name="port"}
</tmpl_loop>
</tmpl_if>
......@@ -33,12 +33,7 @@
SetHandler fcgid-script
</FilesMatch>
FCGIWrapper /var/www/php-fcgi-scripts/ispconfig/.php-fcgi-starter .php
<tmpl_if name='apache_version' op='>' value='2.2' format='version'>
Require all granted
<tmpl_else>
Order allow,deny
Allow from all
</tmpl_if>
</Directory>
IPCCommTimeout 7200
MaxRequestLen 15728640
......@@ -52,12 +47,7 @@
# php_admin_value open_basedir "/usr/local/ispconfig/interface:/usr/share:/tmp"
Options +FollowSymLinks
AllowOverride None
<tmpl_if name='apache_version' op='>' value='2.2' format='version'>
Require all granted
<tmpl_else>
Order allow,deny
Allow from all
</tmpl_if>
php_value magic_quotes_gpc 0
</Directory>
</IfModule>
......@@ -121,20 +111,10 @@
<Directory /var/www/php-cgi-scripts>
AllowOverride None
<tmpl_if name='apache_version' op='>' value='2.2' format='version'>
Require all denied
<tmpl_else>
Order Deny,Allow
Deny from all
</tmpl_if>
</Directory>
<Directory /var/www/php-fcgi-scripts>
AllowOverride None
<tmpl_if name='apache_version' op='>' value='2.2' format='version'>
Require all denied
<tmpl_else>
Order Deny,Allow
Deny from all
</tmpl_if>
</Directory>
......@@ -134,7 +134,6 @@ fastcgi_phpini_path=/etc/php5/cgi/
fastcgi_children=8
fastcgi_max_requests=5000
fastcgi_bin=/usr/bin/php-cgi
fastcgi_config_syntax=2
[jailkit]
jailkit_chroot_home=/home/[username]
......
......@@ -1602,15 +1602,7 @@ $form["tabs"]['fastcgi'] = array(
'value' => '',
'width' => '40',
'maxlength' => '255'
),
'fastcgi_config_syntax' => array(
'datatype' => 'INTEGER',
'formtype' => 'SELECT',
'default' => '2',
'value' => array('1' => 'Old (apache 2.0)', '2' => 'New (apache 2.2)'),
'width' => '40',
'maxlength' => '255'
),
)
//#################################
// ENDE Datatable fields
//#################################
......
......@@ -26,12 +26,6 @@
<div class="form-group">
<label for="fastcgi_bin" class="col-sm-3 control-label">{tmpl_var name='fastcgi_bin_txt'}</label>
<div class="col-sm-9"><input type="text" name="fastcgi_bin" id="fastcgi_bin" value="{tmpl_var name='fastcgi_bin'}" class="form-control" /></div></div>
<div class="form-group">
<label for="fastcgi_config_syntax" class="col-sm-3 control-label">{tmpl_var name='fastcgi_config_syntax_txt'}</label>
<div class="col-sm-9"><select name="fastcgi_config_syntax" id="fastcgi_config_syntax" class="form-control">
{tmpl_var name='fastcgi_config_syntax'}
</select></div>
</div>
<input type="hidden" name="id" value="{tmpl_var name='id'}">
......
......@@ -24,12 +24,7 @@
<Directory {tmpl_var name='apps_vhost_dir'}>
Options FollowSymLinks
AllowOverride None
<tmpl_if name='apache_version' op='>' value='2.2' format='version'>
Require all granted
<tmpl_else>
Order allow,deny
Allow from all
</tmpl_if>
</Directory>
</IfModule>
......@@ -39,12 +34,7 @@
<Directory {tmpl_var name='apps_vhost_dir'}>
Options FollowSymLinks
AllowOverride None
<tmpl_if name='apache_version' op='>' value='2.2' format='version'>
Require all granted
<tmpl_else>
Order allow,deny
Allow from all
</tmpl_if>
</Directory>
</IfModule>
......@@ -58,12 +48,7 @@
SetHandler fcgid-script
</FilesMatch>
FCGIWrapper {tmpl_var name='apps_vhost_basedir'}/php-fcgi-scripts/apps/.php-fcgi-starter .php
<tmpl_if name='apache_version' op='>' value='2.2' format='version'>
Require all granted
<tmpl_else>
Order allow,deny
Allow from all
</tmpl_if>
</Directory>
</IfModule>
......
......@@ -27,131 +27,63 @@ CustomLog "| /usr/local/ispconfig/server/scripts/vlogger -s access.log -t \"%Y%m
<Directory /var/www/clients>
AllowOverride None
<tmpl_if name='apache_version' op='>' value='2.2' format='version'>
Require all denied
<tmpl_else>
Order Deny,Allow
Deny from all
</tmpl_if>
</Directory>
# Do not allow access to the root file system of the server for security reasons
<Directory />
Options -Indexes
AllowOverride None
<tmpl_if name='apache_version' op='>' value='2.2' format='version'>
Require all denied
<tmpl_else>
Order Deny,Allow
Deny from all
</tmpl_if>
</Directory>
<Directory /var/www/conf>
AllowOverride None
<tmpl_if name='apache_version' op='>' value='2.2' format='version'>
Require all denied
<tmpl_else>
Order Deny,Allow
Deny from all
</tmpl_if>
</Directory>
# Except of the following directories that contain website scripts
<Directory /usr/share/phpmyadmin>
<tmpl_if name='apache_version' op='>' value='2.2' format='version'>
Require all granted
<tmpl_else>
Order allow,deny
Allow from all
</tmpl_if>
</Directory>
<Directory /usr/share/phpMyAdmin>
<tmpl_if name='apache_version' op='>' value='2.2' format='version'>
Require all granted
<tmpl_else>
Order allow,deny
Allow from all
</tmpl_if>
</Directory>
<Directory /srv/www/htdocs>
<tmpl_if name='apache_version' op='>' value='2.2' format='version'>
Require all granted
<tmpl_else>
Order allow,deny
Allow from all
</tmpl_if>
</Directory>
<Directory /usr/share/squirrelmail>
<tmpl_if name='apache_version' op='>' value='2.2' format='version'>
Require all granted
<tmpl_else>
Order allow,deny
Allow from all
</tmpl_if>
</Directory>
# Allow access to mailman on OpenSuSE
<Directory /usr/lib/mailman/cgi-bin>
<tmpl_if name='apache_version' op='>' value='2.2' format='version'>
Require all granted
<tmpl_else>
Order allow,deny
Allow from all
</tmpl_if>
</Directory>
<Directory /usr/lib/mailman/icons>
<tmpl_if name='apache_version' op='>' value='2.2' format='version'>
Require all granted
<tmpl_else>
Order allow,deny
Allow from all
</tmpl_if>
</Directory>
<Directory /var/lib/mailman/archives/>
Options +FollowSymLinks
<tmpl_if name='apache_version' op='>' value='2.2' format='version'>
Require all granted
<tmpl_else>
Order allow,deny
Allow from all
</tmpl_if>
</Directory>
# allow path to awstats and alias for awstats icons
<Directory /usr/share/awstats>
<tmpl_if name='apache_version' op='>' value='2.2' format='version'>
Require all granted
<tmpl_else>
Order allow,deny
Allow from all
</tmpl_if>
</Directory>
Alias /awstats-icon "/usr/share/awstats/icon"
Alias /.well-known/acme-challenge /usr/local/ispconfig/interface/acme/.well-known/acme-challenge
<Directory /usr/local/ispconfig/interface/acme/.well-known/acme-challenge>
<tmpl_if name='apache_version' op='>' value='2.2' format='version'>
Require all granted
<tmpl_else>
Order allow,deny
Allow from all
</tmpl_if>
<IfModule mpm_itk_module>
AssignUserId www-data www-data
</IfModule>
</Directory>
<tmpl_if name='apache_version' op='<' value='2.4' format='version'>
NameVirtualHost *:80
NameVirtualHost *:443
<tmpl_loop name="ip_adresses">
NameVirtualHost {tmpl_var name="ip_address"}:{tmpl_var name="port"}
</tmpl_loop>
</tmpl_if>
......@@ -2,12 +2,7 @@
<Directory {tmpl_var name='web_basedir'}/{tmpl_var name='domain'}>
AllowOverride None
<tmpl_if name='apache_version' op='>' value='2.2' format='version'>
Require all denied
<tmpl_else>
Order Deny,Allow
Deny from all
</tmpl_if>
</Directory>
<tmpl_loop name='vhosts'>
......@@ -89,12 +84,7 @@ DocumentRoot <tmpl_var name='web_document_root_www'>
</FilesMatch>
Options +FollowSymLinks
AllowOverride <tmpl_var name='allow_override'>
<tmpl_if name='apache_version' op='>' value='2.2' format='version'>
Require all granted
<tmpl_else>
Order allow,deny
Allow from all
</tmpl_if>
<tmpl_if name='ssi' op='==' value='y'>
# ssi enabled
......@@ -104,13 +94,7 @@ DocumentRoot <tmpl_var name='web_document_root_www'>
</tmpl_if>
<tmpl_if name='php' op='==' value='no'>
<Files ~ '.php[s3-6]{0,1}$'>
<tmpl_if name='apache_version' op='>' value='2.2' format='version'>
Require all denied
<tmpl_else>
Order allow,deny
Deny from all
Allow from none
</tmpl_if>
</Files>
</tmpl_if>
</Directory>
......@@ -121,12 +105,7 @@ DocumentRoot <tmpl_var name='web_document_root_www'>
</FilesMatch>
Options +FollowSymLinks
AllowOverride <tmpl_var name='allow_override'>
<tmpl_if name='apache_version' op='>' value='2.2' format='version'>
Require all granted
<tmpl_else>
Order allow,deny
Allow from all
</tmpl_if>
<tmpl_if name='ssi' op='==' value='y'>
# ssi enabled
......@@ -136,13 +115,7 @@ DocumentRoot <tmpl_var name='web_document_root_www'>
</tmpl_if>
<tmpl_if name='php' op='==' value='no'>
<Files ~ '.php[s3-6]{0,1}$'>
<tmpl_if name='apache_version' op='>' value='2.2' format='version'>
Require all denied
<tmpl_else>
Order allow,deny
Deny from all
Allow from none
</tmpl_if>
</Files>
</tmpl_if>
</Directory>
......@@ -209,12 +182,7 @@ DocumentRoot <tmpl_var name='web_document_root_www'>
<tmpl_if name='cgi' op='==' value='y'>
# cgi enabled
<Directory {tmpl_var name='document_root'}/cgi-bin>
<tmpl_if name='apache_version' op='>' value='2.2' format='version'>
Require all granted
<tmpl_else>
Order allow,deny
Allow from all
</tmpl_if>
</Directory>
ScriptAlias /cgi-bin/ <tmpl_var name='document_root'>/cgi-bin/
<FilesMatch "\.(cgi|pl)$">
......@@ -245,7 +213,6 @@ DocumentRoot <tmpl_var name='web_document_root_www'>
# php as fast-cgi enabled
# For config options see: http://httpd.apache.org/mod_fcgid/mod/mod_fcgid.html
<IfModule mod_fcgid.c>
<tmpl_if name='fastcgi_config_syntax' op='==' value='2'>
FcgidIdleTimeout 300
FcgidProcessLifeTime 3600
# FcgidMaxProcesses 1000
......@@ -256,16 +223,6 @@ DocumentRoot <tmpl_var name='web_document_root_www'>
FcgidIOTimeout 600
FcgidBusyTimeout 3600
FcgidMaxRequestLen 1073741824
<tmpl_else>
IdleTimeout 300
ProcessLifeTime 3600
# MaxProcessCount 1000
DefaultMinClassProcessCount 0
DefaultMaxClassProcessCount 10
IPCConnectTimeout 3
IPCCommTimeout 600
BusyTimeout 3600
</tmpl_if>
</IfModule>
<Directory {tmpl_var name='web_document_root_www'}>
<FilesMatch "\.php[345]?$">
......@@ -277,12 +234,7 @@ DocumentRoot <tmpl_var name='web_document_root_www'>
FCGIWrapper <tmpl_var name='fastcgi_starter_path'><tmpl_var name='fastcgi_starter_script'> .php5
Options +ExecCGI
AllowOverride <tmpl_var name='allow_override'>
<tmpl_if name='apache_version' op='>' value='2.2' format='version'>
Require all granted
<tmpl_else>
Order allow,deny
Allow from all
</tmpl_if>
</Directory>
<Directory {tmpl_var name='web_document_root'}>
<FilesMatch "\.php[345]?$">
......@@ -294,23 +246,13 @@ DocumentRoot <tmpl_var name='web_document_root_www'>
FCGIWrapper <tmpl_var name='fastcgi_starter_path'><tmpl_var name='fastcgi_starter_script'> .php5
Options +ExecCGI
AllowOverride <tmpl_var name='allow_override'>
<tmpl_if name='apache_version' op='>' value='2.2' format='version'>
Require all granted
<tmpl_else>
Order allow,deny
Allow from all
</tmpl_if>
</Directory>
</tmpl_if>
<tmpl_if name='php' op='==' value='php-fpm'>
<IfModule mod_fastcgi.c>
<Directory {tmpl_var name='document_root'}/cgi-bin>
<tmpl_if name='apache_version' op='>' value='2.2' format='version'>
Require all granted
<tmpl_else>
Order allow,deny
Allow from all
</tmpl_if>
</Directory>
<Directory {tmpl_var name='web_document_root_www'}>
<FilesMatch "\.php[345]?$">
......@@ -377,10 +319,8 @@ DocumentRoot <tmpl_var name='web_document_root_www'>
<tmpl_if name="rewrite_enabled">
RewriteEngine on
<tmpl_if name='apache_version' op='>' value='2.2' format='version'>
RewriteCond %{REQUEST_URI} ^/\.well-known/acme-challenge/
RewriteRule ^ - [END]
</tmpl_if>
<tmpl_if name='ssl_enabled'>
<tmpl_else>
<tmpl_if name='rewrite_to_https' op='==' value='y'>
......
......@@ -367,7 +367,6 @@ class plugin_webserver_apache {
$tpl->setVar('fastcgi_alias', $fastcgi_config['fastcgi_alias']);
$tpl->setVar('fastcgi_starter_path', $fastcgi_starter_path);
$tpl->setVar('fastcgi_starter_script', $fastcgi_config['fastcgi_starter_script'].(($data['new']['type'] == 'vhostsubdomain' || $data['new']['type'] == 'vhostalias') ? '_web' . $data['new']['domain_id'] : ''));
$tpl->setVar('fastcgi_config_syntax', $fastcgi_config['fastcgi_config_syntax']);
$tpl->setVar('fastcgi_max_requests', $fastcgi_config['fastcgi_max_requests']);
} else {
......
......@@ -2921,8 +2921,6 @@ class plugin_webserver_base {
$output .= "AuthUserFile $webdavRoot/$file\n";
$output .= "Require valid-user\n";
$output .= "Options +Indexes\n";
if($app->system->getapacheversion()<=2.2)