|
1
|
|
|
<?php |
|
2
|
|
|
/* |
|
3
|
|
|
******************************************************************************* |
|
4
|
|
|
* Copyright 2011-2017 DANTE Ltd. and GÉANT on behalf of the GN3, GN3+, GN4-1 |
|
5
|
|
|
* and GN4-2 consortia |
|
6
|
|
|
* |
|
7
|
|
|
* License: see the web/copyright.php file in the file structure |
|
8
|
|
|
******************************************************************************* |
|
9
|
|
|
*/ |
|
10
|
|
|
?> |
|
11
|
|
|
<?php |
|
12
|
|
|
|
|
13
|
|
|
require_once(dirname(dirname(dirname(__FILE__))) . "/config/_config.php"); |
|
14
|
|
|
|
|
15
|
|
|
$Tests = [ |
|
16
|
|
|
'cat_base_url', |
|
17
|
|
|
'ssp', |
|
18
|
|
|
'security', |
|
19
|
|
|
'php', |
|
20
|
|
|
'phpModules', |
|
21
|
|
|
'openssl', |
|
22
|
|
|
'zip', |
|
23
|
|
|
'directories', |
|
24
|
|
|
'locales', |
|
25
|
|
|
'defaults', |
|
26
|
|
|
'databases', |
|
27
|
|
|
'device_cache', |
|
28
|
|
|
'mailer', |
|
29
|
|
|
]; |
|
30
|
|
|
|
|
31
|
|
|
if (CONFIG['FUNCTIONALITY_LOCATIONS']['CONFASSISTANT_SILVERBULLET'] == "LOCAL" || CONFIG['FUNCTIONALITY_LOCATIONS']['CONFASSISTANT_RADIUS'] == "LOCAL" ) { |
|
|
|
|
|
|
32
|
|
|
$Tests[] = 'makensis'; |
|
33
|
|
|
$Tests[] = 'makensis=>NSISmodules'; |
|
34
|
|
|
} |
|
35
|
|
|
|
|
36
|
|
|
if (CONFIG['FUNCTIONALITY_LOCATIONS']['DIAGNOSTICS'] == "LOCAL") { |
|
37
|
|
|
$Tests[] = 'eapol_test'; |
|
38
|
|
|
} |
|
39
|
|
|
|
|
40
|
|
|
ini_set('display_errors', '0'); |
|
41
|
|
|
|
|
42
|
|
|
function print_test_results($test) { |
|
43
|
|
|
$out = ''; |
|
44
|
|
|
switch ($test->test_result['global']) { |
|
45
|
|
|
case \core\common\Entity::L_OK: |
|
46
|
|
|
$message = "Your configuration appears to be fine."; |
|
47
|
|
|
break; |
|
48
|
|
|
case \core\common\Entity::L_WARN: |
|
49
|
|
|
$message = "There were some warnings, but your configuration should work."; |
|
50
|
|
|
break; |
|
51
|
|
|
case \core\common\Entity::L_ERROR: |
|
52
|
|
|
$message = "Your configuration appears to be broken, please fix the errors."; |
|
53
|
|
|
break; |
|
54
|
|
|
case \core\common\Entity::L_REMARK: |
|
55
|
|
|
$message = "Your configuration appears to be fine."; |
|
56
|
|
|
break; |
|
57
|
|
|
default: |
|
58
|
|
|
throw new Exception("The result code level " . $test->test_result['global'] . " is not defined!"); |
|
59
|
|
|
} |
|
60
|
|
|
$uiElements = new web\lib\admin\UIElements(); |
|
61
|
|
|
$out .= $uiElements->boxFlexible($test->test_result['global'], "<br><strong>Test Summary</strong><br>" . $message . "<br>See below for details<br><hr>"); |
|
62
|
|
|
foreach ($test->out as $testValue) { |
|
63
|
|
|
foreach ($testValue as $o) { |
|
64
|
|
|
$out .= $uiElements->boxFlexible($o['level'], $o['message']); |
|
65
|
|
|
} |
|
66
|
|
|
} |
|
67
|
|
|
return($out); |
|
68
|
|
|
} |
|
69
|
|
|
|
|
70
|
|
|
if (!in_array("I do not care about security!", CONFIG['SUPERADMINS'])) { |
|
71
|
|
|
$auth = new \web\lib\admin\Authentication(); |
|
72
|
|
|
$auth->authenticate(); |
|
73
|
|
|
$user = new \core\User($_SESSION['user']); |
|
74
|
|
|
if (!$user->isSuperadmin()) { |
|
75
|
|
|
throw new Exception("Not Superadmin"); |
|
76
|
|
|
} |
|
77
|
|
|
} |
|
78
|
|
|
$test = new \core\SanityTests(); |
|
79
|
|
|
$test->run_tests($Tests); |
|
80
|
|
|
$format = empty($_REQUEST['format']) ? 'include' : $_REQUEST['format']; |
|
81
|
|
|
switch ($format) { |
|
82
|
|
|
case 'include': |
|
83
|
|
|
$o = print_test_results($test); |
|
84
|
|
|
print "<table>$o</table>"; |
|
85
|
|
|
break; |
|
86
|
|
|
case 'html': |
|
87
|
|
|
header("Content-Type:text/html;charset=utf-8"); |
|
88
|
|
|
echo "<!DOCTYPE html> |
|
89
|
|
|
<html xmlns='http://www.w3.org/1999/xhtml' lang='$ourlocale'> |
|
90
|
|
|
<head lang='$ourlocale'> |
|
91
|
|
|
<meta http-equiv='Content-Type' content='text/html; charset=UTF-8'></head>"; |
|
92
|
|
|
|
|
93
|
|
|
$o = print_test_results($test); |
|
94
|
|
|
print "<body><table>$o</table></body></html>"; |
|
95
|
|
|
break; |
|
96
|
|
|
case 'json': |
|
97
|
|
|
header('Content-type: application/json; utf-8'); |
|
98
|
|
|
print json_encode(['global' => $test->test_result, 'details' => $test->out]); |
|
99
|
|
|
break; |
|
100
|
|
|
case 'print_r': |
|
101
|
|
|
echo "<!DOCTYPE html> |
|
102
|
|
|
<html xmlns='http://www.w3.org/1999/xhtml' lang='$ourlocale'> |
|
103
|
|
|
<head lang='$ourlocale'> |
|
104
|
|
|
<meta http-equiv='Content-Type' content='text/html; charset=UTF-8'></head>"; |
|
105
|
|
|
print "<body><pre>"; |
|
106
|
|
|
print_r(['global' => $test->test_result, 'details' => $test->out]); |
|
107
|
|
|
print "</pre><body>"; |
|
108
|
|
|
break; |
|
109
|
|
|
default: |
|
110
|
|
|
break; |
|
111
|
|
|
} |
|
112
|
|
|
|