1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace SimpleSAML\Module\monitor\TestSuite; |
4
|
|
|
|
5
|
|
|
use \SimpleSAML\Module\monitor\TestConfiguration as TestConfiguration; |
6
|
|
|
use \SimpleSAML\Module\monitor\TestCase as TestCase; |
7
|
|
|
use \SimpleSAML\Module\monitor\TestData as TestData; |
8
|
|
|
use \SimpleSAML\Utils as Utils; |
9
|
|
|
|
10
|
|
|
final class Configuration extends \SimpleSAML\Module\monitor\TestSuiteFactory |
11
|
|
|
{ |
12
|
|
|
/** |
13
|
|
|
* @param string|null |
14
|
|
|
*/ |
15
|
|
|
private $metadataCert = null; |
16
|
|
|
|
17
|
|
|
/** |
18
|
|
|
* @param string|null; |
19
|
|
|
*/ |
20
|
|
|
private $serverName = null; |
21
|
|
|
|
22
|
|
|
/** |
23
|
|
|
* @param integer|null; |
24
|
|
|
*/ |
25
|
|
|
private $serverPort = null; |
26
|
|
|
|
27
|
|
|
/** |
28
|
|
|
* @param TestConfiguration $configuration |
29
|
|
|
*/ |
30
|
|
|
public function __construct($configuration) |
31
|
|
|
{ |
32
|
|
|
$globalConfig = $configuration->getGlobalConfig(); |
33
|
|
|
$serverVars = $configuration->getServerVars(); |
34
|
|
|
|
35
|
|
|
$this->metadataCert = $globalConfig->getString('metadata.sign.certificate', null); |
36
|
|
|
$this->serverName = $serverVars->get('SERVER_NAME'); |
37
|
|
|
$this->serverPort = $serverVars->get('SERVER_PORT'); |
38
|
|
|
$this->setCategory('Configuration'); |
39
|
|
|
|
40
|
|
|
parent::__construct($configuration); |
41
|
|
|
} |
42
|
|
|
|
43
|
|
|
/** |
44
|
|
|
* @return void |
45
|
|
|
*/ |
46
|
|
|
public function invokeTest() |
47
|
|
|
{ |
48
|
|
|
// Check network connection to full public URL |
49
|
|
|
$input = [ |
50
|
|
|
'connectString' => 'ssl://'.$this->serverName.':'.$this->serverPort, |
51
|
|
|
'context' => stream_context_create([ |
52
|
|
|
"ssl" => [ |
53
|
|
|
"capture_peer_cert" => true, |
54
|
|
|
"verify_peer" => false, |
55
|
|
|
"verify_peer_name" => false |
56
|
|
|
] |
57
|
|
|
]), |
58
|
|
|
]; |
59
|
|
|
|
60
|
|
|
$connTest = new TestCase\Network\ConnectUri($this, new TestData($input)); |
61
|
|
|
$connTestResult = $connTest->getTestResult(); |
62
|
|
|
|
63
|
|
|
$this->addTestResult($connTest->getTestResult()); |
64
|
|
|
|
65
|
|
|
if ($connTestResult->getState() === State::OK) { |
|
|
|
|
66
|
|
|
// We were able to connect |
67
|
|
|
if (Utils\HTTP::isHTTPS()) { |
68
|
|
|
// Check Service Communications Certificate |
69
|
|
|
$certData = $connTestResult->getOutput('certData'); |
70
|
|
|
|
71
|
|
|
$input = [ |
72
|
|
|
'category' => 'Service Communications Certificate', |
73
|
|
|
'certData' => $certData, |
74
|
|
|
]; |
75
|
|
|
|
76
|
|
|
$certTest = new TestCase\Cert\Data($this, new TestData($input)); |
77
|
|
|
$this->addTestResult($certTest->getTestResult()); |
78
|
|
|
} |
79
|
|
|
} |
80
|
|
|
|
81
|
|
|
// Check metadata signing certificate when available |
82
|
|
|
if (is_string($this->metadataCert)) { |
83
|
|
|
$input = array( |
84
|
|
|
'certFile' => Utils\Config::getCertPath($this->metadataCert), |
85
|
|
|
'category' => 'Metadata Signing Certificate' |
86
|
|
|
); |
87
|
|
|
$testData = new TestData($input); |
88
|
|
|
|
89
|
|
|
$test = new TestCase\Cert\File($this, $testData); |
90
|
|
|
$this->addTestResult($test->getTestResult()); |
91
|
|
|
} |
92
|
|
|
|
93
|
|
|
$testResult = new TestResult('Configuration', ''); |
|
|
|
|
94
|
|
|
$testResult->setState($this->calculateState()); |
95
|
|
|
$this->setTestResult($testResult); |
96
|
|
|
} |
97
|
|
|
} |
98
|
|
|
|
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"]
, you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths