Project

General

Profile

Download (40.4 KB) Statistics
| Branch: | Tag: | Revision:
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
require_once("openvpn.inc");
40

    
41
$pgtitle = array("OpenVPN", "Server");
42

    
43
if (!is_array($config['openvpn']['openvpn-server']))
44
	$config['openvpn']['openvpn-server'] = array();
45

    
46
$a_server = &$config['openvpn']['openvpn-server'];
47

    
48
$id = $_GET['id'];
49
if (isset($_POST['id']))
50
	$id = $_POST['id'];
51

    
52
$act = $_GET['act'];
53
if (isset($_POST['act']))
54
	$act = $_POST['act'];
55

    
56
if ($_GET['act'] == "del") {
57

    
58
	if (!$a_server[$id]) {
59
		pfSenseHeader("vpn_openvpn_server.php");
60
		exit;
61
	}
62

    
63
	openvpn_delete('server', $a_server[$id]);
64
	unset($a_server[$id]);
65
	write_config();
66
	$savemsg = gettext("Server successfully deleted")."<br/>";
67
}
68

    
69
if($_GET['act']=="new"){
70
	$pconfig['autokey_enable'] = "yes";
71
	$pconfig['tlsauth_enable'] = "yes";
72
	$pconfig['autotls_enable'] = "yes";
73
	$pconfig['dh_length'] = 1024;
74
	$pconfig['interface'] = "wan";
75
	$pconfig['local_port'] = openvpn_port_next('UDP');
76
	$pconfig['pool_enable'] = "yes";
77
}
78

    
79
if($_GET['act']=="edit"){
80

    
81
	if (isset($id) && $a_server[$id]) {
82

    
83
		$pconfig['disable'] = $a_server[$id]['disable'];
84
		$pconfig['mode'] = $a_server[$id]['mode'];
85
		$pconfig['protocol'] = $a_server[$id]['protocol'];
86
		$pconfig['interface'] = $a_server[$id]['interface'];
87
		$pconfig['local_port'] = $a_server[$id]['local_port'];
88
		$pconfig['description'] = $a_server[$id]['description'];
89
		$pconfig['custom_options'] = $a_server[$id]['custom_options'];
90

    
91
		if ($pconfig['mode'] != "p2p_shared_key") {
92
			if ($a_server[$id]['tls']) {
93
				$pconfig['tlsauth_enable'] = "yes";
94
				$pconfig['tls'] = base64_decode($a_server[$id]['tls']);
95
			}
96
			$pconfig['caref'] = $a_server[$id]['caref'];
97
			$pconfig['certref'] = $a_server[$id]['certref'];
98
			$pconfig['dh_length'] = $a_server[$id]['dh_length'];
99
		} else
100
			$pconfig['shared_key'] = base64_decode($a_server[$id]['shared_key']);
101
		$pconfig['crypto'] = $a_server[$id]['crypto'];
102

    
103
		$pconfig['tunnel_network'] = $a_server[$id]['tunnel_network'];
104
		$pconfig['remote_network'] = $a_server[$id]['remote_network'];
105
		$pconfig['gwredir'] = $a_server[$id]['gwredir'];
106
		$pconfig['local_network'] = $a_server[$id]['local_network'];
107
		$pconfig['maxclients'] = $a_server[$id]['maxclients'];
108
		$pconfig['compression'] = $a_server[$id]['compression'];
109
		$pconfig['passtos'] = $a_server[$id]['passtos'];
110
		$pconfig['client2client'] = $a_server[$id]['client2client'];
111

    
112
		$pconfig['pool_enable'] = $a_server[$id]['pool_enable'];
113

    
114
		$pconfig['dns_domain'] = $a_server[$id]['dns_domain'];
115
		if ($pconfig['dns_domain'])
116
			$pconfig['dns_domain_enable'] = true;
117

    
118
		$pconfig['dns_server1'] = $a_server[$id]['dns_server1'];
119
		$pconfig['dns_server2'] = $a_server[$id]['dns_server2'];
120
		$pconfig['dns_server3'] = $a_server[$id]['dns_server3'];
121
		$pconfig['dns_server4'] = $a_server[$id]['dns_server4'];
122
		if ($pconfig['dns_server1'] ||
123
			$pconfig['dns_server2'] ||
124
			$pconfig['dns_server3'] ||
125
			$pconfig['dns_server4'])
126
			$pconfig['dns_server_enable'] = true;
127

    
128
		$pconfig['ntp_server1'] = $a_server[$id]['ntp_server1'];
129
		$pconfig['ntp_server2'] = $a_server[$id]['ntp_server2'];
130
		if ($pconfig['ntp_server1'] ||
131
			$pconfig['ntp_server2'])
132
			$pconfig['ntp_server_enable'] = true;
133

    
134
		$pconfig['netbios_enable'] = $a_server[$id]['netbios_enable'];
135
		$pconfig['netbios_ntype'] = $a_server[$id]['netbios_ntype'];
136
		$pconfig['netbios_scope'] = $a_server[$id]['netbios_scope'];
137

    
138
		$pconfig['wins_server1'] = $a_server[$id]['wins_server1'];
139
		$pconfig['wins_server2'] = $a_server[$id]['wins_server2'];
140
		if ($pconfig['wins_server1'] ||
141
			$pconfig['wins_server2'])
142
			$pconfig['wins_server_enable'] = true;
143

    
144
		$pconfig['nbdd_server1'] = $a_server[$id]['nbdd_server1'];
145
		if ($pconfig['nbdd_server1'])
146
			$pconfig['nbdd_server_enable'] = true;
147

    
148
		// just in case the modes switch
149
		$pconfig['autokey_enable'] = "yes";
150
		$pconfig['autotls_enable'] = "yes";
151
	}
152
}
153

    
154
if ($_POST) {
155

    
156
	unset($input_errors);
157
	$pconfig = $_POST;
158

    
159
	if (isset($id) && $a_server[$id])
160
		$vpnid = $a_server[$id]['vpnid'];
161
	else
162
		$vpnid = 0;
163

    
164
	if ($pconfig['mode'] != "p2p_shared_key")
165
		$tls_mode = true;
166
	else
167
		$tls_mode = false;
168

    
169
	/* input validation */
170
	if ($result = openvpn_validate_port($pconfig['local_port'], 'Local port'))
171
		$input_errors[] = $result;
172

    
173
	if ($result = openvpn_validate_cidr($pconfig['tunnel_network'], 'Tunnel network'))
174
		$input_errors[] = $result;
175

    
176
	if ($result = openvpn_validate_cidr($pconfig['remote_network'], 'Remote network'))
177
		$input_errors[] = $result;
178

    
179
	if ($result = openvpn_validate_cidr($pconfig['local_network'], 'Local network'))
180
		$input_errors[] = $result;
181

    
182
	$portused = openvpn_port_used($pconfig['protocol'], $pconfig['local_port']);
183
	if (($portused != $vpnid) && ($portused != 0))
184
		$input_errors[] = "The specified 'Local port' is in use. Please select another value";
185

    
186
	if ($pconfig['autokey_enable'])
187
		$pconfig['shared_key'] = openvpn_create_key();
188

    
189
	if (!$tls_mode && !$pconfig['autokey_enable'])
190
		if (!strstr($pconfig['shared_key'], "-----BEGIN OpenVPN Static key V1-----") ||
191
			!strstr($pconfig['shared_key'], "-----END OpenVPN Static key V1-----"))
192
			$input_errors[] = "The field 'Shared Key' does not appear to be valid";
193

    
194
	if ($tls_mode && $pconfig['tlsauth_enable'] && !$pconfig['autotls_enable'])
195
		if (!strstr($pconfig['tls'], "-----BEGIN OpenVPN Static key V1-----") ||
196
			!strstr($pconfig['tls'], "-----END OpenVPN Static key V1-----"))
197
			$input_errors[] = "The field 'TLS Authentication Key' does not appear to be valid";
198

    
199
	if ($pconfig['dns_server_enable']) {
200
		if (!empty($pconfig['dns_server1']) && !is_ipaddr(trim($pconfig['dns_server1'])))
201
			$input_errors[] = "The field 'DNS Server #1' must contain a valid IP address";
202
		if (!empty($pconfig['dns_server2']) && !is_ipaddr(trim($pconfig['dns_server2'])))
203
			$input_errors[] = "The field 'DNS Server #2' must contain a valid IP address";
204
		if (!empty($pconfig['dns_server3']) && !is_ipaddr(trim($pconfig['dns_server3'])))
205
			$input_errors[] = "The field 'DNS Server #3' must contain a valid IP address";
206
		if (!empty($pconfig['dns_server4']) && !is_ipaddr(trim($pconfig['dns_server4'])))
207
			$input_errors[] = "The field 'DNS Server #4' must contain a valid IP address";
208
	}
209

    
210
	if ($pconfig['ntp_server_enable']) {
211
		if (!empty($pconfig['ntp_server1']) && !is_ipaddr(trim($pconfig['ntp_server1'])))
212
			$input_errors[] = "The field 'NTP Server #1' must contain a valid IP address";
213
		if (!empty($pconfig['ntp_server2']) && !is_ipaddr(trim($pconfig['ntp_server2'])))
214
			$input_errors[] = "The field 'NTP Server #2' must contain a valid IP address";
215
		if (!empty($pconfig['ntp_server3']) && !is_ipaddr(trim($pconfig['ntp_server3'])))
216
			$input_errors[] = "The field 'NTP Server #3' must contain a valid IP address";
217
		if (!empty($pconfig['ntp_server4']) && !is_ipaddr(trim($pconfig['ntp_server4'])))
218
			$input_errors[] = "The field 'NTP Server #4' must contain a valid IP address";
219
	}
220

    
221
	if ($pconfig['netbios_enable']) {
222
		if ($pconfig['wins_server_enable']) {
223
			if (!empty($pconfig['wins_server1']) && !is_ipaddr(trim($pconfig['wins_server1'])))
224
				$input_errors[] = "The field 'WINS Server #1' must contain a valid IP address";
225
			if (!empty($pconfig['wins_server2']) && !is_ipaddr(trim($pconfig['wins_server2'])))
226
				$input_errors[] = "The field 'WINS Server #2' must contain a valid IP address";
227
		}
228
		if ($pconfig['nbdd_server_enable'])
229
			if (!empty($pconfig['nbdd_server1']) && !is_ipaddr(trim($pconfig['nbdd_server1'])))
230
				$input_errors[] = "The field 'NetBIOS Data Distribution Server #1' must contain a valid IP address";
231
	}
232

    
233
	if ($pconfig['maxclients'] && !is_numeric($pconfig['maxclients']))
234
		$input_errors[] = "The field 'Concurrent connections' must be numeric.";
235

    
236
	if (!$tls_mode && !$pconfig['autokey_enable']) {
237
		$reqdfields = array('shared_key');
238
		$reqdfieldsn = array('Shared key');
239
    } else {
240
		$reqdfields = explode(" ", "caref certref");
241
		$reqdfieldsn = explode(",", "Certificate Authority,Certificate");;
242
	}
243

    
244
	$reqdfields[] = 'tunnel_network';
245
	$reqdfieldsn[] = 'Tunnel network';
246

    
247
	do_input_validation($_POST, $reqdfields, $reqdfieldsn, &$input_errors);
248
	
249
	if (!$input_errors) {
250

    
251
		$server = array();
252

    
253
		if ($vpnid)
254
			$server['vpnid'] = $vpnid;
255
		else
256
			$server['vpnid'] = openvpn_vpnid_next();
257

    
258
		$server['disable'] = $pconfig['disable'];
259
		$server['mode'] = $pconfig['mode'];
260
		$server['protocol'] = $pconfig['protocol'];
261
		$server['interface'] = $pconfig['interface'];
262
		$server['local_port'] = $pconfig['local_port'];
263
		$server['description'] = $pconfig['description'];
264
		$server['custom_options'] = $pconfig['custom_options'];
265

    
266
		if ($tls_mode) {
267
			if ($pconfig['tlsauth_enable']) {
268
				if ($pconfig['autotls_enable'])
269
					$pconfig['tls'] = openvpn_create_key();
270
				$server['tls'] = base64_encode($pconfig['tls']);
271
			}
272
			$server['caref'] = $pconfig['caref'];
273
			$server['certref'] = $pconfig['certref'];
274
			$server['dh_length'] = $pconfig['dh_length'];
275
		} else {
276
			$server['shared_key'] = base64_encode($pconfig['shared_key']);
277
		}
278
		$server['crypto'] = $pconfig['crypto'];
279

    
280
		$server['tunnel_network'] = $pconfig['tunnel_network'];
281
		$server['remote_network'] = $pconfig['remote_network'];
282
		$server['gwredir'] = $pconfig['gwredir'];
283
		$server['local_network'] = $pconfig['local_network'];
284
		$server['maxclients'] = $pconfig['maxclients'];
285
		$server['compression'] = $pconfig['compression'];
286
		$server['passtos'] = $pconfig['passtos'];
287
		$server['client2client'] = $pconfig['client2client'];
288

    
289
		$server['pool_enable'] = $pconfig['pool_enable'];
290

    
291
		if ($pconfig['dns_domain_enable'])
292
			$server['dns_domain'] = $pconfig['dns_domain'];
293

    
294
		if ($pconfig['dns_server_enable']) {
295
			$server['dns_server1'] = $pconfig['dns_server1'];
296
			$server['dns_server2'] = $pconfig['dns_server2'];
297
			$server['dns_server3'] = $pconfig['dns_server3'];
298
			$server['dns_server4'] = $pconfig['dns_server4'];
299
		}
300

    
301
		if ($pconfig['ntp_server_enable']) {
302
			$server['ntp_server1'] = $pconfig['ntp_server1'];
303
			$server['ntp_server2'] = $pconfig['ntp_server2'];
304
		}
305

    
306
		$server['netbios_enable'] = $pconfig['netbios_enable'];
307
		$server['netbios_ntype'] = $pconfig['netbios_ntype'];
308
		$server['netbios_scope'] = $pconfig['netbios_scope'];
309

    
310
		if ($pconfig['netbios_enable']) {
311

    
312
			if ($pconfig['wins_server_enable']) {
313
				$server['wins_server1'] = $pconfig['wins_server1'];
314
				$server['wins_server2'] = $pconfig['wins_server2'];
315
			}
316

    
317
			if ($pconfig['dns_server_enable'])
318
				$server['nbdd_server1'] = $pconfig['nbdd_server1'];
319
		}
320
	
321
		if (isset($id) && $a_server[$id])
322
			$a_server[$id] = $server;
323
		else
324
			$a_server[] = $server;
325

    
326
		openvpn_resync('server', $server);
327
		write_config();
328
		
329
		header("Location: vpn_openvpn_server.php");
330
		exit;
331
	}
332
}
333

    
334
include("head.inc");
335

    
336
?>
337

    
338
<body link="#000000" vlink="#000000" alink="#000000" onload="<?= $jsevents["body"]["onload"] ?>">
339
<?php include("fbegin.inc"); ?>
340
<script language="JavaScript">
341
<!--
342

    
343
function mode_change() {
344
	index = document.iform.mode.selectedIndex;
345
	value = document.iform.mode.options[index].value;
346
	switch(value) {
347
		case "p2p_tls":
348
		case "server_tls":
349
		case "server_user":
350
		case "server_tls_user":
351
			document.getElementById("tls").style.display="";
352
			document.getElementById("tls_ca").style.display="";
353
			document.getElementById("tls_cert").style.display="";
354
			document.getElementById("tls_dh").style.display="";
355
			document.getElementById("psk").style.display="none";
356
			break;
357
		case "p2p_shared_key":
358
			document.getElementById("tls").style.display="none";
359
			document.getElementById("tls_ca").style.display="none";
360
			document.getElementById("tls_cert").style.display="none";
361
			document.getElementById("tls_dh").style.display="none";
362
			document.getElementById("psk").style.display="";
363
			break;
364
	}
365
	switch(value) {
366
		case "p2p_tls":
367
		case "p2p_shared_key":
368
			document.getElementById("client_opts").style.display="none";
369
			document.getElementById("remote_opts").style.display="";
370
			break;
371
		default:
372
			document.getElementById("client_opts").style.display="";
373
			document.getElementById("remote_opts").style.display="none";
374
			break;
375
	}
376
}
377

    
378
function autokey_change() {
379

    
380
	if (document.iform.autokey_enable.checked)
381
		document.getElementById("autokey_opts").style.display="none";
382
	else
383
		document.getElementById("autokey_opts").style.display="";
384
}
385

    
386
function tlsauth_change() {
387

    
388
<?php if (!$pconfig['tls']): ?>
389
	if (document.iform.tlsauth_enable.checked)
390
		document.getElementById("tlsauth_opts").style.display="";
391
	else
392
		document.getElementById("tlsauth_opts").style.display="none";
393
<?php endif; ?>
394

    
395
	autotls_change();
396
}
397

    
398
function autotls_change() {
399

    
400
<?php if (!$pconfig['tls']): ?>
401
	autocheck = document.iform.autotls_enable.checked;
402
<?php else: ?>
403
	autocheck = false;
404
<?php endif; ?>
405

    
406
	if (document.iform.tlsauth_enable.checked && !autocheck)
407
		document.getElementById("autotls_opts").style.display="";
408
	else
409
		document.getElementById("autotls_opts").style.display="none";
410
}
411

    
412
function gwredir_change() {
413

    
414
	if (document.iform.gwredir.checked)
415
		document.getElementById("local_opts").style.display="none";
416
	else
417
		document.getElementById("local_opts").style.display="";
418
}
419

    
420
function dns_domain_change() {
421

    
422
	if (document.iform.dns_domain_enable.checked)
423
		document.getElementById("dns_domain_data").style.display="";
424
	else
425
		document.getElementById("dns_domain_data").style.display="none";
426
}
427

    
428
function dns_server_change() {
429

    
430
	if (document.iform.dns_server_enable.checked)
431
		document.getElementById("dns_server_data").style.display="";
432
	else
433
		document.getElementById("dns_server_data").style.display="none";
434
}
435

    
436
function wins_server_change() {
437

    
438
	if (document.iform.wins_server_enable.checked)
439
		document.getElementById("wins_server_data").style.display="";
440
	else
441
		document.getElementById("wins_server_data").style.display="none";
442
}
443

    
444
function ntp_server_change() {
445

    
446
	if (document.iform.ntp_server_enable.checked)
447
		document.getElementById("ntp_server_data").style.display="";
448
	else
449
		document.getElementById("ntp_server_data").style.display="none";
450
}
451

    
452
function netbios_change() {
453

    
454
	if (document.iform.netbios_enable.checked) {
455
		document.getElementById("netbios_data").style.display="";
456
		document.getElementById("wins_opts").style.display="";
457
	} else {
458
		document.getElementById("netbios_data").style.display="none";
459
		document.getElementById("wins_opts").style.display="none";
460
	}
461
}
462

    
463
//-->
464
</script>
465
<?php
466
	if ($input_errors)
467
		print_input_errors($input_errors);
468
	if ($savemsg)
469
		print_info_box($savemsg);
470
?>
471
<table width="100%" border="0" cellpadding="0" cellspacing="0">
472
	<tr>
473
		<td class="tabnavtbl">
474
			<ul id="tabnav">
475
			<?php 
476
				$tab_array = array();
477
				$tab_array[] = array(gettext("Server"), true, "vpn_openvpn_server.php");
478
				$tab_array[] = array(gettext("Client"), false, "vpn_openvpn_client.php");
479
				$tab_array[] = array(gettext("Client Specific Overrides"), false, "vpn_openvpn_csc.php");
480
				add_package_tabs("OpenVPN", $tab_array);
481
				display_top_tabs($tab_array);
482
			?>
483
			</ul>
484
		</td>
485
	</tr>    
486
	<tr>
487
		<td class="tabcont">
488

    
489
			<?php if($act=="new" || $act=="edit"): ?>
490

    
491
			<form action="vpn_openvpn_server.php" method="post" name="iform" id="iform" onsubmit="presubmit()">
492
				<table width="100%" border="0" cellpadding="6" cellspacing="0">
493
					<tr>
494
						<td colspan="2" valign="top" class="listtopic">General information</td>
495
					</tr>
496
					<tr>
497
						<td width="22%" valign="top" class="vncellreq">Disabled</td>
498
						<td width="78%" class="vtable">
499
							<table border="0" cellpadding="0" cellspacing="0">
500
								<tr>
501
									<td>
502
										<?php set_checked($pconfig['disable'],$chk); ?>
503
										<input name="disable" type="checkbox" value="yes" <?=$chk;?>/>
504
									</td>
505
									<td>
506
										&nbsp;
507
										<span class="vexpl">
508
											<strong>Disable this server</strong><br>
509
										</span>
510
									</td>
511
								</tr>
512
							</table>
513
							Set this option to disable this server without removing it from the list.
514
						</td>
515
					</tr>
516
					<tr>
517
						<td width="22%" valign="top" class="vncellreq"><?=gettext("Server Mode");?></td>
518
							<td width="78%" class="vtable">
519
							<select name='mode' id='mode' class="formselect" onchange='mode_change()'>
520
							<?php
521
								foreach ($openvpn_server_modes as $name => $desc):
522
									$selected = "";
523
									if ($pconfig['mode'] == $name)
524
										$selected = "selected";
525
							?>
526
								<option value="<?=$name;?>" <?=$selected;?>><?=$desc;?></option>
527
							<?php endforeach; ?>
528
							</select>
529
						</td>
530
					</tr>
531
					<tr>
532
						<td width="22%" valign="top" class="vncellreq"><?=gettext("Protocol");?></td>
533
							<td width="78%" class="vtable">
534
							<select name='protocol' class="formselect">
535
							<?php
536
								foreach ($openvpn_prots as $prot):
537
									$selected = "";
538
									if ($pconfig['protocol'] == $prot)
539
										$selected = "selected";
540
							?>
541
								<option value="<?=$prot;?>" <?=$selected;?>><?=$prot;?></option>
542
							<?php endforeach; ?>
543
							</select>
544
							</td>
545
					</tr>
546
					<tr>
547
						<td width="22%" valign="top" class="vncellreq">Interface</td>
548
						<td width="78%" class="vtable">
549
							<select name="interface" class="formselect">
550
								<?php
551
									$interfaces = get_configured_interface_with_descr();
552
									foreach ($interfaces as $iface => $ifacename):
553
										$selected = "";
554
										if ($iface == $pconfig['interface'])
555
											$selected = "selected";
556
								?>
557
									<option value="<?=$iface;?>" <?=$selected;?>>
558
										<?=htmlspecialchars($ifacename);?>
559
									</option>
560
								<?php endforeach; ?>
561
							</select> <br>
562
						</td>
563
					</tr>
564
					<tr>
565
						<td width="22%" valign="top" class="vncellreq"><?=gettext("Local port");?></td>
566
						<td width="78%" class="vtable">
567
							<input name="local_port" type="text" class="formfld unknown" size="5" value="<?=htmlspecialchars($pconfig['local_port']);?>"/>
568
						</td>
569
					</tr>
570
					<tr> 
571
						<td width="22%" valign="top" class="vncell">Description</td>
572
						<td width="78%" class="vtable"> 
573
							<input name="description" type="text" class="formfld unknown" size="30" value="<?=htmlspecialchars($pconfig['description']);?>">
574
							<br>
575
							You may enter a description here for your reference (not parsed).
576
						</td>
577
					</tr>
578
					<tr>
579
						<td colspan="2" class="list" height="12"></td>
580
					</tr>
581
					<tr>
582
						<td colspan="2" valign="top" class="listtopic">Cryptographic Settings</td>
583
					</tr>
584
					<tr id="tls">
585
						<td width="22%" valign="top" class="vncellreq">TLS Authentication</td>
586
						<td width="78%" class="vtable">
587
							<table border="0" cellpadding="2" cellspacing="0">
588
								<tr>
589
									<td>
590
										<?php set_checked($pconfig['tlsauth_enable'],$chk); ?>
591
										<input name="tlsauth_enable" id="tlsauth_enable" type="checkbox" value="yes" <?=$chk;?> onClick="tlsauth_change()">
592
									</td>
593
									<td>
594
										<span class="vexpl">
595
											Enable authentication of TLS packets.
596
										</span>
597
									</td>
598
								</tr>
599
							</table>
600
							<?php if (!$pconfig['tls']): ?>
601
							<table border="0" cellpadding="2" cellspacing="0" id='tlsauth_opts'>
602
								<tr>
603
									<td>
604
										<?php set_checked($pconfig['autotls_enable'],$chk); ?>
605
										<input name="autotls_enable" id="autotls_enable" type="checkbox" value="yes" <?=$chk;?> onClick="autotls_change()">
606
									</td>
607
									<td>
608
										<span class="vexpl">
609
											Automatically generate a shared TLS authentication key.
610
										</span>
611
									</td>
612
								</tr>
613
							</table>
614
							<?php endif; ?>
615
							<table border="0" cellpadding="2" cellspacing="0" id='autotls_opts'>
616
								<tr>
617
									<td>
618
										<textarea name="tls" cols="65" rows="7" class="formpre"><?=htmlspecialchars($pconfig['tls']);?></textarea>
619
										<br/>
620
										Paste your shared key here.
621
									</td>
622
								</tr>
623
							</table>
624
						</td>
625
					</tr>
626
					<tr id="tls_ca">
627
						<td width="22%" valign="top" class="vncellreq">Peer Certificate Authority</td>
628
							<td width="78%" class="vtable">
629
							<select name='caref' class="formselect">
630
							<?php
631
								foreach ($config['system']['ca'] as $ca):
632
									$selected = "";
633
									if ($pconfig['caref'] == $ca['refid'])
634
										$selected = "selected";
635
							?>
636
								<option value="<?=$ca['refid'];?>" <?=$selected;?>><?=$ca['name'];?></option>
637
							<?php endforeach; ?>
638
							</select>
639
							</td>
640
					</tr>
641
					<tr id="tls_cert">
642
						<td width="22%" valign="top" class="vncellreq">Server Certificate</td>
643
							<td width="78%" class="vtable">
644
							<select name='certref' class="formselect">
645
							<?php
646
								foreach ($config['system']['cert'] as $cert):
647
									$selected = "";
648
									if ($pconfig['certref'] == $cert['refid'])
649
										$selected = "selected";
650
							?>
651
								<option value="<?=$cert['refid'];?>" <?=$selected;?>><?=$cert['name'];?></option>
652
							<?php endforeach; ?>
653
							</select>
654
						</td>
655
					</tr>
656
					<tr id="tls_dh">
657
						<td width="22%" valign="top" class="vncellreq">DH Parameters Length</td>
658
						<td width="78%" class="vtable">
659
							<select name="dh_length" class="formselect">
660
								<?php
661
									foreach ($openvpn_dh_lengths as $length):
662
									$selected = '';
663
									if ($length == $pconfig['dh_length'])
664
										$selected = ' selected';
665
								?>
666
								<option<?=$selected?>><?=$length;?></option>
667
								<?php endforeach; ?>
668
							</select>
669
							<span class="vexpl">
670
								bits
671
							</span>
672
						</td>
673
					</tr>
674
					<tr id="psk">
675
						<td width="22%" valign="top" class="vncellreq">Shared Key</td>
676
						<td width="78%" class="vtable">
677
							<?php if (!$pconfig['shared_key']): ?>
678
							<table border="0" cellpadding="2" cellspacing="0">
679
								<tr>
680
									<td>
681
										<?php set_checked($pconfig['autokey_enable'],$chk); ?>
682
										<input name="autokey_enable" type="checkbox" value="yes" <?=$chk;?> onClick="autokey_change()">
683
									</td>
684
									<td>
685
										<span class="vexpl">
686
											Automatically generate a shared key.
687
										</span>
688
									</td>
689
								</tr>
690
							</table>
691
							<?php endif; ?>
692
							<table border="0" cellpadding="2" cellspacing="0" id='autokey_opts'>
693
								<tr>
694
									<td>
695
										<textarea name="shared_key" cols="65" rows="7" class="formpre"><?=htmlspecialchars($pconfig['shared_key']);?></textarea>
696
										<br/>
697
										Paste your shared key here.
698
									</td>
699
								</tr>
700
							</table>
701
						</td>
702
					</tr>
703
					<tr>
704
						<td width="22%" valign="top" class="vncellreq">Encryption algorithm</td>
705
						<td width="78%" class="vtable">
706
							<select name="crypto" class="formselect">
707
								<?php
708
									$cipherlist = openvpn_get_cipherlist();
709
									foreach ($cipherlist as $name => $desc):
710
									$selected = '';
711
									if ($name == $pconfig['crypto'])
712
										$selected = ' selected';
713
								?>
714
								<option value="<?=$name;?>"<?=$selected?>>
715
									<?=htmlspecialchars($desc);?>
716
								</option>
717
								<?php endforeach; ?>
718
							</select>
719
						</td>
720
					</tr>
721
					<tr>
722
						<td colspan="2" class="list" height="12"></td>
723
					</tr>
724
					<tr>
725
						<td colspan="2" valign="top" class="listtopic">Tunnel Settings</td>
726
					</tr>
727
					<tr>
728
						<td width="22%" valign="top" class="vncellreq">Tunnel Network</td>
729
						<td width="78%" class="vtable">
730
							<input name="tunnel_network" type="text" class="formfld unknown" size="20" value="<?=htmlspecialchars($pconfig['tunnel_network']);?>">
731
							<br>
732
							This is the virtual network used for private
733
							communications between this server and client
734
							hosts expressed using CIDR (eg. 10.0.8.0/24).
735
							The first network address will be assigned to
736
							the	server virtual interface. The remaining
737
							network addresses can optionally be assigned
738
							to connecting clients. (see Address Pool)
739
						</td>
740
					</tr>
741
					<tr>
742
						<td width="22%" valign="top" class="vncell">Redirect Gateway</td>
743
						<td width="78%" class="vtable">
744
							<table border="0" cellpadding="2" cellspacing="0">
745
								<tr>
746
									<td>
747
										<?php set_checked($pconfig['gwredir'],$chk); ?>
748
										<input name="gwredir" type="checkbox" value="yes" <?=$chk;?> onClick="gwredir_change()"/>
749
									</td>
750
									<td>
751
										<span class="vexpl">
752
											Force all client generated traffic through the tunnel.
753
										</span>
754
									</td>
755
								</tr>
756
							</table>
757
						</td>
758
					</tr>
759
					<tr id="local_opts">
760
						<td width="22%" valign="top" class="vncell">Local Network</td>
761
						<td width="78%" class="vtable">
762
							<input name="local_network" type="text" class="formfld unknown" size="20" value="<?=htmlspecialchars($pconfig['local_network']);?>">
763
							<br>
764
							This is the network that will be accessable
765
							from the remote endpoint. Expressed as a CIDR
766
							range. You may leave this blank if you don't
767
							want to add a route to the local network
768
							through this tunnel on the remote machine.
769
							This is generally set to your LAN network.
770
						</td>
771
					</tr>
772
					<tr id="remote_opts">
773
						<td width="22%" valign="top" class="vncell">Remote Network</td>
774
						<td width="78%" class="vtable">
775
							<input name="remote_network" type="text" class="formfld unknown" size="20" value="<?=htmlspecialchars($pconfig['remote_network']);?>">
776
							<br>
777
							This is a network that will be routed through
778
							the tunnel, so that a site-to-site VPN can be
779
							established without manually changing the
780
							routing tables. Expressed as a CIDR range. If
781
							this is a site-to-site VPN, enter here the
782
							remote LAN here. You may leave this blank if
783
							you don't want a site-to-site VPN.
784
						</td>
785
					</tr>
786
					<tr>
787
						<td width="22%" valign="top" class="vncell"><?=gettext("Concurrent connections");?></td>
788
						<td width="78%" class="vtable">
789
							<input name="maxclients" type="text" class="formfld unknown" size="5" value="<?=htmlspecialchars($pconfig['maxclients']);?>"/>
790
							<br/>
791
							Specify the maximum number of clients allowed to concurrently connect to this server.
792
						</td>
793
					</tr>
794
					<tr>
795
						<td width="22%" valign="top" class="vncell">Compression</td>
796
						<td width="78%" class="vtable">
797
							<table border="0" cellpadding="2" cellspacing="0">
798
								<tr>
799
									<td>
800
										<?php set_checked($pconfig['compression'],$chk); ?>
801
										<input name="compression" type="checkbox" value="yes" <?=$chk;?>>
802
									</td>
803
									<td>
804
										<span class="vexpl">
805
											Compress tunnel packets using the LZO algorithm.
806
										</span>
807
									</td>
808
								</tr>
809
							</table>
810
						</td>
811
					</tr>
812
					<tr>
813
						<td width="22%" valign="top" class="vncell">Type-of-Service</td>
814
						<td width="78%" class="vtable">
815
							<table border="0" cellpadding="2" cellspacing="0">
816
								<tr>
817
									<td>
818
										<?php set_checked($pconfig['passtos'],$chk); ?>
819
										<input name="passtos" type="checkbox" value="yes" <?=$chk;?>>
820
									</td>
821
									<td>
822
										<span class="vexpl">
823
											Set the TOS IP header value of tunnel packets to match the encapsulated packet value.
824
										</span>
825
									</td>
826
								</tr>
827
							</table>
828
						</td>
829
					</tr>
830
					<tr>
831
						<td width="22%" valign="top" class="vncell">Inter-client communication</td>
832
						<td width="78%" class="vtable">
833
							<table border="0" cellpadding="2" cellspacing="0">
834
								<tr>
835
									<td>
836
										<?php set_checked($pconfig['client2client'],$chk); ?>
837
										<input name="client2client" type="checkbox" value="yes" <?=$chk;?>/>
838
									</td>
839
									<td>
840
										<span class="vexpl">
841
											Allow communication between clients connected to this server
842
										</span>
843
									</td>
844
								</tr>
845
							</table>
846
						</td>
847
					</tr>
848
				</table>
849

    
850
				<table width="100%" border="0" cellpadding="6" cellspacing="0" id="client_opts">
851
					<tr>
852
						<td colspan="2" class="list" height="12"></td>
853
					</tr>
854
					<tr>
855
						<td colspan="2" valign="top" class="listtopic">Client Settings</td>
856
					</tr>
857
					<tr>
858
						<td width="22%" valign="top" class="vncell">Address Pool</td>
859
						<td width="78%" class="vtable">
860
							<table border="0" cellpadding="2" cellspacing="0">
861
								<tr>
862
									<td>
863
										<?php set_checked($pconfig['pool_enable'],$chk); ?>
864
										<input name="pool_enable" type="checkbox" id="pool_enable" value="yes" <?=$chk;?>">
865
									</td>
866
									<td>
867
										<span class="vexpl">
868
											Provide a virtual adapter IP address to clients (see Tunnel Network)<br>
869
										</span>
870
									</td>
871
								</tr>
872
							</table>
873
						</td>
874
					</tr>
875
					<tr>
876
						<td width="22%" valign="top" class="vncell">DNS Default Domain</td>
877
						<td width="78%" class="vtable">
878
							<table border="0" cellpadding="2" cellspacing="0">
879
								<tr>
880
									<td>
881
										<?php set_checked($pconfig['dns_domain_enable'],$chk); ?>
882
										<input name="dns_domain_enable" type="checkbox" id="dns_domain_enable" value="yes" <?=$chk;?> onClick="dns_domain_change()">
883
									</td>
884
									<td>
885
										<span class="vexpl">
886
	                                        Provide a default domain name to clients<br>
887
										</span>
888
									</td>
889
								</tr>
890
							</table>
891
							<table border="0" cellpadding="2" cellspacing="0" id="dns_domain_data">
892
								<tr>
893
									<td>
894
										<input name="dns_domain" type="text" class="formfld unknown" id="dns_domain" size="30" value="<?=htmlspecialchars($pconfig['dns_domain']);?>">
895
									</td>
896
								</tr>
897
							</table>
898
						</td>
899
					</tr>
900
					<tr>
901
						<td width="22%" valign="top" class="vncell">DNS Servers</td>
902
						<td width="78%" class="vtable">
903
							<table border="0" cellpadding="2" cellspacing="0">
904
								<tr>
905
									<td>
906
										<?php set_checked($pconfig['dns_server_enable'],$chk); ?>
907
										<input name="dns_server_enable" type="checkbox" id="dns_server_enable" value="yes" <?=$chk;?> onClick="dns_server_change()">
908
									</td>
909
									<td>
910
										<span class="vexpl">
911
											Provide a DNS server list to clients<br>
912
										</span>
913
									</td>
914
								</tr>
915
							</table>
916
							<table border="0" cellpadding="2" cellspacing="0" id="dns_server_data">
917
								<tr>
918
									<td>
919
										<span class="vexpl">
920
											Server #1:&nbsp;
921
										</span>
922
										<input name="dns_server1" type="text" class="formfld unknown" id="dns_server1" size="20" value="<?=$pconfig['dns_server1'];?>">
923
									</td>
924
								</tr>
925
								<tr>
926
									<td>
927
										<span class="vexpl">
928
											Server #2:&nbsp;
929
										</span>
930
										<input name="dns_server2" type="text" class="formfld unknown" id="dns_server2" size="20" value="<?=$pconfig['dns_server2'];?>">
931
									</td>
932
								</tr>
933
								<tr>
934
									<td>
935
										<span class="vexpl">
936
											Server #3:&nbsp;
937
										</span>
938
										<input name="dns_server3" type="text" class="formfld unknown" id="dns_server3" size="20" value="<?=$pconfig['dns_server3'];?>">
939
									</td>
940
								</tr>
941
								<tr>
942
									<td>
943
										<span class="vexpl">
944
											Server #4:&nbsp;
945
										</span>
946
										<input name="dns_server4" type="text" class="formfld unknown" id="dns_server4" size="20" value="<?=$pconfig['dns_server4'];?>">
947
									</td>
948
								</tr>
949
							</table>
950
						</td>
951
					</tr>
952
					<tr>
953
						<td width="22%" valign="top" class="vncell">NTP Servers</td>
954
						<td width="78%" class="vtable">
955
							<table border="0" cellpadding="2" cellspacing="0">
956
								<tr>
957
									<td>
958
										<?php set_checked($pconfig['ntp_server_enable'],$chk); ?>
959
										<input name="ntp_server_enable" type="checkbox" id="ntp_server_enable" value="yes" <?=$chk;?> onClick="ntp_server_change()">
960
									</td>
961
									<td>
962
										<span class="vexpl">
963
											Provide a NTP server list to clients<br>
964
										</span>
965
									</td>
966
								</tr>
967
							</table>
968
							<table border="0" cellpadding="2" cellspacing="0" id="ntp_server_data">
969
								<tr>
970
									<td>
971
										<span class="vexpl">
972
											Server #1:&nbsp;
973
										</span>
974
										<input name="ntp_server1" type="text" class="formfld unknown" id="ntp_server1" size="20" value="<?=$pconfig['ntp_server1'];?>">
975
									</td>
976
								</tr>
977
								<tr>
978
									<td>
979
										<span class="vexpl">
980
											Server #2:&nbsp;
981
										</span>
982
										<input name="ntp_server2" type="text" class="formfld unknown" id="ntp_server2" size="20" value="<?=$pconfig['ntp_server2'];?>">
983
									</td>
984
								</tr>
985
							</table>
986
						</td>
987
					</tr>
988
					<tr>
989
						<td width="22%" valign="top" class="vncell">NetBIOS Options</td>
990
						<td width="78%" class="vtable">
991
							<table border="0" cellpadding="2" cellspacing="0">
992
								<tr>
993
									<td>
994
										<?php set_checked($pconfig['netbios_enable'],$chk); ?>
995
										<input name="netbios_enable" type="checkbox" id="netbios_enable" value="yes" <?=$chk;?> onClick="netbios_change()">
996
									</td>
997
									<td>
998
										<span class="vexpl">
999
											Enable NetBIOS over TCP/IP<br>
1000
										</span>
1001
									</td>
1002
								</tr>
1003
							</table>
1004
							If this option is not set, all Netbios-over-TCP/IP options (includeing WINS) will be disabled.
1005
							<br/>
1006
							<table border="0" cellpadding="2" cellspacing="0" id="netbios_data">
1007
								<tr>
1008
									<td>
1009
										<br/>
1010
										<span class="vexpl">
1011
											Node Type:&nbsp;
1012
										</span>
1013
										<select name='netbios_ntype' class="formselect">
1014
										<?php
1015
											foreach ($netbios_nodetypes as $type => $name):
1016
												$selected = "";
1017
												if ($pconfig['netbios_ntype'] == $type)
1018
													$selected = "selected";
1019
										?>
1020
											<option value="<?=$type;?>" <?=$selected;?>><?=$name;?></option>
1021
										<?php endforeach; ?>
1022
										</select>
1023
										<br/>
1024
										Possible options: b-node (broadcasts), p-node
1025
										(point-to-point name queries to a WINS server),
1026
										m-node (broadcast then query name server), and
1027
										h-node (query name server, then broadcast).
1028
									</td>
1029
								</tr>
1030
								<tr>
1031
									<td>
1032
										<br/>
1033
										<span class="vexpl">
1034
											Scope ID:&nbsp;
1035
										</span>
1036
										<input name="netbios_scope" type="text" class="formfld unknown" id="netbios_scope" size="30" value="<?=htmlspecialchars($pconfig['netbios_scope']);?>">
1037
										<br/>
1038
										A NetBIOS Scope	ID provides an extended naming
1039
										service for	NetBIOS over TCP/IP. The NetBIOS
1040
										scope ID isolates NetBIOS traffic on a single
1041
										network to only those nodes with the same
1042
										NetBIOS scope ID.
1043
									</td>
1044
								</tr>
1045
							</table>
1046
						</td>
1047
					</tr>
1048
					<tr id="wins_opts">
1049
						<td width="22%" valign="top" class="vncell">WINS Servers</td>
1050
						<td width="78%" class="vtable">
1051
							<table border="0" cellpadding="2" cellspacing="0">
1052
								<tr>
1053
									<td>
1054
										<?php set_checked($pconfig['wins_server_enable'],$chk); ?>
1055
										<input name="wins_server_enable" type="checkbox" id="wins_server_enable" value="yes" <?=$chk;?> onClick="wins_server_change()">
1056
									</td>
1057
									<td>
1058
										<span class="vexpl">
1059
											Provide a WINS server list to clients<br>
1060
										</span>
1061
									</td>
1062
								</tr>
1063
							</table>
1064
							<table border="0" cellpadding="2" cellspacing="0" id="wins_server_data">
1065
								<tr>
1066
									<td>
1067
										<span class="vexpl">
1068
											Server #1:&nbsp;
1069
										</span>
1070
										<input name="wins_server1" type="text" class="formfld unknown" id="wins_server1" size="20" value="<?=$pconfig['wins_server1'];?>">
1071
									</td>
1072
								</tr>
1073
								<tr>
1074
									<td>
1075
										<span class="vexpl">
1076
											Server #2:&nbsp;
1077
										</span>
1078
										<input name="wins_server2" type="text" class="formfld unknown" id="wins_server2" size="20" value="<?=$pconfig['wins_server2'];?>">
1079
									</td>
1080
								</tr>
1081
							</table>
1082
						</td>
1083
					</tr>
1084
				</table>
1085

    
1086
				<table width="100%" border="0" cellpadding="6" cellspacing="0" id="client_opts">
1087
					<tr>
1088
						<td colspan="2" class="list" height="12"></td>
1089
					</tr>
1090
					<tr>
1091
						<td colspan="2" valign="top" class="listtopic">Advanced configuration</td>
1092
					</tr>
1093
					<tr>
1094
						<td width="22%" valign="top" class="vncell">Advanced</td>
1095
						<td width="78%" class="vtable">
1096
							<table border="0" cellpadding="2" cellspacing="0">
1097
								<tr>
1098
									<td>
1099
										<textarea rows="6" cols="78" name="custom_options" id="custom_options"><?=$pconfig['custom_options'];?></textarea><br/>
1100
										Paste any additional options you would like to pass through to the openvpn server here seperated by a semicoloin ;<br/>
1101
										EXAMPLE: push "route 10.0.0.0 255.255.255.0";
1102
									</td>
1103
								</tr>
1104
							</table>
1105
						</td>
1106
					</tr>
1107
				</table>
1108

    
1109
				<br/>
1110

    
1111
				<table width="100%" border="0" cellpadding="6" cellspacing="0" id="client_opts">
1112
					<tr>
1113
						<td width="22%" valign="top">&nbsp;</td>
1114
						<td width="78%"> 
1115
							<input name="save" type="submit" class="formbtn" value="Save"> 
1116
							<input name="act" type="hidden" value="<?=$act;?>">
1117
							<?php if (isset($id) && $a_server[$id]): ?>
1118
							<input name="id" type="hidden" value="<?=$id;?>">
1119
							<?php endif; ?>
1120
						</td>
1121
					</tr>
1122
				</table>
1123
			</form>
1124

    
1125
			<?php else: ?>
1126

    
1127
			<table class="sortable" width="100%" border="0" cellpadding="0" cellspacing="0">
1128
				<tr>
1129
					<td width="10%" class="listhdrr">Disabled</td>
1130
					<td width="10%" class="listhdrr">Protocol</td>
1131
					<td width="30%" class="listhdrr">Tunnel Network</td>
1132
					<td width="40%" class="listhdrr">Description</td>
1133
					<td width="10%" class="list"></td>
1134
				</tr>
1135
				<?php
1136
					$i = 0;
1137
					foreach($a_server as $server):
1138
						$disabled = "NO";
1139
						if ($server['disable'])
1140
							$disabled = "YES";
1141
				?>
1142
				<tr>
1143
					<td class="listlr" ondblclick="document.location='vpn_openvpn_server.php?act=edit&id=<?=$i;?>'">
1144
						<?=$disabled;?>
1145
					</td>
1146
					<td class="listr" ondblclick="document.location='vpn_openvpn_server.php?act=edit&id=<?=$i;?>'">
1147
						<?=htmlspecialchars($server['protocol']);?>
1148
					</td>
1149
					<td class="listr" ondblclick="document.location='vpn_openvpn_server.php?act=edit&id=<?=$i;?>'">
1150
						<?=htmlspecialchars($server['tunnel_network']);?>
1151
					</td>
1152
					<td class="listbg" ondblclick="document.location='vpn_openvpn_server.php?act=edit&id=<?=$i;?>'">
1153
						<?=htmlspecialchars($server['description']);?>
1154
					</td>
1155
					<td valign="middle" nowrap class="list">
1156
						<a href="vpn_openvpn_server.php?act=edit&id=<?=$i;?>">
1157
							<img src="./themes/<?=$g['theme'];?>/images/icons/icon_e.gif" title="edit server" width="17" height="17" border="0">
1158
						</a>
1159
						&nbsp;
1160
						<a href="vpn_openvpn_server.php?act=del&id=<?=$i;?>" onclick="return confirm('Do you really want to delete this server?')">
1161
							<img src="/themes/<?=$g['theme'];?>/images/icons/icon_x.gif" title="delete server" width="17" height="17" border="0">
1162
						</a>
1163
					</td>
1164
				</tr>
1165
				<?php
1166
					$i++;
1167
					endforeach;
1168
				?>
1169
				<tr>
1170
					<td class="list" colspan="4"></td>
1171
					<td class="list">
1172
						<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">
1173
						</a>
1174
					</td>
1175
				</tr>
1176
			</table>
1177

    
1178
			<?=gettext("Additional OpenVPN servers can be added here.");?>
1179

    
1180
			<? endif; ?>
1181

    
1182
		</td>
1183
	</tr>
1184
</table>
1185
<script language="JavaScript">
1186
<!--
1187
mode_change();
1188
autokey_change();
1189
tlsauth_change();
1190
gwredir_change();
1191
dns_domain_change();
1192
dns_server_change();
1193
wins_server_change();
1194
ntp_server_change();
1195
netbios_change();
1196
//-->
1197
</script>
1198
</body>
1199
<?php include("fend.inc"); ?>
1200

    
1201
<?php
1202

    
1203
/* local utility functions */
1204

    
1205
function set_checked($var,& $chk) {
1206
    if($var)
1207
        $chk = 'checked';
1208
    else
1209
        $chk = '';
1210
}
1211

    
1212
?>
(209-209/217)