This project does not seem to handle request data directly as such no vulnerable execution paths were found.
include
, or for example
via PHP's auto-loading mechanism.
1 | <?php |
||||||
2 | /* |
||||||
3 | * ***************************************************************************** |
||||||
4 | * Contributions to this work were made on behalf of the GÉANT project, a |
||||||
5 | * project that has received funding from the European Union’s Framework |
||||||
6 | * Programme 7 under Grant Agreements No. 238875 (GN3) and No. 605243 (GN3plus), |
||||||
7 | * Horizon 2020 research and innovation programme under Grant Agreements No. |
||||||
8 | * 691567 (GN4-1) and No. 731122 (GN4-2). |
||||||
9 | * On behalf of the aforementioned projects, GEANT Association is the sole owner |
||||||
10 | * of the copyright in all material which was developed by a member of the GÉANT |
||||||
11 | * project. GÉANT Vereniging (Association) is registered with the Chamber of |
||||||
12 | * Commerce in Amsterdam with registration number 40535155 and operates in the |
||||||
13 | * UK as a branch of GÉANT Vereniging. |
||||||
14 | * |
||||||
15 | * Registered office: Hoekenrode 3, 1102BR Amsterdam, The Netherlands. |
||||||
16 | * UK branch address: City House, 126-130 Hills Road, Cambridge CB2 1PQ, UK |
||||||
17 | * |
||||||
18 | * License: see the web/copyright.inc.php file in the file structure or |
||||||
19 | * <base_url>/copyright.php after deploying the software |
||||||
20 | */ |
||||||
21 | |||||||
22 | /** |
||||||
23 | * This file creates MS Windows Vista and MS Windows 7 installers |
||||||
24 | * It supports EAP-TLS, PEAP and EAP-pwd (with external software) |
||||||
25 | * @author Tomasz Wolniewicz <[email protected]> |
||||||
26 | * |
||||||
27 | * @package ModuleWriting |
||||||
28 | */ |
||||||
29 | /** |
||||||
30 | * necessary includes |
||||||
31 | */ |
||||||
32 | |||||||
33 | namespace devices\ms; |
||||||
34 | use \Exception; |
||||||
0 ignored issues
–
show
|
|||||||
35 | |||||||
36 | class DeviceVista7 extends WindowsCommon |
||||||
37 | { |
||||||
38 | |||||||
39 | /** |
||||||
40 | * constructor; tells the world about supported EAP types and device anomalies |
||||||
41 | */ |
||||||
42 | final public function __construct() |
||||||
43 | { |
||||||
44 | parent::__construct(); |
||||||
45 | \core\common\Entity::intoThePotatoes(); |
||||||
46 | $this->setSupportedEapMethods([\core\common\EAP::EAPTYPE_TLS, \core\common\EAP::EAPTYPE_PEAP_MSCHAP2, \core\common\EAP::EAPTYPE_TTLS_PAP, \core\common\EAP::EAPTYPE_TTLS_MSCHAP2, \core\common\EAP::EAPTYPE_SILVERBULLET]); |
||||||
47 | $this->loggerInstance->debug(4, "This device supports the following EAP methods: "); |
||||||
48 | $this->loggerInstance->debug(4, $this->supportedEapMethods); |
||||||
49 | $this->specialities['internal:use_anon_outer'][serialize(\core\common\EAP::EAPTYPE_PEAP_MSCHAP2)] = _("Anonymous identities do not use the realm as specified in the profile - it is derived from the suffix of the user's username input instead."); |
||||||
50 | $this->specialities['media:openroaming'] = _("While OpenRoaming can be configured, it is possible that the Wi-Fi hardware does not support it; then the network definition is ignored."); |
||||||
51 | $this->specialities['media:consortium_OI'] = _("While Passpoint networks can be configured, it is possible that the Wi-Fi hardware does not support it; then the network definition is ignored."); |
||||||
52 | \core\common\Entity::outOfThePotatoes(); |
||||||
53 | } |
||||||
54 | |||||||
55 | /** |
||||||
56 | * create the actual installer executable |
||||||
57 | * |
||||||
58 | * @return string filename of the generated installer |
||||||
59 | * |
||||||
60 | */ |
||||||
61 | public function writeInstaller() |
||||||
62 | { |
||||||
63 | $dom = textdomain(NULL); |
||||||
64 | textdomain("devices"); |
||||||
65 | // create certificate files and save their names in $caFiles array |
||||||
66 | $caFiles = $this->saveCertificateFiles('der'); |
||||||
67 | |||||||
68 | $allSSID = $this->attributes['internal:SSID']; |
||||||
69 | $delSSIDs = $this->attributes['internal:remove_SSID']; |
||||||
70 | $this->prepareInstallerLang(); |
||||||
71 | $setWired = isset($this->attributes['media:wired'][0]) && $this->attributes['media:wired'][0] == 'on' ? 1 : 0; |
||||||
72 | // create a list of profiles to be deleted after installation |
||||||
73 | $delProfiles = []; |
||||||
74 | foreach ($delSSIDs as $ssid => $cipher) { |
||||||
75 | if ($cipher == 'DEL') { |
||||||
76 | $delProfiles[] = $ssid; |
||||||
77 | } |
||||||
78 | if ($cipher == 'TKIP') { |
||||||
79 | $delProfiles[] = $ssid . ' (TKIP)'; |
||||||
80 | } |
||||||
81 | } |
||||||
82 | |||||||
83 | if ($this->selectedEap == \core\common\EAP::EAPTYPE_TLS || $this->selectedEap == \core\common\EAP::EAPTYPE_PEAP_MSCHAP2 || $this->selectedEap == \core\common\EAP::EAPTYPE_PWD || $this->selectedEap == \core\common\EAP::EAPTYPE_TTLS_PAP || $this->selectedEap == \core\common\EAP::EAPTYPE_TTLS_MSCHAP2 || $this->selectedEap == \core\common\EAP::EAPTYPE_SILVERBULLET) { |
||||||
84 | $windowsProfile = []; |
||||||
85 | $eapConfig = $this->prepareEapConfig($this->attributes); |
||||||
86 | $iterator = 0; |
||||||
87 | foreach ($allSSID as $ssid => $cipher) { |
||||||
88 | if ($cipher == 'TKIP') { |
||||||
89 | $windowsProfile[$iterator] = $this->writeWLANprofile($ssid . ' (TKIP)', $ssid, 'WPA', 'TKIP', $eapConfig, $iterator); |
||||||
90 | $iterator++; |
||||||
91 | } |
||||||
92 | $windowsProfile[$iterator] = $this->writeWLANprofile($ssid, $ssid, 'WPA2', 'AES', $eapConfig, $iterator); |
||||||
93 | $iterator++; |
||||||
94 | } |
||||||
95 | if ($setWired) { |
||||||
96 | $this->writeLANprofile($eapConfig); |
||||||
97 | } |
||||||
98 | } else { |
||||||
99 | print(" this EAP type is not handled yet.\n"); |
||||||
100 | return; |
||||||
101 | } |
||||||
102 | $this->loggerInstance->debug(4, "windowsProfile"); |
||||||
103 | $this->loggerInstance->debug(4, $windowsProfile); |
||||||
104 | |||||||
105 | $this->writeProfilesNSH($windowsProfile, $caFiles); |
||||||
106 | $this->writeAdditionalDeletes($delProfiles); |
||||||
107 | if ($this->selectedEap == \core\common\EAP::EAPTYPE_SILVERBULLET) { |
||||||
108 | $this->writeClientP12File(); |
||||||
109 | } |
||||||
110 | $this->copyFiles($this->selectedEap); |
||||||
111 | $fedLogo = $this->attributes['fed:logo_file'] ?? NULL; |
||||||
112 | $idpLogo = $this->attributes['internal:logo_file'] ?? NULL; |
||||||
113 | $this->combineLogo($idpLogo, $fedLogo); |
||||||
114 | $this->writeMainNSH($this->selectedEap, $this->attributes); |
||||||
115 | $this->compileNSIS(); |
||||||
116 | $installerPath = $this->signInstaller(); |
||||||
117 | |||||||
118 | textdomain($dom); |
||||||
119 | return($installerPath); |
||||||
120 | } |
||||||
121 | |||||||
122 | /** |
||||||
123 | * creates the XML snippet that describes the EAP configuration |
||||||
124 | * |
||||||
125 | * @param array $attr the attributes for the profile |
||||||
126 | * @return array two XML snippets describing the EAP configuration, for Vista and 7 respectively |
||||||
127 | */ |
||||||
128 | private function prepareEapConfig($attr) |
||||||
129 | { |
||||||
130 | $outerUser = ''; |
||||||
131 | $vistaExt = ''; |
||||||
132 | $w7Ext = ''; |
||||||
133 | $useAnon = isset($attr['internal:use_anon_outer']) && $attr['internal:use_anon_outer'][0] == "1" && isset($attr['internal:realm']) ? true : false; |
||||||
0 ignored issues
–
show
|
|||||||
134 | $useAnon = $attr['internal:use_anon_outer'] [0]; |
||||||
135 | $realm = $attr['internal:realm'] [0]; |
||||||
136 | if ($useAnon) { |
||||||
137 | $outerUser = $attr['internal:anon_local_value'][0]; |
||||||
138 | } |
||||||
139 | // $servers = preg_quote(implode(';',$attr['eap:server_name'])); |
||||||
140 | $servers = implode(';', $attr['eap:server_name']); |
||||||
141 | $caArray = $attr['internal:CAs'][0]; |
||||||
142 | $authorId = "0"; |
||||||
143 | if ($this->selectedEap == \core\common\EAP::EAPTYPE_TTLS_PAP || $this->selectedEap == \core\common\EAP::EAPTYPE_TTLS_MSCHAP2) { |
||||||
144 | $authorId = "67532"; |
||||||
145 | $servers = implode('</ServerName><ServerName>', $attr['eap:server_name']); |
||||||
146 | } |
||||||
147 | |||||||
148 | $profileFileCont = '<EAPConfig><EapHostConfig xmlns="http://www.microsoft.com/provisioning/EapHostConfig"> |
||||||
149 | <EapMethod> |
||||||
150 | <Type xmlns="http://www.microsoft.com/provisioning/EapCommon">' . |
||||||
151 | $this->selectedEap["OUTER"] . '</Type> |
||||||
152 | <VendorId xmlns="http://www.microsoft.com/provisioning/EapCommon">0</VendorId> |
||||||
153 | <VendorType xmlns="http://www.microsoft.com/provisioning/EapCommon">0</VendorType> |
||||||
154 | <AuthorId xmlns="http://www.microsoft.com/provisioning/EapCommon">' . $authorId . '</AuthorId> |
||||||
155 | </EapMethod> |
||||||
156 | '; |
||||||
157 | |||||||
158 | |||||||
159 | if ($this->selectedEap == \core\common\EAP::EAPTYPE_TTLS_PAP || $this->selectedEap == \core\common\EAP::EAPTYPE_TTLS_MSCHAP2) { |
||||||
160 | $innerMethod = 'MSCHAPv2'; |
||||||
161 | if ($this->selectedEap == \core\common\EAP::EAPTYPE_TTLS_PAP) { |
||||||
162 | $innerMethod = 'PAP'; |
||||||
163 | } |
||||||
164 | $profileFileCont .= ' |
||||||
165 | <Config xmlns="http://www.microsoft.com/provisioning/EapHostConfig"> |
||||||
166 | <EAPIdentityProviderList xmlns="urn:ietf:params:xml:ns:yang:ietf-eap-metadata"> |
||||||
167 | <EAPIdentityProvider ID="' . $this->deviceUUID . '" namespace="urn:UUID"> |
||||||
168 | <ProviderInfo> |
||||||
169 | <DisplayName>' . $this->translateString($attr['general:instname'][0]) . '</DisplayName> |
||||||
170 | </ProviderInfo> |
||||||
171 | <AuthenticationMethods> |
||||||
172 | <AuthenticationMethod> |
||||||
173 | <EAPMethod>21</EAPMethod> |
||||||
174 | <ClientSideCredential> |
||||||
175 | <allow-save>true</allow-save> |
||||||
176 | '; |
||||||
177 | if ($useAnon) { |
||||||
178 | if ($outerUser == '') { |
||||||
179 | $profileFileCont .= '<AnonymousIdentity>@</AnonymousIdentity>'; |
||||||
180 | } else { |
||||||
181 | $profileFileCont .= '<AnonymousIdentity>' . $outerUser . '@' . $realm . '</AnonymousIdentity>'; |
||||||
182 | } |
||||||
183 | } |
||||||
184 | $profileFileCont .= '</ClientSideCredential> |
||||||
185 | <ServerSideCredential> |
||||||
186 | '; |
||||||
187 | |||||||
188 | foreach ($caArray as $ca) { |
||||||
189 | $profileFileCont .= '<CA><format>PEM</format><cert-data>'; |
||||||
190 | $profileFileCont .= base64_encode($ca['der']); |
||||||
191 | $profileFileCont .= '</cert-data></CA> |
||||||
192 | '; |
||||||
193 | } |
||||||
194 | $profileFileCont .= "<ServerName>$servers</ServerName>\n"; |
||||||
195 | |||||||
196 | $profileFileCont .= ' |
||||||
197 | </ServerSideCredential> |
||||||
198 | <InnerAuthenticationMethod> |
||||||
199 | <NonEAPAuthMethod>' .$innerMethod. '</NonEAPAuthMethod> |
||||||
200 | </InnerAuthenticationMethod> |
||||||
201 | <VendorSpecific> |
||||||
202 | <SessionResumption>false</SessionResumption> |
||||||
203 | </VendorSpecific> |
||||||
204 | </AuthenticationMethod> |
||||||
205 | </AuthenticationMethods> |
||||||
206 | </EAPIdentityProvider> |
||||||
207 | </EAPIdentityProviderList> |
||||||
208 | </Config> |
||||||
209 | '; |
||||||
210 | } elseif ($this->selectedEap == \core\common\EAP::EAPTYPE_TLS || $this->selectedEap == \core\common\EAP::EAPTYPE_SILVERBULLET) { |
||||||
211 | |||||||
212 | $profileFileCont .= ' |
||||||
213 | |||||||
214 | <Config xmlns:baseEap="http://www.microsoft.com/provisioning/BaseEapConnectionPropertiesV1" |
||||||
215 | xmlns:eapTls="http://www.microsoft.com/provisioning/EapTlsConnectionPropertiesV1"> |
||||||
216 | <baseEap:Eap> |
||||||
217 | <baseEap:Type>13</baseEap:Type> |
||||||
218 | <eapTls:EapType> |
||||||
219 | <eapTls:CredentialsSource> |
||||||
220 | <eapTls:CertificateStore /> |
||||||
221 | </eapTls:CredentialsSource> |
||||||
222 | <eapTls:ServerValidation> |
||||||
223 | <eapTls:DisableUserPromptForServerValidation>true</eapTls:DisableUserPromptForServerValidation> |
||||||
224 | <eapTls:ServerNames>' . $servers . '</eapTls:ServerNames>'; |
||||||
225 | if ($caArray) { |
||||||
226 | foreach ($caArray as $certAuthority) { |
||||||
227 | if ($certAuthority['root']) { |
||||||
228 | $profileFileCont .= "<eapTls:TrustedRootCA>" . $certAuthority['sha1'] . "</eapTls:TrustedRootCA>\n"; |
||||||
229 | } |
||||||
230 | } |
||||||
231 | } |
||||||
232 | $profileFileCont .= '</eapTls:ServerValidation> |
||||||
233 | '; |
||||||
234 | if (isset($attr['eap-specific:tls_use_other_id']) && $attr['eap-specific:tls_use_other_id'][0] == 'on') { |
||||||
235 | $profileFileCont .= '<eapTls:DifferentUsername>true</eapTls:DifferentUsername>'; |
||||||
236 | $this->tlsOtherUsername = true; |
||||||
237 | } else { |
||||||
238 | $profileFileCont .= '<eapTls:DifferentUsername>false</eapTls:DifferentUsername>'; |
||||||
239 | } |
||||||
240 | $profileFileCont .= ' |
||||||
241 | </eapTls:EapType> |
||||||
242 | </baseEap:Eap> |
||||||
243 | </Config> |
||||||
244 | '; |
||||||
245 | } elseif ($this->selectedEap == \core\common\EAP::EAPTYPE_PEAP_MSCHAP2) { |
||||||
246 | if (isset($attr['eap:enable_nea']) && $attr['eap:enable_nea'][0] == 'on') { |
||||||
247 | $nea = 'true'; |
||||||
248 | } else { |
||||||
249 | $nea = 'false'; |
||||||
250 | } |
||||||
251 | $vistaExt = '<Config xmlns:eapUser="http://www.microsoft.com/provisioning/EapUserPropertiesV1" |
||||||
252 | xmlns:baseEap="http://www.microsoft.com/provisioning/BaseEapConnectionPropertiesV1" |
||||||
253 | xmlns:msPeap="http://www.microsoft.com/provisioning/MsPeapConnectionPropertiesV1" |
||||||
254 | xmlns:msChapV2="http://www.microsoft.com/provisioning/MsChapV2ConnectionPropertiesV1"> |
||||||
255 | <baseEap:Eap> |
||||||
256 | <baseEap:Type>25</baseEap:Type> |
||||||
257 | <msPeap:EapType> |
||||||
258 | <msPeap:ServerValidation> |
||||||
259 | <msPeap:DisableUserPromptForServerValidation>true</msPeap:DisableUserPromptForServerValidation> |
||||||
260 | <msPeap:ServerNames>' . $servers . '</msPeap:ServerNames>'; |
||||||
261 | if ($caArray) { |
||||||
262 | foreach ($caArray as $certAuthority) { |
||||||
263 | if ($certAuthority['root']) { |
||||||
264 | $vistaExt .= "<msPeap:TrustedRootCA>" . $certAuthority['sha1'] . "</msPeap:TrustedRootCA>\n"; |
||||||
265 | } |
||||||
266 | } |
||||||
267 | } |
||||||
268 | $vistaExt .= '</msPeap:ServerValidation> |
||||||
269 | <msPeap:FastReconnect>true</msPeap:FastReconnect> |
||||||
270 | <msPeap:InnerEapOptional>0</msPeap:InnerEapOptional> |
||||||
271 | <baseEap:Eap> |
||||||
272 | <baseEap:Type>26</baseEap:Type> |
||||||
273 | <msChapV2:EapType> |
||||||
274 | <msChapV2:UseWinLogonCredentials>false</msChapV2:UseWinLogonCredentials> |
||||||
275 | </msChapV2:EapType> |
||||||
276 | </baseEap:Eap> |
||||||
277 | <msPeap:EnableQuarantineChecks>' . $nea . '</msPeap:EnableQuarantineChecks> |
||||||
278 | <msPeap:RequireCryptoBinding>false</msPeap:RequireCryptoBinding> |
||||||
279 | </msPeap:EapType> |
||||||
280 | </baseEap:Eap> |
||||||
281 | </Config> |
||||||
282 | '; |
||||||
283 | $w7Ext = '<Config xmlns="http://www.microsoft.com/provisioning/EapHostConfig"> |
||||||
284 | <Eap xmlns="http://www.microsoft.com/provisioning/BaseEapConnectionPropertiesV1"> |
||||||
285 | <Type>25</Type> |
||||||
286 | <EapType xmlns="http://www.microsoft.com/provisioning/MsPeapConnectionPropertiesV1"> |
||||||
287 | <ServerValidation> |
||||||
288 | <DisableUserPromptForServerValidation>true</DisableUserPromptForServerValidation> |
||||||
289 | <ServerNames>' . $servers . '</ServerNames>'; |
||||||
290 | if ($caArray) { |
||||||
291 | foreach ($caArray as $certAuthority) { |
||||||
292 | if ($certAuthority['root']) { |
||||||
293 | $w7Ext .= "<TrustedRootCA>" . $certAuthority['sha1'] . "</TrustedRootCA>\n"; |
||||||
294 | } |
||||||
295 | } |
||||||
296 | } |
||||||
297 | $w7Ext .= '</ServerValidation> |
||||||
298 | <FastReconnect>true</FastReconnect> |
||||||
299 | <InnerEapOptional>false</InnerEapOptional> |
||||||
300 | <Eap xmlns="http://www.microsoft.com/provisioning/BaseEapConnectionPropertiesV1"> |
||||||
301 | <Type>26</Type> |
||||||
302 | <EapType xmlns="http://www.microsoft.com/provisioning/MsChapV2ConnectionPropertiesV1"> |
||||||
303 | <UseWinLogonCredentials>false</UseWinLogonCredentials> |
||||||
304 | </EapType> |
||||||
305 | </Eap> |
||||||
306 | <EnableQuarantineChecks>' . $nea . '</EnableQuarantineChecks> |
||||||
307 | <RequireCryptoBinding>false</RequireCryptoBinding> |
||||||
308 | '; |
||||||
309 | if ($useAnon) { |
||||||
310 | $w7Ext .= '<PeapExtensions> |
||||||
311 | <IdentityPrivacy xmlns="http://www.microsoft.com/provisioning/MsPeapConnectionPropertiesV2"> |
||||||
312 | <EnableIdentityPrivacy>true</EnableIdentityPrivacy> |
||||||
313 | <AnonymousUserName>' . $outerUser . '</AnonymousUserName> |
||||||
314 | </IdentityPrivacy> |
||||||
315 | </PeapExtensions> |
||||||
316 | '; |
||||||
317 | } |
||||||
318 | $w7Ext .= '</EapType> |
||||||
319 | </Eap> |
||||||
320 | </Config> |
||||||
321 | '; |
||||||
322 | } elseif ($this->selectedEap == \core\common\EAP::EAPTYPE_PWD) { |
||||||
323 | $profileFileCont .= '<ConfigBlob></ConfigBlob>'; |
||||||
324 | } |
||||||
325 | |||||||
326 | |||||||
327 | |||||||
328 | $profileFileContEnd = '</EapHostConfig></EAPConfig> |
||||||
329 | '; |
||||||
330 | $returnArray = []; |
||||||
331 | $returnArray['vista'] = $profileFileCont . $vistaExt . $profileFileContEnd; |
||||||
332 | $returnArray['w7'] = $profileFileCont . $w7Ext . $profileFileContEnd; |
||||||
333 | return $returnArray; |
||||||
334 | } |
||||||
335 | |||||||
336 | /** |
||||||
337 | * produce PEAP, TLS and TTLS configuration files for Vista and Windows 7. |
||||||
338 | * Writes XML snippet into file and returns some meta information |
||||||
339 | * |
||||||
340 | * @param string $wlanProfileName name of the WLAN profile |
||||||
341 | * @param string $ssid SSID that is being configured |
||||||
342 | * @param string $auth can be one of "WPA", "WPA2" |
||||||
343 | * @param string $encryption can be one of: "TKIP", "AES" |
||||||
344 | * @param array $eapConfig XML configuration block with EAP config data (two entries, one for Vista, one for 7) |
||||||
345 | * @param int $profileNumber counter, which profile number is this |
||||||
346 | * @return string meta info about generated XML snippet |
||||||
347 | */ |
||||||
348 | private function writeWLANprofile($wlanProfileName, $ssid, $auth, $encryption, $eapConfig, $profileNumber) { |
||||||
349 | $profileFileCont = '<?xml version="1.0"?> |
||||||
350 | <WLANProfile xmlns="http://www.microsoft.com/networking/WLAN/profile/v1"> |
||||||
351 | <name>' . $wlanProfileName . '</name> |
||||||
352 | <SSIDConfig> |
||||||
353 | <SSID> |
||||||
354 | <name>' . $ssid . '</name> |
||||||
355 | </SSID> |
||||||
356 | <nonBroadcast>true</nonBroadcast> |
||||||
357 | </SSIDConfig> |
||||||
358 | <connectionType>ESS</connectionType> |
||||||
359 | <connectionMode>auto</connectionMode> |
||||||
360 | <autoSwitch>false</autoSwitch> |
||||||
361 | <MSM> |
||||||
362 | <security> |
||||||
363 | <authEncryption> |
||||||
364 | <authentication>' . $auth . '</authentication> |
||||||
365 | <encryption>' . $encryption . '</encryption> |
||||||
366 | <useOneX>true</useOneX> |
||||||
367 | </authEncryption> |
||||||
368 | '; |
||||||
369 | if ($auth == 'WPA2') { |
||||||
370 | $profileFileCont .= '<PMKCacheMode>enabled</PMKCacheMode> |
||||||
371 | <PMKCacheTTL>720</PMKCacheTTL> |
||||||
372 | <PMKCacheSize>128</PMKCacheSize> |
||||||
373 | <preAuthMode>disabled</preAuthMode> |
||||||
374 | '; |
||||||
375 | } |
||||||
376 | $profileFileCont .= '<OneX xmlns="http://www.microsoft.com/networking/OneX/v1"> |
||||||
377 | <cacheUserData>true</cacheUserData> |
||||||
378 | <authMode>user</authMode> |
||||||
379 | '; |
||||||
380 | |||||||
381 | $closing = ' |
||||||
382 | </OneX> |
||||||
383 | </security> |
||||||
384 | </MSM> |
||||||
385 | </WLANProfile> |
||||||
386 | '; |
||||||
387 | |||||||
388 | if (!is_dir('w7')) { |
||||||
389 | mkdir('w7'); |
||||||
390 | } |
||||||
391 | if (!is_dir('vista')) { |
||||||
392 | mkdir('vista'); |
||||||
393 | } |
||||||
394 | $vistaFileName = "vista/wlan_prof-$profileNumber.xml"; |
||||||
395 | file_put_contents($vistaFileName, $profileFileCont . $eapConfig['vista'] . $closing); |
||||||
396 | $sevenFileName = "w7/wlan_prof-$profileNumber.xml"; |
||||||
397 | file_put_contents($sevenFileName, $profileFileCont . $eapConfig['w7'] . $closing); |
||||||
398 | $this->loggerInstance->debug(2, "Installer has been written into directory $this->FPATH\n"); |
||||||
399 | $this->loggerInstance->debug(4, "WLAN_Profile:$wlanProfileName:$encryption\n"); |
||||||
400 | return("\"$wlanProfileName\" \"$encryption\""); |
||||||
401 | } |
||||||
402 | |||||||
403 | /** |
||||||
404 | * writes LAN configuration profile into file |
||||||
405 | * |
||||||
406 | * @param array $eapConfig contains XML snippets for Vista and 7 with the EAP configuration |
||||||
407 | * @return void |
||||||
408 | */ |
||||||
409 | private function writeLANprofile($eapConfig) |
||||||
410 | { |
||||||
411 | $profileFileCont = '<?xml version="1.0"?> |
||||||
412 | <LANProfile xmlns="http://www.microsoft.com/networking/LAN/profile/v1"> |
||||||
413 | <MSM> |
||||||
414 | <security> |
||||||
415 | <OneXEnforced>false</OneXEnforced> |
||||||
416 | <OneXEnabled>true</OneXEnabled> |
||||||
417 | <OneX xmlns="http://www.microsoft.com/networking/OneX/v1"> |
||||||
418 | <cacheUserData>true</cacheUserData> |
||||||
419 | <authMode>user</authMode> |
||||||
420 | '; |
||||||
421 | $closing = ' |
||||||
422 | </OneX> |
||||||
423 | </security> |
||||||
424 | </MSM> |
||||||
425 | </LANProfile> |
||||||
426 | '; |
||||||
427 | if (!is_dir('w7')) { |
||||||
428 | mkdir('w7'); |
||||||
429 | } |
||||||
430 | if (!is_dir('vista')) { |
||||||
431 | mkdir('vista'); |
||||||
432 | } |
||||||
433 | |||||||
434 | file_put_contents("vista/lan_prof.xml", $profileFileCont . $eapConfig['vista'] . $closing); |
||||||
435 | file_put_contents("w7/lan_prof.xml", $profileFileCont . $eapConfig['w7'] . $closing); |
||||||
436 | |||||||
437 | } |
||||||
438 | |||||||
439 | /** |
||||||
440 | * writes the main NSH file |
||||||
441 | * |
||||||
442 | * @param array $eap EAP type that is being configured in array representation |
||||||
443 | * @param array $attr list of attributes |
||||||
444 | * @return void |
||||||
445 | */ |
||||||
446 | private function writeMainNSH($eap, $attr) { |
||||||
447 | $this->loggerInstance->debug(4, "writeMainNSH"); |
||||||
448 | $this->loggerInstance->debug(4, $attr); |
||||||
449 | $this->loggerInstance->debug(4, "MYLANG=" . $this->lang . "\n"); |
||||||
450 | |||||||
451 | $eapOptions = [ |
||||||
452 | \core\common\EAP::PEAP => ['str' => 'PEAP', 'exec' => 'user'], |
||||||
453 | \core\common\EAP::TLS => ['str' => 'TLS', 'exec' => 'user'], |
||||||
454 | // TODO for TW: the following line doesn't work - that constant is an array, which can't be a key for another array |
||||||
455 | // generated a PHP Warning but doesn't seem to have any catastrophic effect? |
||||||
456 | // \core\common\EAP::EAPTYPE_SILVERBULLET => ['str' => 'TLS', 'exec' => 'user'], |
||||||
457 | \core\common\EAP::TTLS => ['str' => 'GEANTLink', 'exec' => 'user'], |
||||||
458 | \core\common\EAP::PWD => ['str' => 'PWD', 'exec' => 'user'], |
||||||
459 | ]; |
||||||
460 | $fcontents = ''; |
||||||
461 | if (\config\ConfAssistant::NSIS_VERSION >= 3) { |
||||||
462 | $fcontents .= "Unicode true\n"; |
||||||
463 | } |
||||||
464 | |||||||
465 | // Uncomment the line below if you want this module to run under XP (only displaying a warning) |
||||||
466 | // $fcontents .= "!define ALLOW_XP\n"; |
||||||
467 | // Uncomment the line below if you want this module to produce debugging messages on the client |
||||||
468 | // $fcontents .= "!define DEBUG_CAT\n"; |
||||||
469 | if ($this->tlsOtherUsername === true) { |
||||||
470 | $fcontents .= "!define PFX_USERNAME\n"; |
||||||
471 | } |
||||||
472 | $execLevel = $eapOptions[$eap["OUTER"]]['exec']; |
||||||
473 | $eapStr = $eapOptions[$eap["OUTER"]]['str']; |
||||||
474 | if ($eap == \core\common\EAP::EAPTYPE_SILVERBULLET) { |
||||||
475 | $fcontents .= "!define SILVERBULLET\n"; |
||||||
476 | } |
||||||
477 | $this->loggerInstance->debug(4, "EAP_STR=$eapStr\n"); |
||||||
478 | $this->loggerInstance->debug(4, $eap); |
||||||
479 | |||||||
480 | $fcontents .= '!define ' . $eapStr; |
||||||
481 | $fcontents .= "\n" . '!define EXECLEVEL "' . $execLevel . '"'; |
||||||
482 | $fcontents .= $this->writeNsisDefines($attr); |
||||||
483 | file_put_contents('main.nsh', $fcontents); |
||||||
484 | } |
||||||
485 | |||||||
486 | /** |
||||||
487 | * writes references to the individual WLAN profile files into main file |
||||||
488 | * @param array $wlanProfiles list of WLAN profiles |
||||||
489 | * @param array $caArray list of CA certificates |
||||||
490 | * @return void |
||||||
491 | * @throws Exception |
||||||
492 | */ |
||||||
493 | private function writeProfilesNSH($wlanProfiles, $caArray) { |
||||||
494 | $this->loggerInstance->debug(4, "writeProfilesNSH"); |
||||||
495 | $this->loggerInstance->debug(4, $wlanProfiles); |
||||||
496 | $contentWlan = ''; |
||||||
497 | foreach ($wlanProfiles as $wlanProfile) { |
||||||
498 | $contentWlan .= "!insertmacro define_wlan_profile $wlanProfile 0 0\n"; |
||||||
499 | } |
||||||
500 | |||||||
501 | file_put_contents('profiles.nsh', $contentWlan); |
||||||
502 | |||||||
503 | $contentCerts = ''; |
||||||
504 | $fileHandleCerts = fopen('certs.nsh', 'w'); |
||||||
505 | if ($fileHandleCerts === false) { |
||||||
506 | throw new Exception("Unable to open new file certs.nsh to write CAs!"); |
||||||
507 | } |
||||||
508 | foreach ($caArray as $certAuthority) { |
||||||
509 | $store = $certAuthority['root'] ? "root" : "ca"; |
||||||
510 | $contentCerts .= '!insertmacro install_ca_cert "' . $certAuthority['file'] . '" "' . $certAuthority['sha1'] . '" "' . $store . "\"\n"; |
||||||
511 | } |
||||||
512 | fwrite($fileHandleCerts, $contentCerts); |
||||||
513 | fclose($fileHandleCerts); |
||||||
514 | } |
||||||
515 | |||||||
516 | /** |
||||||
517 | * copies various files into temp dir for inclusion into installer |
||||||
518 | * |
||||||
519 | * @param array $eap EAP type being configured, in array notation |
||||||
520 | * @return boolean true if things worked (and throws an Exception if not) |
||||||
521 | * @throws Exception |
||||||
522 | */ |
||||||
523 | private function copyFiles($eap) |
||||||
524 | { |
||||||
525 | $this->loggerInstance->debug(4, "copyFiles start\n"); |
||||||
526 | $this->copyBasicFiles(); |
||||||
527 | |||||||
528 | switch ($eap["OUTER"]) { |
||||||
529 | case \core\common\EAP::TTLS: |
||||||
530 | $this->copyGeantLinkFiles(); |
||||||
531 | break; |
||||||
532 | case \core\common\EAP::PWD: |
||||||
533 | $this->copyPwdFiles(); |
||||||
0 ignored issues
–
show
The method
copyPwdFiles() does not exist on devices\ms\DeviceVista7 . Did you maybe mean copyFiles() ?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces. This is most likely a typographical error or the method has been renamed. ![]() |
|||||||
534 | break; |
||||||
535 | default: |
||||||
536 | if (!$this->translateFile('peap_tls.inc', 'cat.NSI')) { |
||||||
537 | throw new Exception("Translating needed file peap_tls.inc failed!"); |
||||||
538 | } |
||||||
539 | } |
||||||
540 | $this->loggerInstance->debug(4, "copyFiles end\n"); |
||||||
541 | return true; |
||||||
542 | } |
||||||
543 | |||||||
544 | /** |
||||||
545 | * should a different username be prompted for when using EAP-TLS? |
||||||
546 | * |
||||||
547 | * @var boolean |
||||||
548 | */ |
||||||
549 | private $tlsOtherUsername = false; |
||||||
550 | |||||||
551 | } |
||||||
552 |
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