|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
/* |
|
4
|
|
|
* To change this license header, choose License Headers in Project Properties. |
|
5
|
|
|
* To change this template file, choose Tools | Templates |
|
6
|
|
|
* and open the template in the editor. |
|
7
|
|
|
*/ |
|
8
|
|
|
|
|
9
|
|
|
namespace devices\ms; |
|
10
|
|
|
|
|
11
|
|
|
class MsPeapProfile extends MsEapProfile |
|
12
|
|
|
{ |
|
13
|
|
|
const MS_MSCHAP_NS = 'http://www.microsoft.com/provisioning/MsChapV2ConnectionPropertiesV1'; |
|
14
|
|
|
const MS_PEAP_NS1 = 'http://www.microsoft.com/provisioning/MsPeapConnectionPropertiesV1'; |
|
15
|
|
|
const MS_PEAP_NS2 = 'http://www.microsoft.com/provisioning/MsPeapConnectionPropertiesV2'; |
|
16
|
|
|
|
|
17
|
|
|
public function __construct() { |
|
18
|
|
|
$this->type = \core\common\EAP::PEAP; |
|
19
|
|
|
$this->authorId = 0; |
|
20
|
|
|
} |
|
21
|
|
|
|
|
22
|
|
|
protected function getConfig() |
|
23
|
|
|
{ |
|
24
|
|
|
$element = new \core\DeviceXMLmain(); |
|
25
|
|
|
$element->setChild('Eap', $this->getPeapEap(), self::MS_BASEEAPCONN_NS); |
|
26
|
|
|
return($element); |
|
27
|
|
|
} |
|
28
|
|
|
|
|
29
|
|
|
private function getPeapEap() |
|
30
|
|
|
{ |
|
31
|
|
|
$element = new \core\DeviceXMLmain(); |
|
32
|
|
|
$element->setChild('Type', \core\common\EAP::PEAP); |
|
33
|
|
|
$element->setChild('EapType', $this->getPeapEapType(), self::MS_PEAP_NS1); |
|
34
|
|
|
return($element); |
|
35
|
|
|
} |
|
36
|
|
|
|
|
37
|
|
|
private function getPeapEapType() |
|
38
|
|
|
{ |
|
39
|
|
|
$element = new \core\DeviceXMLmain(); |
|
40
|
|
|
$element->setChild('ServerValidation', $this->getPeapServerValidation()); |
|
41
|
|
|
$element->setChild('FastReconnect','true'); |
|
42
|
|
|
$element->setChild('InnerEapOptional', 'false'); |
|
43
|
|
|
$element->setChild('Eap', $this->getMsChapV2(), self::MS_BASEEAPCONN_NS); |
|
44
|
|
|
$element->setChild('EnableQuarantineChecks', $this->nea); |
|
45
|
|
|
$element->setChild('RequireCryptoBinding', 'false'); |
|
46
|
|
|
if ($this->outerId !== NULL) { |
|
47
|
|
|
$element->setChild('PeapExtensions', $this->getPrivacyExtensions()); |
|
48
|
|
|
} |
|
49
|
|
|
return($element); |
|
50
|
|
|
} |
|
51
|
|
|
|
|
52
|
|
|
private function getPeapServerValidation() |
|
53
|
|
|
{ |
|
54
|
|
|
$element = new \core\DeviceXMLmain(); |
|
55
|
|
|
$element->setChild('DisableUserPromptForServerValidation', 'true'); |
|
56
|
|
|
$element->setChild('ServerNames', $this->serverNames); |
|
57
|
|
|
foreach ($this->caList as $ca) { |
|
58
|
|
|
$element->setChild('TrustedRootCA', $ca['sha1']); |
|
59
|
|
|
} |
|
60
|
|
|
return($element); |
|
61
|
|
|
} |
|
62
|
|
|
|
|
63
|
|
|
private function getMsChapV2() |
|
64
|
|
|
{ |
|
65
|
|
|
$element = new \core\DeviceXMLmain(); |
|
66
|
|
|
$element->setChild('Type', \core\common\EAP::MSCHAP2); |
|
67
|
|
|
$element->setChild('EapType', $this->getWinLogonCred(), self::MS_MSCHAP_NS); |
|
68
|
|
|
return($element); |
|
69
|
|
|
} |
|
70
|
|
|
|
|
71
|
|
|
private function getPrivacyExtensions() { |
|
72
|
|
|
$element = new \core\DeviceXMLmain(); |
|
73
|
|
|
$element->setChild('IdentityPrivacy', $this->getIdentityPrivacy(), self::MS_PEAP_NS2); |
|
74
|
|
|
return($element); |
|
75
|
|
|
} |
|
76
|
|
|
|
|
77
|
|
|
private function getIdentityPrivacy() { |
|
78
|
|
|
$element = new \core\DeviceXMLmain(); |
|
79
|
|
|
preg_match('/^[^@]*/', $this->outerId, $matches); |
|
80
|
|
|
$outerUser = empty($matches[0]) ? '@' : $matches[0]; |
|
81
|
|
|
$element->setChild('EnableIdentityPrivacy', 'true'); |
|
82
|
|
|
$element->setChild('AnonymousUserName', $outerUser); |
|
83
|
|
|
return($element); |
|
84
|
|
|
|
|
85
|
|
|
} |
|
86
|
|
|
|
|
87
|
|
|
private function getWinLogonCred() |
|
88
|
|
|
{ |
|
89
|
|
|
$element = new \core\DeviceXMLmain(); |
|
90
|
|
|
$element->setChild('UseWinLogonCredentials', 'false'); |
|
91
|
|
|
return($element); |
|
92
|
|
|
} |
|
93
|
|
|
} |
|
94
|
|
|
|