Projet

Général

Profil

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

univnautes / usr / local / www / vpn_openvpn_client.php @ 770f29c4

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 certref");
248
		$reqdfieldsn = array(gettext("Certificate Authority"),gettext("Certificate"));
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 (!$input_errors) {
258

    
259
		$client = array();
260
		
261
		foreach($simplefields as $stat)
262
			update_if_changed($stat, $client[$stat], $_POST[$stat]);
263
			
264
		if ($vpnid)
265
			$client['vpnid'] = $vpnid;
266
		else
267
			$client['vpnid'] = openvpn_vpnid_next();
268

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

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

    
302
		$client['tunnel_network'] = $pconfig['tunnel_network'];
303
		$client['tunnel_networkv6'] = $pconfig['tunnel_networkv6'];
304
		$client['remote_network'] = $pconfig['remote_network'];
305
		$client['remote_networkv6'] = $pconfig['remote_networkv6'];
306
		$client['use_shaper'] = $pconfig['use_shaper'];
307
		$client['compression'] = $pconfig['compression'];
308
		$client['passtos'] = $pconfig['passtos'];
309

    
310
		if (isset($id) && $a_client[$id])
311
			$a_client[$id] = $client;
312
		else
313
			$a_client[] = $client;
314

    
315
		openvpn_resync('client', $client);
316
		write_config();
317
		
318
		header("Location: vpn_openvpn_client.php");
319
		exit;
320
	}
321
}
322

    
323
include("head.inc");
324

    
325
?>
326

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

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

    
351
function autokey_change() {
352
	if (document.iform.autokey_enable.checked)
353
		document.getElementById("autokey_opts").style.display="none";
354
	else
355
		document.getElementById("autokey_opts").style.display="";
356
}
357

    
358
function useproxy_changed() {
359

    
360
	if (jQuery('#proxy_authtype').val() != 'none') {
361
                jQuery('#proxy_authtype_opts').show();
362
        } else {
363
                jQuery('#proxy_authtype_opts').hide();
364
        }
365
}
366

    
367
function tlsauth_change() {
368

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

    
376
	autotls_change();
377
}
378

    
379
function autotls_change() {
380

    
381
<?php if (!$pconfig['tls']): ?>
382
	autocheck = document.iform.autotls_enable.checked;
383
<?php else: ?>
384
	autocheck = false;
385
<?php endif; ?>
386

    
387
	if (document.iform.tlsauth_enable.checked && !autocheck)
388
		document.getElementById("autotls_opts").style.display="";
389
	else
390
		document.getElementById("autotls_opts").style.display="none";
391
}
392

    
393
//]]>
394
</script>
395
<?php
396
if (!$savemsg)
397
	$savemsg = "";
398

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

    
421
			<?php if($act=="new" || $act=="edit"): ?>
422

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

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

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

    
993
			<?php else: ?>
994

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

    
1061
			<?php endif; ?>
1062

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

    
1078
<?php
1079

    
1080
/* local utility functions */
1081

    
1082
function set_checked($var,& $chk) {
1083
    if($var)
1084
        $chk = "checked=\"checked\"";
1085
    else
1086
        $chk = "";
1087
}
1088

    
1089
?>
(245-245/254)