Project

General

Profile

Download (41 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
require("guiconfig.inc");
38 d84bd468 Ermal Lu?i
require_once("openvpn.inc");
39 d799787e Matthew Grooms
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 67b0902f pierrepomes
		if (!empty($a_server[$id]['ipaddr'])) {
87
			$pconfig['interface'] = $pconfig['interface'] . '|' . $a_server[$id]['ipaddr'];
88
		}
89 d799787e Matthew Grooms
		$pconfig['local_port'] = $a_server[$id]['local_port'];
90
		$pconfig['description'] = $a_server[$id]['description'];
91 a9a613dd Scott Ullrich
		$pconfig['custom_options'] = $a_server[$id]['custom_options'];
92 d799787e Matthew Grooms
93 3c11bd3c Matthew Grooms
		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 fe787fc7 Matthew Grooms
			$pconfig['caref'] = $a_server[$id]['caref'];
99
			$pconfig['certref'] = $a_server[$id]['certref'];
100
			$pconfig['dh_length'] = $a_server[$id]['dh_length'];
101 3c11bd3c Matthew Grooms
		} else
102
			$pconfig['shared_key'] = base64_decode($a_server[$id]['shared_key']);
103 d799787e Matthew Grooms
		$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 1cb0b40a Matthew Grooms
		$pconfig['passtos'] = $a_server[$id]['passtos'];
112 d799787e Matthew Grooms
		$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 3c11bd3c Matthew Grooms
150
		// just in case the modes switch
151
		$pconfig['autokey_enable'] = "yes";
152
		$pconfig['autotls_enable'] = "yes";
153 d799787e Matthew Grooms
	}
154
}
155
156
if ($_POST) {
157
158
	unset($input_errors);
159
	$pconfig = $_POST;
160
161 f432e364 Matthew Grooms
	if (isset($id) && $a_server[$id])
162
		$vpnid = $a_server[$id]['vpnid'];
163
	else
164
		$vpnid = 0;
165
166 98c0c87a jim-p
	if ($pconfig['mode'] != "p2p_shared_key")
167 3c11bd3c Matthew Grooms
		$tls_mode = true;
168
	else
169
		$tls_mode = false;
170
171 d799787e Matthew Grooms
	/* 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 5accf130 jim-p
	$portused = openvpn_port_used($pconfig['protocol'], $pconfig['local_port']);
185
	if (($portused != $vpnid) && ($portused != 0))
186 f432e364 Matthew Grooms
		$input_errors[] = "The specified 'Local port' is in use. Please select another value";
187
188 89e6e210 jim-p
	if ($pconfig['autokey_enable'])
189
		$pconfig['shared_key'] = openvpn_create_key();
190
191 3c11bd3c Matthew Grooms
	if (!$tls_mode && !$pconfig['autokey_enable'])
192 d799787e Matthew Grooms
		if (!strstr($pconfig['shared_key'], "-----BEGIN OpenVPN Static key V1-----") ||
193
			!strstr($pconfig['shared_key'], "-----END OpenVPN Static key V1-----"))
194 3c11bd3c Matthew Grooms
			$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 d799787e Matthew Grooms
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 89e6e210 jim-p
	if (!$tls_mode && !$pconfig['autokey_enable']) {
239 872d9195 Matthew Grooms
		$reqdfields = array('shared_key');
240 69aae7e3 jim-p
		$reqdfieldsn = array('Shared key');
241 d799787e Matthew Grooms
    } else {
242 872d9195 Matthew Grooms
		$reqdfields = explode(" ", "caref certref");
243
		$reqdfieldsn = explode(",", "Certificate Authority,Certificate");;
244 d799787e Matthew Grooms
	}
245
246 872d9195 Matthew Grooms
	$reqdfields[] = 'tunnel_network';
247
	$reqdfieldsn[] = 'Tunnel network';
248
249 d799787e Matthew Grooms
	do_input_validation($_POST, $reqdfields, $reqdfieldsn, &$input_errors);
250
	
251
	if (!$input_errors) {
252
253
		$server = array();
254
255 f432e364 Matthew Grooms
		if ($vpnid)
256
			$server['vpnid'] = $vpnid;
257 e28120e5 Matthew Grooms
		else
258 d799787e Matthew Grooms
			$server['vpnid'] = openvpn_vpnid_next();
259
260
		$server['disable'] = $pconfig['disable'];
261 3c11bd3c Matthew Grooms
		$server['mode'] = $pconfig['mode'];
262 d799787e Matthew Grooms
		$server['protocol'] = $pconfig['protocol'];
263 67b0902f pierrepomes
		list($server['interface'], $server['ipaddr']) = explode ("|",$pconfig['interface']);
264 d799787e Matthew Grooms
		$server['local_port'] = $pconfig['local_port'];
265
		$server['description'] = $pconfig['description'];
266 a9a613dd Scott Ullrich
		$server['custom_options'] = $pconfig['custom_options'];
267 d799787e Matthew Grooms
268 3c11bd3c Matthew Grooms
		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 fe787fc7 Matthew Grooms
			$server['caref'] = $pconfig['caref'];
275
			$server['certref'] = $pconfig['certref'];
276
			$server['dh_length'] = $pconfig['dh_length'];
277 3c11bd3c Matthew Grooms
		} else {
278
			$server['shared_key'] = base64_encode($pconfig['shared_key']);
279 d799787e Matthew Grooms
		}
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 1cb0b40a Matthew Grooms
		$server['passtos'] = $pconfig['passtos'];
289 d799787e Matthew Grooms
		$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 dc408939 Matthew Grooms
		openvpn_resync('server', $server);
329 d799787e Matthew Grooms
		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 3c11bd3c Matthew Grooms
function mode_change() {
346
	index = document.iform.mode.selectedIndex;
347
	value = document.iform.mode.options[index].value;
348 d799787e Matthew Grooms
	switch(value) {
349 3c11bd3c Matthew Grooms
		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 fe787fc7 Matthew Grooms
			document.getElementById("tls_dh").style.display="";
357 d799787e Matthew Grooms
			document.getElementById("psk").style.display="none";
358
			break;
359 3c11bd3c Matthew Grooms
		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 fe787fc7 Matthew Grooms
			document.getElementById("tls_dh").style.display="none";
364 d799787e Matthew Grooms
			document.getElementById("psk").style.display="";
365
			break;
366
	}
367 3c11bd3c Matthew Grooms
	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 d799787e Matthew Grooms
}
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 5a3b0d3b mgrooms
	<tr>
475 d799787e Matthew Grooms
		<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 b63f2e8b Matthew Grooms
				add_package_tabs("OpenVPN", $tab_array);
483 d799787e Matthew Grooms
				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 47c00c09 Scott Ullrich
					<tr>
496
						<td colspan="2" valign="top" class="listtopic">General information</td>
497 b63f2e8b Matthew Grooms
					</tr>
498 d799787e Matthew Grooms
					<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 3c11bd3c Matthew Grooms
					<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 d799787e Matthew Grooms
					<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 3d06e8f0 pierrepomes
									$carplist = get_configured_carp_interface_list();
555
									foreach ($carplist as $cif => $carpip)
556 67b0902f pierrepomes
										$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 d799787e Matthew Grooms
									foreach ($interfaces as $iface => $ifacename):
562 1d3bcd2a Matthew Grooms
										$selected = "";
563
										if ($iface == $pconfig['interface'])
564
											$selected = "selected";
565 d799787e Matthew Grooms
								?>
566 1d3bcd2a Matthew Grooms
									<option value="<?=$iface;?>" <?=$selected;?>>
567
										<?=htmlspecialchars($ifacename);?>
568
									</option>
569 d799787e Matthew Grooms
								<?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 3c11bd3c Matthew Grooms
					<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 d799787e Matthew Grooms
					</tr>
635 3c11bd3c Matthew Grooms
					<tr id="tls_ca">
636
						<td width="22%" valign="top" class="vncellreq">Peer Certificate Authority</td>
637 d799787e Matthew Grooms
							<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 3c11bd3c Matthew Grooms
					<tr id="tls_cert">
651
						<td width="22%" valign="top" class="vncellreq">Server Certificate</td>
652 d799787e Matthew Grooms
							<td width="78%" class="vtable">
653
							<select name='certref' class="formselect">
654
							<?php
655
								foreach ($config['system']['cert'] as $cert):
656
									$selected = "";
657 05657769 Ermal Lu?i
									if (strstr($cert['name'], "webConfigurator"))
658
										continue;
659 d799787e Matthew Grooms
									if ($pconfig['certref'] == $cert['refid'])
660
										$selected = "selected";
661
							?>
662
								<option value="<?=$cert['refid'];?>" <?=$selected;?>><?=$cert['name'];?></option>
663
							<?php endforeach; ?>
664
							</select>
665
						</td>
666
					</tr>
667 fe787fc7 Matthew Grooms
					<tr id="tls_dh">
668
						<td width="22%" valign="top" class="vncellreq">DH Parameters Length</td>
669
						<td width="78%" class="vtable">
670
							<select name="dh_length" class="formselect">
671
								<?php
672
									foreach ($openvpn_dh_lengths as $length):
673
									$selected = '';
674
									if ($length == $pconfig['dh_length'])
675
										$selected = ' selected';
676
								?>
677
								<option<?=$selected?>><?=$length;?></option>
678
								<?php endforeach; ?>
679
							</select>
680
							<span class="vexpl">
681
								bits
682
							</span>
683
						</td>
684
					</tr>
685 d799787e Matthew Grooms
					<tr id="psk">
686
						<td width="22%" valign="top" class="vncellreq">Shared Key</td>
687 3c11bd3c Matthew Grooms
						<td width="78%" class="vtable">
688
							<?php if (!$pconfig['shared_key']): ?>
689
							<table border="0" cellpadding="2" cellspacing="0">
690
								<tr>
691
									<td>
692
										<?php set_checked($pconfig['autokey_enable'],$chk); ?>
693
										<input name="autokey_enable" type="checkbox" value="yes" <?=$chk;?> onClick="autokey_change()">
694
									</td>
695
									<td>
696
										<span class="vexpl">
697
											Automatically generate a shared key.
698
										</span>
699
									</td>
700
								</tr>
701
							</table>
702
							<?php endif; ?>
703
							<table border="0" cellpadding="2" cellspacing="0" id='autokey_opts'>
704
								<tr>
705
									<td>
706
										<textarea name="shared_key" cols="65" rows="7" class="formpre"><?=htmlspecialchars($pconfig['shared_key']);?></textarea>
707
										<br/>
708
										Paste your shared key here.
709
									</td>
710
								</tr>
711
							</table>
712 d799787e Matthew Grooms
						</td>
713
					</tr>
714
					<tr>
715
						<td width="22%" valign="top" class="vncellreq">Encryption algorithm</td>
716
						<td width="78%" class="vtable">
717
							<select name="crypto" class="formselect">
718
								<?php
719
									$cipherlist = openvpn_get_cipherlist();
720
									foreach ($cipherlist as $name => $desc):
721
									$selected = '';
722
									if ($name == $pconfig['crypto'])
723
										$selected = ' selected';
724
								?>
725
								<option value="<?=$name;?>"<?=$selected?>>
726
									<?=htmlspecialchars($desc);?>
727
								</option>
728
								<?php endforeach; ?>
729
							</select>
730
						</td>
731
					</tr>
732
					<tr>
733
						<td colspan="2" class="list" height="12"></td>
734
					</tr>
735
					<tr>
736
						<td colspan="2" valign="top" class="listtopic">Tunnel Settings</td>
737
					</tr>
738
					<tr>
739
						<td width="22%" valign="top" class="vncellreq">Tunnel Network</td>
740
						<td width="78%" class="vtable">
741
							<input name="tunnel_network" type="text" class="formfld unknown" size="20" value="<?=htmlspecialchars($pconfig['tunnel_network']);?>">
742
							<br>
743
							This is the virtual network used for private
744
							communications between this server and client
745
							hosts expressed using CIDR (eg. 10.0.8.0/24).
746
							The first network address will be assigned to
747
							the	server virtual interface. The remaining
748
							network addresses can optionally be assigned
749
							to connecting clients. (see Address Pool)
750
						</td>
751
					</tr>
752
					<tr>
753
						<td width="22%" valign="top" class="vncell">Redirect Gateway</td>
754
						<td width="78%" class="vtable">
755
							<table border="0" cellpadding="2" cellspacing="0">
756
								<tr>
757
									<td>
758
										<?php set_checked($pconfig['gwredir'],$chk); ?>
759
										<input name="gwredir" type="checkbox" value="yes" <?=$chk;?> onClick="gwredir_change()"/>
760
									</td>
761
									<td>
762
										<span class="vexpl">
763
											Force all client generated traffic through the tunnel.
764
										</span>
765
									</td>
766
								</tr>
767
							</table>
768
						</td>
769
					</tr>
770
					<tr id="local_opts">
771
						<td width="22%" valign="top" class="vncell">Local Network</td>
772
						<td width="78%" class="vtable">
773
							<input name="local_network" type="text" class="formfld unknown" size="20" value="<?=htmlspecialchars($pconfig['local_network']);?>">
774
							<br>
775
							This is the network that will be accessable
776
							from the remote endpoint. Expressed as a CIDR
777
							range. You may leave this blank if you don't
778
							want to add a route to the local network
779
							through this tunnel on the remote machine.
780
							This is generally set to your LAN network.
781
						</td>
782
					</tr>
783 3c11bd3c Matthew Grooms
					<tr id="remote_opts">
784
						<td width="22%" valign="top" class="vncell">Remote Network</td>
785
						<td width="78%" class="vtable">
786
							<input name="remote_network" type="text" class="formfld unknown" size="20" value="<?=htmlspecialchars($pconfig['remote_network']);?>">
787
							<br>
788
							This is a network that will be routed through
789
							the tunnel, so that a site-to-site VPN can be
790
							established without manually changing the
791
							routing tables. Expressed as a CIDR range. If
792
							this is a site-to-site VPN, enter here the
793
							remote LAN here. You may leave this blank if
794
							you don't want a site-to-site VPN.
795
						</td>
796
					</tr>
797 d799787e Matthew Grooms
					<tr>
798
						<td width="22%" valign="top" class="vncell"><?=gettext("Concurrent connections");?></td>
799
						<td width="78%" class="vtable">
800
							<input name="maxclients" type="text" class="formfld unknown" size="5" value="<?=htmlspecialchars($pconfig['maxclients']);?>"/>
801
							<br/>
802
							Specify the maximum number of clients allowed to concurrently connect to this server.
803
						</td>
804
					</tr>
805
					<tr>
806
						<td width="22%" valign="top" class="vncell">Compression</td>
807
						<td width="78%" class="vtable">
808
							<table border="0" cellpadding="2" cellspacing="0">
809
								<tr>
810
									<td>
811
										<?php set_checked($pconfig['compression'],$chk); ?>
812
										<input name="compression" type="checkbox" value="yes" <?=$chk;?>>
813
									</td>
814
									<td>
815
										<span class="vexpl">
816
											Compress tunnel packets using the LZO algorithm.
817
										</span>
818
									</td>
819
								</tr>
820
							</table>
821
						</td>
822
					</tr>
823
					<tr>
824
						<td width="22%" valign="top" class="vncell">Type-of-Service</td>
825
						<td width="78%" class="vtable">
826
							<table border="0" cellpadding="2" cellspacing="0">
827
								<tr>
828
									<td>
829 1cb0b40a Matthew Grooms
										<?php set_checked($pconfig['passtos'],$chk); ?>
830
										<input name="passtos" type="checkbox" value="yes" <?=$chk;?>>
831 d799787e Matthew Grooms
									</td>
832
									<td>
833
										<span class="vexpl">
834
											Set the TOS IP header value of tunnel packets to match the encapsulated packet value.
835
										</span>
836
									</td>
837
								</tr>
838
							</table>
839
						</td>
840
					</tr>
841
					<tr>
842
						<td width="22%" valign="top" class="vncell">Inter-client communication</td>
843
						<td width="78%" class="vtable">
844
							<table border="0" cellpadding="2" cellspacing="0">
845
								<tr>
846
									<td>
847
										<?php set_checked($pconfig['client2client'],$chk); ?>
848
										<input name="client2client" type="checkbox" value="yes" <?=$chk;?>/>
849
									</td>
850
									<td>
851
										<span class="vexpl">
852
											Allow communication between clients connected to this server
853
										</span>
854
									</td>
855
								</tr>
856
							</table>
857
						</td>
858
					</tr>
859 3c11bd3c Matthew Grooms
				</table>
860
861
				<table width="100%" border="0" cellpadding="6" cellspacing="0" id="client_opts">
862 d799787e Matthew Grooms
					<tr>
863
						<td colspan="2" class="list" height="12"></td>
864
					</tr>
865
					<tr>
866
						<td colspan="2" valign="top" class="listtopic">Client Settings</td>
867
					</tr>
868
					<tr>
869
						<td width="22%" valign="top" class="vncell">Address Pool</td>
870
						<td width="78%" class="vtable">
871
							<table border="0" cellpadding="2" cellspacing="0">
872
								<tr>
873
									<td>
874
										<?php set_checked($pconfig['pool_enable'],$chk); ?>
875
										<input name="pool_enable" type="checkbox" id="pool_enable" value="yes" <?=$chk;?>">
876
									</td>
877
									<td>
878
										<span class="vexpl">
879
											Provide a virtual adapter IP address to clients (see Tunnel Network)<br>
880
										</span>
881
									</td>
882
								</tr>
883
							</table>
884
						</td>
885
					</tr>
886
					<tr>
887
						<td width="22%" valign="top" class="vncell">DNS Default Domain</td>
888
						<td width="78%" class="vtable">
889
							<table border="0" cellpadding="2" cellspacing="0">
890
								<tr>
891
									<td>
892
										<?php set_checked($pconfig['dns_domain_enable'],$chk); ?>
893
										<input name="dns_domain_enable" type="checkbox" id="dns_domain_enable" value="yes" <?=$chk;?> onClick="dns_domain_change()">
894
									</td>
895
									<td>
896
										<span class="vexpl">
897
	                                        Provide a default domain name to clients<br>
898
										</span>
899
									</td>
900
								</tr>
901
							</table>
902
							<table border="0" cellpadding="2" cellspacing="0" id="dns_domain_data">
903
								<tr>
904
									<td>
905
										<input name="dns_domain" type="text" class="formfld unknown" id="dns_domain" size="30" value="<?=htmlspecialchars($pconfig['dns_domain']);?>">
906
									</td>
907
								</tr>
908
							</table>
909
						</td>
910
					</tr>
911
					<tr>
912
						<td width="22%" valign="top" class="vncell">DNS Servers</td>
913
						<td width="78%" class="vtable">
914
							<table border="0" cellpadding="2" cellspacing="0">
915
								<tr>
916
									<td>
917
										<?php set_checked($pconfig['dns_server_enable'],$chk); ?>
918
										<input name="dns_server_enable" type="checkbox" id="dns_server_enable" value="yes" <?=$chk;?> onClick="dns_server_change()">
919
									</td>
920
									<td>
921
										<span class="vexpl">
922
											Provide a DNS server list to clients<br>
923
										</span>
924
									</td>
925
								</tr>
926
							</table>
927
							<table border="0" cellpadding="2" cellspacing="0" id="dns_server_data">
928
								<tr>
929
									<td>
930
										<span class="vexpl">
931
											Server #1:&nbsp;
932
										</span>
933
										<input name="dns_server1" type="text" class="formfld unknown" id="dns_server1" size="20" value="<?=$pconfig['dns_server1'];?>">
934
									</td>
935
								</tr>
936
								<tr>
937
									<td>
938
										<span class="vexpl">
939
											Server #2:&nbsp;
940
										</span>
941
										<input name="dns_server2" type="text" class="formfld unknown" id="dns_server2" size="20" value="<?=$pconfig['dns_server2'];?>">
942
									</td>
943
								</tr>
944
								<tr>
945
									<td>
946
										<span class="vexpl">
947
											Server #3:&nbsp;
948
										</span>
949
										<input name="dns_server3" type="text" class="formfld unknown" id="dns_server3" size="20" value="<?=$pconfig['dns_server3'];?>">
950
									</td>
951
								</tr>
952
								<tr>
953
									<td>
954
										<span class="vexpl">
955
											Server #4:&nbsp;
956
										</span>
957
										<input name="dns_server4" type="text" class="formfld unknown" id="dns_server4" size="20" value="<?=$pconfig['dns_server4'];?>">
958
									</td>
959
								</tr>
960
							</table>
961
						</td>
962
					</tr>
963
					<tr>
964
						<td width="22%" valign="top" class="vncell">NTP Servers</td>
965
						<td width="78%" class="vtable">
966
							<table border="0" cellpadding="2" cellspacing="0">
967
								<tr>
968
									<td>
969
										<?php set_checked($pconfig['ntp_server_enable'],$chk); ?>
970
										<input name="ntp_server_enable" type="checkbox" id="ntp_server_enable" value="yes" <?=$chk;?> onClick="ntp_server_change()">
971
									</td>
972
									<td>
973
										<span class="vexpl">
974
											Provide a NTP server list to clients<br>
975
										</span>
976
									</td>
977
								</tr>
978
							</table>
979
							<table border="0" cellpadding="2" cellspacing="0" id="ntp_server_data">
980
								<tr>
981
									<td>
982
										<span class="vexpl">
983
											Server #1:&nbsp;
984
										</span>
985
										<input name="ntp_server1" type="text" class="formfld unknown" id="ntp_server1" size="20" value="<?=$pconfig['ntp_server1'];?>">
986
									</td>
987
								</tr>
988
								<tr>
989
									<td>
990
										<span class="vexpl">
991
											Server #2:&nbsp;
992
										</span>
993
										<input name="ntp_server2" type="text" class="formfld unknown" id="ntp_server2" size="20" value="<?=$pconfig['ntp_server2'];?>">
994
									</td>
995
								</tr>
996
							</table>
997
						</td>
998
					</tr>
999
					<tr>
1000
						<td width="22%" valign="top" class="vncell">NetBIOS Options</td>
1001
						<td width="78%" class="vtable">
1002
							<table border="0" cellpadding="2" cellspacing="0">
1003
								<tr>
1004
									<td>
1005
										<?php set_checked($pconfig['netbios_enable'],$chk); ?>
1006
										<input name="netbios_enable" type="checkbox" id="netbios_enable" value="yes" <?=$chk;?> onClick="netbios_change()">
1007
									</td>
1008
									<td>
1009
										<span class="vexpl">
1010
											Enable NetBIOS over TCP/IP<br>
1011
										</span>
1012
									</td>
1013
								</tr>
1014
							</table>
1015 f31607c5 Chris Buechler
							If this option is not set, all NetBIOS-over-TCP/IP options (including WINS) will be disabled.
1016 d799787e Matthew Grooms
							<br/>
1017
							<table border="0" cellpadding="2" cellspacing="0" id="netbios_data">
1018
								<tr>
1019
									<td>
1020
										<br/>
1021
										<span class="vexpl">
1022
											Node Type:&nbsp;
1023
										</span>
1024
										<select name='netbios_ntype' class="formselect">
1025
										<?php
1026
											foreach ($netbios_nodetypes as $type => $name):
1027
												$selected = "";
1028
												if ($pconfig['netbios_ntype'] == $type)
1029
													$selected = "selected";
1030
										?>
1031
											<option value="<?=$type;?>" <?=$selected;?>><?=$name;?></option>
1032
										<?php endforeach; ?>
1033
										</select>
1034
										<br/>
1035
										Possible options: b-node (broadcasts), p-node
1036
										(point-to-point name queries to a WINS server),
1037
										m-node (broadcast then query name server), and
1038
										h-node (query name server, then broadcast).
1039
									</td>
1040
								</tr>
1041
								<tr>
1042
									<td>
1043
										<br/>
1044
										<span class="vexpl">
1045
											Scope ID:&nbsp;
1046
										</span>
1047
										<input name="netbios_scope" type="text" class="formfld unknown" id="netbios_scope" size="30" value="<?=htmlspecialchars($pconfig['netbios_scope']);?>">
1048
										<br/>
1049
										A NetBIOS Scope	ID provides an extended naming
1050
										service for	NetBIOS over TCP/IP. The NetBIOS
1051
										scope ID isolates NetBIOS traffic on a single
1052
										network to only those nodes with the same
1053
										NetBIOS scope ID.
1054
									</td>
1055
								</tr>
1056
							</table>
1057
						</td>
1058
					</tr>
1059
					<tr id="wins_opts">
1060
						<td width="22%" valign="top" class="vncell">WINS Servers</td>
1061
						<td width="78%" class="vtable">
1062
							<table border="0" cellpadding="2" cellspacing="0">
1063
								<tr>
1064
									<td>
1065
										<?php set_checked($pconfig['wins_server_enable'],$chk); ?>
1066
										<input name="wins_server_enable" type="checkbox" id="wins_server_enable" value="yes" <?=$chk;?> onClick="wins_server_change()">
1067
									</td>
1068
									<td>
1069
										<span class="vexpl">
1070
											Provide a WINS server list to clients<br>
1071
										</span>
1072
									</td>
1073
								</tr>
1074
							</table>
1075
							<table border="0" cellpadding="2" cellspacing="0" id="wins_server_data">
1076
								<tr>
1077
									<td>
1078
										<span class="vexpl">
1079
											Server #1:&nbsp;
1080
										</span>
1081
										<input name="wins_server1" type="text" class="formfld unknown" id="wins_server1" size="20" value="<?=$pconfig['wins_server1'];?>">
1082
									</td>
1083
								</tr>
1084
								<tr>
1085
									<td>
1086
										<span class="vexpl">
1087
											Server #2:&nbsp;
1088
										</span>
1089
										<input name="wins_server2" type="text" class="formfld unknown" id="wins_server2" size="20" value="<?=$pconfig['wins_server2'];?>">
1090
									</td>
1091
								</tr>
1092
							</table>
1093
						</td>
1094
					</tr>
1095 3c11bd3c Matthew Grooms
				</table>
1096
1097 2f4f30ee Scott Ullrich
				<table width="100%" border="0" cellpadding="6" cellspacing="0" id="client_opts">
1098
					<tr>
1099
						<td colspan="2" class="list" height="12"></td>
1100
					</tr>
1101
					<tr>
1102
						<td colspan="2" valign="top" class="listtopic">Advanced configuration</td>
1103
					</tr>
1104
					<tr>
1105 6804263e Scott Ullrich
						<td width="22%" valign="top" class="vncell">Advanced</td>
1106 2f4f30ee Scott Ullrich
						<td width="78%" class="vtable">
1107
							<table border="0" cellpadding="2" cellspacing="0">
1108
								<tr>
1109
									<td>
1110 a9a613dd Scott Ullrich
										<textarea rows="6" cols="78" name="custom_options" id="custom_options"><?=$pconfig['custom_options'];?></textarea><br/>
1111 1a4f9b42 Chris Buechler
										Enter any additional options you would like to add to the OpenVPN server configuration here, separated by a semicolon<br/>
1112 53be9d3c Scott Ullrich
										EXAMPLE: push "route 10.0.0.0 255.255.255.0";
1113 2f4f30ee Scott Ullrich
									</td>
1114
								</tr>
1115
							</table>
1116
						</td>
1117
					</tr>
1118
				</table>
1119
1120 f68fc963 Scott Ullrich
				<br/>
1121
1122 3c11bd3c Matthew Grooms
				<table width="100%" border="0" cellpadding="6" cellspacing="0" id="client_opts">
1123 d799787e Matthew Grooms
					<tr>
1124
						<td width="22%" valign="top">&nbsp;</td>
1125
						<td width="78%"> 
1126
							<input name="save" type="submit" class="formbtn" value="Save"> 
1127
							<input name="act" type="hidden" value="<?=$act;?>">
1128
							<?php if (isset($id) && $a_server[$id]): ?>
1129
							<input name="id" type="hidden" value="<?=$id;?>">
1130
							<?php endif; ?>
1131
						</td>
1132
					</tr>
1133
				</table>
1134
			</form>
1135
1136
			<?php else: ?>
1137
1138 7128ed17 Scott Ullrich
			<table class="sortable" width="100%" border="0" cellpadding="0" cellspacing="0">
1139 d799787e Matthew Grooms
				<tr>
1140
					<td width="10%" class="listhdrr">Disabled</td>
1141
					<td width="10%" class="listhdrr">Protocol</td>
1142
					<td width="30%" class="listhdrr">Tunnel Network</td>
1143
					<td width="40%" class="listhdrr">Description</td>
1144
					<td width="10%" class="list"></td>
1145
				</tr>
1146
				<?php
1147
					$i = 0;
1148
					foreach($a_server as $server):
1149
						$disabled = "NO";
1150
						if ($server['disable'])
1151
							$disabled = "YES";
1152
				?>
1153
				<tr>
1154 d3d9b0ee Scott Ullrich
					<td class="listlr" ondblclick="document.location='vpn_openvpn_server.php?act=edit&id=<?=$i;?>'">
1155 d799787e Matthew Grooms
						<?=$disabled;?>
1156
					</td>
1157 d3d9b0ee Scott Ullrich
					<td class="listr" ondblclick="document.location='vpn_openvpn_server.php?act=edit&id=<?=$i;?>'">
1158 d799787e Matthew Grooms
						<?=htmlspecialchars($server['protocol']);?>
1159
					</td>
1160 d3d9b0ee Scott Ullrich
					<td class="listr" ondblclick="document.location='vpn_openvpn_server.php?act=edit&id=<?=$i;?>'">
1161 d799787e Matthew Grooms
						<?=htmlspecialchars($server['tunnel_network']);?>
1162
					</td>
1163 d3d9b0ee Scott Ullrich
					<td class="listbg" ondblclick="document.location='vpn_openvpn_server.php?act=edit&id=<?=$i;?>'">
1164 d799787e Matthew Grooms
						<?=htmlspecialchars($server['description']);?>
1165
					</td>
1166
					<td valign="middle" nowrap class="list">
1167
						<a href="vpn_openvpn_server.php?act=edit&id=<?=$i;?>">
1168
							<img src="./themes/<?=$g['theme'];?>/images/icons/icon_e.gif" title="edit server" width="17" height="17" border="0">
1169
						</a>
1170
						&nbsp;
1171
						<a href="vpn_openvpn_server.php?act=del&id=<?=$i;?>" onclick="return confirm('Do you really want to delete this server?')">
1172
							<img src="/themes/<?=$g['theme'];?>/images/icons/icon_x.gif" title="delete server" width="17" height="17" border="0">
1173
						</a>
1174
					</td>
1175
				</tr>
1176
				<?php
1177
					$i++;
1178
					endforeach;
1179
				?>
1180
				<tr>
1181
					<td class="list" colspan="4"></td>
1182
					<td class="list">
1183
						<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">
1184
						</a>
1185
					</td>
1186
				</tr>
1187
			</table>
1188
1189 7128ed17 Scott Ullrich
			<?=gettext("Additional OpenVPN servers can be added here.");?>
1190
1191 d799787e Matthew Grooms
			<? endif; ?>
1192
1193
		</td>
1194
	</tr>
1195
</table>
1196
<script language="JavaScript">
1197
<!--
1198 3c11bd3c Matthew Grooms
mode_change();
1199
autokey_change();
1200
tlsauth_change();
1201 d799787e Matthew Grooms
gwredir_change();
1202
dns_domain_change();
1203
dns_server_change();
1204
wins_server_change();
1205
ntp_server_change();
1206
netbios_change();
1207
//-->
1208
</script>
1209
</body>
1210
<?php include("fend.inc"); ?>
1211
1212
<?php
1213
1214
/* local utility functions */
1215
1216
function set_checked($var,& $chk) {
1217
    if($var)
1218
        $chk = 'checked';
1219
    else
1220
        $chk = '';
1221
}
1222
1223 d84bd468 Ermal Lu?i
?>