Projet

Général

Profil

Télécharger (42,9 ko) Statistiques
| Branche: | Tag: | Révision:

univnautes / usr / local / www / vpn_openvpn_client.php @ 2da48592

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
	// OpenVPN Defaults to SHA1
97
	$pconfig['digest'] = "SHA1";
98
}
99

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

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

    
105
	if (isset($id) && $a_client[$id]) {
106
		foreach($simplefields as $stat)
107
			$pconfig[$stat] = $a_client[$id][$stat];
108
	
109
		$pconfig['disable'] = isset($a_client[$id]['disable']);
110
		$pconfig['mode'] = $a_client[$id]['mode'];
111
		$pconfig['protocol'] = $a_client[$id]['protocol'];
112
		$pconfig['interface'] = $a_client[$id]['interface'];
113
		if (!empty($a_client[$id]['ipaddr'])) {
114
			$pconfig['interface'] = $pconfig['interface'] . '|' . $a_client[$id]['ipaddr'];
115
		}
116
		$pconfig['local_port'] = $a_client[$id]['local_port'];
117
		$pconfig['server_addr'] = $a_client[$id]['server_addr'];
118
		$pconfig['server_port'] = $a_client[$id]['server_port'];
119
		$pconfig['resolve_retry'] = $a_client[$id]['resolve_retry'];
120
		$pconfig['proxy_addr'] = $a_client[$id]['proxy_addr'];
121
		$pconfig['proxy_port'] = $a_client[$id]['proxy_port'];
122
		$pconfig['proxy_user'] = $a_client[$id]['proxy_user'];
123
		$pconfig['proxy_passwd'] = $a_client[$id]['proxy_passwd'];
124
		$pconfig['proxy_authtype'] = $a_client[$id]['proxy_authtype'];
125
		$pconfig['description'] = $a_client[$id]['description'];
126
		$pconfig['custom_options'] = $a_client[$id]['custom_options'];
127
		$pconfig['ns_cert_type'] = $a_client[$id]['ns_cert_type'];
128
		$pconfig['dev_mode'] = $a_client[$id]['dev_mode'];
129
	
130
		if ($pconfig['mode'] != "p2p_shared_key") {
131
			$pconfig['caref'] = $a_client[$id]['caref'];
132
			$pconfig['certref'] = $a_client[$id]['certref'];
133
			if ($a_client[$id]['tls']) {
134
				$pconfig['tlsauth_enable'] = "yes";
135
				$pconfig['tls'] = base64_decode($a_client[$id]['tls']);
136
			}
137
		} else
138
			$pconfig['shared_key'] = base64_decode($a_client[$id]['shared_key']);
139
		$pconfig['crypto'] = $a_client[$id]['crypto'];
140
		// OpenVPN Defaults to SHA1 if unset
141
		$pconfig['digest'] = !empty($a_client[$id]['digest']) ? $a_client[$id]['digest'] : "SHA1";
142
		$pconfig['engine'] = $a_client[$id]['engine'];
143

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

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

    
158
if ($_POST) {
159

    
160
	unset($input_errors);
161
	$pconfig = $_POST;
162

    
163
	if (isset($id) && $a_client[$id])
164
		$vpnid = $a_client[$id]['vpnid'];
165
	else
166
		$vpnid = 0;
167

    
168
	list($iv_iface, $iv_ip) = explode ("|",$pconfig['interface']);
169
	if (is_ipaddrv4($iv_ip) && (stristr($pconfig['protocol'], "6") !== false)) {
170
		$input_errors[] = gettext("Protocol and IP address families do not match. You cannot select an IPv6 protocol and an IPv4 IP address.");
171
	} elseif (is_ipaddrv6($iv_ip) && (stristr($pconfig['protocol'], "6") === false)) {
172
		$input_errors[] = gettext("Protocol and IP address families do not match. You cannot select an IPv4 protocol and an IPv6 IP address.");
173
	} elseif ((stristr($pconfig['protocol'], "6") === false) && !get_interface_ip($iv_iface) && ($pconfig['interface'] != "any")) {
174
		$input_errors[] = gettext("An IPv4 protocol was selected, but the selected interface has no IPv4 address.");
175
	} elseif ((stristr($pconfig['protocol'], "6") !== false) && !get_interface_ipv6($iv_iface) && ($pconfig['interface'] != "any")) {
176
		$input_errors[] = gettext("An IPv6 protocol was selected, but the selected interface has no IPv6 address.");
177
	}
178

    
179
	if ($pconfig['mode'] != "p2p_shared_key")
180
		$tls_mode = true;
181
	else
182
		$tls_mode = false;
183

    
184
	/* input validation */
185
	if ($pconfig['local_port']) {
186

    
187
		if ($result = openvpn_validate_port($pconfig['local_port'], 'Local port'))
188
			$input_errors[] = $result;
189

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

    
195
	if ($result = openvpn_validate_host($pconfig['server_addr'], 'Server host or address'))
196
		$input_errors[] = $result;
197

    
198
	if ($result = openvpn_validate_port($pconfig['server_port'], 'Server port'))
199
		$input_errors[] = $result;
200

    
201
	if ($pconfig['proxy_addr']) {
202

    
203
		if ($result = openvpn_validate_host($pconfig['proxy_addr'], 'Proxy host or address'))
204
			$input_errors[] = $result;
205

    
206
		if ($result = openvpn_validate_port($pconfig['proxy_port'], 'Proxy port'))
207
			$input_errors[] = $result;
208

    
209
		if ($pconfig['proxy_authtype'] != "none") {
210
			if (empty($pconfig['proxy_user']) || empty($pconfig['proxy_passwd']))
211
				$input_errors[] = gettext("User name and password are required for proxy with authentication.");
212
		}
213
	}
214

    
215
	if($pconfig['tunnel_network'])
216
		if ($result = openvpn_validate_cidr($pconfig['tunnel_network'], 'IPv4 Tunnel Network', false, "ipv4"))
217
			$input_errors[] = $result;
218

    
219
	if($pconfig['tunnel_networkv6'])
220
		if ($result = openvpn_validate_cidr($pconfig['tunnel_networkv6'], 'IPv6 Tunnel Network', false, "ipv6"))
221
			$input_errors[] = $result;
222

    
223
	if ($result = openvpn_validate_cidr($pconfig['remote_network'], 'IPv4 Remote Network', true, "ipv4"))
224
		$input_errors[] = $result;
225

    
226
	if ($result = openvpn_validate_cidr($pconfig['remote_networkv6'], 'IPv6 Remote Network', true, "ipv6"))
227
		$input_errors[] = $result;
228

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

    
232
    if ($pconfig['autokey_enable'])
233
        $pconfig['shared_key'] = openvpn_create_key();
234

    
235
	if (!$tls_mode && !$pconfig['autokey_enable'])
236
		if (!strstr($pconfig['shared_key'], "-----BEGIN OpenVPN Static key V1-----") ||
237
			!strstr($pconfig['shared_key'], "-----END OpenVPN Static key V1-----"))
238
			$input_errors[] = gettext("The field 'Shared Key' does not appear to be valid");
239

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

    
245
	/* If we are not in shared key mode, then we need the CA/Cert. */
246
	if ($pconfig['mode'] != "p2p_shared_key") {
247
		$reqdfields = explode(" ", "caref");
248
		$reqdfieldsn = array(gettext("Certificate Authority"));
249
	} elseif (!$pconfig['autokey_enable']) {
250
		/* We only need the shared key filled in if we are in shared key mode and autokey is not selected. */
251
		$reqdfields = array('shared_key');
252
		$reqdfieldsn = array(gettext('Shared key'));
253
	}
254

    
255
	do_input_validation($_POST, $reqdfields, $reqdfieldsn, $input_errors);
256

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

    
261
	if (!$input_errors) {
262

    
263
		$client = array();
264
		
265
		foreach($simplefields as $stat)
266
			update_if_changed($stat, $client[$stat], $_POST[$stat]);
267
			
268
		if ($vpnid)
269
			$client['vpnid'] = $vpnid;
270
		else
271
			$client['vpnid'] = openvpn_vpnid_next();
272

    
273
		if ($_POST['disable'] == "yes")
274
			$client['disable'] = true;
275
		$client['protocol'] = $pconfig['protocol'];
276
		$client['dev_mode'] = $pconfig['dev_mode'];
277
		list($client['interface'], $client['ipaddr']) = explode ("|",$pconfig['interface']);
278
		$client['local_port'] = $pconfig['local_port'];
279
		$client['server_addr'] = $pconfig['server_addr'];
280
		$client['server_port'] = $pconfig['server_port'];
281
		$client['resolve_retry'] = $pconfig['resolve_retry'];
282
		$client['proxy_addr'] = $pconfig['proxy_addr'];
283
		$client['proxy_port'] = $pconfig['proxy_port'];
284
		$client['proxy_authtype'] = $pconfig['proxy_authtype'];
285
		$client['proxy_user'] = $pconfig['proxy_user'];
286
		$client['proxy_passwd'] = $pconfig['proxy_passwd'];
287
		$client['description'] = $pconfig['description'];
288
		$client['mode'] = $pconfig['mode'];
289
		$client['custom_options'] = str_replace("\r\n", "\n", $pconfig['custom_options']);
290

    
291
        if ($tls_mode) {
292
            $client['caref'] = $pconfig['caref'];
293
            $client['certref'] = $pconfig['certref'];
294
            if ($pconfig['tlsauth_enable']) {
295
                if ($pconfig['autotls_enable'])
296
                    $pconfig['tls'] = openvpn_create_key();
297
                $client['tls'] = base64_encode($pconfig['tls']);
298
            }
299
        } else {
300
            $client['shared_key'] = base64_encode($pconfig['shared_key']);
301
        }
302
		$client['crypto'] = $pconfig['crypto'];
303
		$client['digest'] = $pconfig['digest'];
304
		$client['engine'] = $pconfig['engine'];
305

    
306
		$client['tunnel_network'] = $pconfig['tunnel_network'];
307
		$client['tunnel_networkv6'] = $pconfig['tunnel_networkv6'];
308
		$client['remote_network'] = $pconfig['remote_network'];
309
		$client['remote_networkv6'] = $pconfig['remote_networkv6'];
310
		$client['use_shaper'] = $pconfig['use_shaper'];
311
		$client['compression'] = $pconfig['compression'];
312
		$client['passtos'] = $pconfig['passtos'];
313

    
314
		if (isset($id) && $a_client[$id])
315
			$a_client[$id] = $client;
316
		else
317
			$a_client[] = $client;
318

    
319
		openvpn_resync('client', $client);
320
		write_config();
321
		
322
		header("Location: vpn_openvpn_client.php");
323
		exit;
324
	}
325
}
326

    
327
include("head.inc");
328

    
329
?>
330

    
331
<body link="#000000" vlink="#000000" alink="#000000" onload="<?= $jsevents["body"]["onload"] ?>">
332
<?php include("fbegin.inc"); ?>
333
<script type="text/javascript">
334
//<![CDATA[
335

    
336
function mode_change() {
337
	index = document.iform.mode.selectedIndex;
338
	value = document.iform.mode.options[index].value;
339
	switch(value) {
340
		case "p2p_tls":
341
			document.getElementById("tls").style.display="";
342
			document.getElementById("tls_ca").style.display="";
343
			document.getElementById("tls_cert").style.display="";
344
			document.getElementById("psk").style.display="none";
345
			break;
346
		case "p2p_shared_key":
347
			document.getElementById("tls").style.display="none";
348
			document.getElementById("tls_ca").style.display="none";
349
			document.getElementById("tls_cert").style.display="none";
350
			document.getElementById("psk").style.display="";
351
			break;
352
	}
353
}
354

    
355
function autokey_change() {
356
	if (document.iform.autokey_enable.checked)
357
		document.getElementById("autokey_opts").style.display="none";
358
	else
359
		document.getElementById("autokey_opts").style.display="";
360
}
361

    
362
function useproxy_changed() {
363

    
364
	if (jQuery('#proxy_authtype').val() != 'none') {
365
                jQuery('#proxy_authtype_opts').show();
366
        } else {
367
                jQuery('#proxy_authtype_opts').hide();
368
        }
369
}
370

    
371
function tlsauth_change() {
372

    
373
<?php if (!$pconfig['tls']): ?>
374
	if (document.iform.tlsauth_enable.checked)
375
		document.getElementById("tlsauth_opts").style.display="";
376
	else
377
		document.getElementById("tlsauth_opts").style.display="none";
378
<?php endif; ?>
379

    
380
	autotls_change();
381
}
382

    
383
function autotls_change() {
384

    
385
<?php if (!$pconfig['tls']): ?>
386
	autocheck = document.iform.autotls_enable.checked;
387
<?php else: ?>
388
	autocheck = false;
389
<?php endif; ?>
390

    
391
	if (document.iform.tlsauth_enable.checked && !autocheck)
392
		document.getElementById("autotls_opts").style.display="";
393
	else
394
		document.getElementById("autotls_opts").style.display="none";
395
}
396

    
397
//]]>
398
</script>
399
<?php
400
if (!$savemsg)
401
	$savemsg = "";
402

    
403
if ($input_errors)
404
	print_input_errors($input_errors);
405
if ($savemsg)
406
	print_info_box($savemsg);
407
?>
408
<table width="100%" border="0" cellpadding="0" cellspacing="0" summary="vpn openvpn client">
409
 	<tr>
410
		<td class="tabnavtbl">
411
			<?php 
412
				$tab_array = array();
413
				$tab_array[] = array(gettext("Server"), false, "vpn_openvpn_server.php");
414
				$tab_array[] = array(gettext("Client"), true, "vpn_openvpn_client.php");
415
				$tab_array[] = array(gettext("Client Specific Overrides"), false, "vpn_openvpn_csc.php");
416
				$tab_array[] = array(gettext("Wizards"), false, "wizard.php?xml=openvpn_wizard.xml");
417
				add_package_tabs("OpenVPN", $tab_array);
418
				display_top_tabs($tab_array);
419
			?>
420
		</td>
421
	</tr>    
422
	<tr>
423
		<td class="tabcont">
424

    
425
			<?php if($act=="new" || $act=="edit"): ?>
426

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

    
959
				<table width="100%" border="0" cellpadding="6" cellspacing="0" id="client_opts" summary="advance configuration">
960
					<tr>
961
						<td colspan="2" class="list" height="12"></td>
962
					</tr>
963
					<tr>
964
						<td colspan="2" valign="top" class="listtopic"><?=gettext("Advanced configuration"); ?></td>
965
					</tr>
966
					<tr>
967
						<td width="22%" valign="top" class="vncell"><?=gettext("Advanced"); ?></td>
968
						<td width="78%" class="vtable">
969
							<table border="0" cellpadding="2" cellspacing="0" summary="advance configuration">
970
								<tr>
971
									<td>
972
										<textarea rows="6" cols="78" name="custom_options" id="custom_options"><?=htmlspecialchars($pconfig['custom_options']);?></textarea><br />
973
										<?=gettext("Enter any additional options you would like to add to the OpenVPN client configuration here, separated by a semicolon"); ?><br />
974
										<?=gettext("EXAMPLE:"); ?> <strong>remote server.mysite.com 1194;</strong> or <strong>remote 1.2.3.4 1194;</strong>
975
									</td>
976
								</tr>
977
							</table>
978
						</td>
979
					</tr>
980
				</table>
981

    
982
				<br />
983
				<table width="100%" border="0" cellpadding="6" cellspacing="0" summary="icons">
984
					<tr>
985
						<td width="22%" valign="top">&nbsp;</td>
986
						<td width="78%"> 
987
							<input name="save" type="submit" class="formbtn" value="<?=gettext("Save"); ?>" /> 
988
							<input name="act" type="hidden" value="<?=$act;?>" />
989
							<?php if (isset($id) && $a_client[$id]): ?>
990
							<input name="id" type="hidden" value="<?=htmlspecialchars($id);?>" />
991
							<?php endif; ?>
992
						</td>
993
					</tr>
994
				</table>
995
			</form>
996

    
997
			<?php else: ?>
998

    
999
			<table class="sortable" width="100%" border="0" cellpadding="0" cellspacing="0" summary="list of openvpn clients">
1000
				<thead>
1001
				<tr>
1002
					<td width="10%" class="listhdrr"><?=gettext("Disabled"); ?></td>
1003
					<td width="10%" class="listhdrr"><?=gettext("Protocol"); ?></td>
1004
					<td width="30%" class="listhdrr"><?=gettext("Server"); ?></td>
1005
					<td width="40%" class="listhdrr"><?=gettext("Description"); ?></td>
1006
					<td width="10%" class="list"></td>
1007
				</tr>
1008
				</thead>
1009
				<tfoot>
1010
				<tr>
1011
					<td class="list" colspan="4"></td>
1012
					<td class="list">
1013
						<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" />
1014
						</a>
1015
					</td>
1016
				</tr>
1017
				<tr>
1018
					<td colspan="4">
1019
						<p>
1020
							<?=gettext("Additional OpenVPN clients can be added here.");?>
1021
						</p>
1022
					</td>
1023
				</tr>
1024
				</tfoot>
1025
				<tbody>
1026
				<?php
1027
					$i = 0;
1028
					foreach($a_client as $client):
1029
						$disabled = "NO";
1030
						if (isset($client['disable']))
1031
							$disabled = "YES";
1032
						$server = "{$client['server_addr']}:{$client['server_port']}";
1033
				?>
1034
				<tr ondblclick="document.location='vpn_openvpn_client.php?act=edit&amp;id=<?=$i;?>'">
1035
					<td class="listlr">
1036
						<?=$disabled;?>
1037
					</td>
1038
					<td class="listr">
1039
						<?=htmlspecialchars($client['protocol']);?>
1040
					</td>
1041
					<td class="listr">
1042
						<?=htmlspecialchars($server);?>
1043
					</td>
1044
					<td class="listbg">
1045
						<?=htmlspecialchars($client['description']);?>
1046
					</td>
1047
					<td valign="middle" class="list nowrap">
1048
						<a href="vpn_openvpn_client.php?act=edit&amp;id=<?=$i;?>">
1049
							<img src="./themes/<?=$g['theme'];?>/images/icons/icon_e.gif" title="<?=gettext("edit client"); ?>" width="17" height="17" border="0" alt="edit" />
1050
						</a>
1051
						&nbsp;
1052
						<a href="vpn_openvpn_client.php?act=del&amp;id=<?=$i;?>" onclick="return confirm('<?=gettext("Do you really want to delete this client?"); ?>')">
1053
							<img src="/themes/<?=$g['theme'];?>/images/icons/icon_x.gif" title="<?=gettext("delete client"); ?>" width="17" height="17" border="0" alt="delete" />
1054
						</a>
1055
					</td>
1056
				</tr>
1057
				<?php
1058
					$i++;
1059
					endforeach;
1060
				?>
1061
				<tr style="dispaly:none;"><td></td></tr>
1062
				</tbody>
1063
			</table>
1064

    
1065
			<?php endif; ?>
1066

    
1067
		</td>
1068
	</tr>
1069
</table>
1070
<script type="text/javascript">
1071
//<![CDATA[
1072
mode_change();
1073
autokey_change();
1074
tlsauth_change();
1075
useproxy_changed();
1076
//]]>
1077
</script>
1078
<?php include("fend.inc"); ?>
1079
</body>
1080
</html>
1081

    
1082
<?php
1083

    
1084
/* local utility functions */
1085

    
1086
function set_checked($var,& $chk) {
1087
    if($var)
1088
        $chk = "checked=\"checked\"";
1089
    else
1090
        $chk = "";
1091
}
1092

    
1093
?>
(246-246/255)