Project

General

Profile

Download (43.2 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
require("guiconfig.inc");
38
require_once("openvpn.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
if (!is_array($config['system']['authserver']))
48
	$config['system']['authserver'] = array();
49
$auth_servers =& $config['system']['authserver'];
50

    
51
$id = $_GET['id'];
52
if (isset($_POST['id']))
53
	$id = $_POST['id'];
54

    
55
$act = $_GET['act'];
56
if (isset($_POST['act']))
57
	$act = $_POST['act'];
58

    
59
if ($_GET['act'] == "del") {
60

    
61
	if (!$a_server[$id]) {
62
		pfSenseHeader("vpn_openvpn_server.php");
63
		exit;
64
	}
65

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

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

    
82
if($_GET['act']=="edit"){
83

    
84
	if (isset($id) && $a_server[$id]) {
85

    
86
		$pconfig['disable'] = isset($a_server[$id]['disable']);
87
		$pconfig['mode'] = $a_server[$id]['mode'];
88
		$pconfig['protocol'] = $a_server[$id]['protocol'];
89
		$pconfig['authmode'] = $a_server[$id]['authmode'];
90
		$pconfig['interface'] = $a_server[$id]['interface'];
91
		if (!empty($a_server[$id]['ipaddr'])) {
92
			$pconfig['interface'] = $pconfig['interface'] . '|' . $a_server[$id]['ipaddr'];
93
		}
94
		$pconfig['local_port'] = $a_server[$id]['local_port'];
95
		$pconfig['description'] = $a_server[$id]['description'];
96
		$pconfig['custom_options'] = $a_server[$id]['custom_options'];
97

    
98
		if ($pconfig['mode'] != "p2p_shared_key") {
99
			if ($a_server[$id]['tls']) {
100
				$pconfig['tlsauth_enable'] = "yes";
101
				$pconfig['tls'] = base64_decode($a_server[$id]['tls']);
102
			}
103
			$pconfig['caref'] = $a_server[$id]['caref'];
104
			$pconfig['certref'] = $a_server[$id]['certref'];
105
			$pconfig['dh_length'] = $a_server[$id]['dh_length'];
106
		} else
107
			$pconfig['shared_key'] = base64_decode($a_server[$id]['shared_key']);
108
		$pconfig['crypto'] = $a_server[$id]['crypto'];
109

    
110
		$pconfig['tunnel_network'] = $a_server[$id]['tunnel_network'];
111
		$pconfig['remote_network'] = $a_server[$id]['remote_network'];
112
		$pconfig['gwredir'] = $a_server[$id]['gwredir'];
113
		$pconfig['local_network'] = $a_server[$id]['local_network'];
114
		$pconfig['maxclients'] = $a_server[$id]['maxclients'];
115
		$pconfig['compression'] = $a_server[$id]['compression'];
116
		$pconfig['passtos'] = $a_server[$id]['passtos'];
117
		$pconfig['client2client'] = $a_server[$id]['client2client'];
118

    
119
		$pconfig['pool_enable'] = $a_server[$id]['pool_enable'];
120

    
121
		$pconfig['dns_domain'] = $a_server[$id]['dns_domain'];
122
		if ($pconfig['dns_domain'])
123
			$pconfig['dns_domain_enable'] = true;
124

    
125
		$pconfig['dns_server1'] = $a_server[$id]['dns_server1'];
126
		$pconfig['dns_server2'] = $a_server[$id]['dns_server2'];
127
		$pconfig['dns_server3'] = $a_server[$id]['dns_server3'];
128
		$pconfig['dns_server4'] = $a_server[$id]['dns_server4'];
129
		if ($pconfig['dns_server1'] ||
130
			$pconfig['dns_server2'] ||
131
			$pconfig['dns_server3'] ||
132
			$pconfig['dns_server4'])
133
			$pconfig['dns_server_enable'] = true;
134

    
135
		$pconfig['ntp_server1'] = $a_server[$id]['ntp_server1'];
136
		$pconfig['ntp_server2'] = $a_server[$id]['ntp_server2'];
137
		if ($pconfig['ntp_server1'] ||
138
			$pconfig['ntp_server2'])
139
			$pconfig['ntp_server_enable'] = true;
140

    
141
		$pconfig['netbios_enable'] = $a_server[$id]['netbios_enable'];
142
		$pconfig['netbios_ntype'] = $a_server[$id]['netbios_ntype'];
143
		$pconfig['netbios_scope'] = $a_server[$id]['netbios_scope'];
144

    
145
		$pconfig['wins_server1'] = $a_server[$id]['wins_server1'];
146
		$pconfig['wins_server2'] = $a_server[$id]['wins_server2'];
147
		if ($pconfig['wins_server1'] ||
148
			$pconfig['wins_server2'])
149
			$pconfig['wins_server_enable'] = true;
150

    
151
		$pconfig['nbdd_server1'] = $a_server[$id]['nbdd_server1'];
152
		if ($pconfig['nbdd_server1'])
153
			$pconfig['nbdd_server_enable'] = true;
154

    
155
		// just in case the modes switch
156
		$pconfig['autokey_enable'] = "yes";
157
		$pconfig['autotls_enable'] = "yes";
158
	}
159
}
160

    
161
if ($_POST) {
162

    
163
	unset($input_errors);
164
	$pconfig = $_POST;
165

    
166
	if (isset($id) && $a_server[$id])
167
		$vpnid = $a_server[$id]['vpnid'];
168
	else
169
		$vpnid = 0;
170

    
171
	if ($pconfig['mode'] != "p2p_shared_key")
172
		$tls_mode = true;
173
	else
174
		$tls_mode = false;
175

    
176
	/* input validation */
177
	if ($result = openvpn_validate_port($pconfig['local_port'], 'Local port'))
178
		$input_errors[] = $result;
179

    
180
	if ($result = openvpn_validate_cidr($pconfig['tunnel_network'], 'Tunnel network'))
181
		$input_errors[] = $result;
182

    
183
	if ($result = openvpn_validate_cidr($pconfig['remote_network'], 'Remote network'))
184
		$input_errors[] = $result;
185

    
186
	if ($result = openvpn_validate_cidr($pconfig['local_network'], 'Local network'))
187
		$input_errors[] = $result;
188

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

    
193
	if ($pconfig['autokey_enable'])
194
		$pconfig['shared_key'] = openvpn_create_key();
195

    
196
	if (!$tls_mode && !$pconfig['autokey_enable'])
197
		if (!strstr($pconfig['shared_key'], "-----BEGIN OpenVPN Static key V1-----") ||
198
			!strstr($pconfig['shared_key'], "-----END OpenVPN Static key V1-----"))
199
			$input_errors[] = "The field 'Shared Key' does not appear to be valid";
200

    
201
	if ($tls_mode && $pconfig['tlsauth_enable'] && !$pconfig['autotls_enable'])
202
		if (!strstr($pconfig['tls'], "-----BEGIN OpenVPN Static key V1-----") ||
203
			!strstr($pconfig['tls'], "-----END OpenVPN Static key V1-----"))
204
			$input_errors[] = "The field 'TLS Authentication Key' does not appear to be valid";
205

    
206
	if ($pconfig['dns_server_enable']) {
207
		if (!empty($pconfig['dns_server1']) && !is_ipaddr(trim($pconfig['dns_server1'])))
208
			$input_errors[] = "The field 'DNS Server #1' must contain a valid IP address";
209
		if (!empty($pconfig['dns_server2']) && !is_ipaddr(trim($pconfig['dns_server2'])))
210
			$input_errors[] = "The field 'DNS Server #2' must contain a valid IP address";
211
		if (!empty($pconfig['dns_server3']) && !is_ipaddr(trim($pconfig['dns_server3'])))
212
			$input_errors[] = "The field 'DNS Server #3' must contain a valid IP address";
213
		if (!empty($pconfig['dns_server4']) && !is_ipaddr(trim($pconfig['dns_server4'])))
214
			$input_errors[] = "The field 'DNS Server #4' must contain a valid IP address";
215
	}
216

    
217
	if ($pconfig['ntp_server_enable']) {
218
		if (!empty($pconfig['ntp_server1']) && !is_ipaddr(trim($pconfig['ntp_server1'])))
219
			$input_errors[] = "The field 'NTP Server #1' must contain a valid IP address";
220
		if (!empty($pconfig['ntp_server2']) && !is_ipaddr(trim($pconfig['ntp_server2'])))
221
			$input_errors[] = "The field 'NTP Server #2' must contain a valid IP address";
222
		if (!empty($pconfig['ntp_server3']) && !is_ipaddr(trim($pconfig['ntp_server3'])))
223
			$input_errors[] = "The field 'NTP Server #3' must contain a valid IP address";
224
		if (!empty($pconfig['ntp_server4']) && !is_ipaddr(trim($pconfig['ntp_server4'])))
225
			$input_errors[] = "The field 'NTP Server #4' must contain a valid IP address";
226
	}
227

    
228
	if ($pconfig['netbios_enable']) {
229
		if ($pconfig['wins_server_enable']) {
230
			if (!empty($pconfig['wins_server1']) && !is_ipaddr(trim($pconfig['wins_server1'])))
231
				$input_errors[] = "The field 'WINS Server #1' must contain a valid IP address";
232
			if (!empty($pconfig['wins_server2']) && !is_ipaddr(trim($pconfig['wins_server2'])))
233
				$input_errors[] = "The field 'WINS Server #2' must contain a valid IP address";
234
		}
235
		if ($pconfig['nbdd_server_enable'])
236
			if (!empty($pconfig['nbdd_server1']) && !is_ipaddr(trim($pconfig['nbdd_server1'])))
237
				$input_errors[] = "The field 'NetBIOS Data Distribution Server #1' must contain a valid IP address";
238
	}
239

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

    
243
	if (!$tls_mode && !$pconfig['autokey_enable']) {
244
		$reqdfields = array('shared_key');
245
		$reqdfieldsn = array('Shared key');
246
	} else {
247
		$reqdfields = explode(" ", "caref certref");
248
		$reqdfieldsn = explode(",", "Certificate Authority,Certificate");;
249
	}
250

    
251
	$reqdfields[] = 'tunnel_network';
252
	$reqdfieldsn[] = 'Tunnel network';
253

    
254
	do_input_validation($_POST, $reqdfields, $reqdfieldsn, &$input_errors);
255
	
256
	if (!$input_errors) {
257

    
258
		$server = array();
259

    
260
		if ($vpnid)
261
			$server['vpnid'] = $vpnid;
262
		else
263
			$server['vpnid'] = openvpn_vpnid_next();
264

    
265
		if ($_POST['disable'] == "yes")
266
			$server['disable'] = true;
267
		$server['mode'] = $pconfig['mode'];
268
		$server['authmode'] = implode(",", $pconfig['authmode']);
269
		$server['protocol'] = $pconfig['protocol'];
270
		list($server['interface'], $server['ipaddr']) = explode ("|",$pconfig['interface']);
271
		$server['local_port'] = $pconfig['local_port'];
272
		$server['description'] = $pconfig['description'];
273
		$server['custom_options'] = $pconfig['custom_options'];
274

    
275
		if ($tls_mode) {
276
			if ($pconfig['tlsauth_enable']) {
277
				if ($pconfig['autotls_enable'])
278
					$pconfig['tls'] = openvpn_create_key();
279
				$server['tls'] = base64_encode($pconfig['tls']);
280
			}
281
			$server['caref'] = $pconfig['caref'];
282
			$server['certref'] = $pconfig['certref'];
283
			$server['dh_length'] = $pconfig['dh_length'];
284
		} else {
285
			$server['shared_key'] = base64_encode($pconfig['shared_key']);
286
		}
287
		$server['crypto'] = $pconfig['crypto'];
288

    
289
		$server['tunnel_network'] = $pconfig['tunnel_network'];
290
		$server['remote_network'] = $pconfig['remote_network'];
291
		$server['gwredir'] = $pconfig['gwredir'];
292
		$server['local_network'] = $pconfig['local_network'];
293
		$server['maxclients'] = $pconfig['maxclients'];
294
		$server['compression'] = $pconfig['compression'];
295
		$server['passtos'] = $pconfig['passtos'];
296
		$server['client2client'] = $pconfig['client2client'];
297

    
298
		$server['pool_enable'] = $pconfig['pool_enable'];
299

    
300
		if ($pconfig['dns_domain_enable'])
301
			$server['dns_domain'] = $pconfig['dns_domain'];
302

    
303
		if ($pconfig['dns_server_enable']) {
304
			$server['dns_server1'] = $pconfig['dns_server1'];
305
			$server['dns_server2'] = $pconfig['dns_server2'];
306
			$server['dns_server3'] = $pconfig['dns_server3'];
307
			$server['dns_server4'] = $pconfig['dns_server4'];
308
		}
309

    
310
		if ($pconfig['ntp_server_enable']) {
311
			$server['ntp_server1'] = $pconfig['ntp_server1'];
312
			$server['ntp_server2'] = $pconfig['ntp_server2'];
313
		}
314

    
315
		$server['netbios_enable'] = $pconfig['netbios_enable'];
316
		$server['netbios_ntype'] = $pconfig['netbios_ntype'];
317
		$server['netbios_scope'] = $pconfig['netbios_scope'];
318

    
319
		if ($pconfig['netbios_enable']) {
320

    
321
			if ($pconfig['wins_server_enable']) {
322
				$server['wins_server1'] = $pconfig['wins_server1'];
323
				$server['wins_server2'] = $pconfig['wins_server2'];
324
			}
325

    
326
			if ($pconfig['dns_server_enable'])
327
				$server['nbdd_server1'] = $pconfig['nbdd_server1'];
328
		}
329
	
330
		if (isset($id) && $a_server[$id])
331
			$a_server[$id] = $server;
332
		else
333
			$a_server[] = $server;
334

    
335
		openvpn_resync('server', $server);
336
		write_config();
337
		
338
		header("Location: vpn_openvpn_server.php");
339
		exit;
340
	}
341
	$pconfig['authmode'] = implode(",", $pconfig['authmode']);
342
}
343

    
344
include("head.inc");
345

    
346
?>
347

    
348
<body link="#000000" vlink="#000000" alink="#000000" onload="<?= $jsevents["body"]["onload"] ?>">
349
<?php include("fbegin.inc"); ?>
350
<script language="JavaScript">
351
<!--
352

    
353
function mode_change() {
354
	index = document.iform.mode.selectedIndex;
355
	value = document.iform.mode.options[index].value;
356
	switch(value) {
357
		case "p2p_tls":
358
		case "server_tls":
359
		case "server_user":
360
		case "server_tls_user":
361
			document.getElementById("tls").style.display="";
362
			document.getElementById("tls_ca").style.display="";
363
			document.getElementById("tls_cert").style.display="";
364
			document.getElementById("tls_dh").style.display="";
365
			document.getElementById("psk").style.display="none";
366
			break;
367
		case "p2p_shared_key":
368
			document.getElementById("tls").style.display="none";
369
			document.getElementById("tls_ca").style.display="none";
370
			document.getElementById("tls_cert").style.display="none";
371
			document.getElementById("tls_dh").style.display="none";
372
			document.getElementById("psk").style.display="";
373
			break;
374
	}
375
	switch(value) {
376
		case "p2p_tls":
377
		case "p2p_shared_key":
378
			document.getElementById("client_opts").style.display="none";
379
			document.getElementById("remote_opts").style.display="";
380
			document.getElementById("authmodetr").style.display="none";
381
			break;
382
		case "server_user":
383
                case "server_tls_user":
384
			document.getElementById("authmodetr").style.display="";
385
			/* FALL THROUGH */
386
		default:
387
			document.getElementById("client_opts").style.display="";
388
			document.getElementById("remote_opts").style.display="none";
389
			break;
390
	}
391
}
392

    
393
function autokey_change() {
394

    
395
	if (document.iform.autokey_enable.checked)
396
		document.getElementById("autokey_opts").style.display="none";
397
	else
398
		document.getElementById("autokey_opts").style.display="";
399
}
400

    
401
function tlsauth_change() {
402

    
403
<?php if (!$pconfig['tls']): ?>
404
	if (document.iform.tlsauth_enable.checked)
405
		document.getElementById("tlsauth_opts").style.display="";
406
	else
407
		document.getElementById("tlsauth_opts").style.display="none";
408
<?php endif; ?>
409

    
410
	autotls_change();
411
}
412

    
413
function autotls_change() {
414

    
415
<?php if (!$pconfig['tls']): ?>
416
	autocheck = document.iform.autotls_enable.checked;
417
<?php else: ?>
418
	autocheck = false;
419
<?php endif; ?>
420

    
421
	if (document.iform.tlsauth_enable.checked && !autocheck)
422
		document.getElementById("autotls_opts").style.display="";
423
	else
424
		document.getElementById("autotls_opts").style.display="none";
425
}
426

    
427
function gwredir_change() {
428

    
429
	if (document.iform.gwredir.checked)
430
		document.getElementById("local_opts").style.display="none";
431
	else
432
		document.getElementById("local_opts").style.display="";
433
}
434

    
435
function dns_domain_change() {
436

    
437
	if (document.iform.dns_domain_enable.checked)
438
		document.getElementById("dns_domain_data").style.display="";
439
	else
440
		document.getElementById("dns_domain_data").style.display="none";
441
}
442

    
443
function dns_server_change() {
444

    
445
	if (document.iform.dns_server_enable.checked)
446
		document.getElementById("dns_server_data").style.display="";
447
	else
448
		document.getElementById("dns_server_data").style.display="none";
449
}
450

    
451
function wins_server_change() {
452

    
453
	if (document.iform.wins_server_enable.checked)
454
		document.getElementById("wins_server_data").style.display="";
455
	else
456
		document.getElementById("wins_server_data").style.display="none";
457
}
458

    
459
function ntp_server_change() {
460

    
461
	if (document.iform.ntp_server_enable.checked)
462
		document.getElementById("ntp_server_data").style.display="";
463
	else
464
		document.getElementById("ntp_server_data").style.display="none";
465
}
466

    
467
function netbios_change() {
468

    
469
	if (document.iform.netbios_enable.checked) {
470
		document.getElementById("netbios_data").style.display="";
471
		document.getElementById("wins_opts").style.display="";
472
	} else {
473
		document.getElementById("netbios_data").style.display="none";
474
		document.getElementById("wins_opts").style.display="none";
475
	}
476
}
477

    
478
//-->
479
</script>
480
<?php
481
	if ($input_errors)
482
		print_input_errors($input_errors);
483
	if ($savemsg)
484
		print_info_box($savemsg);
485
?>
486
<table width="100%" border="0" cellpadding="0" cellspacing="0">
487
	<tr>
488
		<td class="tabnavtbl">
489
			<ul id="tabnav">
490
			<?php 
491
				$tab_array = array();
492
				$tab_array[] = array(gettext("Server"), true, "vpn_openvpn_server.php");
493
				$tab_array[] = array(gettext("Client"), false, "vpn_openvpn_client.php");
494
				$tab_array[] = array(gettext("Client Specific Overrides"), false, "vpn_openvpn_csc.php");
495
				add_package_tabs("OpenVPN", $tab_array);
496
				display_top_tabs($tab_array);
497
			?>
498
			</ul>
499
		</td>
500
	</tr>    
501
	<tr>
502
		<td class="tabcont">
503

    
504
			<?php if($act=="new" || $act=="edit"): ?>
505

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

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

    
1127
				<table width="100%" border="0" cellpadding="6" cellspacing="0" id="client_opts">
1128
					<tr>
1129
						<td colspan="2" class="list" height="12"></td>
1130
					</tr>
1131
					<tr>
1132
						<td colspan="2" valign="top" class="listtopic">Advanced configuration</td>
1133
					</tr>
1134
					<tr>
1135
						<td width="22%" valign="top" class="vncell">Advanced</td>
1136
						<td width="78%" class="vtable">
1137
							<table border="0" cellpadding="2" cellspacing="0">
1138
								<tr>
1139
									<td>
1140
										<textarea rows="6" cols="78" name="custom_options" id="custom_options"><?=$pconfig['custom_options'];?></textarea><br/>
1141
										Enter any additional options you would like to add to the OpenVPN server configuration here, separated by a semicolon<br/>
1142
										EXAMPLE: push "route 10.0.0.0 255.255.255.0";
1143
									</td>
1144
								</tr>
1145
							</table>
1146
						</td>
1147
					</tr>
1148
				</table>
1149

    
1150
				<br/>
1151

    
1152
				<table width="100%" border="0" cellpadding="6" cellspacing="0" id="client_opts">
1153
					<tr>
1154
						<td width="22%" valign="top">&nbsp;</td>
1155
						<td width="78%"> 
1156
							<input name="save" type="submit" class="formbtn" value="Save"> 
1157
							<input name="act" type="hidden" value="<?=$act;?>">
1158
							<?php if (isset($id) && $a_server[$id]): ?>
1159
							<input name="id" type="hidden" value="<?=$id;?>">
1160
							<?php endif; ?>
1161
						</td>
1162
					</tr>
1163
				</table>
1164
			</form>
1165

    
1166
			<?php else: ?>
1167

    
1168
			<table class="sortable" width="100%" border="0" cellpadding="0" cellspacing="0">
1169
				<tr>
1170
					<td width="10%" class="listhdrr">Disabled</td>
1171
					<td width="10%" class="listhdrr">Protocol</td>
1172
					<td width="30%" class="listhdrr">Tunnel Network</td>
1173
					<td width="40%" class="listhdrr">Description</td>
1174
					<td width="10%" class="list"></td>
1175
				</tr>
1176
				<?php
1177
					$i = 0;
1178
					foreach($a_server as $server):
1179
						$disabled = "NO";
1180
						if (isset($server['disable']))
1181
							$disabled = "YES";
1182
				?>
1183
				<tr>
1184
					<td class="listlr" ondblclick="document.location='vpn_openvpn_server.php?act=edit&id=<?=$i;?>'">
1185
						<?=$disabled;?>
1186
					</td>
1187
					<td class="listr" ondblclick="document.location='vpn_openvpn_server.php?act=edit&id=<?=$i;?>'">
1188
						<?=htmlspecialchars($server['protocol']);?>
1189
					</td>
1190
					<td class="listr" ondblclick="document.location='vpn_openvpn_server.php?act=edit&id=<?=$i;?>'">
1191
						<?=htmlspecialchars($server['tunnel_network']);?>
1192
					</td>
1193
					<td class="listbg" ondblclick="document.location='vpn_openvpn_server.php?act=edit&id=<?=$i;?>'">
1194
						<?=htmlspecialchars($server['description']);?>
1195
					</td>
1196
					<td valign="middle" nowrap class="list">
1197
						<a href="vpn_openvpn_server.php?act=edit&id=<?=$i;?>">
1198
							<img src="./themes/<?=$g['theme'];?>/images/icons/icon_e.gif" title="edit server" width="17" height="17" border="0">
1199
						</a>
1200
						&nbsp;
1201
						<a href="vpn_openvpn_server.php?act=del&id=<?=$i;?>" onclick="return confirm('Do you really want to delete this server?')">
1202
							<img src="/themes/<?=$g['theme'];?>/images/icons/icon_x.gif" title="delete server" width="17" height="17" border="0">
1203
						</a>
1204
					</td>
1205
				</tr>
1206
				<?php
1207
					$i++;
1208
					endforeach;
1209
				?>
1210
				<tr>
1211
					<td class="list" colspan="4"></td>
1212
					<td class="list">
1213
						<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">
1214
						</a>
1215
					</td>
1216
				</tr>
1217
			</table>
1218

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

    
1221
			<? endif; ?>
1222

    
1223
		</td>
1224
	</tr>
1225
</table>
1226
<script language="JavaScript">
1227
<!--
1228
mode_change();
1229
autokey_change();
1230
tlsauth_change();
1231
gwredir_change();
1232
dns_domain_change();
1233
dns_server_change();
1234
wins_server_change();
1235
ntp_server_change();
1236
netbios_change();
1237
//-->
1238
</script>
1239
</body>
1240
<?php include("fend.inc"); ?>
1241

    
1242
<?php
1243

    
1244
/* local utility functions */
1245

    
1246
function set_checked($var,& $chk) {
1247
    if($var)
1248
        $chk = 'checked';
1249
    else
1250
        $chk = '';
1251
}
1252

    
1253
?>
(207-207/215)