Project

General

Profile

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