Projet

Général

Profil

Télécharger (44,6 ko) Statistiques
| Branche: | Tag: | Révision:

univnautes / usr / local / www / vpn_openvpn_client.php @ c7264382

1
<?php
2
/*
3
	vpn_openvpn_client.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-client
32
##|*NAME=OpenVPN: Client page
33
##|*DESCR=Allow access to the 'OpenVPN: Client' page.
34
##|*MATCH=vpn_openvpn_client.php*
35
##|-PRIV
36

    
37
require("guiconfig.inc");
38
require_once("openvpn.inc");
39

    
40
$pgtitle = array(gettext("OpenVPN"), gettext("Client"));
41
$shortcut_section = "openvpn";
42

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

    
46
$a_client = &$config['openvpn']['openvpn-client'];
47

    
48
if (!is_array($config['ca']))
49
	$config['ca'] = array();
50

    
51
$a_ca =& $config['ca'];
52

    
53
if (!is_array($config['cert']))
54
	$config['cert'] = array();
55

    
56
$a_cert =& $config['cert'];
57

    
58
if (!is_array($config['crl']))
59
	$config['crl'] = array();
60

    
61
$a_crl =& $config['crl'];
62

    
63
if (is_numericint($_GET['id']))
64
	$id = $_GET['id'];
65
if (isset($_POST['id']) && is_numericint($_POST['id']))
66
	$id = $_POST['id'];
67

    
68
$act = $_GET['act'];
69
if (isset($_POST['act']))
70
	$act = $_POST['act'];
71

    
72
if (isset($id) && $a_client[$id])
73
	$vpnid = $a_client[$id]['vpnid'];
74
else
75
	$vpnid = 0;
76

    
77
if ($_GET['act'] == "del") {
78

    
79
	if (!isset($a_client[$id])) {
80
		pfSenseHeader("vpn_openvpn_client.php");
81
		exit;
82
	}
83
	if (!empty($a_client[$id]))
84
		openvpn_delete('client', $a_client[$id]);
85
	unset($a_client[$id]);
86
	write_config();
87
	$savemsg = gettext("Client successfully deleted")."<br />";
88
}
89

    
90
if($_GET['act']=="new"){
91
	$pconfig['autokey_enable'] = "yes";
92
	$pconfig['tlsauth_enable'] = "yes";
93
	$pconfig['autotls_enable'] = "yes";
94
	$pconfig['interface'] = "wan";
95
	$pconfig['server_port'] = 1194;
96
	$pconfig['verbosity_level'] = 1; // Default verbosity is 1
97
	// OpenVPN Defaults to SHA1
98
	$pconfig['digest'] = "SHA1";
99
}
100

    
101
global $simplefields;
102
$simplefields = array('auth_user','auth_pass');
103

    
104
if($_GET['act']=="edit"){
105

    
106
	if (isset($id) && $a_client[$id]) {
107
		foreach($simplefields as $stat)
108
			$pconfig[$stat] = $a_client[$id][$stat];
109

    
110
		$pconfig['disable'] = isset($a_client[$id]['disable']);
111
		$pconfig['mode'] = $a_client[$id]['mode'];
112
		$pconfig['protocol'] = $a_client[$id]['protocol'];
113
		$pconfig['interface'] = $a_client[$id]['interface'];
114
		if (!empty($a_client[$id]['ipaddr'])) {
115
			$pconfig['interface'] = $pconfig['interface'] . '|' . $a_client[$id]['ipaddr'];
116
		}
117
		$pconfig['local_port'] = $a_client[$id]['local_port'];
118
		$pconfig['server_addr'] = $a_client[$id]['server_addr'];
119
		$pconfig['server_port'] = $a_client[$id]['server_port'];
120
		$pconfig['resolve_retry'] = $a_client[$id]['resolve_retry'];
121
		$pconfig['proxy_addr'] = $a_client[$id]['proxy_addr'];
122
		$pconfig['proxy_port'] = $a_client[$id]['proxy_port'];
123
		$pconfig['proxy_user'] = $a_client[$id]['proxy_user'];
124
		$pconfig['proxy_passwd'] = $a_client[$id]['proxy_passwd'];
125
		$pconfig['proxy_authtype'] = $a_client[$id]['proxy_authtype'];
126
		$pconfig['description'] = $a_client[$id]['description'];
127
		$pconfig['custom_options'] = $a_client[$id]['custom_options'];
128
		$pconfig['ns_cert_type'] = $a_client[$id]['ns_cert_type'];
129
		$pconfig['dev_mode'] = $a_client[$id]['dev_mode'];
130

    
131
		if ($pconfig['mode'] != "p2p_shared_key") {
132
			$pconfig['caref'] = $a_client[$id]['caref'];
133
			$pconfig['certref'] = $a_client[$id]['certref'];
134
			if ($a_client[$id]['tls']) {
135
				$pconfig['tlsauth_enable'] = "yes";
136
				$pconfig['tls'] = base64_decode($a_client[$id]['tls']);
137
			}
138
		} else
139
			$pconfig['shared_key'] = base64_decode($a_client[$id]['shared_key']);
140
		$pconfig['crypto'] = $a_client[$id]['crypto'];
141
		// OpenVPN Defaults to SHA1 if unset
142
		$pconfig['digest'] = !empty($a_client[$id]['digest']) ? $a_client[$id]['digest'] : "SHA1";
143
		$pconfig['engine'] = $a_client[$id]['engine'];
144

    
145
		$pconfig['tunnel_network'] = $a_client[$id]['tunnel_network'];
146
		$pconfig['tunnel_networkv6'] = $a_client[$id]['tunnel_networkv6'];
147
		$pconfig['remote_network'] = $a_client[$id]['remote_network'];
148
		$pconfig['remote_networkv6'] = $a_client[$id]['remote_networkv6'];
149
		$pconfig['use_shaper'] = $a_client[$id]['use_shaper'];
150
		$pconfig['compression'] = $a_client[$id]['compression'];
151
		$pconfig['passtos'] = $a_client[$id]['passtos'];
152

    
153
		// just in case the modes switch
154
		$pconfig['autokey_enable'] = "yes";
155
		$pconfig['autotls_enable'] = "yes";
156
		
157
		// New features
158
		$pconfig['no_tun_ipv6'] = $a_client[$id]['no_tun_ipv6'];
159
		$pconfig['route_no_pull'] = $a_client[$id]['route_no_pull'];
160
		$pconfig['route_no_exec'] = $a_client[$id]['route_no_exec'];
161
		if (isset($a_client[$id]['verbosity_level']))
162
			$pconfig['verbosity_level'] = $a_client[$id]['verbosity_level'];
163
		else
164
			$pconfig['verbosity_level'] = 1; // Default verbosity is 1
165
	}
166
}
167

    
168
if ($_POST) {
169

    
170
	unset($input_errors);
171
	$pconfig = $_POST;
172

    
173
	if (isset($id) && $a_client[$id])
174
		$vpnid = $a_client[$id]['vpnid'];
175
	else
176
		$vpnid = 0;
177

    
178
	list($iv_iface, $iv_ip) = explode ("|",$pconfig['interface']);
179
	if (is_ipaddrv4($iv_ip) && (stristr($pconfig['protocol'], "6") !== false)) {
180
		$input_errors[] = gettext("Protocol and IP address families do not match. You cannot select an IPv6 protocol and an IPv4 IP address.");
181
	} elseif (is_ipaddrv6($iv_ip) && (stristr($pconfig['protocol'], "6") === false)) {
182
		$input_errors[] = gettext("Protocol and IP address families do not match. You cannot select an IPv4 protocol and an IPv6 IP address.");
183
	} elseif ((stristr($pconfig['protocol'], "6") === false) && !get_interface_ip($iv_iface) && ($pconfig['interface'] != "any")) {
184
		$input_errors[] = gettext("An IPv4 protocol was selected, but the selected interface has no IPv4 address.");
185
	} elseif ((stristr($pconfig['protocol'], "6") !== false) && !get_interface_ipv6($iv_iface) && ($pconfig['interface'] != "any")) {
186
		$input_errors[] = gettext("An IPv6 protocol was selected, but the selected interface has no IPv6 address.");
187
	}
188

    
189
	if ($pconfig['mode'] != "p2p_shared_key")
190
		$tls_mode = true;
191
	else
192
		$tls_mode = false;
193

    
194
	/* input validation */
195
	if ($pconfig['local_port']) {
196

    
197
		if ($result = openvpn_validate_port($pconfig['local_port'], 'Local port'))
198
			$input_errors[] = $result;
199

    
200
		$portused = openvpn_port_used($pconfig['protocol'], $pconfig['interface'], $pconfig['local_port'], $vpnid);
201
		if (($portused != $vpnid) && ($portused != 0))
202
			$input_errors[] = gettext("The specified 'Local port' is in use. Please select another value");
203
	}
204

    
205
	if ($result = openvpn_validate_host($pconfig['server_addr'], 'Server host or address'))
206
		$input_errors[] = $result;
207

    
208
	if ($result = openvpn_validate_port($pconfig['server_port'], 'Server port'))
209
		$input_errors[] = $result;
210

    
211
	if ($pconfig['proxy_addr']) {
212

    
213
		if ($result = openvpn_validate_host($pconfig['proxy_addr'], 'Proxy host or address'))
214
			$input_errors[] = $result;
215

    
216
		if ($result = openvpn_validate_port($pconfig['proxy_port'], 'Proxy port'))
217
			$input_errors[] = $result;
218

    
219
		if ($pconfig['proxy_authtype'] != "none") {
220
			if (empty($pconfig['proxy_user']) || empty($pconfig['proxy_passwd']))
221
				$input_errors[] = gettext("User name and password are required for proxy with authentication.");
222
		}
223
	}
224

    
225
	if($pconfig['tunnel_network'])
226
		if ($result = openvpn_validate_cidr($pconfig['tunnel_network'], 'IPv4 Tunnel Network', false, "ipv4"))
227
			$input_errors[] = $result;
228

    
229
	if($pconfig['tunnel_networkv6'])
230
		if ($result = openvpn_validate_cidr($pconfig['tunnel_networkv6'], 'IPv6 Tunnel Network', false, "ipv6"))
231
			$input_errors[] = $result;
232

    
233
	if ($result = openvpn_validate_cidr($pconfig['remote_network'], 'IPv4 Remote Network', true, "ipv4"))
234
		$input_errors[] = $result;
235

    
236
	if ($result = openvpn_validate_cidr($pconfig['remote_networkv6'], 'IPv6 Remote Network', true, "ipv6"))
237
		$input_errors[] = $result;
238

    
239
	if (!empty($pconfig['use_shaper']) && (!is_numeric($pconfig['use_shaper']) || ($pconfig['use_shaper'] <= 0)))
240
		$input_errors[] = gettext("The bandwidth limit must be a positive numeric value.");
241

    
242
	if ($pconfig['autokey_enable'])
243
		$pconfig['shared_key'] = openvpn_create_key();
244

    
245
	if (!$tls_mode && !$pconfig['autokey_enable'])
246
		if (!strstr($pconfig['shared_key'], "-----BEGIN OpenVPN Static key V1-----") ||
247
			!strstr($pconfig['shared_key'], "-----END OpenVPN Static key V1-----"))
248
			$input_errors[] = gettext("The field 'Shared Key' does not appear to be valid");
249

    
250
	if ($tls_mode && $pconfig['tlsauth_enable'] && !$pconfig['autotls_enable'])
251
		if (!strstr($pconfig['tls'], "-----BEGIN OpenVPN Static key V1-----") ||
252
			!strstr($pconfig['tls'], "-----END OpenVPN Static key V1-----"))
253
			$input_errors[] = gettext("The field 'TLS Authentication Key' does not appear to be valid");
254

    
255
	/* If we are not in shared key mode, then we need the CA/Cert. */
256
	if ($pconfig['mode'] != "p2p_shared_key") {
257
		$reqdfields = explode(" ", "caref");
258
		$reqdfieldsn = array(gettext("Certificate Authority"));
259
	} elseif (!$pconfig['autokey_enable']) {
260
		/* We only need the shared key filled in if we are in shared key mode and autokey is not selected. */
261
		$reqdfields = array('shared_key');
262
		$reqdfieldsn = array(gettext('Shared key'));
263
	}
264

    
265
	do_input_validation($_POST, $reqdfields, $reqdfieldsn, $input_errors);
266

    
267
	if (($pconfig['mode'] != "p2p_shared_key") && empty($pconfig['certref']) && empty($pconfig['auth_user']) && empty($pconfig['auth_pass'])) {
268
		$input_errors[] = gettext("If no Client Certificate is selected, a username and password must be entered.");
269
	}
270

    
271
	if (!$input_errors) {
272

    
273
		$client = array();
274

    
275
		foreach($simplefields as $stat)
276
			update_if_changed($stat, $client[$stat], $_POST[$stat]);
277

    
278
		if ($vpnid)
279
			$client['vpnid'] = $vpnid;
280
		else
281
			$client['vpnid'] = openvpn_vpnid_next();
282

    
283
		if ($_POST['disable'] == "yes")
284
			$client['disable'] = true;
285
		$client['protocol'] = $pconfig['protocol'];
286
		$client['dev_mode'] = $pconfig['dev_mode'];
287
		list($client['interface'], $client['ipaddr']) = explode ("|",$pconfig['interface']);
288
		$client['local_port'] = $pconfig['local_port'];
289
		$client['server_addr'] = $pconfig['server_addr'];
290
		$client['server_port'] = $pconfig['server_port'];
291
		$client['resolve_retry'] = $pconfig['resolve_retry'];
292
		$client['proxy_addr'] = $pconfig['proxy_addr'];
293
		$client['proxy_port'] = $pconfig['proxy_port'];
294
		$client['proxy_authtype'] = $pconfig['proxy_authtype'];
295
		$client['proxy_user'] = $pconfig['proxy_user'];
296
		$client['proxy_passwd'] = $pconfig['proxy_passwd'];
297
		$client['description'] = $pconfig['description'];
298
		$client['mode'] = $pconfig['mode'];
299
		$client['custom_options'] = str_replace("\r\n", "\n", $pconfig['custom_options']);
300

    
301
		if ($tls_mode) {
302
			$client['caref'] = $pconfig['caref'];
303
			$client['certref'] = $pconfig['certref'];
304
			if ($pconfig['tlsauth_enable']) {
305
				if ($pconfig['autotls_enable'])
306
					$pconfig['tls'] = openvpn_create_key();
307
				$client['tls'] = base64_encode($pconfig['tls']);
308
			}
309
		} else {
310
			$client['shared_key'] = base64_encode($pconfig['shared_key']);
311
		}
312
		$client['crypto'] = $pconfig['crypto'];
313
		$client['digest'] = $pconfig['digest'];
314
		$client['engine'] = $pconfig['engine'];
315

    
316
		$client['tunnel_network'] = $pconfig['tunnel_network'];
317
		$client['tunnel_networkv6'] = $pconfig['tunnel_networkv6'];
318
		$client['remote_network'] = $pconfig['remote_network'];
319
		$client['remote_networkv6'] = $pconfig['remote_networkv6'];
320
		$client['use_shaper'] = $pconfig['use_shaper'];
321
		$client['compression'] = $pconfig['compression'];
322
		$client['passtos'] = $pconfig['passtos'];
323

    
324
		// New features
325
		$client['no_tun_ipv6'] = $pconfig['no_tun_ipv6'];
326
		$client['route_no_pull'] = $pconfig['route_no_pull'];
327
		$client['route_no_exec'] = $pconfig['route_no_exec'];
328
		$client['verbosity_level'] = $pconfig['verbosity_level'];
329

    
330
		if (isset($id) && $a_client[$id])
331
			$a_client[$id] = $client;
332
		else
333
			$a_client[] = $client;
334

    
335
		openvpn_resync('client', $client);
336
		write_config();
337

    
338
		header("Location: vpn_openvpn_client.php");
339
		exit;
340
	}
341
}
342

    
343
include("head.inc");
344

    
345
?>
346

    
347
<body link="#000000" vlink="#000000" alink="#000000" onload="<?= $jsevents["body"]["onload"] ?>">
348
<?php include("fbegin.inc"); ?>
349
<script type="text/javascript">
350
//<![CDATA[
351

    
352
function mode_change() {
353
	index = document.iform.mode.selectedIndex;
354
	value = document.iform.mode.options[index].value;
355
	switch(value) {
356
		case "p2p_tls":
357
			document.getElementById("tls").style.display="";
358
			document.getElementById("tls_ca").style.display="";
359
			document.getElementById("tls_cert").style.display="";
360
			document.getElementById("psk").style.display="none";
361
			break;
362
		case "p2p_shared_key":
363
			document.getElementById("tls").style.display="none";
364
			document.getElementById("tls_ca").style.display="none";
365
			document.getElementById("tls_cert").style.display="none";
366
			document.getElementById("psk").style.display="";
367
			break;
368
	}
369
}
370

    
371
function dev_mode_change() {
372
	index = document.iform.dev_mode.selectedIndex;
373
	value = document.iform.dev_mode.options[index].value;
374
	switch(value) {
375
		case "tun":
376
			document.getElementById("chkboxNoTunIPv6").style.display="";
377
			break;
378
		case "tap":
379
			document.getElementById("chkboxNoTunIPv6").style.display="none";
380
			break;
381
	}
382
}
383

    
384
function autokey_change() {
385
	if (document.iform.autokey_enable.checked)
386
		document.getElementById("autokey_opts").style.display="none";
387
	else
388
		document.getElementById("autokey_opts").style.display="";
389
}
390

    
391
function useproxy_changed() {
392

    
393
	if (jQuery('#proxy_authtype').val() != 'none') {
394
		jQuery('#proxy_authtype_opts').show();
395
	} else {
396
		jQuery('#proxy_authtype_opts').hide();
397
	}
398
}
399

    
400
function tlsauth_change() {
401

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

    
409
	autotls_change();
410
}
411

    
412
function autotls_change() {
413

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

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

    
426
//]]>
427
</script>
428
<?php
429
if (!$savemsg)
430
	$savemsg = "";
431

    
432
if ($input_errors)
433
	print_input_errors($input_errors);
434
if ($savemsg)
435
	print_info_box($savemsg);
436
?>
437
<table width="100%" border="0" cellpadding="0" cellspacing="0" summary="vpn openvpn client">
438
	<tr>
439
		<td class="tabnavtbl">
440
			<?php
441
				$tab_array = array();
442
				$tab_array[] = array(gettext("Server"), false, "vpn_openvpn_server.php");
443
				$tab_array[] = array(gettext("Client"), true, "vpn_openvpn_client.php");
444
				$tab_array[] = array(gettext("Client Specific Overrides"), false, "vpn_openvpn_csc.php");
445
				$tab_array[] = array(gettext("Wizards"), false, "wizard.php?xml=openvpn_wizard.xml");
446
				add_package_tabs("OpenVPN", $tab_array);
447
				display_top_tabs($tab_array);
448
			?>
449
		</td>
450
	</tr>
451
	<tr>
452
		<td class="tabcont">
453

    
454
			<?php if($act=="new" || $act=="edit"): ?>
455

    
456
			<form action="vpn_openvpn_client.php" method="post" name="iform" id="iform" onsubmit="presubmit()">
457
				<table width="100%" border="0" cellpadding="6" cellspacing="0" summary="general information">
458
					<tr>
459
						<td colspan="2" valign="top" class="listtopic"><?=gettext("General information"); ?></td>
460
					</tr>
461
					<tr>
462
						<td width="22%" valign="top" class="vncellreq"><?=gettext("Disabled"); ?></td>
463
						<td width="78%" class="vtable">
464
							<table border="0" cellpadding="0" cellspacing="0" summary="enable disable client">
465
								<tr>
466
									<td>
467
										<?php set_checked($pconfig['disable'],$chk); ?>
468
										<input name="disable" type="checkbox" value="yes" <?=$chk;?> />
469
									</td>
470
									<td>
471
										&nbsp;
472
										<span class="vexpl">
473
											<strong><?=gettext("Disable this client"); ?></strong><br />
474
										</span>
475
									</td>
476
								</tr>
477
							</table>
478
							<?=gettext("Set this option to disable this client without removing it from the list"); ?>.
479
						</td>
480
					</tr>
481
					<tr>
482
						<td width="22%" valign="top" class="vncellreq"><?=gettext("Server Mode");?></td>
483
						<td width="78%" class="vtable">
484
							<select name="mode" id="mode" class="formselect" onchange="mode_change()">
485
							<?php
486
								foreach ($openvpn_client_modes as $name => $desc):
487
									$selected = "";
488
									if ($pconfig['mode'] == $name)
489
										$selected = "selected=\"selected\"";
490
							?>
491
								<option value="<?=$name;?>" <?=$selected;?>><?=$desc;?></option>
492
							<?php endforeach; ?>
493
							</select>
494
						</td>
495
					</tr>
496
					<tr>
497
						<td width="22%" valign="top" class="vncellreq"><?=gettext("Protocol");?></td>
498
							<td width="78%" class="vtable">
499
							<select name='protocol' class="formselect">
500
							<?php
501
								foreach ($openvpn_prots as $prot):
502
									$selected = "";
503
									if ($pconfig['protocol'] == $prot)
504
										$selected = "selected=\"selected\"";
505
							?>
506
								<option value="<?=$prot;?>" <?=$selected;?>><?=$prot;?></option>
507
							<?php endforeach; ?>
508
							</select>
509
							</td>
510
					</tr>
511
					<tr>
512
						<td width="22%" valign="top" class="vncellreq"><?=gettext("Device mode");?></td>
513
							<td width="78%" class="vtable">
514
							<select name='dev_mode' class="formselect" onchange="dev_mode_change()">
515
							<?php
516
								foreach ($openvpn_dev_mode as $mode):
517
									$selected = "";
518
									if ($pconfig['dev_mode'] == $mode)
519
										$selected = "selected=\"selected\"";
520
							?>
521
								<option value="<?=$mode;?>" <?=$selected;?>><?=$mode;?></option>
522
							<?php endforeach; ?>
523
							</select>
524
							</td>
525
					</tr>
526
					<tr>
527
						<td width="22%" valign="top" class="vncellreq"><?=gettext("Interface"); ?></td>
528
						<td width="78%" class="vtable">
529
							<select name="interface" class="formselect">
530
								<?php
531
									$interfaces = get_configured_interface_with_descr();
532
									$carplist = get_configured_carp_interface_list();
533
									foreach ($carplist as $cif => $carpip)
534
										$interfaces[$cif.'|'.$carpip] = $carpip." (".get_vip_descr($carpip).")";
535
									$aliaslist = get_configured_ip_aliases_list();
536
									foreach ($aliaslist as $aliasip => $aliasif)
537
										$interfaces[$aliasif.'|'.$aliasip] = $aliasip." (".get_vip_descr($aliasip).")";
538
									$grouplist = return_gateway_groups_array();
539
									foreach ($grouplist as $name => $group) {
540
										if($group['ipprotocol'] != inet)
541
											continue;
542
										if($group[0]['vip'] <> "")
543
											$vipif = $group[0]['vip'];
544
										else
545
											$vipif = $group[0]['int'];
546
										$interfaces[$name] = "GW Group {$name}";
547
									}
548
									$interfaces['lo0'] = "Localhost";
549
									$interfaces['any'] = "any";
550
									foreach ($interfaces as $iface => $ifacename):
551
										$selected = "";
552
										if ($iface == $pconfig['interface'])
553
											$selected = "selected=\"selected\"";
554
								?>
555
									<option value="<?=$iface;?>" <?=$selected;?>>
556
										<?=htmlspecialchars($ifacename);?>
557
									</option>
558
								<?php endforeach; ?>
559
							</select> <br />
560
						</td>
561
					</tr>
562
					<tr>
563
						<td width="22%" valign="top" class="vncell"><?=gettext("Local port");?></td>
564
						<td width="78%" class="vtable">
565
							<input name="local_port" type="text" class="formfld unknown" size="5" value="<?=htmlspecialchars($pconfig['local_port']);?>" />
566
							<br />
567
							<?=gettext("Set this option if you would like to bind to a specific port. Leave this blank or enter 0 for a random dynamic port."); ?>
568
						</td>
569
					</tr>
570
					<tr>
571
						<td width="22%" valign="top" class="vncellreq"><?=gettext("Server host or address");?></td>
572
						<td width="78%" class="vtable">
573
							<input name="server_addr" type="text" class="formfld unknown" size="30" value="<?=htmlspecialchars($pconfig['server_addr']);?>" />
574
						</td>
575
					</tr>
576
					<tr>
577
						<td width="22%" valign="top" class="vncellreq"><?=gettext("Server port");?></td>
578
						<td width="78%" class="vtable">
579
							<input name="server_port" type="text" class="formfld unknown" size="5" value="<?=htmlspecialchars($pconfig['server_port']);?>" />
580
						</td>
581
					</tr>
582
					<tr>
583
						<td width="22%" valign="top" class="vncell"><?=gettext("Proxy host or address");?></td>
584
						<td width="78%" class="vtable">
585
							<input name="proxy_addr" type="text" class="formfld unknown" size="30" value="<?=htmlspecialchars($pconfig['proxy_addr']);?>" />
586
						</td>
587
					</tr>
588
					<tr>
589
						<td width="22%" valign="top" class="vncell"><?=gettext("Proxy port");?></td>
590
						<td width="78%" class="vtable">
591
							<input name="proxy_port" type="text" class="formfld unknown" size="5" value="<?=htmlspecialchars($pconfig['proxy_port']);?>" />
592
						</td>
593
					</tr>
594
					<tr>
595
						<td width="22%" valign="top" class="vncell"><?=gettext("Proxy authentication extra options");?></td>
596
						<td width="78%" class="vtable">
597
							<table border="0" cellpadding="2" cellspacing="0" summary="proxy authentication">
598
								<tr>
599
									<td align="right" width="25%">
600
										<span class="vexpl">
601
											 &nbsp;<?=gettext("Authentication method"); ?> :&nbsp;
602
										</span>
603
									</td>
604
									<td>
605
										<select name="proxy_authtype" id="proxy_authtype" class="formfld select" onchange="useproxy_changed()">
606
											<option value="none" <?php if ($pconfig['proxy_authtype'] == "none") echo "selected=\"selected\""; ?>><?=gettext("none"); ?></option>
607
											<option value="basic" <?php if ($pconfig['proxy_authtype'] == "basic") echo "selected=\"selected\""; ?>><?=gettext("basic"); ?></option>
608
											<option value="ntlm" <?php if ($pconfig['proxy_authtype'] == "ntlm") echo "selected=\"selected\""; ?>><?=gettext("ntlm"); ?></option>
609
										</select>
610
									</td>
611
								</tr>
612
							</table>
613
							<br />
614
							 <table border="0" cellpadding="2" cellspacing="0" id="proxy_authtype_opts" style="display:none" summary="proxy authentication options">
615
								<tr>
616
									<td align="right" width="25%">
617
										<span class="vexpl">
618
											 &nbsp;<?=gettext("Username"); ?> :&nbsp;
619
										</span>
620
									</td>
621
									<td>
622
										<input name="proxy_user" id="proxy_user" class="formfld unknown" size="20" value="<?=htmlspecialchars($pconfig['proxy_user']);?>" />
623
									</td>
624
								</tr>
625
								<tr>
626
									<td align="right" width="25%">
627
										<span class="vexpl">
628
											 &nbsp;<?=gettext("Password"); ?> :&nbsp;
629
										</span>
630
									</td>
631
									<td>
632
										<input name="proxy_passwd" id="proxy_passwd" type="password" class="formfld pwd" size="20" value="<?=htmlspecialchars($pconfig['proxy_passwd']);?>" />
633
									</td>
634
								</tr>
635
							</table>
636
						</td>
637
					</tr>
638
					<tr>
639
						<td width="22%" valign="top" class="vncell"><?=gettext("Server host name resolution"); ?></td>
640
						<td width="78%" class="vtable">
641
							<table border="0" cellpadding="2" cellspacing="0" summary="server host name resolution">
642
								<tr>
643
									<td>
644
										<?php set_checked($pconfig['resolve_retry'],$chk); ?>
645
										<input name="resolve_retry" type="checkbox" value="yes" <?=$chk;?> />
646
									</td>
647
									<td>
648
										<span class="vexpl">
649
											<?=gettext("Infinitely resolve server"); ?>
650
										</span>
651
									</td>
652
								</tr>
653
							</table>
654
							<?=gettext("Continuously attempt to resolve the server host " .
655
							"name. Useful when communicating with a server " .
656
							"that is not permanently connected to the Internet"); ?>.
657
						</td>
658
					</tr>
659
					<tr>
660
						<td width="22%" valign="top" class="vncell"><?=gettext("Description"); ?></td>
661
						<td width="78%" class="vtable">
662
							<input name="description" type="text" class="formfld unknown" size="30" value="<?=htmlspecialchars($pconfig['description']);?>" />
663
							<br />
664
							<?=gettext("You may enter a description here for your reference (not parsed)"); ?>.
665
						</td>
666
					</tr>
667
					<tr>
668
						<td colspan="2" class="list" height="12"></td>
669
					</tr>
670
					<tr>
671
						<td colspan="2" valign="top" class="listtopic"><?=gettext("User Authentication Settings"); ?></td>
672
					</tr>
673
					<tr>
674
						<td width="22%" valign="top" class="vncell"><?=gettext("User name/pass"); ?></td>
675
						<td width="78%" class="vtable">
676
							<?=gettext("Leave empty when no user name and password are needed."); ?>
677
							<br/>
678
							<table border="0" cellpadding="2" cellspacing="0" summary="user name password">
679
								<tr>
680
									<td align="right" width="25%">
681
									<span class="vexpl">
682
									&nbsp;<?=gettext("Username"); ?> :&nbsp;
683
									</span>
684
									</td>
685
									<td>
686
									<input name="auth_user" id="auth_user" class="formfld unknown" size="20" value="<?=htmlspecialchars($pconfig['auth_user']);?>" />
687
									</td>
688
								</tr>
689
								<tr>
690
									<td align="right" width="25%">
691
									<span class="vexpl">
692
									&nbsp;<?=gettext("Password"); ?> :&nbsp;
693
									</span>
694
									</td>
695
									<td>
696
									<input name="auth_pass" id="auth_pass" type="password" class="formfld pwd" size="20" value="<?=htmlspecialchars($pconfig['auth_pass']);?>" />
697
									</td>
698
								</tr>
699
							</table>
700
						</td>
701
					</tr>
702
					<tr>
703
						<td colspan="2" valign="top" class="listtopic"><?=gettext("Cryptographic Settings"); ?></td>
704
					</tr>
705
					<tr id="tls">
706
						<td width="22%" valign="top" class="vncellreq"><?=gettext("TLS Authentication"); ?></td>
707
						<td width="78%" class="vtable">
708
							<table border="0" cellpadding="2" cellspacing="0" summary="tls authentication">
709
								<tr>
710
									<td>
711
										<?php set_checked($pconfig['tlsauth_enable'],$chk); ?>
712
										<input name="tlsauth_enable" id="tlsauth_enable" type="checkbox" value="yes" <?=$chk;?> onclick="tlsauth_change()" />
713
									</td>
714
									<td>
715
										<span class="vexpl">
716
											<?=gettext("Enable authentication of TLS packets"); ?>.
717
										</span>
718
									</td>
719
								</tr>
720
							</table>
721
							<?php if (!$pconfig['tls']): ?>
722
							<table border="0" cellpadding="2" cellspacing="0" id="tlsauth_opts" summary="tls authentication options">
723
								<tr>
724
									<td>
725
										<?php set_checked($pconfig['autotls_enable'],$chk); ?>
726
										<input name="autotls_enable" id="autotls_enable" type="checkbox" value="yes" <?=$chk;?> onclick="autotls_change()" />
727
									</td>
728
									<td>
729
										<span class="vexpl">
730
											<?=gettext("Automatically generate a shared TLS authentication key"); ?>.
731
										</span>
732
									</td>
733
								</tr>
734
							</table>
735
							<?php endif; ?>
736
							<table border="0" cellpadding="2" cellspacing="0" id="autotls_opts" summary="tls authentication options">
737
								<tr>
738
									<td>
739
										<textarea name="tls" cols="65" rows="7" class="formpre"><?=htmlspecialchars($pconfig['tls']);?></textarea>
740
										<br />
741
										<?=gettext("Paste your shared key here"); ?>.
742
									</td>
743
								</tr>
744
							</table>
745
						</td>
746
					</tr>
747
					<tr id="tls_ca">
748
						<td width="22%" valign="top" class="vncellreq"><?=gettext("Peer Certificate Authority"); ?></td>
749
							<td width="78%" class="vtable">
750
							<?php if (count($a_ca)): ?>
751
							<select name='caref' class="formselect">
752
							<?php
753
								foreach ($a_ca as $ca):
754
									$selected = "";
755
									if ($pconfig['caref'] == $ca['refid'])
756
										$selected = "selected=\"selected\"";
757
							?>
758
								<option value="<?=$ca['refid'];?>" <?=$selected;?>><?=$ca['descr'];?></option>
759
							<?php endforeach; ?>
760
							</select>
761
							<?php else: ?>
762
								<b>No Certificate Authorities defined.</b> <br />Create one under <a href="system_camanager.php">System &gt; Cert Manager</a>.
763
							<?php endif; ?>
764
							</td>
765
					</tr>
766
					<tr id="tls_cert">
767
						<td width="22%" valign="top" class="vncellreq"><?=gettext("Client Certificate"); ?></td>
768
							<td width="78%" class="vtable">
769
							<select name='certref' class="formselect">
770
							<?php
771
							foreach ($a_cert as $cert):
772
								$selected = "";
773
								$caname = "";
774
								$inuse = "";
775
								$revoked = "";
776
								$ca = lookup_ca($cert['caref']);
777
								if ($ca)
778
									$caname = " (CA: {$ca['descr']})";
779
								if ($pconfig['certref'] == $cert['refid'])
780
									$selected = "selected=\"selected\"";
781
								if (cert_in_use($cert['refid']))
782
									$inuse = " *In Use";
783
								if (is_cert_revoked($cert))
784
									$revoked = " *Revoked";
785
							?>
786
								<option value="<?=$cert['refid'];?>" <?=$selected;?>><?=$cert['descr'] . $caname . $inuse . $revoked;?></option>
787
							<?php endforeach; ?>
788
								<option value="" <?PHP if (empty($pconfig['certref'])) echo "selected=\"selected\""; ?>>None (Username and Password required)</option>
789
							</select>
790
							<?php if (!count($a_cert)): ?>
791
								<b>No Certificates defined.</b> <br />Create one under <a href="system_certmanager.php">System &gt; Cert Manager</a> if one is required for this connection.
792
							<?php endif; ?>
793
						</td>
794
					</tr>
795
					<tr id="psk">
796
						<td width="22%" valign="top" class="vncellreq"><?=gettext("Shared Key"); ?></td>
797
						<td width="78%" class="vtable">
798
							<?php if (!$pconfig['shared_key']): ?>
799
							<table border="0" cellpadding="2" cellspacing="0" summary="shared key">
800
								<tr>
801
									<td>
802
										<?php set_checked($pconfig['autokey_enable'],$chk); ?>
803
										<input name="autokey_enable" type="checkbox" value="yes" <?=$chk;?> onclick="autokey_change()" />
804
									</td>
805
									<td>
806
										<span class="vexpl">
807
											<?=gettext("Automatically generate a shared key"); ?>.
808
										</span>
809
									</td>
810
								</tr>
811
							</table>
812
							<?php endif; ?>
813
							<table border="0" cellpadding="2" cellspacing="0" id="autokey_opts" summary="shared key options">
814
								<tr>
815
									<td>
816
										<textarea name="shared_key" cols="65" rows="7" class="formpre"><?=htmlspecialchars($pconfig['shared_key']);?></textarea>
817
										<br />
818
										<?=gettext("Paste your shared key here"); ?>.
819
									</td>
820
								</tr>
821
							</table>
822
						</td>
823
					</tr>
824
					<tr>
825
						<td width="22%" valign="top" class="vncellreq"><?=gettext("Encryption algorithm"); ?></td>
826
						<td width="78%" class="vtable">
827
							<select name="crypto" class="formselect">
828
								<?php
829
									$cipherlist = openvpn_get_cipherlist();
830
									foreach ($cipherlist as $name => $desc):
831
									$selected = "";
832
									if ($name == $pconfig['crypto'])
833
										$selected = " selected=\"selected\"";
834
								?>
835
								<option value="<?=$name;?>"<?=$selected?>>
836
									<?=htmlspecialchars($desc);?>
837
								</option>
838
								<?php endforeach; ?>
839
							</select>
840
						</td>
841
					</tr>
842
					<tr>
843
						<td width="22%" valign="top" class="vncellreq"><?=gettext("Auth Digest Algorithm"); ?></td>
844
						<td width="78%" class="vtable">
845
							<select name="digest" class="formselect">
846
								<?php
847
									$digestlist = openvpn_get_digestlist();
848
									foreach ($digestlist as $name => $desc):
849
									$selected = "";
850
									if ($name == $pconfig['digest'])
851
										$selected = " selected=\"selected\"";
852
								?>
853
								<option value="<?=$name;?>"<?=$selected?>>
854
									<?=htmlspecialchars($desc);?>
855
								</option>
856
								<?php endforeach; ?>
857
							</select>
858
						</td>
859
					</tr>
860
					<tr id="engine">
861
						<td width="22%" valign="top" class="vncellreq"><?=gettext("Hardware Crypto"); ?></td>
862
						<td width="78%" class="vtable">
863
							<select name="engine" class="formselect">
864
								<?php
865
									$engines = openvpn_get_engines();
866
									foreach ($engines as $name => $desc):
867
									$selected = "";
868
									if ($name == $pconfig['engine'])
869
										$selected = " selected=\"selected\"";
870
								?>
871
								<option value="<?=$name;?>"<?=$selected?>>
872
									<?=htmlspecialchars($desc);?>
873
								</option>
874
								<?php endforeach; ?>
875
							</select>
876
						</td>
877
					</tr>
878
					<tr>
879
						<td colspan="2" class="list" height="12"></td>
880
					</tr>
881
					<tr>
882
						<td colspan="2" valign="top" class="listtopic"><?=gettext("Tunnel Settings"); ?></td>
883
					</tr>
884
					<tr>
885
						<td width="22%" valign="top" class="vncell"><?=gettext("IPv4 Tunnel Network"); ?></td>
886
						<td width="78%" class="vtable">
887
							<input name="tunnel_network" type="text" class="formfld unknown" size="20" value="<?=htmlspecialchars($pconfig['tunnel_network']);?>" />
888
							<br />
889
							<?=gettext("This is the virtual network used for private " .
890
							"communications between this client and the " .
891
							"server expressed using CIDR (eg. 10.0.8.0/24). " .
892
							"The first network address is assumed to be the " .
893
							"server address and the second network address " .
894
							"will be assigned to the client virtual " .
895
							"interface"); ?>.
896
						</td>
897
					</tr>
898
					<tr>
899
						<td width="22%" valign="top" class="vncell"><?=gettext("IPv6 Tunnel Network"); ?></td>
900
						<td width="78%" class="vtable">
901
							<input name="tunnel_networkv6" type="text" class="formfld unknown" size="20" value="<?=htmlspecialchars($pconfig['tunnel_networkv6']);?>" />
902
							<br />
903
							<?=gettext("This is the IPv6 virtual network used for private " .
904
							"communications between this client and the " .
905
							"server expressed using CIDR (eg. fe80::/64). " .
906
							"The first network address is assumed to be the " .
907
							"server address and the second network address " .
908
							"will be assigned to the client virtual " .
909
							"interface"); ?>.
910
						</td>
911
					</tr>
912
					<tr>
913
						<td width="22%" valign="top" class="vncell"><?=gettext("IPv4 Remote Network/s"); ?></td>
914
						<td width="78%" class="vtable">
915
							<input name="remote_network" type="text" class="formfld unknown" size="40" value="<?=htmlspecialchars($pconfig['remote_network']);?>" />
916
							<br />
917
							<?=gettext("These are the IPv4 networks that will be routed through " .
918
							"the tunnel, so that a site-to-site VPN can be " .
919
							"established without manually changing the routing tables. " .
920
							"Expressed as a comma-separated list of one or more CIDR ranges. " .
921
							"If this is a site-to-site VPN, enter the " .
922
							"remote LAN/s here. You may leave this blank to " .
923
							"only communicate with other clients"); ?>.
924
						</td>
925
					</tr>
926
					<tr>
927
						<td width="22%" valign="top" class="vncell"><?=gettext("IPv6 Remote Network/s"); ?></td>
928
						<td width="78%" class="vtable">
929
							<input name="remote_networkv6" type="text" class="formfld unknown" size="40" value="<?=htmlspecialchars($pconfig['remote_networkv6']);?>" />
930
							<br />
931
							<?=gettext("These are the IPv6 networks that will be routed through " .
932
							"the tunnel, so that a site-to-site VPN can be " .
933
							"established without manually changing the routing tables. " .
934
							"Expressed as a comma-separated list of one or more IP/PREFIX. " .
935
							"If this is a site-to-site VPN, enter the " .
936
							"remote LAN/s here. You may leave this blank to " .
937
							"only communicate with other clients"); ?>.
938
						</td>
939
					</tr>
940
					<tr>
941
						<td width="22%" valign="top" class="vncell"><?=gettext("Limit outgoing bandwidth");?></td>
942
						<td width="78%" class="vtable">
943
							<input name="use_shaper" type="text" class="formfld unknown" size="5" value="<?=htmlspecialchars($pconfig['use_shaper']);?>" />
944
							<br />
945
							<?=gettext("Maximum outgoing bandwidth for this tunnel. " .
946
							"Leave empty for no limit. The input value has " .
947
							"to be something between 100 bytes/sec and 100 " .
948
							"Mbytes/sec (entered as bytes per second)"); ?>.
949
						</td>
950
					</tr>
951
					<tr>
952
						<td width="22%" valign="top" class="vncell"><?=gettext("Compression"); ?></td>
953
						<td width="78%" class="vtable">
954
							<select name="compression" class="formselect">
955
								<?php
956
									foreach ($openvpn_compression_modes as $cmode => $cmodedesc):
957
									$selected = "";
958
									if ($cmode == $pconfig['compression'])
959
										$selected = " selected=\"selected\"";
960
								?>
961
								<option value="<?= $cmode ?>" <?= $selected ?>><?= $cmodedesc ?></option>
962
								<?php endforeach; ?>
963
							</select>
964
							<br />
965
							<?=gettext("Compress tunnel packets using the LZO algorithm. Adaptive compression will dynamically disable compression for a period of time if OpenVPN detects that the data in the packets is not being compressed efficiently."); ?>.
966
						</td>
967
					</tr>
968
					<tr>
969
						<td width="22%" valign="top" class="vncell"><?=gettext("Type-of-Service"); ?></td>
970
						<td width="78%" class="vtable">
971
							<table border="0" cellpadding="2" cellspacing="0" summary="type-of-service">
972
								<tr>
973
									<td>
974
										<?php set_checked($pconfig['passtos'],$chk); ?>
975
										<input name="passtos" type="checkbox" value="yes" <?=$chk;?> />
976
									</td>
977
									<td>
978
										<span class="vexpl">
979
											<?=gettext("Set the TOS IP header value of tunnel packets to match the encapsulated packet value"); ?>.
980
										</span>
981
									</td>
982
								</tr>
983
							</table>
984
						</td>
985
					</tr>
986

    
987

    
988
					<tr id="chkboxNoTunIPv6">
989
						<td width="22%" valign="top" class="vncell"><?=gettext("Disable IPv6"); ?></td>
990
						<td width="78%" class="vtable">
991
							<table border="0" cellpadding="2" cellspacing="0" summary="disable-ipv6">
992
								<tr>
993
									<td>
994
										<?php set_checked($pconfig['no_tun_ipv6'],$chk); ?>
995
										<input name="no_tun_ipv6" type="checkbox" value="yes" <?=$chk;?> />
996
									</td>
997
									<td>
998
										<span class="vexpl">
999
											<?=gettext("Do not forward IPv6 traffic"); ?>.
1000
										</span>
1001
									</td>
1002
								</tr>
1003
							</table>
1004
						</td>
1005
					</tr>
1006

    
1007
					<tr id="chkboxRouteNoPull">
1008
						<td width="22%" valign="top" class="vncell"><?=gettext("Dont pull routes"); ?></td>
1009
						<td width="78%" class="vtable">
1010
							<table border="0" cellpadding="2" cellspacing="0" summary="dont-pull-routes">
1011
								<tr>
1012
									<td>
1013
										<?php set_checked($pconfig['route_no_pull'],$chk); ?>
1014
										<input name="route_no_pull" type="checkbox" value="yes" <?=$chk;?> />
1015
									</td>
1016
									<td>
1017
										<span class="vexpl">
1018
											<?=gettext("Don't add or remove routes automatically. Instead pass routes to "); ?> <strong>--route-up</strong> <?=gettext("script using environmental variables"); ?>.
1019
										</span>
1020
									</td>
1021
								</tr>
1022
							</table>
1023
						</td>
1024
					</tr>
1025

    
1026
					<tr id="chkboxRouteNoExec">
1027
						<td width="22%" valign="top" class="vncell"><?=gettext("Dont add/remove routes"); ?></td>
1028
						<td width="78%" class="vtable">
1029
							<table border="0" cellpadding="2" cellspacing="0" summary="dont-exec-routes">
1030
								<tr>
1031
									<td>
1032
										<?php set_checked($pconfig['route_no_exec'],$chk); ?>
1033
										<input name="route_no_exec" type="checkbox" value="yes" <?=$chk;?> />
1034
									</td>
1035
									<td>
1036
										<span class="vexpl">
1037
											<?=gettext("This option effectively bars the server from adding routes to the client's routing table, however note that this option still allows the server to set the TCP/IP properties of the client's TUN/TAP interface"); ?>.
1038
										</span>
1039
									</td>
1040
								</tr>
1041
							</table>
1042
						</td>
1043
					</tr>
1044
				</table>
1045

    
1046
				<table width="100%" border="0" cellpadding="6" cellspacing="0" id="client_opts" summary="advance configuration">
1047
					<tr>
1048
						<td colspan="2" class="list" height="12"></td>
1049
					</tr>
1050
					<tr>
1051
						<td colspan="2" valign="top" class="listtopic"><?=gettext("Advanced configuration"); ?></td>
1052
					</tr>
1053
					<tr>
1054
						<td width="22%" valign="top" class="vncell"><?=gettext("Advanced"); ?></td>
1055
						<td width="78%" class="vtable">
1056
							<table border="0" cellpadding="2" cellspacing="0" summary="advance configuration">
1057
								<tr>
1058
									<td>
1059
										<textarea rows="6" cols="78" name="custom_options" id="custom_options"><?=htmlspecialchars($pconfig['custom_options']);?></textarea><br />
1060
										<?=gettext("Enter any additional options you would like to add to the OpenVPN client configuration here, separated by a semicolon"); ?><br />
1061
										<?=gettext("EXAMPLE:"); ?> <strong>remote server.mysite.com 1194;</strong> or <strong>remote 1.2.3.4 1194;</strong>
1062
									</td>
1063
								</tr>
1064
							</table>
1065
						</td>
1066
					</tr>
1067

    
1068
					<tr id="comboboxVerbosityLevel">
1069
							<td width="22%" valign="top" class="vncell"><?=gettext("Verbosity level");?></td>
1070
							<td width="78%" class="vtable">
1071
							<select name="verbosity_level" class="formselect">
1072
							<?php
1073
								foreach ($openvpn_verbosity_level as $verb_value => $verb_desc):
1074
									$selected = "";
1075
									if ($pconfig['verbosity_level'] == $verb_value)
1076
										$selected = "selected=\"selected\"";
1077
							?>
1078
								<option value="<?=$verb_value;?>" <?=$selected;?>><?=$verb_desc;?></option>
1079
							<?php endforeach; ?>
1080
							</select>
1081
							<br />
1082
							<?=gettext("Each level shows all info from the previous levels. Level 3 is recommended if you want a good summary of what's happening without being swamped by output"); ?>.<br /> <br />
1083
							<strong>none</strong> -- <?=gettext("No output except fatal errors"); ?>. <br />
1084
							<strong>default</strong>-<strong>4</strong> -- <?=gettext("Normal usage range"); ?>. <br />
1085
							<strong>5</strong> -- <?=gettext("Output R and W characters to the console for each packet read and write, uppercase is used for TCP/UDP packets and lowercase is used for TUN/TAP packets"); ?>. <br />
1086
							<strong>6</strong>-<strong>11</strong> -- <?=gettext("Debug info range"); ?>.
1087
							</td>
1088
					</tr>
1089

    
1090
				</table>
1091

    
1092
				<br />
1093
				<table width="100%" border="0" cellpadding="6" cellspacing="0" summary="icons">
1094
					<tr>
1095
						<td width="22%" valign="top">&nbsp;</td>
1096
						<td width="78%">
1097
							<input name="save" type="submit" class="formbtn" value="<?=gettext("Save"); ?>" />
1098
							<input name="act" type="hidden" value="<?=$act;?>" />
1099
							<?php if (isset($id) && $a_client[$id]): ?>
1100
							<input name="id" type="hidden" value="<?=htmlspecialchars($id);?>" />
1101
							<?php endif; ?>
1102
						</td>
1103
					</tr>
1104
				</table>
1105
			</form>
1106

    
1107
			<?php else: ?>
1108

    
1109
			<table class="sortable" width="100%" border="0" cellpadding="0" cellspacing="0" summary="list of openvpn clients">
1110
				<thead>
1111
				<tr>
1112
					<td width="10%" class="listhdrr"><?=gettext("Disabled"); ?></td>
1113
					<td width="10%" class="listhdrr"><?=gettext("Protocol"); ?></td>
1114
					<td width="30%" class="listhdrr"><?=gettext("Server"); ?></td>
1115
					<td width="40%" class="listhdrr"><?=gettext("Description"); ?></td>
1116
					<td width="10%" class="list"></td>
1117
				</tr>
1118
				</thead>
1119
				<tfoot>
1120
				<tr>
1121
					<td class="list" colspan="4"></td>
1122
					<td class="list">
1123
						<a href="vpn_openvpn_client.php?act=new"><img src="./themes/<?=$g['theme'];?>/images/icons/icon_plus.gif" title="<?=gettext("add client"); ?>" width="17" height="17" border="0" alt="add" />
1124
						</a>
1125
					</td>
1126
				</tr>
1127
				<tr>
1128
					<td colspan="4">
1129
						<p>
1130
							<?=gettext("Additional OpenVPN clients can be added here.");?>
1131
						</p>
1132
					</td>
1133
				</tr>
1134
				</tfoot>
1135
				<tbody>
1136
				<?php
1137
					$i = 0;
1138
					foreach($a_client as $client):
1139
						$disabled = "NO";
1140
						if (isset($client['disable']))
1141
							$disabled = "YES";
1142
						$server = "{$client['server_addr']}:{$client['server_port']}";
1143
				?>
1144
				<tr ondblclick="document.location='vpn_openvpn_client.php?act=edit&amp;id=<?=$i;?>'">
1145
					<td class="listlr">
1146
						<?=$disabled;?>
1147
					</td>
1148
					<td class="listr">
1149
						<?=htmlspecialchars($client['protocol']);?>
1150
					</td>
1151
					<td class="listr">
1152
						<?=htmlspecialchars($server);?>
1153
					</td>
1154
					<td class="listbg">
1155
						<?=htmlspecialchars($client['description']);?>
1156
					</td>
1157
					<td valign="middle" class="list nowrap">
1158
						<a href="vpn_openvpn_client.php?act=edit&amp;id=<?=$i;?>">
1159
							<img src="./themes/<?=$g['theme'];?>/images/icons/icon_e.gif" title="<?=gettext("edit client"); ?>" width="17" height="17" border="0" alt="edit" />
1160
						</a>
1161
						&nbsp;
1162
						<a href="vpn_openvpn_client.php?act=del&amp;id=<?=$i;?>" onclick="return confirm('<?=gettext("Do you really want to delete this client?"); ?>')">
1163
							<img src="/themes/<?=$g['theme'];?>/images/icons/icon_x.gif" title="<?=gettext("delete client"); ?>" width="17" height="17" border="0" alt="delete" />
1164
						</a>
1165
					</td>
1166
				</tr>
1167
				<?php
1168
					$i++;
1169
					endforeach;
1170
				?>
1171
				<tr style="dispaly:none;"><td></td></tr>
1172
				</tbody>
1173
			</table>
1174

    
1175
			<?php endif; ?>
1176

    
1177
		</td>
1178
	</tr>
1179
</table>
1180
<script type="text/javascript">
1181
//<![CDATA[
1182
mode_change();
1183
autokey_change();
1184
tlsauth_change();
1185
useproxy_changed();
1186
//]]>
1187
</script>
1188
<?php include("fend.inc"); ?>
1189
</body>
1190
</html>
1191

    
1192
<?php
1193

    
1194
/* local utility functions */
1195

    
1196
function set_checked($var,& $chk) {
1197
	if($var)
1198
		$chk = "checked=\"checked\"";
1199
	else
1200
		$chk = "";
1201
}
1202

    
1203
?>
(246-246/255)