Skip to content

Commit 60b7000

Browse files
author
Marius Cramer
committed
Implemented apache module check and mod_authz_compat warning for OpenSuSE
1 parent 696af94 commit 60b7000

File tree

4 files changed

+92
-23
lines changed

4 files changed

+92
-23
lines changed

install/dist/lib/opensuse.lib.php

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,23 @@
2929
*/
3030

3131
class installer_dist extends installer_base {
32-
32+
33+
public function __construct() {
34+
//** check apache modules */
35+
$mods = getapachemodules();
36+
if(in_array('authz_compat', $mods, true)) {
37+
swriteln($inst->lng(' WARNING! You are using mod_authz_compat.'));
38+
swriteln($inst->lng(' Please make sure that your apache config uses the new auth syntax:'));
39+
swriteln($inst->lng(' <Directory />'));
40+
swriteln($inst->lng(' Options None'));
41+
swriteln($inst->lng(' AllowOverride None'));
42+
swriteln($inst->lng(' Require all denied'));
43+
swriteln($inst->lng(' </Directory>'."\n"));
44+
45+
swriteln($inst->lng(' If it uses the old syntax (deny from all) ISPConfig would fail to work.'));
46+
}
47+
}
48+
3349
public function configure_mailman($status = 'insert') {
3450
global $conf;
3551

install/install.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@
8787
//** Installer Interface
8888
//****************************************************************************************************
8989
$inst = new installer();
90+
9091
swriteln($inst->lng(' Following will be a few questions for primary configuration so be careful.'));
9192
swriteln($inst->lng(' Default values are in [brackets] and can be accepted with <ENTER>.'));
9293
swriteln($inst->lng(' Tap in "quit" (without the quotes) to stop the installer.'."\n\n"));

install/lib/install.lib.php

Lines changed: 48 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -830,29 +830,55 @@ function get_system_timezone() {
830830
}
831831

832832
function getapacheversion($get_minor = false) {
833-
global $app;
834-
835-
$cmd = '';
836-
if(is_installed('apache2ctl')) $cmd = 'apache2ctl -v';
837-
elseif(is_installed('apachectl')) $cmd = 'apachectl -v';
838-
else {
839-
$app->log("Could not check apache version, apachectl not found.", LOGLEVEL_WARN);
840-
return '2.2';
841-
}
842-
843-
exec($cmd, $output, $return_var);
844-
if($return_var != 0 || !$output[0]) {
845-
$app->log("Could not check apache version, apachectl did not return any data.", LOGLEVEL_WARN);
846-
return '2.2';
847-
}
848-
849-
if(preg_match('/version:\s*Apache\/(\d+)(\.(\d+)(\.(\d+))*)?(\D|$)/i', $output[0], $matches)) {
850-
return $matches[1] . (isset($matches[3]) ? '.' . $matches[3] : '') . (isset($matches[5]) && $get_minor == true ? '.' . $matches[5] : '');
851-
} else {
852-
$app->log("Could not check apache version, did not find version string in apachectl output.", LOGLEVEL_WARN);
853-
return '2.2';
854-
}
833+
global $app;
834+
835+
$cmd = '';
836+
if(is_installed('apache2ctl')) $cmd = 'apache2ctl -v';
837+
elseif(is_installed('apachectl')) $cmd = 'apachectl -v';
838+
else {
839+
$app->log("Could not check apache version, apachectl not found.", LOGLEVEL_WARN);
840+
return '2.2';
841+
}
842+
843+
exec($cmd, $output, $return_var);
844+
if($return_var != 0 || !$output[0]) {
845+
$app->log("Could not check apache version, apachectl did not return any data.", LOGLEVEL_WARN);
846+
return '2.2';
847+
}
848+
849+
if(preg_match('/version:\s*Apache\/(\d+)(\.(\d+)(\.(\d+))*)?(\D|$)/i', $output[0], $matches)) {
850+
return $matches[1] . (isset($matches[3]) ? '.' . $matches[3] : '') . (isset($matches[5]) && $get_minor == true ? '.' . $matches[5] : '');
851+
} else {
852+
$app->log("Could not check apache version, did not find version string in apachectl output.", LOGLEVEL_WARN);
853+
return '2.2';
855854
}
855+
}
856856

857+
function getapachemodules() {
858+
global $app;
859+
860+
$cmd = '';
861+
if(is_installed('apache2ctl')) $cmd = 'apache2ctl -t -D DUMP_MODULES';
862+
elseif(is_installed('apachectl')) $cmd = 'apachectl -t -D DUMP_MODULES';
863+
else {
864+
$app->log("Could not check apache modules, apachectl not found.", LOGLEVEL_WARN);
865+
return array();
866+
}
867+
868+
exec($cmd, $output, $return_var);
869+
if($return_var != 0 || !$output[0]) {
870+
$app->log("Could not check apache modules, apachectl did not return any data.", LOGLEVEL_WARN);
871+
return array();
872+
}
873+
874+
$modules = array();
875+
for($i = 0; $i < count($output); $i++) {
876+
if(preg_match('/^\s*(\w+)\s+\((shared|static)\)\s*$/', $output[$i], $matches)) {
877+
$modules[] = $matches[1];
878+
}
879+
}
880+
881+
return $modules;
882+
}
857883

858884
?>

server/lib/classes/system.inc.php

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1759,6 +1759,32 @@ function getapacheversion($get_minor = false) {
17591759
}
17601760
}
17611761

1762+
function getapachemodules() {
1763+
global $app;
1764+
1765+
$cmd = '';
1766+
if(is_installed('apache2ctl')) $cmd = 'apache2ctl -t -D DUMP_MODULES';
1767+
elseif(is_installed('apachectl')) $cmd = 'apachectl -t -D DUMP_MODULES';
1768+
else {
1769+
$app->log("Could not check apache modules, apachectl not found.", LOGLEVEL_WARN);
1770+
return array();
1771+
}
1772+
1773+
exec($cmd, $output, $return_var);
1774+
if($return_var != 0 || !$output[0]) {
1775+
$app->log("Could not check apache modules, apachectl did not return any data.", LOGLEVEL_WARN);
1776+
return array();
1777+
}
1778+
1779+
$modules = array();
1780+
for($i = 0; $i < count($output); $i++) {
1781+
if(preg_match('/^\s*(\w+)\s+\((shared|static)\)\s*$/', $output[$i], $matches)) {
1782+
$modules[] = $matches[1];
1783+
}
1784+
}
1785+
1786+
return $modules;
1787+
}
17621788
}
17631789

17641790
?>

0 commit comments

Comments
 (0)