Project

General

Profile

Download (40.9 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
$id = $_GET['id'];
48
if (isset($_POST['id']))
49
	$id = $_POST['id'];
50

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

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

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

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

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

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

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

    
82
		$pconfig['disable'] = $a_server[$id]['disable'];
83
		$pconfig['mode'] = $a_server[$id]['mode'];
84
		$pconfig['protocol'] = $a_server[$id]['protocol'];
85
		$pconfig['interface'] = $a_server[$id]['interface'];
86
		if (!empty($a_server[$id]['ipaddr'])) {
87
			$pconfig['interface'] = $pconfig['interface'] . '|' . $a_server[$id]['ipaddr'];
88
		}
89
		$pconfig['local_port'] = $a_server[$id]['local_port'];
90
		$pconfig['description'] = $a_server[$id]['description'];
91
		$pconfig['custom_options'] = $a_server[$id]['custom_options'];
92

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

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

    
114
		$pconfig['pool_enable'] = $a_server[$id]['pool_enable'];
115

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

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

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

    
136
		$pconfig['netbios_enable'] = $a_server[$id]['netbios_enable'];
137
		$pconfig['netbios_ntype'] = $a_server[$id]['netbios_ntype'];
138
		$pconfig['netbios_scope'] = $a_server[$id]['netbios_scope'];
139

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

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

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

    
156
if ($_POST) {
157

    
158
	unset($input_errors);
159
	$pconfig = $_POST;
160

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

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

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

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

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

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

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

    
188
	if ($pconfig['autokey_enable'])
189
		$pconfig['shared_key'] = openvpn_create_key();
190

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

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

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

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

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

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

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

    
246
	$reqdfields[] = 'tunnel_network';
247
	$reqdfieldsn[] = 'Tunnel network';
248

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

    
253
		$server = array();
254

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

    
260
		$server['disable'] = $pconfig['disable'];
261
		$server['mode'] = $pconfig['mode'];
262
		$server['protocol'] = $pconfig['protocol'];
263
		list($server['interface'], $server['ipaddr']) = explode ("|",$pconfig['interface']);
264
		$server['local_port'] = $pconfig['local_port'];
265
		$server['description'] = $pconfig['description'];
266
		$server['custom_options'] = $pconfig['custom_options'];
267

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

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

    
291
		$server['pool_enable'] = $pconfig['pool_enable'];
292

    
293
		if ($pconfig['dns_domain_enable'])
294
			$server['dns_domain'] = $pconfig['dns_domain'];
295

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

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

    
308
		$server['netbios_enable'] = $pconfig['netbios_enable'];
309
		$server['netbios_ntype'] = $pconfig['netbios_ntype'];
310
		$server['netbios_scope'] = $pconfig['netbios_scope'];
311

    
312
		if ($pconfig['netbios_enable']) {
313

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

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

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

    
336
include("head.inc");
337

    
338
?>
339

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

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

    
380
function autokey_change() {
381

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

    
388
function tlsauth_change() {
389

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

    
397
	autotls_change();
398
}
399

    
400
function autotls_change() {
401

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

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

    
414
function gwredir_change() {
415

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

    
422
function dns_domain_change() {
423

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

    
430
function dns_server_change() {
431

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

    
438
function wins_server_change() {
439

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

    
446
function ntp_server_change() {
447

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

    
454
function netbios_change() {
455

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

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

    
491
			<?php if($act=="new" || $act=="edit"): ?>
492

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

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

    
1095
				<table width="100%" border="0" cellpadding="6" cellspacing="0" id="client_opts">
1096
					<tr>
1097
						<td colspan="2" class="list" height="12"></td>
1098
					</tr>
1099
					<tr>
1100
						<td colspan="2" valign="top" class="listtopic">Advanced configuration</td>
1101
					</tr>
1102
					<tr>
1103
						<td width="22%" valign="top" class="vncell">Advanced</td>
1104
						<td width="78%" class="vtable">
1105
							<table border="0" cellpadding="2" cellspacing="0">
1106
								<tr>
1107
									<td>
1108
										<textarea rows="6" cols="78" name="custom_options" id="custom_options"><?=$pconfig['custom_options'];?></textarea><br/>
1109
										Paste any additional options you would like to pass through to the OpenVPN server here seperated by a semicolon<br/>
1110
										EXAMPLE: push "route 10.0.0.0 255.255.255.0";
1111
									</td>
1112
								</tr>
1113
							</table>
1114
						</td>
1115
					</tr>
1116
				</table>
1117

    
1118
				<br/>
1119

    
1120
				<table width="100%" border="0" cellpadding="6" cellspacing="0" id="client_opts">
1121
					<tr>
1122
						<td width="22%" valign="top">&nbsp;</td>
1123
						<td width="78%"> 
1124
							<input name="save" type="submit" class="formbtn" value="Save"> 
1125
							<input name="act" type="hidden" value="<?=$act;?>">
1126
							<?php if (isset($id) && $a_server[$id]): ?>
1127
							<input name="id" type="hidden" value="<?=$id;?>">
1128
							<?php endif; ?>
1129
						</td>
1130
					</tr>
1131
				</table>
1132
			</form>
1133

    
1134
			<?php else: ?>
1135

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

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

    
1189
			<? endif; ?>
1190

    
1191
		</td>
1192
	</tr>
1193
</table>
1194
<script language="JavaScript">
1195
<!--
1196
mode_change();
1197
autokey_change();
1198
tlsauth_change();
1199
gwredir_change();
1200
dns_domain_change();
1201
dns_server_change();
1202
wins_server_change();
1203
ntp_server_change();
1204
netbios_change();
1205
//-->
1206
</script>
1207
</body>
1208
<?php include("fend.inc"); ?>
1209

    
1210
<?php
1211

    
1212
/* local utility functions */
1213

    
1214
function set_checked($var,& $chk) {
1215
    if($var)
1216
        $chk = 'checked';
1217
    else
1218
        $chk = '';
1219
}
1220

    
1221
?>
(206-206/214)