1
|
<?php
|
2
|
/*
|
3
|
vpn_openvpn_server.php
|
4
|
|
5
|
Copyright (C) 2008 Shrew Soft Inc.
|
6
|
All rights reserved.
|
7
|
|
8
|
Redistribution and use in source and binary forms, with or without
|
9
|
modification, are permitted provided that the following conditions are met:
|
10
|
|
11
|
1. Redistributions of source code must retain the above copyright notice,
|
12
|
this list of conditions and the following disclaimer.
|
13
|
|
14
|
2. Redistributions in binary form must reproduce the above copyright
|
15
|
notice, this list of conditions and the following disclaimer in the
|
16
|
documentation and/or other materials provided with the distribution.
|
17
|
|
18
|
THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
19
|
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
|
20
|
AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
21
|
AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
|
22
|
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
23
|
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
24
|
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
25
|
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
26
|
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
27
|
POSSIBILITY OF SUCH DAMAGE.
|
28
|
*/
|
29
|
|
30
|
##|+PRIV
|
31
|
##|*IDENT=page-openvpn-server
|
32
|
##|*NAME=OpenVPN: Server page
|
33
|
##|*DESCR=Allow access to the 'OpenVPN: Server' page.
|
34
|
##|*MATCH=vpn_openvpn_server.php*
|
35
|
##|-PRIV
|
36
|
|
37
|
|
38
|
require("guiconfig.inc");
|
39
|
|
40
|
$pgtitle = array("OpenVPN", "Server");
|
41
|
|
42
|
if (!is_array($config['openvpn']['openvpn-server']))
|
43
|
$config['openvpn']['openvpn-server'] = array();
|
44
|
|
45
|
$a_server = &$config['openvpn']['openvpn-server'];
|
46
|
|
47
|
$id = $_GET['id'];
|
48
|
if (isset($_POST['id']))
|
49
|
$id = $_POST['id'];
|
50
|
|
51
|
$act = $_GET['act'];
|
52
|
if (isset($_POST['act']))
|
53
|
$act = $_POST['act'];
|
54
|
|
55
|
if ($_GET['act'] == "del") {
|
56
|
|
57
|
if (!$a_server[$id]) {
|
58
|
pfSenseHeader("vpn_openvpn_server.php");
|
59
|
exit;
|
60
|
}
|
61
|
|
62
|
openvpn_delete('server', $a_server[$id]);
|
63
|
unset($a_server[$id]);
|
64
|
write_config();
|
65
|
$savemsg = gettext("Server successfully deleted")."<br/>";
|
66
|
}
|
67
|
|
68
|
if($_GET['act']=="new"){
|
69
|
$pconfig['autokey_enable'] = "yes";
|
70
|
$pconfig['tlsauth_enable'] = "yes";
|
71
|
$pconfig['autotls_enable'] = "yes";
|
72
|
$pconfig['dh_length'] = 1024;
|
73
|
$pconfig['interface'] = "wan";
|
74
|
$pconfig['local_port'] = openvpn_port_next('UDP');
|
75
|
$pconfig['pool_enable'] = "yes";
|
76
|
}
|
77
|
|
78
|
if($_GET['act']=="edit"){
|
79
|
|
80
|
if (isset($id) && $a_server[$id]) {
|
81
|
|
82
|
$pconfig['disable'] = $a_server[$id]['disable'];
|
83
|
$pconfig['mode'] = $a_server[$id]['mode'];
|
84
|
$pconfig['protocol'] = $a_server[$id]['protocol'];
|
85
|
$pconfig['interface'] = $a_server[$id]['interface'];
|
86
|
$pconfig['local_port'] = $a_server[$id]['local_port'];
|
87
|
$pconfig['description'] = $a_server[$id]['description'];
|
88
|
$pconfig['custom_options'] = $a_server[$id]['custom_options'];
|
89
|
|
90
|
if ($pconfig['mode'] != "p2p_shared_key") {
|
91
|
if ($a_server[$id]['tls']) {
|
92
|
$pconfig['tlsauth_enable'] = "yes";
|
93
|
$pconfig['tls'] = base64_decode($a_server[$id]['tls']);
|
94
|
}
|
95
|
$pconfig['caref'] = $a_server[$id]['caref'];
|
96
|
$pconfig['certref'] = $a_server[$id]['certref'];
|
97
|
$pconfig['dh_length'] = $a_server[$id]['dh_length'];
|
98
|
} else
|
99
|
$pconfig['shared_key'] = base64_decode($a_server[$id]['shared_key']);
|
100
|
$pconfig['crypto'] = $a_server[$id]['crypto'];
|
101
|
|
102
|
$pconfig['tunnel_network'] = $a_server[$id]['tunnel_network'];
|
103
|
$pconfig['remote_network'] = $a_server[$id]['remote_network'];
|
104
|
$pconfig['gwredir'] = $a_server[$id]['gwredir'];
|
105
|
$pconfig['local_network'] = $a_server[$id]['local_network'];
|
106
|
$pconfig['maxclients'] = $a_server[$id]['maxclients'];
|
107
|
$pconfig['compression'] = $a_server[$id]['compression'];
|
108
|
$pconfig['passtos'] = $a_server[$id]['passtos'];
|
109
|
$pconfig['client2client'] = $a_server[$id]['client2client'];
|
110
|
|
111
|
$pconfig['pool_enable'] = $a_server[$id]['pool_enable'];
|
112
|
|
113
|
$pconfig['dns_domain'] = $a_server[$id]['dns_domain'];
|
114
|
if ($pconfig['dns_domain'])
|
115
|
$pconfig['dns_domain_enable'] = true;
|
116
|
|
117
|
$pconfig['dns_server1'] = $a_server[$id]['dns_server1'];
|
118
|
$pconfig['dns_server2'] = $a_server[$id]['dns_server2'];
|
119
|
$pconfig['dns_server3'] = $a_server[$id]['dns_server3'];
|
120
|
$pconfig['dns_server4'] = $a_server[$id]['dns_server4'];
|
121
|
if ($pconfig['dns_server1'] ||
|
122
|
$pconfig['dns_server2'] ||
|
123
|
$pconfig['dns_server3'] ||
|
124
|
$pconfig['dns_server4'])
|
125
|
$pconfig['dns_server_enable'] = true;
|
126
|
|
127
|
$pconfig['ntp_server1'] = $a_server[$id]['ntp_server1'];
|
128
|
$pconfig['ntp_server2'] = $a_server[$id]['ntp_server2'];
|
129
|
if ($pconfig['ntp_server1'] ||
|
130
|
$pconfig['ntp_server2'])
|
131
|
$pconfig['ntp_server_enable'] = true;
|
132
|
|
133
|
$pconfig['netbios_enable'] = $a_server[$id]['netbios_enable'];
|
134
|
$pconfig['netbios_ntype'] = $a_server[$id]['netbios_ntype'];
|
135
|
$pconfig['netbios_scope'] = $a_server[$id]['netbios_scope'];
|
136
|
|
137
|
$pconfig['wins_server1'] = $a_server[$id]['wins_server1'];
|
138
|
$pconfig['wins_server2'] = $a_server[$id]['wins_server2'];
|
139
|
if ($pconfig['wins_server1'] ||
|
140
|
$pconfig['wins_server2'])
|
141
|
$pconfig['wins_server_enable'] = true;
|
142
|
|
143
|
$pconfig['nbdd_server1'] = $a_server[$id]['nbdd_server1'];
|
144
|
if ($pconfig['nbdd_server1'])
|
145
|
$pconfig['nbdd_server_enable'] = true;
|
146
|
|
147
|
// just in case the modes switch
|
148
|
$pconfig['autokey_enable'] = "yes";
|
149
|
$pconfig['autotls_enable'] = "yes";
|
150
|
}
|
151
|
}
|
152
|
|
153
|
if ($_POST) {
|
154
|
|
155
|
unset($input_errors);
|
156
|
$pconfig = $_POST;
|
157
|
|
158
|
if (isset($id) && $a_server[$id])
|
159
|
$vpnid = $a_server[$id]['vpnid'];
|
160
|
else
|
161
|
$vpnid = 0;
|
162
|
|
163
|
if ($pconfig['mode'] != "p2p_shared_key")
|
164
|
$tls_mode = true;
|
165
|
else
|
166
|
$tls_mode = false;
|
167
|
|
168
|
/* input validation */
|
169
|
if ($result = openvpn_validate_port($pconfig['local_port'], 'Local port'))
|
170
|
$input_errors[] = $result;
|
171
|
|
172
|
if ($result = openvpn_validate_cidr($pconfig['tunnel_network'], 'Tunnel network'))
|
173
|
$input_errors[] = $result;
|
174
|
|
175
|
if ($result = openvpn_validate_cidr($pconfig['remote_network'], 'Remote network'))
|
176
|
$input_errors[] = $result;
|
177
|
|
178
|
if ($result = openvpn_validate_cidr($pconfig['local_network'], 'Local network'))
|
179
|
$input_errors[] = $result;
|
180
|
|
181
|
$portused = openvpn_port_used($pconfig['protocol'], $pconfig['local_port']);
|
182
|
if (($portused != $vpnid) && ($portused != 0))
|
183
|
$input_errors[] = "The specified 'Local port' is in use. Please select another value";
|
184
|
|
185
|
if ($pconfig['autokey_enable'])
|
186
|
$pconfig['shared_key'] = openvpn_create_key();
|
187
|
|
188
|
if (!$tls_mode && !$pconfig['autokey_enable'])
|
189
|
if (!strstr($pconfig['shared_key'], "-----BEGIN OpenVPN Static key V1-----") ||
|
190
|
!strstr($pconfig['shared_key'], "-----END OpenVPN Static key V1-----"))
|
191
|
$input_errors[] = "The field 'Shared Key' does not appear to be valid";
|
192
|
|
193
|
if ($tls_mode && $pconfig['tlsauth_enable'] && !$pconfig['autotls_enable'])
|
194
|
if (!strstr($pconfig['tls'], "-----BEGIN OpenVPN Static key V1-----") ||
|
195
|
!strstr($pconfig['tls'], "-----END OpenVPN Static key V1-----"))
|
196
|
$input_errors[] = "The field 'TLS Authentication Key' does not appear to be valid";
|
197
|
|
198
|
if ($pconfig['dns_server_enable']) {
|
199
|
if (!empty($pconfig['dns_server1']) && !is_ipaddr(trim($pconfig['dns_server1'])))
|
200
|
$input_errors[] = "The field 'DNS Server #1' must contain a valid IP address";
|
201
|
if (!empty($pconfig['dns_server2']) && !is_ipaddr(trim($pconfig['dns_server2'])))
|
202
|
$input_errors[] = "The field 'DNS Server #2' must contain a valid IP address";
|
203
|
if (!empty($pconfig['dns_server3']) && !is_ipaddr(trim($pconfig['dns_server3'])))
|
204
|
$input_errors[] = "The field 'DNS Server #3' must contain a valid IP address";
|
205
|
if (!empty($pconfig['dns_server4']) && !is_ipaddr(trim($pconfig['dns_server4'])))
|
206
|
$input_errors[] = "The field 'DNS Server #4' must contain a valid IP address";
|
207
|
}
|
208
|
|
209
|
if ($pconfig['ntp_server_enable']) {
|
210
|
if (!empty($pconfig['ntp_server1']) && !is_ipaddr(trim($pconfig['ntp_server1'])))
|
211
|
$input_errors[] = "The field 'NTP Server #1' must contain a valid IP address";
|
212
|
if (!empty($pconfig['ntp_server2']) && !is_ipaddr(trim($pconfig['ntp_server2'])))
|
213
|
$input_errors[] = "The field 'NTP Server #2' must contain a valid IP address";
|
214
|
if (!empty($pconfig['ntp_server3']) && !is_ipaddr(trim($pconfig['ntp_server3'])))
|
215
|
$input_errors[] = "The field 'NTP Server #3' must contain a valid IP address";
|
216
|
if (!empty($pconfig['ntp_server4']) && !is_ipaddr(trim($pconfig['ntp_server4'])))
|
217
|
$input_errors[] = "The field 'NTP Server #4' must contain a valid IP address";
|
218
|
}
|
219
|
|
220
|
if ($pconfig['netbios_enable']) {
|
221
|
if ($pconfig['wins_server_enable']) {
|
222
|
if (!empty($pconfig['wins_server1']) && !is_ipaddr(trim($pconfig['wins_server1'])))
|
223
|
$input_errors[] = "The field 'WINS Server #1' must contain a valid IP address";
|
224
|
if (!empty($pconfig['wins_server2']) && !is_ipaddr(trim($pconfig['wins_server2'])))
|
225
|
$input_errors[] = "The field 'WINS Server #2' must contain a valid IP address";
|
226
|
}
|
227
|
if ($pconfig['nbdd_server_enable'])
|
228
|
if (!empty($pconfig['nbdd_server1']) && !is_ipaddr(trim($pconfig['nbdd_server1'])))
|
229
|
$input_errors[] = "The field 'NetBIOS Data Distribution Server #1' must contain a valid IP address";
|
230
|
}
|
231
|
|
232
|
if ($pconfig['maxclients'] && !is_numeric($pconfig['maxclients']))
|
233
|
$input_errors[] = "The field 'Concurrent connections' must be numeric.";
|
234
|
|
235
|
if (!$tls_mode && !$pconfig['autokey_enable']) {
|
236
|
$reqdfields = array('shared_key');
|
237
|
$reqdfieldsn = array('Shared key');
|
238
|
} else {
|
239
|
$reqdfields = explode(" ", "caref certref");
|
240
|
$reqdfieldsn = explode(",", "Certificate Authority,Certificate");;
|
241
|
}
|
242
|
|
243
|
$reqdfields[] = 'tunnel_network';
|
244
|
$reqdfieldsn[] = 'Tunnel network';
|
245
|
|
246
|
do_input_validation($_POST, $reqdfields, $reqdfieldsn, &$input_errors);
|
247
|
|
248
|
if (!$input_errors) {
|
249
|
|
250
|
$server = array();
|
251
|
|
252
|
if ($vpnid)
|
253
|
$server['vpnid'] = $vpnid;
|
254
|
else
|
255
|
$server['vpnid'] = openvpn_vpnid_next();
|
256
|
|
257
|
$server['disable'] = $pconfig['disable'];
|
258
|
$server['mode'] = $pconfig['mode'];
|
259
|
$server['protocol'] = $pconfig['protocol'];
|
260
|
$server['interface'] = $pconfig['interface'];
|
261
|
$server['local_port'] = $pconfig['local_port'];
|
262
|
$server['description'] = $pconfig['description'];
|
263
|
$server['custom_options'] = $pconfig['custom_options'];
|
264
|
|
265
|
if ($tls_mode) {
|
266
|
if ($pconfig['tlsauth_enable']) {
|
267
|
if ($pconfig['autotls_enable'])
|
268
|
$pconfig['tls'] = openvpn_create_key();
|
269
|
$server['tls'] = base64_encode($pconfig['tls']);
|
270
|
}
|
271
|
$server['caref'] = $pconfig['caref'];
|
272
|
$server['certref'] = $pconfig['certref'];
|
273
|
$server['dh_length'] = $pconfig['dh_length'];
|
274
|
} else {
|
275
|
$server['shared_key'] = base64_encode($pconfig['shared_key']);
|
276
|
}
|
277
|
$server['crypto'] = $pconfig['crypto'];
|
278
|
|
279
|
$server['tunnel_network'] = $pconfig['tunnel_network'];
|
280
|
$server['remote_network'] = $pconfig['remote_network'];
|
281
|
$server['gwredir'] = $pconfig['gwredir'];
|
282
|
$server['local_network'] = $pconfig['local_network'];
|
283
|
$server['maxclients'] = $pconfig['maxclients'];
|
284
|
$server['compression'] = $pconfig['compression'];
|
285
|
$server['passtos'] = $pconfig['passtos'];
|
286
|
$server['client2client'] = $pconfig['client2client'];
|
287
|
|
288
|
$server['pool_enable'] = $pconfig['pool_enable'];
|
289
|
|
290
|
if ($pconfig['dns_domain_enable'])
|
291
|
$server['dns_domain'] = $pconfig['dns_domain'];
|
292
|
|
293
|
if ($pconfig['dns_server_enable']) {
|
294
|
$server['dns_server1'] = $pconfig['dns_server1'];
|
295
|
$server['dns_server2'] = $pconfig['dns_server2'];
|
296
|
$server['dns_server3'] = $pconfig['dns_server3'];
|
297
|
$server['dns_server4'] = $pconfig['dns_server4'];
|
298
|
}
|
299
|
|
300
|
if ($pconfig['ntp_server_enable']) {
|
301
|
$server['ntp_server1'] = $pconfig['ntp_server1'];
|
302
|
$server['ntp_server2'] = $pconfig['ntp_server2'];
|
303
|
}
|
304
|
|
305
|
$server['netbios_enable'] = $pconfig['netbios_enable'];
|
306
|
$server['netbios_ntype'] = $pconfig['netbios_ntype'];
|
307
|
$server['netbios_scope'] = $pconfig['netbios_scope'];
|
308
|
|
309
|
if ($pconfig['netbios_enable']) {
|
310
|
|
311
|
if ($pconfig['wins_server_enable']) {
|
312
|
$server['wins_server1'] = $pconfig['wins_server1'];
|
313
|
$server['wins_server2'] = $pconfig['wins_server2'];
|
314
|
}
|
315
|
|
316
|
if ($pconfig['dns_server_enable'])
|
317
|
$server['nbdd_server1'] = $pconfig['nbdd_server1'];
|
318
|
}
|
319
|
|
320
|
if (isset($id) && $a_server[$id])
|
321
|
$a_server[$id] = $server;
|
322
|
else
|
323
|
$a_server[] = $server;
|
324
|
|
325
|
openvpn_resync('server', $server);
|
326
|
write_config();
|
327
|
|
328
|
header("Location: vpn_openvpn_server.php");
|
329
|
exit;
|
330
|
}
|
331
|
}
|
332
|
|
333
|
include("head.inc");
|
334
|
|
335
|
?>
|
336
|
|
337
|
<body link="#000000" vlink="#000000" alink="#000000" onload="<?= $jsevents["body"]["onload"] ?>">
|
338
|
<?php include("fbegin.inc"); ?>
|
339
|
<script language="JavaScript">
|
340
|
<!--
|
341
|
|
342
|
function mode_change() {
|
343
|
index = document.iform.mode.selectedIndex;
|
344
|
value = document.iform.mode.options[index].value;
|
345
|
switch(value) {
|
346
|
case "p2p_tls":
|
347
|
case "server_tls":
|
348
|
case "server_user":
|
349
|
case "server_tls_user":
|
350
|
document.getElementById("tls").style.display="";
|
351
|
document.getElementById("tls_ca").style.display="";
|
352
|
document.getElementById("tls_cert").style.display="";
|
353
|
document.getElementById("tls_dh").style.display="";
|
354
|
document.getElementById("psk").style.display="none";
|
355
|
break;
|
356
|
case "p2p_shared_key":
|
357
|
document.getElementById("tls").style.display="none";
|
358
|
document.getElementById("tls_ca").style.display="none";
|
359
|
document.getElementById("tls_cert").style.display="none";
|
360
|
document.getElementById("tls_dh").style.display="none";
|
361
|
document.getElementById("psk").style.display="";
|
362
|
break;
|
363
|
}
|
364
|
switch(value) {
|
365
|
case "p2p_tls":
|
366
|
case "p2p_shared_key":
|
367
|
document.getElementById("client_opts").style.display="none";
|
368
|
document.getElementById("remote_opts").style.display="";
|
369
|
break;
|
370
|
default:
|
371
|
document.getElementById("client_opts").style.display="";
|
372
|
document.getElementById("remote_opts").style.display="none";
|
373
|
break;
|
374
|
}
|
375
|
}
|
376
|
|
377
|
function autokey_change() {
|
378
|
|
379
|
if (document.iform.autokey_enable.checked)
|
380
|
document.getElementById("autokey_opts").style.display="none";
|
381
|
else
|
382
|
document.getElementById("autokey_opts").style.display="";
|
383
|
}
|
384
|
|
385
|
function tlsauth_change() {
|
386
|
|
387
|
<?php if (!$pconfig['tls']): ?>
|
388
|
if (document.iform.tlsauth_enable.checked)
|
389
|
document.getElementById("tlsauth_opts").style.display="";
|
390
|
else
|
391
|
document.getElementById("tlsauth_opts").style.display="none";
|
392
|
<?php endif; ?>
|
393
|
|
394
|
autotls_change();
|
395
|
}
|
396
|
|
397
|
function autotls_change() {
|
398
|
|
399
|
<?php if (!$pconfig['tls']): ?>
|
400
|
autocheck = document.iform.autotls_enable.checked;
|
401
|
<?php else: ?>
|
402
|
autocheck = false;
|
403
|
<?php endif; ?>
|
404
|
|
405
|
if (document.iform.tlsauth_enable.checked && !autocheck)
|
406
|
document.getElementById("autotls_opts").style.display="";
|
407
|
else
|
408
|
document.getElementById("autotls_opts").style.display="none";
|
409
|
}
|
410
|
|
411
|
function gwredir_change() {
|
412
|
|
413
|
if (document.iform.gwredir.checked)
|
414
|
document.getElementById("local_opts").style.display="none";
|
415
|
else
|
416
|
document.getElementById("local_opts").style.display="";
|
417
|
}
|
418
|
|
419
|
function dns_domain_change() {
|
420
|
|
421
|
if (document.iform.dns_domain_enable.checked)
|
422
|
document.getElementById("dns_domain_data").style.display="";
|
423
|
else
|
424
|
document.getElementById("dns_domain_data").style.display="none";
|
425
|
}
|
426
|
|
427
|
function dns_server_change() {
|
428
|
|
429
|
if (document.iform.dns_server_enable.checked)
|
430
|
document.getElementById("dns_server_data").style.display="";
|
431
|
else
|
432
|
document.getElementById("dns_server_data").style.display="none";
|
433
|
}
|
434
|
|
435
|
function wins_server_change() {
|
436
|
|
437
|
if (document.iform.wins_server_enable.checked)
|
438
|
document.getElementById("wins_server_data").style.display="";
|
439
|
else
|
440
|
document.getElementById("wins_server_data").style.display="none";
|
441
|
}
|
442
|
|
443
|
function ntp_server_change() {
|
444
|
|
445
|
if (document.iform.ntp_server_enable.checked)
|
446
|
document.getElementById("ntp_server_data").style.display="";
|
447
|
else
|
448
|
document.getElementById("ntp_server_data").style.display="none";
|
449
|
}
|
450
|
|
451
|
function netbios_change() {
|
452
|
|
453
|
if (document.iform.netbios_enable.checked) {
|
454
|
document.getElementById("netbios_data").style.display="";
|
455
|
document.getElementById("wins_opts").style.display="";
|
456
|
} else {
|
457
|
document.getElementById("netbios_data").style.display="none";
|
458
|
document.getElementById("wins_opts").style.display="none";
|
459
|
}
|
460
|
}
|
461
|
|
462
|
//-->
|
463
|
</script>
|
464
|
<?php
|
465
|
if ($input_errors)
|
466
|
print_input_errors($input_errors);
|
467
|
if ($savemsg)
|
468
|
print_info_box($savemsg);
|
469
|
?>
|
470
|
<table width="100%" border="0" cellpadding="0" cellspacing="0">
|
471
|
<tr>
|
472
|
<td class="tabnavtbl">
|
473
|
<ul id="tabnav">
|
474
|
<?php
|
475
|
$tab_array = array();
|
476
|
$tab_array[] = array(gettext("Server"), true, "vpn_openvpn_server.php");
|
477
|
$tab_array[] = array(gettext("Client"), false, "vpn_openvpn_client.php");
|
478
|
$tab_array[] = array(gettext("Client Specific Overrides"), false, "vpn_openvpn_csc.php");
|
479
|
add_package_tabs("OpenVPN", $tab_array);
|
480
|
display_top_tabs($tab_array);
|
481
|
?>
|
482
|
</ul>
|
483
|
</td>
|
484
|
</tr>
|
485
|
<tr>
|
486
|
<td class="tabcont">
|
487
|
|
488
|
<?php if($act=="new" || $act=="edit"): ?>
|
489
|
|
490
|
<form action="vpn_openvpn_server.php" method="post" name="iform" id="iform" onsubmit="presubmit()">
|
491
|
<table width="100%" border="0" cellpadding="6" cellspacing="0">
|
492
|
<tr>
|
493
|
<td colspan="2" valign="top" class="listtopic">General information</td>
|
494
|
</tr>
|
495
|
<tr>
|
496
|
<td width="22%" valign="top" class="vncellreq">Disabled</td>
|
497
|
<td width="78%" class="vtable">
|
498
|
<table border="0" cellpadding="0" cellspacing="0">
|
499
|
<tr>
|
500
|
<td>
|
501
|
<?php set_checked($pconfig['disable'],$chk); ?>
|
502
|
<input name="disable" type="checkbox" value="yes" <?=$chk;?>/>
|
503
|
</td>
|
504
|
<td>
|
505
|
|
506
|
<span class="vexpl">
|
507
|
<strong>Disable this server</strong><br>
|
508
|
</span>
|
509
|
</td>
|
510
|
</tr>
|
511
|
</table>
|
512
|
Set this option to disable this server without removing it from the list.
|
513
|
</td>
|
514
|
</tr>
|
515
|
<tr>
|
516
|
<td width="22%" valign="top" class="vncellreq"><?=gettext("Server Mode");?></td>
|
517
|
<td width="78%" class="vtable">
|
518
|
<select name='mode' id='mode' class="formselect" onchange='mode_change()'>
|
519
|
<?php
|
520
|
foreach ($openvpn_server_modes as $name => $desc):
|
521
|
$selected = "";
|
522
|
if ($pconfig['mode'] == $name)
|
523
|
$selected = "selected";
|
524
|
?>
|
525
|
<option value="<?=$name;?>" <?=$selected;?>><?=$desc;?></option>
|
526
|
<?php endforeach; ?>
|
527
|
</select>
|
528
|
</td>
|
529
|
</tr>
|
530
|
<tr>
|
531
|
<td width="22%" valign="top" class="vncellreq"><?=gettext("Protocol");?></td>
|
532
|
<td width="78%" class="vtable">
|
533
|
<select name='protocol' class="formselect">
|
534
|
<?php
|
535
|
foreach ($openvpn_prots as $prot):
|
536
|
$selected = "";
|
537
|
if ($pconfig['protocol'] == $prot)
|
538
|
$selected = "selected";
|
539
|
?>
|
540
|
<option value="<?=$prot;?>" <?=$selected;?>><?=$prot;?></option>
|
541
|
<?php endforeach; ?>
|
542
|
</select>
|
543
|
</td>
|
544
|
</tr>
|
545
|
<tr>
|
546
|
<td width="22%" valign="top" class="vncellreq">Interface</td>
|
547
|
<td width="78%" class="vtable">
|
548
|
<select name="interface" class="formselect">
|
549
|
<?php
|
550
|
$interfaces = get_configured_interface_with_descr();
|
551
|
foreach ($interfaces as $iface => $ifacename):
|
552
|
$selected = "";
|
553
|
if ($iface == $pconfig['interface'])
|
554
|
$selected = "selected";
|
555
|
?>
|
556
|
<option value="<?=$iface;?>" <?=$selected;?>>
|
557
|
<?=htmlspecialchars($ifacename);?>
|
558
|
</option>
|
559
|
<?php endforeach; ?>
|
560
|
</select> <br>
|
561
|
</td>
|
562
|
</tr>
|
563
|
<tr>
|
564
|
<td width="22%" valign="top" class="vncellreq"><?=gettext("Local port");?></td>
|
565
|
<td width="78%" class="vtable">
|
566
|
<input name="local_port" type="text" class="formfld unknown" size="5" value="<?=htmlspecialchars($pconfig['local_port']);?>"/>
|
567
|
</td>
|
568
|
</tr>
|
569
|
<tr>
|
570
|
<td width="22%" valign="top" class="vncell">Description</td>
|
571
|
<td width="78%" class="vtable">
|
572
|
<input name="description" type="text" class="formfld unknown" size="30" value="<?=htmlspecialchars($pconfig['description']);?>">
|
573
|
<br>
|
574
|
You may enter a description here for your reference (not parsed).
|
575
|
</td>
|
576
|
</tr>
|
577
|
<tr>
|
578
|
<td colspan="2" class="list" height="12"></td>
|
579
|
</tr>
|
580
|
<tr>
|
581
|
<td colspan="2" valign="top" class="listtopic">Cryptographic Settings</td>
|
582
|
</tr>
|
583
|
<tr id="tls">
|
584
|
<td width="22%" valign="top" class="vncellreq">TLS Authentication</td>
|
585
|
<td width="78%" class="vtable">
|
586
|
<table border="0" cellpadding="2" cellspacing="0">
|
587
|
<tr>
|
588
|
<td>
|
589
|
<?php set_checked($pconfig['tlsauth_enable'],$chk); ?>
|
590
|
<input name="tlsauth_enable" id="tlsauth_enable" type="checkbox" value="yes" <?=$chk;?> onClick="tlsauth_change()">
|
591
|
</td>
|
592
|
<td>
|
593
|
<span class="vexpl">
|
594
|
Enable authentication of TLS packets.
|
595
|
</span>
|
596
|
</td>
|
597
|
</tr>
|
598
|
</table>
|
599
|
<?php if (!$pconfig['tls']): ?>
|
600
|
<table border="0" cellpadding="2" cellspacing="0" id='tlsauth_opts'>
|
601
|
<tr>
|
602
|
<td>
|
603
|
<?php set_checked($pconfig['autotls_enable'],$chk); ?>
|
604
|
<input name="autotls_enable" id="autotls_enable" type="checkbox" value="yes" <?=$chk;?> onClick="autotls_change()">
|
605
|
</td>
|
606
|
<td>
|
607
|
<span class="vexpl">
|
608
|
Automatically generate a shared TLS authentication key.
|
609
|
</span>
|
610
|
</td>
|
611
|
</tr>
|
612
|
</table>
|
613
|
<?php endif; ?>
|
614
|
<table border="0" cellpadding="2" cellspacing="0" id='autotls_opts'>
|
615
|
<tr>
|
616
|
<td>
|
617
|
<textarea name="tls" cols="65" rows="7" class="formpre"><?=htmlspecialchars($pconfig['tls']);?></textarea>
|
618
|
<br/>
|
619
|
Paste your shared key here.
|
620
|
</td>
|
621
|
</tr>
|
622
|
</table>
|
623
|
</td>
|
624
|
</tr>
|
625
|
<tr id="tls_ca">
|
626
|
<td width="22%" valign="top" class="vncellreq">Peer Certificate Authority</td>
|
627
|
<td width="78%" class="vtable">
|
628
|
<select name='caref' class="formselect">
|
629
|
<?php
|
630
|
foreach ($config['system']['ca'] as $ca):
|
631
|
$selected = "";
|
632
|
if ($pconfig['caref'] == $ca['refid'])
|
633
|
$selected = "selected";
|
634
|
?>
|
635
|
<option value="<?=$ca['refid'];?>" <?=$selected;?>><?=$ca['name'];?></option>
|
636
|
<?php endforeach; ?>
|
637
|
</select>
|
638
|
</td>
|
639
|
</tr>
|
640
|
<tr id="tls_cert">
|
641
|
<td width="22%" valign="top" class="vncellreq">Server Certificate</td>
|
642
|
<td width="78%" class="vtable">
|
643
|
<select name='certref' class="formselect">
|
644
|
<?php
|
645
|
foreach ($config['system']['cert'] as $cert):
|
646
|
$selected = "";
|
647
|
if ($pconfig['certref'] == $cert['refid'])
|
648
|
$selected = "selected";
|
649
|
?>
|
650
|
<option value="<?=$cert['refid'];?>" <?=$selected;?>><?=$cert['name'];?></option>
|
651
|
<?php endforeach; ?>
|
652
|
</select>
|
653
|
</td>
|
654
|
</tr>
|
655
|
<tr id="tls_dh">
|
656
|
<td width="22%" valign="top" class="vncellreq">DH Parameters Length</td>
|
657
|
<td width="78%" class="vtable">
|
658
|
<select name="dh_length" class="formselect">
|
659
|
<?php
|
660
|
foreach ($openvpn_dh_lengths as $length):
|
661
|
$selected = '';
|
662
|
if ($length == $pconfig['dh_length'])
|
663
|
$selected = ' selected';
|
664
|
?>
|
665
|
<option<?=$selected?>><?=$length;?></option>
|
666
|
<?php endforeach; ?>
|
667
|
</select>
|
668
|
<span class="vexpl">
|
669
|
bits
|
670
|
</span>
|
671
|
</td>
|
672
|
</tr>
|
673
|
<tr id="psk">
|
674
|
<td width="22%" valign="top" class="vncellreq">Shared Key</td>
|
675
|
<td width="78%" class="vtable">
|
676
|
<?php if (!$pconfig['shared_key']): ?>
|
677
|
<table border="0" cellpadding="2" cellspacing="0">
|
678
|
<tr>
|
679
|
<td>
|
680
|
<?php set_checked($pconfig['autokey_enable'],$chk); ?>
|
681
|
<input name="autokey_enable" type="checkbox" value="yes" <?=$chk;?> onClick="autokey_change()">
|
682
|
</td>
|
683
|
<td>
|
684
|
<span class="vexpl">
|
685
|
Automatically generate a shared key.
|
686
|
</span>
|
687
|
</td>
|
688
|
</tr>
|
689
|
</table>
|
690
|
<?php endif; ?>
|
691
|
<table border="0" cellpadding="2" cellspacing="0" id='autokey_opts'>
|
692
|
<tr>
|
693
|
<td>
|
694
|
<textarea name="shared_key" cols="65" rows="7" class="formpre"><?=htmlspecialchars($pconfig['shared_key']);?></textarea>
|
695
|
<br/>
|
696
|
Paste your shared key here.
|
697
|
</td>
|
698
|
</tr>
|
699
|
</table>
|
700
|
</td>
|
701
|
</tr>
|
702
|
<tr>
|
703
|
<td width="22%" valign="top" class="vncellreq">Encryption algorithm</td>
|
704
|
<td width="78%" class="vtable">
|
705
|
<select name="crypto" class="formselect">
|
706
|
<?php
|
707
|
$cipherlist = openvpn_get_cipherlist();
|
708
|
foreach ($cipherlist as $name => $desc):
|
709
|
$selected = '';
|
710
|
if ($name == $pconfig['crypto'])
|
711
|
$selected = ' selected';
|
712
|
?>
|
713
|
<option value="<?=$name;?>"<?=$selected?>>
|
714
|
<?=htmlspecialchars($desc);?>
|
715
|
</option>
|
716
|
<?php endforeach; ?>
|
717
|
</select>
|
718
|
</td>
|
719
|
</tr>
|
720
|
<tr>
|
721
|
<td colspan="2" class="list" height="12"></td>
|
722
|
</tr>
|
723
|
<tr>
|
724
|
<td colspan="2" valign="top" class="listtopic">Tunnel Settings</td>
|
725
|
</tr>
|
726
|
<tr>
|
727
|
<td width="22%" valign="top" class="vncellreq">Tunnel Network</td>
|
728
|
<td width="78%" class="vtable">
|
729
|
<input name="tunnel_network" type="text" class="formfld unknown" size="20" value="<?=htmlspecialchars($pconfig['tunnel_network']);?>">
|
730
|
<br>
|
731
|
This is the virtual network used for private
|
732
|
communications between this server and client
|
733
|
hosts expressed using CIDR (eg. 10.0.8.0/24).
|
734
|
The first network address will be assigned to
|
735
|
the server virtual interface. The remaining
|
736
|
network addresses can optionally be assigned
|
737
|
to connecting clients. (see Address Pool)
|
738
|
</td>
|
739
|
</tr>
|
740
|
<tr>
|
741
|
<td width="22%" valign="top" class="vncell">Redirect Gateway</td>
|
742
|
<td width="78%" class="vtable">
|
743
|
<table border="0" cellpadding="2" cellspacing="0">
|
744
|
<tr>
|
745
|
<td>
|
746
|
<?php set_checked($pconfig['gwredir'],$chk); ?>
|
747
|
<input name="gwredir" type="checkbox" value="yes" <?=$chk;?> onClick="gwredir_change()"/>
|
748
|
</td>
|
749
|
<td>
|
750
|
<span class="vexpl">
|
751
|
Force all client generated traffic through the tunnel.
|
752
|
</span>
|
753
|
</td>
|
754
|
</tr>
|
755
|
</table>
|
756
|
</td>
|
757
|
</tr>
|
758
|
<tr id="local_opts">
|
759
|
<td width="22%" valign="top" class="vncell">Local Network</td>
|
760
|
<td width="78%" class="vtable">
|
761
|
<input name="local_network" type="text" class="formfld unknown" size="20" value="<?=htmlspecialchars($pconfig['local_network']);?>">
|
762
|
<br>
|
763
|
This is the network that will be accessable
|
764
|
from the remote endpoint. Expressed as a CIDR
|
765
|
range. You may leave this blank if you don't
|
766
|
want to add a route to the local network
|
767
|
through this tunnel on the remote machine.
|
768
|
This is generally set to your LAN network.
|
769
|
</td>
|
770
|
</tr>
|
771
|
<tr id="remote_opts">
|
772
|
<td width="22%" valign="top" class="vncell">Remote Network</td>
|
773
|
<td width="78%" class="vtable">
|
774
|
<input name="remote_network" type="text" class="formfld unknown" size="20" value="<?=htmlspecialchars($pconfig['remote_network']);?>">
|
775
|
<br>
|
776
|
This is a network that will be routed through
|
777
|
the tunnel, so that a site-to-site VPN can be
|
778
|
established without manually changing the
|
779
|
routing tables. Expressed as a CIDR range. If
|
780
|
this is a site-to-site VPN, enter here the
|
781
|
remote LAN here. You may leave this blank if
|
782
|
you don't want a site-to-site VPN.
|
783
|
</td>
|
784
|
</tr>
|
785
|
<tr>
|
786
|
<td width="22%" valign="top" class="vncell"><?=gettext("Concurrent connections");?></td>
|
787
|
<td width="78%" class="vtable">
|
788
|
<input name="maxclients" type="text" class="formfld unknown" size="5" value="<?=htmlspecialchars($pconfig['maxclients']);?>"/>
|
789
|
<br/>
|
790
|
Specify the maximum number of clients allowed to concurrently connect to this server.
|
791
|
</td>
|
792
|
</tr>
|
793
|
<tr>
|
794
|
<td width="22%" valign="top" class="vncell">Compression</td>
|
795
|
<td width="78%" class="vtable">
|
796
|
<table border="0" cellpadding="2" cellspacing="0">
|
797
|
<tr>
|
798
|
<td>
|
799
|
<?php set_checked($pconfig['compression'],$chk); ?>
|
800
|
<input name="compression" type="checkbox" value="yes" <?=$chk;?>>
|
801
|
</td>
|
802
|
<td>
|
803
|
<span class="vexpl">
|
804
|
Compress tunnel packets using the LZO algorithm.
|
805
|
</span>
|
806
|
</td>
|
807
|
</tr>
|
808
|
</table>
|
809
|
</td>
|
810
|
</tr>
|
811
|
<tr>
|
812
|
<td width="22%" valign="top" class="vncell">Type-of-Service</td>
|
813
|
<td width="78%" class="vtable">
|
814
|
<table border="0" cellpadding="2" cellspacing="0">
|
815
|
<tr>
|
816
|
<td>
|
817
|
<?php set_checked($pconfig['passtos'],$chk); ?>
|
818
|
<input name="passtos" type="checkbox" value="yes" <?=$chk;?>>
|
819
|
</td>
|
820
|
<td>
|
821
|
<span class="vexpl">
|
822
|
Set the TOS IP header value of tunnel packets to match the encapsulated packet value.
|
823
|
</span>
|
824
|
</td>
|
825
|
</tr>
|
826
|
</table>
|
827
|
</td>
|
828
|
</tr>
|
829
|
<tr>
|
830
|
<td width="22%" valign="top" class="vncell">Inter-client communication</td>
|
831
|
<td width="78%" class="vtable">
|
832
|
<table border="0" cellpadding="2" cellspacing="0">
|
833
|
<tr>
|
834
|
<td>
|
835
|
<?php set_checked($pconfig['client2client'],$chk); ?>
|
836
|
<input name="client2client" type="checkbox" value="yes" <?=$chk;?>/>
|
837
|
</td>
|
838
|
<td>
|
839
|
<span class="vexpl">
|
840
|
Allow communication between clients connected to this server
|
841
|
</span>
|
842
|
</td>
|
843
|
</tr>
|
844
|
</table>
|
845
|
</td>
|
846
|
</tr>
|
847
|
</table>
|
848
|
|
849
|
<table width="100%" border="0" cellpadding="6" cellspacing="0" id="client_opts">
|
850
|
<tr>
|
851
|
<td colspan="2" class="list" height="12"></td>
|
852
|
</tr>
|
853
|
<tr>
|
854
|
<td colspan="2" valign="top" class="listtopic">Client Settings</td>
|
855
|
</tr>
|
856
|
<tr>
|
857
|
<td width="22%" valign="top" class="vncell">Address Pool</td>
|
858
|
<td width="78%" class="vtable">
|
859
|
<table border="0" cellpadding="2" cellspacing="0">
|
860
|
<tr>
|
861
|
<td>
|
862
|
<?php set_checked($pconfig['pool_enable'],$chk); ?>
|
863
|
<input name="pool_enable" type="checkbox" id="pool_enable" value="yes" <?=$chk;?>">
|
864
|
</td>
|
865
|
<td>
|
866
|
<span class="vexpl">
|
867
|
Provide a virtual adapter IP address to clients (see Tunnel Network)<br>
|
868
|
</span>
|
869
|
</td>
|
870
|
</tr>
|
871
|
</table>
|
872
|
</td>
|
873
|
</tr>
|
874
|
<tr>
|
875
|
<td width="22%" valign="top" class="vncell">DNS Default Domain</td>
|
876
|
<td width="78%" class="vtable">
|
877
|
<table border="0" cellpadding="2" cellspacing="0">
|
878
|
<tr>
|
879
|
<td>
|
880
|
<?php set_checked($pconfig['dns_domain_enable'],$chk); ?>
|
881
|
<input name="dns_domain_enable" type="checkbox" id="dns_domain_enable" value="yes" <?=$chk;?> onClick="dns_domain_change()">
|
882
|
</td>
|
883
|
<td>
|
884
|
<span class="vexpl">
|
885
|
Provide a default domain name to clients<br>
|
886
|
</span>
|
887
|
</td>
|
888
|
</tr>
|
889
|
</table>
|
890
|
<table border="0" cellpadding="2" cellspacing="0" id="dns_domain_data">
|
891
|
<tr>
|
892
|
<td>
|
893
|
<input name="dns_domain" type="text" class="formfld unknown" id="dns_domain" size="30" value="<?=htmlspecialchars($pconfig['dns_domain']);?>">
|
894
|
</td>
|
895
|
</tr>
|
896
|
</table>
|
897
|
</td>
|
898
|
</tr>
|
899
|
<tr>
|
900
|
<td width="22%" valign="top" class="vncell">DNS Servers</td>
|
901
|
<td width="78%" class="vtable">
|
902
|
<table border="0" cellpadding="2" cellspacing="0">
|
903
|
<tr>
|
904
|
<td>
|
905
|
<?php set_checked($pconfig['dns_server_enable'],$chk); ?>
|
906
|
<input name="dns_server_enable" type="checkbox" id="dns_server_enable" value="yes" <?=$chk;?> onClick="dns_server_change()">
|
907
|
</td>
|
908
|
<td>
|
909
|
<span class="vexpl">
|
910
|
Provide a DNS server list to clients<br>
|
911
|
</span>
|
912
|
</td>
|
913
|
</tr>
|
914
|
</table>
|
915
|
<table border="0" cellpadding="2" cellspacing="0" id="dns_server_data">
|
916
|
<tr>
|
917
|
<td>
|
918
|
<span class="vexpl">
|
919
|
Server #1:
|
920
|
</span>
|
921
|
<input name="dns_server1" type="text" class="formfld unknown" id="dns_server1" size="20" value="<?=$pconfig['dns_server1'];?>">
|
922
|
</td>
|
923
|
</tr>
|
924
|
<tr>
|
925
|
<td>
|
926
|
<span class="vexpl">
|
927
|
Server #2:
|
928
|
</span>
|
929
|
<input name="dns_server2" type="text" class="formfld unknown" id="dns_server2" size="20" value="<?=$pconfig['dns_server2'];?>">
|
930
|
</td>
|
931
|
</tr>
|
932
|
<tr>
|
933
|
<td>
|
934
|
<span class="vexpl">
|
935
|
Server #3:
|
936
|
</span>
|
937
|
<input name="dns_server3" type="text" class="formfld unknown" id="dns_server3" size="20" value="<?=$pconfig['dns_server3'];?>">
|
938
|
</td>
|
939
|
</tr>
|
940
|
<tr>
|
941
|
<td>
|
942
|
<span class="vexpl">
|
943
|
Server #4:
|
944
|
</span>
|
945
|
<input name="dns_server4" type="text" class="formfld unknown" id="dns_server4" size="20" value="<?=$pconfig['dns_server4'];?>">
|
946
|
</td>
|
947
|
</tr>
|
948
|
</table>
|
949
|
</td>
|
950
|
</tr>
|
951
|
<tr>
|
952
|
<td width="22%" valign="top" class="vncell">NTP Servers</td>
|
953
|
<td width="78%" class="vtable">
|
954
|
<table border="0" cellpadding="2" cellspacing="0">
|
955
|
<tr>
|
956
|
<td>
|
957
|
<?php set_checked($pconfig['ntp_server_enable'],$chk); ?>
|
958
|
<input name="ntp_server_enable" type="checkbox" id="ntp_server_enable" value="yes" <?=$chk;?> onClick="ntp_server_change()">
|
959
|
</td>
|
960
|
<td>
|
961
|
<span class="vexpl">
|
962
|
Provide a NTP server list to clients<br>
|
963
|
</span>
|
964
|
</td>
|
965
|
</tr>
|
966
|
</table>
|
967
|
<table border="0" cellpadding="2" cellspacing="0" id="ntp_server_data">
|
968
|
<tr>
|
969
|
<td>
|
970
|
<span class="vexpl">
|
971
|
Server #1:
|
972
|
</span>
|
973
|
<input name="ntp_server1" type="text" class="formfld unknown" id="ntp_server1" size="20" value="<?=$pconfig['ntp_server1'];?>">
|
974
|
</td>
|
975
|
</tr>
|
976
|
<tr>
|
977
|
<td>
|
978
|
<span class="vexpl">
|
979
|
Server #2:
|
980
|
</span>
|
981
|
<input name="ntp_server2" type="text" class="formfld unknown" id="ntp_server2" size="20" value="<?=$pconfig['ntp_server2'];?>">
|
982
|
</td>
|
983
|
</tr>
|
984
|
</table>
|
985
|
</td>
|
986
|
</tr>
|
987
|
<tr>
|
988
|
<td width="22%" valign="top" class="vncell">NetBIOS Options</td>
|
989
|
<td width="78%" class="vtable">
|
990
|
<table border="0" cellpadding="2" cellspacing="0">
|
991
|
<tr>
|
992
|
<td>
|
993
|
<?php set_checked($pconfig['netbios_enable'],$chk); ?>
|
994
|
<input name="netbios_enable" type="checkbox" id="netbios_enable" value="yes" <?=$chk;?> onClick="netbios_change()">
|
995
|
</td>
|
996
|
<td>
|
997
|
<span class="vexpl">
|
998
|
Enable NetBIOS over TCP/IP<br>
|
999
|
</span>
|
1000
|
</td>
|
1001
|
</tr>
|
1002
|
</table>
|
1003
|
If this option is not set, all Netbios-over-TCP/IP options (includeing WINS) will be disabled.
|
1004
|
<br/>
|
1005
|
<table border="0" cellpadding="2" cellspacing="0" id="netbios_data">
|
1006
|
<tr>
|
1007
|
<td>
|
1008
|
<br/>
|
1009
|
<span class="vexpl">
|
1010
|
Node Type:
|
1011
|
</span>
|
1012
|
<select name='netbios_ntype' class="formselect">
|
1013
|
<?php
|
1014
|
foreach ($netbios_nodetypes as $type => $name):
|
1015
|
$selected = "";
|
1016
|
if ($pconfig['netbios_ntype'] == $type)
|
1017
|
$selected = "selected";
|
1018
|
?>
|
1019
|
<option value="<?=$type;?>" <?=$selected;?>><?=$name;?></option>
|
1020
|
<?php endforeach; ?>
|
1021
|
</select>
|
1022
|
<br/>
|
1023
|
Possible options: b-node (broadcasts), p-node
|
1024
|
(point-to-point name queries to a WINS server),
|
1025
|
m-node (broadcast then query name server), and
|
1026
|
h-node (query name server, then broadcast).
|
1027
|
</td>
|
1028
|
</tr>
|
1029
|
<tr>
|
1030
|
<td>
|
1031
|
<br/>
|
1032
|
<span class="vexpl">
|
1033
|
Scope ID:
|
1034
|
</span>
|
1035
|
<input name="netbios_scope" type="text" class="formfld unknown" id="netbios_scope" size="30" value="<?=htmlspecialchars($pconfig['netbios_scope']);?>">
|
1036
|
<br/>
|
1037
|
A NetBIOS Scope ID provides an extended naming
|
1038
|
service for NetBIOS over TCP/IP. The NetBIOS
|
1039
|
scope ID isolates NetBIOS traffic on a single
|
1040
|
network to only those nodes with the same
|
1041
|
NetBIOS scope ID.
|
1042
|
</td>
|
1043
|
</tr>
|
1044
|
</table>
|
1045
|
</td>
|
1046
|
</tr>
|
1047
|
<tr id="wins_opts">
|
1048
|
<td width="22%" valign="top" class="vncell">WINS Servers</td>
|
1049
|
<td width="78%" class="vtable">
|
1050
|
<table border="0" cellpadding="2" cellspacing="0">
|
1051
|
<tr>
|
1052
|
<td>
|
1053
|
<?php set_checked($pconfig['wins_server_enable'],$chk); ?>
|
1054
|
<input name="wins_server_enable" type="checkbox" id="wins_server_enable" value="yes" <?=$chk;?> onClick="wins_server_change()">
|
1055
|
</td>
|
1056
|
<td>
|
1057
|
<span class="vexpl">
|
1058
|
Provide a WINS server list to clients<br>
|
1059
|
</span>
|
1060
|
</td>
|
1061
|
</tr>
|
1062
|
</table>
|
1063
|
<table border="0" cellpadding="2" cellspacing="0" id="wins_server_data">
|
1064
|
<tr>
|
1065
|
<td>
|
1066
|
<span class="vexpl">
|
1067
|
Server #1:
|
1068
|
</span>
|
1069
|
<input name="wins_server1" type="text" class="formfld unknown" id="wins_server1" size="20" value="<?=$pconfig['wins_server1'];?>">
|
1070
|
</td>
|
1071
|
</tr>
|
1072
|
<tr>
|
1073
|
<td>
|
1074
|
<span class="vexpl">
|
1075
|
Server #2:
|
1076
|
</span>
|
1077
|
<input name="wins_server2" type="text" class="formfld unknown" id="wins_server2" size="20" value="<?=$pconfig['wins_server2'];?>">
|
1078
|
</td>
|
1079
|
</tr>
|
1080
|
</table>
|
1081
|
</td>
|
1082
|
</tr>
|
1083
|
</table>
|
1084
|
|
1085
|
<table width="100%" border="0" cellpadding="6" cellspacing="0" id="client_opts">
|
1086
|
<tr>
|
1087
|
<td colspan="2" class="list" height="12"></td>
|
1088
|
</tr>
|
1089
|
<tr>
|
1090
|
<td colspan="2" valign="top" class="listtopic">Advanced configuration</td>
|
1091
|
</tr>
|
1092
|
<tr>
|
1093
|
<td width="22%" valign="top" class="vncell">Advanced</td>
|
1094
|
<td width="78%" class="vtable">
|
1095
|
<table border="0" cellpadding="2" cellspacing="0">
|
1096
|
<tr>
|
1097
|
<td>
|
1098
|
<textarea rows="6" cols="78" name="custom_options" id="custom_options"><?=$pconfig['custom_options'];?></textarea><br/>
|
1099
|
Paste any additional options you would like to pass through to the openvpn server here seperated by a semicoloin ;<br/>
|
1100
|
EXAMPLE: push "route 10.0.0.0 255.255.255.0";
|
1101
|
</td>
|
1102
|
</tr>
|
1103
|
</table>
|
1104
|
</td>
|
1105
|
</tr>
|
1106
|
</table>
|
1107
|
|
1108
|
<br/>
|
1109
|
|
1110
|
<table width="100%" border="0" cellpadding="6" cellspacing="0" id="client_opts">
|
1111
|
<tr>
|
1112
|
<td width="22%" valign="top"> </td>
|
1113
|
<td width="78%">
|
1114
|
<input name="save" type="submit" class="formbtn" value="Save">
|
1115
|
<input name="act" type="hidden" value="<?=$act;?>">
|
1116
|
<?php if (isset($id) && $a_server[$id]): ?>
|
1117
|
<input name="id" type="hidden" value="<?=$id;?>">
|
1118
|
<?php endif; ?>
|
1119
|
</td>
|
1120
|
</tr>
|
1121
|
</table>
|
1122
|
</form>
|
1123
|
|
1124
|
<?php else: ?>
|
1125
|
|
1126
|
<table width="100%" border="0" cellpadding="0" cellspacing="0">
|
1127
|
<tr>
|
1128
|
<td width="10%" class="listhdrr">Disabled</td>
|
1129
|
<td width="10%" class="listhdrr">Protocol</td>
|
1130
|
<td width="30%" class="listhdrr">Tunnel Network</td>
|
1131
|
<td width="40%" class="listhdrr">Description</td>
|
1132
|
<td width="10%" class="list"></td>
|
1133
|
</tr>
|
1134
|
<?php
|
1135
|
$i = 0;
|
1136
|
foreach($a_server as $server):
|
1137
|
$disabled = "NO";
|
1138
|
if ($server['disable'])
|
1139
|
$disabled = "YES";
|
1140
|
?>
|
1141
|
<tr>
|
1142
|
<td class="listlr" ondblclick="document.location='vpn_openvpn_server.php?act=edit&id=<?=$i;?>'">
|
1143
|
<?=$disabled;?>
|
1144
|
</td>
|
1145
|
<td class="listr" ondblclick="document.location='vpn_openvpn_server.php?act=edit&id=<?=$i;?>'">
|
1146
|
<?=htmlspecialchars($server['protocol']);?>
|
1147
|
</td>
|
1148
|
<td class="listr" ondblclick="document.location='vpn_openvpn_server.php?act=edit&id=<?=$i;?>'">
|
1149
|
<?=htmlspecialchars($server['tunnel_network']);?>
|
1150
|
</td>
|
1151
|
<td class="listbg" ondblclick="document.location='vpn_openvpn_server.php?act=edit&id=<?=$i;?>'">
|
1152
|
<?=htmlspecialchars($server['description']);?>
|
1153
|
</td>
|
1154
|
<td valign="middle" nowrap class="list">
|
1155
|
<a href="vpn_openvpn_server.php?act=edit&id=<?=$i;?>">
|
1156
|
<img src="./themes/<?=$g['theme'];?>/images/icons/icon_e.gif" title="edit server" width="17" height="17" border="0">
|
1157
|
</a>
|
1158
|
|
1159
|
<a href="vpn_openvpn_server.php?act=del&id=<?=$i;?>" onclick="return confirm('Do you really want to delete this server?')">
|
1160
|
<img src="/themes/<?=$g['theme'];?>/images/icons/icon_x.gif" title="delete server" width="17" height="17" border="0">
|
1161
|
</a>
|
1162
|
</td>
|
1163
|
</tr>
|
1164
|
<?php
|
1165
|
$i++;
|
1166
|
endforeach;
|
1167
|
?>
|
1168
|
<tr>
|
1169
|
<td class="list" colspan="4"></td>
|
1170
|
<td class="list">
|
1171
|
<a href="vpn_openvpn_server.php?act=new"><img src="./themes/<?=$g['theme'];?>/images/icons/icon_plus.gif" title="add server" width="17" height="17" border="0">
|
1172
|
</a>
|
1173
|
</td>
|
1174
|
</tr>
|
1175
|
<tr>
|
1176
|
<td colspan="4">
|
1177
|
<p>
|
1178
|
<?=gettext("Additional OpenVPN servers can be added here.");?>
|
1179
|
</p>
|
1180
|
</td>
|
1181
|
</tr>
|
1182
|
</table>
|
1183
|
|
1184
|
<? endif; ?>
|
1185
|
|
1186
|
</td>
|
1187
|
</tr>
|
1188
|
</table>
|
1189
|
<script language="JavaScript">
|
1190
|
<!--
|
1191
|
mode_change();
|
1192
|
autokey_change();
|
1193
|
tlsauth_change();
|
1194
|
gwredir_change();
|
1195
|
dns_domain_change();
|
1196
|
dns_server_change();
|
1197
|
wins_server_change();
|
1198
|
ntp_server_change();
|
1199
|
netbios_change();
|
1200
|
//-->
|
1201
|
</script>
|
1202
|
</body>
|
1203
|
<?php include("fend.inc"); ?>
|
1204
|
|
1205
|
<?php
|
1206
|
|
1207
|
/* local utility functions */
|
1208
|
|
1209
|
function set_checked($var,& $chk) {
|
1210
|
if($var)
|
1211
|
$chk = 'checked';
|
1212
|
else
|
1213
|
$chk = '';
|
1214
|
}
|
1215
|
|
1216
|
?>
|