forked from ArnaudFeld/myVPNonDemandConfig
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.php
387 lines (341 loc) · 11.1 KB
/
index.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
<?php
//VPNonDemand-Script
//written by Arnaud Feld <[email protected]>
// found on Github ( https://github.com/jonathanjdavis/iosmailprofile ):
// based on a Script from
// Jonathan Davis <[email protected]>
// Jon Nistor <[email protected]>
// Orginal-Purpose: Generate snickers.org profile entries in iOS
// New-Purpose: Generate VPNonDemand-Profil for iOS
$o_vpnuser = NULL;
$o_vpnpasswort = NULL;
$o_Dyndns = NULL;
$o_SharedSecret = NULL;
$o_gWlan1 = NULL;
$o_gWlan2 = NULL;
$o_gWlan3 = NULL;
$o_gWlan4 = NULL;
$o_DomainIP1 = NULL;
$o_DomainIP2 = NULL;
$o_DomainIP3 = NULL;
$o_DomainIP4 = NULL;
$generate = TRUE;
function gen_uuid()
{
return sprintf( '%04x%04x-%04x-%04x-%04x-%04x%04x%04x',
// 32 bits for "time_low"
mt_rand( 0, 0xffff ), mt_rand( 0, 0xffff ),
// 16 bits for "time_mid"
mt_rand( 0, 0xffff ),
// 16 bits for "time_hi_and_version",
// four most significant bits holds version number 4
mt_rand( 0, 0x0fff ) | 0x4000,
// 16 bits, 8 bits for "clk_seq_hi_res",
// 8 bits for "clk_seq_low",
// two most significant bits holds zero and one for variant DCE1.1
mt_rand( 0, 0x3fff ) | 0x8000,
// 48 bits for "node"
mt_rand( 0, 0xffff ), mt_rand( 0, 0xffff ), mt_rand( 0, 0xffff )
);
}
if( isset($_POST) )
{
if(!empty($_POST['vpnuser']))
{
$o_vpnuser = trim(strip_tags ($_POST['vpnuser']));
} else {
$generate = FALSE;
$o_vpnuser_m = 'class="missing" ';
}
if(!empty($_POST['vpnpasswort']))
{
$o_vpnpasswort = trim(strip_tags ($_POST['vpnpasswort']));
} else {
//$generate = FALSE;
//$o_vpnpasswort_m = 'class="missing" ';
}
if(!empty($_POST['Dyndns']))
{
$o_Dyndns = trim(strip_tags ($_POST['Dyndns']));
if (strpos($o_Dyndns, ' ') > 0) {
$generate = FALSE;
$o_Dyndns_m = 'class="missing" ';
}
} else {
$generate = FALSE;
$o_Dyndns_m = 'class="missing" ';
}
if(!empty($_POST['SharedSecret']))
{
$o_SharedSecret = trim(strip_tags ($_POST['SharedSecret']));
} else {
//$generate = FALSE;
//$o_SharedSecret_m = 'class="missing" ';
}
if(!empty($_POST['gWlan1']))
{
$o_gWlan1 = trim(strip_tags ($_POST['gWlan1']));
} else {
$generate = FALSE;
$o_gWlan1_m = 'class="missing" ';
}
if(!empty($_POST['gWlan2']))
{
$o_gWlan2 = trim(strip_tags ($_POST['gWlan2']));
} else {
//$generate = FALSE;
//$o_gWlan2_m = 'class="missing" ';
}
if(!empty($_POST['gWlan3']))
{
$o_gWlan3 = trim(strip_tags ($_POST['gWlan3']));
} else {
//$generate = FALSE;
//$o_gWlan3_m = 'class="missing" ';
}
if(!empty($_POST['gWlan4']))
{
$o_gWlan4 = trim(strip_tags ($_POST['gWlan4']));
} else {
//$generate = FALSE;
//$o_gWlan4_m = 'class="missing"';
}
if(!empty($_POST['DomainIP1']))
{
$o_DomainIP1 = trim(strip_tags ($_POST['DomainIP1']));
} else {
$generate = FALSE;
$o_DomainIP1_m = 'class="missing" ';
}
if(!empty($_POST['DomainIP2']))
{
$o_DomainIP2 = trim(strip_tags ($_POST['DomainIP2']));
} else {
//$generate = FALSE;
//$o_DomainIP2_m = 'class="missing" ';
}
if(!empty($_POST['DomainIP3']))
{
$o_DomainIP3 = trim(strip_tags ($_POST['DomainIP3']));
} else {
//$generate = FALSE;
//$o_DomainIP3_m = 'class="missing" ';
}
if(!empty($_POST['DomainIP4']))
{
$o_DomainIP4 = trim(strip_tags ($_POST['DomainIP4']));
} else {
//$generate = FALSE;
//$o_DomainIP4_m = 'class="missing" ';
}
if( $generate )
{
$o_uuid1 = gen_uuid();
$o_uuid2 = gen_uuid();
}
} else {
$generate = FALSE;
}
$html = <<< EOHTMLF
<!DOCTYPE html>
<html lang="de-DE">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<meta name="author" content="Arnaud Feld [email protected]">
<title>VPNonDemand Profile Generator for iOS</title>
<link rel="stylesheet" href="default.css">
</head>
<body>
<h1>VPNonDemand Profile Generator for iOS v1.0.3.4</h1>
<p>Diese Seite erstellt ein VPNonDemand Profil für euer iOS-Device. </p> <p>Diese Seite ist für die keinen eignen Webspace haben aber vorallem für mich als Proof of Concept und wenn ich selbst mal eins erstellen muss.</p> <p>Ich empfehle immer das selber hosten aber biete es den Leute hier an.</p>
<p><a href="#FAQ">FAQ findet ihr unten</a></p>
<p>Hier bitte zum selber hosten ist der Code auf <a href="https://github.com/ArnaudFeld/myVPNonDemandConfig">Github.</a></p>
<p>Bitte gebt eure VPN-Einstellungen ein:</p>
<p>Pflichteingaben sind <font color="white"><span style="background-color:orangered;">Rot</span></font> makiert!</p>
<p>Die Erstellung des Profils läuft komplett im Browser ab. Es werden keine Daten auf dem Server gespeichert.</p>
<!--<br>
<p>Please enter the your VPN-information:</p>
<p>This page generates a VPNonDemand Profile for your iOS-Device</p> -->
<form name="profile_info" action="{$_SERVER['PHP_SELF']}" method="post">
<ul>
<li>
<label for="vpnuser" {$o_vpnuser_m}>Benutzername VPN-Users:</label>
<input type="text" name="vpnuser" value="{$o_vpnuser}">(e.g. Arnaud-VPN)
</li>
<li>
<label for="vpnpasswort"{$o_vpnpasswort_m}>Passwort VPN-Users:</label>
<input type="text" name="vpnpasswort" value="{$o_vpnpasswort}">
</li>
<li>
<label for="Dyndns"{$o_Dyndns_m}>Eure DynDNS/MyFritz-Adresse:</label>
<input type="text" name="Dyndns" value="{$o_Dyndns}">(z.B.: xxxxx.myfritz.net)
</li>
<li>
<label for="SharedSecret"{$o_SharedSecret_m}>Shared Secret aus der FritzBox:</label>
<input type="text" name="SharedSecret" value="{$o_SharedSecret}">(wird von eurer FB vorgegeben)
</li>
<li>
<label for="gWlan1"{$o_gWlan1_m}>WLANs wo kein VPN aufgebaut wird:</label>
<input type="text" name="gWlan1" value="{$o_gWlan1}">(z.B.: MeinWLAN-Zuhause)
</li>
<li>
<label for="gWlan2"{$o_gWlan2_m}>WLANs wo kein VPN aufgebaut wird:</label>
<input type="text" name="gWlan2" value="{$o_gWlan2}">
</li>
<li>
<label for="gWlan3"{$o_gWlan3_m}>WLANs wo kein VPN aufgebaut wird:</label>
<input type="text" name="gWlan3" value="{$o_gWlan3}">
</li>
<li>
<label for="gWlan4"{$o_gWlan4_m}>WLANs wo kein VPN aufgebaut wird:</label>
<input type="text" name="gWlan4" value="{$o_gWlan4}">
</li>
<li>
<label for="DomainIP1"{$o_DomainIP1_m}>DomainIP1:</label>
<input type="text" name="DomainIP1" value="{$o_DomainIP1}">(bei welchen Domains oder IPs wird das VPN aufgebaut)
</li>
<li>
<label for="DomainIP2"{$o_DomainIP2_m}>DomainIP2</label>
<input type="text" name="DomainIP2" value="{$o_DomainIP2}">
</li>
<li>
<label for="DomainIP3"{$o_DomainIP3_m}>DomainIP3:</label>
<input type="text" name="DomainIP3" value="{$o_DomainIP3}">
</li>
<li>
<label for="DomainIP4"{$o_DomainIP4_m}>DomainIP4:</label>
<input type="text" name="DomainIP4" size="32" value="{$o_DomainIP4}">
</li>
<li class="submit">
<input type="submit" value="Erstellt euer Profil" >
</li>
</ul>
</form>
<p>:-)</p>
<h2><b id="FAQ">FAQ</b></h2>
<p><b><i>Wie deinstalliere ich das Profil?</i></b></p>
<p>Einstellung -> Allgemein -> Profile ,dort dann das VPN-Profil auswählen und deinstallieren.</p>
<br>
<p><b><i>Werden Daten auf Server gespeichert?</i></b></p>
<p>Nein.</p>
<br>
<p><b><i>ToDo's:</i></b></p>
<p><li>Multi-Language</li></p>
<p><li>Domains/IPs variabel dazu klicken (wenn der eine nur 1, der andere 5 hinterlegen möchte)</li></p>
<hr />
<p>Zurück zu <a href="https://arnaudfeld.de">meinem</a> Blog.</p>
<p class="right">Based on a Script from <a href="http://github.com/notdavis/iosmailprofile">Jonathan Davis ([email protected]) & Jon Nistor ([email protected]) </a></p>
</body>
</html>
EOHTMLF;
$xml = <<< EOXMLF
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>PayloadContent</key>
<array>
<dict>
<key>IPSec</key>
<dict>
<key>AuthenticationMethod</key>
<string>SharedSecret</string>
<key>XAuthEnabled</key>
<integer>1</integer>
<key>XAuthName</key>
<string>{$o_vpnuser}</string>
<key>XAuthPassword</key>
<string>{$o_vpnpasswort}</string>
<key>OnDemandEnabled</key>
<integer>1</integer>
<key>OnDemandRules</key>
<array>
<dict>
<key>InterfaceTypeMatch</key>
<string>WiFi</string>
<key>SSIDMatch</key>
<array>
<string>{$o_gWlan1}</string>
<string>{$o_gWlan2}</string>
<string>{$o_gWlan3}</string>
<string>{$o_gWlan4}</string>
</array>
<key>Action</key>
<string>Disconnect</string>
</dict>
<dict>
<key>Action</key>
<string>EvaluateConnection</string>
<key>ActionParameters</key>
<array>
<dict>
<key>Domains</key>
<array>
<string>{$o_DomainIP1}</string>
<string>{$o_DomainIP2}</string>
<string>{$o_DomainIP3}</string>
<string>{$o_DomainIP4}</string>
</array>
<key>DomainAction</key>
<string>ConnectIfNeeded</string>
</dict>
</array>
</dict>
</array>
<key>LocalIdentifier</key>
<string>{$o_vpnuser}</string>
<key>LocalIdentifierType</key>
<string>KeyID</string>
<key>RemoteAddress</key>
<string>{$o_Dyndns}</string>
<key>SharedSecret</key>
<string>{$o_SharedSecret}</string>
</dict>
<key>PayloadDescription</key>
<string>Konfiguiert das VPNonDemand für euer iOS-Device</string>
<key>PayloadDisplayName</key>
<string>VPNonDemand {$o_Dyndns}</string>
<key>PayloadIdentifier</key>
<string>VPNonDemand {$o_Dyndns}</string>
<key>PayloadOrganization</key>
<string>VPNonDemand {$o_Dyndns}</string>
<key>PayloadType</key>
<string>com.apple.vpn.managed</string>
<key>PayloadUUID</key>
<string>{$o_uuid1}</string>
<key>PayloadVersion</key>
<integer>1</integer>
<key>UserDefinedName</key>
<string>VPNonDemand {$o_Dyndns}</string>
<key>VPNType</key>
<string>IPSec</string>
</dict>
</array>
<key>PayloadDescription</key>
<string>myVPNonDemand-Profil {$o_Dyndns}</string>
<key>PayloadDisplayName</key>
<string>VPNonDemand</string>
<key>PayloadIdentifier</key>
<string>VPNonDemand-Profil</string>
<key>PayloadOrganization</key>
<string>erstellt mit https://zum-en.de/VPN</string>
<key>PayloadType</key>
<string>Configuration</string>
<key>PayloadUUID</key>
<string>{$o_uuid2}</string>
<key>PayloadVersion</key>
<integer>1</integer>
</dict>
</plist>
EOXMLF;
if($generate) {
// header("Content-type: text/plain");
// Modified per: http://www.rootmanager.com/iphone-ota-configuration/iphone-ota-setup-with-signed-mobileconfig.html
header('Content-type: application/x-apple-aspen-config; chatset=utf-8');
header('Content-Disposition: attachment; filename="MyVPNonDemand.mobileconfig"');
echo $xml;
} else {
echo $html;
}
?>