Project

General

Profile

Download (37.7 KB) Statistics
| Branch: | Tag: | Revision:
1 d799787e Matthew Grooms
<?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 d84bd468 Ermal Lu?i
require_once("openvpn.inc");
39 d799787e Matthew Grooms
40 2fa7a468 Carlos Eduardo Ramos
$pgtitle = array(gettext("OpenVPN"), gettext("Client"));
41 b32dd0a6 jim-p
$shortcut_section = "openvpn";
42 d799787e Matthew Grooms
43
if (!is_array($config['openvpn']['openvpn-client']))
44
	$config['openvpn']['openvpn-client'] = array();
45
46
$a_client = &$config['openvpn']['openvpn-client'];
47
48 428e66b6 jim-p
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 d799787e Matthew Grooms
$id = $_GET['id'];
64
if (isset($_POST['id']))
65
	$id = $_POST['id'];
66
67
$act = $_GET['act'];
68
if (isset($_POST['act']))
69
	$act = $_POST['act'];
70
71 6d9b1074 jim-p
if (isset($id) && $a_client[$id])
72
	$vpnid = $a_client[$id]['vpnid'];
73
else
74
	$vpnid = 0;
75
76 d799787e Matthew Grooms
if ($_GET['act'] == "del") {
77
78
	if (!$a_client[$id]) {
79
		pfSenseHeader("vpn_openvpn_client.php");
80
		exit;
81
	}
82
83 dc408939 Matthew Grooms
	openvpn_delete('client', $a_client[$id]);
84 d799787e Matthew Grooms
	unset($a_client[$id]);
85
	write_config();
86
	$savemsg = gettext("Client successfully deleted")."<br/>";
87
}
88
89 f432e364 Matthew Grooms
if($_GET['act']=="new"){
90 3c11bd3c Matthew Grooms
	$pconfig['autokey_enable'] = "yes";
91
	$pconfig['tlsauth_enable'] = "yes";
92
	$pconfig['autotls_enable'] = "yes";
93 f432e364 Matthew Grooms
	$pconfig['interface'] = "wan";
94
	$pconfig['server_port'] = 1194;
95
}
96
97 d799787e Matthew Grooms
if($_GET['act']=="edit"){
98
99
	if (isset($id) && $a_client[$id]) {
100
101 8319ee63 jim-p
		$pconfig['disable'] = isset($a_client[$id]['disable']);
102 3c11bd3c Matthew Grooms
		$pconfig['mode'] = $a_client[$id]['mode'];
103 d799787e Matthew Grooms
		$pconfig['protocol'] = $a_client[$id]['protocol'];
104
		$pconfig['interface'] = $a_client[$id]['interface'];
105 67b0902f pierrepomes
		if (!empty($a_client[$id]['ipaddr'])) {
106
			$pconfig['interface'] = $pconfig['interface'] . '|' . $a_client[$id]['ipaddr'];
107
		}
108 d799787e Matthew Grooms
		$pconfig['local_port'] = $a_client[$id]['local_port'];
109
		$pconfig['server_addr'] = $a_client[$id]['server_addr'];
110
		$pconfig['server_port'] = $a_client[$id]['server_port'];
111
		$pconfig['resolve_retry'] = $a_client[$id]['resolve_retry'];
112
		$pconfig['proxy_addr'] = $a_client[$id]['proxy_addr'];
113
		$pconfig['proxy_port'] = $a_client[$id]['proxy_port'];
114 762a24a3 Ermal Lu?i
		$pconfig['proxy_user'] = $a_client[$id]['proxy_user'];
115
		$pconfig['proxy_passwd'] = $a_client[$id]['proxy_passwd'];
116
		$pconfig['proxy_authtype'] = $a_client[$id]['proxy_authtype'];
117 d799787e Matthew Grooms
		$pconfig['description'] = $a_client[$id]['description'];
118 c7323d81 sullrich
		$pconfig['custom_options'] = $a_client[$id]['custom_options'];
119 691fbf14 Ermal Lu?i
		$pconfig['ns_cert_type'] = $a_client[$id]['ns_cert_type'];
120 4936ff53 jim-p
		$pconfig['dev_mode'] = $a_client[$id]['dev_mode'];
121 691fbf14 Ermal Lu?i
	
122 3c11bd3c Matthew Grooms
		if ($pconfig['mode'] != "p2p_shared_key") {
123 d799787e Matthew Grooms
			$pconfig['caref'] = $a_client[$id]['caref'];
124
			$pconfig['certref'] = $a_client[$id]['certref'];
125 3c11bd3c Matthew Grooms
			if ($a_client[$id]['tls']) {
126
				$pconfig['tlsauth_enable'] = "yes";
127
				$pconfig['tls'] = base64_decode($a_client[$id]['tls']);
128
			}
129
		} else
130
			$pconfig['shared_key'] = base64_decode($a_client[$id]['shared_key']);
131 d799787e Matthew Grooms
		$pconfig['crypto'] = $a_client[$id]['crypto'];
132 f5c704b6 jim-p
		$pconfig['engine'] = $a_client[$id]['engine'];
133 d799787e Matthew Grooms
134
		$pconfig['tunnel_network'] = $a_client[$id]['tunnel_network'];
135 4856df9b jim-p
		$pconfig['tunnel_networkv6'] = $a_client[$id]['tunnel_networkv6'];
136 d799787e Matthew Grooms
		$pconfig['remote_network'] = $a_client[$id]['remote_network'];
137 4856df9b jim-p
		$pconfig['remote_networkv6'] = $a_client[$id]['remote_networkv6'];
138 b422360c jim-p
		$pconfig['use_shaper'] = $a_client[$id]['use_shaper'];
139 d799787e Matthew Grooms
		$pconfig['compression'] = $a_client[$id]['compression'];
140 1cb0b40a Matthew Grooms
		$pconfig['passtos'] = $a_client[$id]['passtos'];
141 3c11bd3c Matthew Grooms
142
		// just in case the modes switch
143
		$pconfig['autokey_enable'] = "yes";
144
		$pconfig['autotls_enable'] = "yes";
145 d799787e Matthew Grooms
	}
146
}
147
148
if ($_POST) {
149
150
	unset($input_errors);
151
	$pconfig = $_POST;
152
153 dc408939 Matthew Grooms
	if (isset($id) && $a_client[$id])
154
		$vpnid = $a_client[$id]['vpnid'];
155 f432e364 Matthew Grooms
	else
156
		$vpnid = 0;
157
158 98c0c87a jim-p
	if ($pconfig['mode'] != "p2p_shared_key")
159 3c11bd3c Matthew Grooms
		$tls_mode = true;
160
	else
161
		$tls_mode = false;
162
163 d799787e Matthew Grooms
	/* input validation */
164 f432e364 Matthew Grooms
	if ($pconfig['local_port']) {
165
166
		if ($result = openvpn_validate_port($pconfig['local_port'], 'Local port'))
167
			$input_errors[] = $result;
168
169 5accf130 jim-p
		$portused = openvpn_port_used($pconfig['protocol'], $pconfig['local_port']);
170
		if (($portused != $vpnid) && ($portused != 0))
171 2fa7a468 Carlos Eduardo Ramos
			$input_errors[] = gettext("The specified 'Local port' is in use. Please select another value");
172 f432e364 Matthew Grooms
	}
173
174 d799787e Matthew Grooms
	if ($result = openvpn_validate_host($pconfig['server_addr'], 'Server host or address'))
175
		$input_errors[] = $result;
176
177
	if ($result = openvpn_validate_port($pconfig['server_port'], 'Server port'))
178
		$input_errors[] = $result;
179
180
	if ($pconfig['proxy_addr']) {
181
182
		if ($result = openvpn_validate_host($pconfig['proxy_addr'], 'Proxy host or address'))
183
			$input_errors[] = $result;
184
185
		if ($result = openvpn_validate_port($pconfig['proxy_port'], 'Proxy port'))
186
			$input_errors[] = $result;
187 762a24a3 Ermal Lu?i
188
		if ($pconfig['proxy_authtype'] != "none") {
189
			if (empty($pconfig['proxy_user']) || empty($pconfig['proxy_passwd']))
190 2fa7a468 Carlos Eduardo Ramos
				$input_errors[] = gettext("User name and password are required for proxy with authentication.");
191 762a24a3 Ermal Lu?i
		}
192 d799787e Matthew Grooms
	}
193
194 c13b87a0 sullrich
	if($pconfig['tunnel_network'])
195
		if ($result = openvpn_validate_cidr($pconfig['tunnel_network'], 'Tunnel network'))
196
			$input_errors[] = $result;
197 d799787e Matthew Grooms
198
	if ($result = openvpn_validate_cidr($pconfig['remote_network'], 'Remote network'))
199
		$input_errors[] = $result;
200
201 b422360c jim-p
	if (!empty($pconfig['use_shaper']) && (!is_numeric($pconfig['use_shaper']) || ($pconfig['use_shaper'] <= 0)))
202
		$input_errors[] = gettext("The bandwidth limit must be a positive numeric value.");
203
204 89e6e210 jim-p
    if ($pconfig['autokey_enable'])
205
        $pconfig['shared_key'] = openvpn_create_key();
206
207 3c11bd3c Matthew Grooms
	if (!$tls_mode && !$pconfig['autokey_enable'])
208 d799787e Matthew Grooms
		if (!strstr($pconfig['shared_key'], "-----BEGIN OpenVPN Static key V1-----") ||
209
			!strstr($pconfig['shared_key'], "-----END OpenVPN Static key V1-----"))
210 2fa7a468 Carlos Eduardo Ramos
			$input_errors[] = gettext("The field 'Shared Key' does not appear to be valid");
211 3c11bd3c Matthew Grooms
212
	if ($tls_mode && $pconfig['tlsauth_enable'] && !$pconfig['autotls_enable'])
213
		if (!strstr($pconfig['tls'], "-----BEGIN OpenVPN Static key V1-----") ||
214
			!strstr($pconfig['tls'], "-----END OpenVPN Static key V1-----"))
215 2fa7a468 Carlos Eduardo Ramos
			$input_errors[] = gettext("The field 'TLS Authentication Key' does not appear to be valid");
216 d799787e Matthew Grooms
217 6180c3ae jim-p
	/* If we are not in shared key mode, then we need the CA/Cert. */
218
	if ($pconfig['mode'] != "p2p_shared_key") {
219 872d9195 Matthew Grooms
		$reqdfields = explode(" ", "caref certref");
220 2fa7a468 Carlos Eduardo Ramos
		$reqdfieldsn = array(gettext("Certificate Authority"),gettext("Certificate"));
221 6180c3ae jim-p
	} elseif (!$pconfig['autokey_enable']) {
222
		/* We only need the shared key filled in if we are in shared key mode and autokey is not selected. */
223
		$reqdfields = array('shared_key');
224 2fa7a468 Carlos Eduardo Ramos
		$reqdfieldsn = array(gettext('Shared key'));
225 d799787e Matthew Grooms
	}
226
227
	do_input_validation($_POST, $reqdfields, $reqdfieldsn, &$input_errors);
228
	
229
	if (!$input_errors) {
230
231
		$client = array();
232
233 f432e364 Matthew Grooms
		if ($vpnid)
234
			$client['vpnid'] = $vpnid;
235 d799787e Matthew Grooms
		else
236
			$client['vpnid'] = openvpn_vpnid_next();
237
238 8319ee63 jim-p
		if ($_POST['disable'] == "yes")
239 b65f56f6 jim-p
			$client['disable'] = true;
240 d799787e Matthew Grooms
		$client['protocol'] = $pconfig['protocol'];
241 4936ff53 jim-p
		$client['dev_mode'] = $pconfig['dev_mode'];
242 67b0902f pierrepomes
		list($client['interface'], $client['ipaddr']) = explode ("|",$pconfig['interface']);
243 d799787e Matthew Grooms
		$client['local_port'] = $pconfig['local_port'];
244
		$client['server_addr'] = $pconfig['server_addr'];
245
		$client['server_port'] = $pconfig['server_port'];
246
		$client['resolve_retry'] = $pconfig['resolve_retry'];
247
		$client['proxy_addr'] = $pconfig['proxy_addr'];
248
		$client['proxy_port'] = $pconfig['proxy_port'];
249 762a24a3 Ermal Lu?i
		$client['proxy_authtype'] = $pconfig['proxy_authtype'];
250
		$client['proxy_user'] = $pconfig['proxy_user'];
251
		$client['proxy_passwd'] = $pconfig['proxy_passwd'];
252 d799787e Matthew Grooms
		$client['description'] = $pconfig['description'];
253 50a9d5b9 jim-p
		$client['mode'] = $pconfig['mode'];
254 e3bbd29a Ermal
		$client['custom_options'] = str_replace("\r\n", "\n", $pconfig['custom_options']);
255 d799787e Matthew Grooms
256 3c11bd3c Matthew Grooms
        if ($tls_mode) {
257
            $client['caref'] = $pconfig['caref'];
258
            $client['certref'] = $pconfig['certref'];
259
            if ($pconfig['tlsauth_enable']) {
260
                if ($pconfig['autotls_enable'])
261
                    $pconfig['tls'] = openvpn_create_key();
262
                $client['tls'] = base64_encode($pconfig['tls']);
263
            }
264
        } else {
265
            $client['shared_key'] = base64_encode($pconfig['shared_key']);
266
        }
267 d799787e Matthew Grooms
		$client['crypto'] = $pconfig['crypto'];
268 582c58ae jim-p
		$client['engine'] = $pconfig['engine'];
269 d799787e Matthew Grooms
270
		$client['tunnel_network'] = $pconfig['tunnel_network'];
271 4856df9b jim-p
		$client['tunnel_networkv6'] = $pconfig['tunnel_networkv6'];
272 d799787e Matthew Grooms
		$client['remote_network'] = $pconfig['remote_network'];
273 4856df9b jim-p
		$client['remote_networkv6'] = $pconfig['remote_networkv6'];
274 b422360c jim-p
		$client['use_shaper'] = $pconfig['use_shaper'];
275 d799787e Matthew Grooms
		$client['compression'] = $pconfig['compression'];
276 e067306d pierrepomes
		$client['passtos'] = $pconfig['passtos'];
277 d799787e Matthew Grooms
278
		if (isset($id) && $a_client[$id])
279
			$a_client[$id] = $client;
280
		else
281
			$a_client[] = $client;
282
283 dc408939 Matthew Grooms
		openvpn_resync('client', $client);
284 d799787e Matthew Grooms
		write_config();
285
		
286
		header("Location: vpn_openvpn_client.php");
287
		exit;
288
	}
289
}
290
291
include("head.inc");
292
293
?>
294
295
<body link="#000000" vlink="#000000" alink="#000000" onload="<?= $jsevents["body"]["onload"] ?>">
296
<?php include("fbegin.inc"); ?>
297
<script language="JavaScript">
298
<!--
299
300 3c11bd3c Matthew Grooms
function mode_change() {
301
	index = document.iform.mode.selectedIndex;
302
	value = document.iform.mode.options[index].value;
303 d799787e Matthew Grooms
	switch(value) {
304 3c11bd3c Matthew Grooms
		case "p2p_tls":
305
			document.getElementById("tls").style.display="";
306
			document.getElementById("tls_ca").style.display="";
307
			document.getElementById("tls_cert").style.display="";
308 d799787e Matthew Grooms
			document.getElementById("psk").style.display="none";
309
			break;
310 3c11bd3c Matthew Grooms
		case "p2p_shared_key":
311
			document.getElementById("tls").style.display="none";
312
			document.getElementById("tls_ca").style.display="none";
313
			document.getElementById("tls_cert").style.display="none";
314 d799787e Matthew Grooms
			document.getElementById("psk").style.display="";
315
			break;
316
	}
317
}
318
319 3c11bd3c Matthew Grooms
function autokey_change() {
320
	if (document.iform.autokey_enable.checked)
321
		document.getElementById("autokey_opts").style.display="none";
322
	else
323
		document.getElementById("autokey_opts").style.display="";
324
}
325
326 762a24a3 Ermal Lu?i
function useproxy_changed() {
327
328 ea1cea05 Vinicius Coque
	if (jQuery('#proxy_authtype').val() != 'none') {
329
                jQuery('#proxy_authtype_opts').show();
330 762a24a3 Ermal Lu?i
        } else {
331 ea1cea05 Vinicius Coque
                jQuery('#proxy_authtype_opts').hide();
332 762a24a3 Ermal Lu?i
        }
333
}
334
335 3c11bd3c Matthew Grooms
function tlsauth_change() {
336
337
<?php if (!$pconfig['tls']): ?>
338
	if (document.iform.tlsauth_enable.checked)
339
		document.getElementById("tlsauth_opts").style.display="";
340
	else
341
		document.getElementById("tlsauth_opts").style.display="none";
342
<?php endif; ?>
343
344
	autotls_change();
345
}
346
347
function autotls_change() {
348
349
<?php if (!$pconfig['tls']): ?>
350
	autocheck = document.iform.autotls_enable.checked;
351
<?php else: ?>
352
	autocheck = false;
353
<?php endif; ?>
354
355
	if (document.iform.tlsauth_enable.checked && !autocheck)
356
		document.getElementById("autotls_opts").style.display="";
357
	else
358
		document.getElementById("autotls_opts").style.display="none";
359
}
360
361 d799787e Matthew Grooms
//-->
362
</script>
363
<?php
364 428e66b6 jim-p
if (!$savemsg)
365
	$savemsg = "";
366
367
if ($input_errors)
368
	print_input_errors($input_errors);
369
if ($savemsg)
370
	print_info_box($savemsg);
371 d799787e Matthew Grooms
?>
372
<table width="100%" border="0" cellpadding="0" cellspacing="0">
373
 	<tr>
374
		<td class="tabnavtbl">
375
			<ul id="tabnav">
376
			<?php 
377
				$tab_array = array();
378
				$tab_array[] = array(gettext("Server"), false, "vpn_openvpn_server.php");
379
				$tab_array[] = array(gettext("Client"), true, "vpn_openvpn_client.php");
380
				$tab_array[] = array(gettext("Client Specific Overrides"), false, "vpn_openvpn_csc.php");
381 5540aee6 Ermal Lu?i
				$tab_array[] = array(gettext("Wizards"), false, "wizard.php?xml=openvpn_wizard.xml");
382 b63f2e8b Matthew Grooms
				add_package_tabs("OpenVPN", $tab_array);
383 d799787e Matthew Grooms
				display_top_tabs($tab_array);
384
			?>
385
			</ul>
386
		</td>
387
	</tr>    
388
	<tr>
389
		<td class="tabcont">
390
391
			<?php if($act=="new" || $act=="edit"): ?>
392
393
			<form action="vpn_openvpn_client.php" method="post" name="iform" id="iform" onsubmit="presubmit()">
394
				<table width="100%" border="0" cellpadding="6" cellspacing="0">
395 47c00c09 Scott Ullrich
					<tr>
396 2fa7a468 Carlos Eduardo Ramos
						<td colspan="2" valign="top" class="listtopic"><?=gettext("General information"); ?></td>
397 47c00c09 Scott Ullrich
					</tr>
398 d799787e Matthew Grooms
					<tr>
399 2fa7a468 Carlos Eduardo Ramos
						<td width="22%" valign="top" class="vncellreq"><?=gettext("Disabled"); ?></td>
400 d799787e Matthew Grooms
						<td width="78%" class="vtable">
401
							<table border="0" cellpadding="0" cellspacing="0">
402
								<tr>
403
									<td>
404
										<?php set_checked($pconfig['disable'],$chk); ?>
405
										<input name="disable" type="checkbox" value="yes" <?=$chk;?>/>
406
									</td>
407
									<td>
408
										&nbsp;
409
										<span class="vexpl">
410 2fa7a468 Carlos Eduardo Ramos
											<strong><?=gettext("Disable this client"); ?></strong><br>
411 d799787e Matthew Grooms
										</span>
412
									</td>
413
								</tr>
414
							</table>
415 2fa7a468 Carlos Eduardo Ramos
							<?=gettext("Set this option to disable this client without removing it from the list"); ?>.
416 d799787e Matthew Grooms
						</td>
417
					</tr>
418 3c11bd3c Matthew Grooms
					<tr>
419
						<td width="22%" valign="top" class="vncellreq"><?=gettext("Server Mode");?></td>
420
						<td width="78%" class="vtable">
421
							<select name='mode' id='mode' class="formselect" onchange='mode_change()'>
422
							<?php
423
								foreach ($openvpn_client_modes as $name => $desc):
424
									$selected = "";
425
									if ($pconfig['mode'] == $name)
426
										$selected = "selected";
427
							?>
428
								<option value="<?=$name;?>" <?=$selected;?>><?=$desc;?></option>
429
							<?php endforeach; ?>
430
							</select>
431
						</td>
432
					</tr>
433 d799787e Matthew Grooms
					<tr>
434
						<td width="22%" valign="top" class="vncellreq"><?=gettext("Protocol");?></td>
435
							<td width="78%" class="vtable">
436
							<select name='protocol' class="formselect">
437
							<?php
438
								foreach ($openvpn_prots as $prot):
439
									$selected = "";
440
									if ($pconfig['protocol'] == $prot)
441
										$selected = "selected";
442
							?>
443
								<option value="<?=$prot;?>" <?=$selected;?>><?=$prot;?></option>
444
							<?php endforeach; ?>
445
							</select>
446
							</td>
447
					</tr>
448 691fbf14 Ermal Lu?i
                                        <tr>
449
                                                <td width="22%" valign="top" class="vncellreq"><?=gettext("Device mode");?></td>
450
                                                        <td width="78%" class="vtable">
451 4936ff53 jim-p
                                                        <select name='dev_mode' class="formselect">
452 691fbf14 Ermal Lu?i
                                                        <?php
453
                                                                foreach ($openvpn_dev_mode as $mode):
454
                                                                        $selected = "";
455 4936ff53 jim-p
                                                                        if ($pconfig['dev_mode'] == $mode)
456 691fbf14 Ermal Lu?i
                                                                                $selected = "selected";
457
                                                        ?>
458
                                                                <option value="<?=$mode;?>" <?=$selected;?>><?=$mode;?></option>
459
                                                        <?php endforeach; ?>
460
                                                        </select>
461
                                                        </td>
462
                                        </tr>
463 d799787e Matthew Grooms
					<tr>
464 2fa7a468 Carlos Eduardo Ramos
						<td width="22%" valign="top" class="vncellreq"><?=gettext("Interface"); ?></td>
465 d799787e Matthew Grooms
						<td width="78%" class="vtable">
466
							<select name="interface" class="formselect">
467
								<?php
468
									$interfaces = get_configured_interface_with_descr();
469 3d06e8f0 pierrepomes
									$carplist = get_configured_carp_interface_list();
470
									foreach ($carplist as $cif => $carpip)
471 dd62256f Pierre POMES
										$interfaces[$cif.'|'.$carpip] = $carpip." (".get_vip_descr($carpip).")";
472 67b0902f pierrepomes
									$aliaslist = get_configured_ip_aliases_list();
473
									foreach ($aliaslist as $aliasip => $aliasif)
474 dd62256f Pierre POMES
										$interfaces[$aliasif.'|'.$aliasip] = $aliasip." (".get_vip_descr($aliasip).")";
475 174ba22b smos
									$grouplist = return_gateway_groups_array();
476
									foreach ($grouplist as $name => $group) {
477
										if($group['ipprotocol'] != inet)
478
											continue;
479
										if($group[0]['vip'] <> "")
480
											$vipif = $group[0]['vip'];
481
										else
482
											$vipif = $group[0]['int'];
483
										$interfaces[$name] = "GW Group {$name}";
484
									}
485 67b0902f pierrepomes
									$interfaces['any'] = "any";
486 3d06e8f0 pierrepomes
									foreach ($interfaces as $iface => $ifacename):
487 1d3bcd2a Matthew Grooms
										$selected = "";
488
										if ($iface == $pconfig['interface'])
489
											$selected = "selected";
490 d799787e Matthew Grooms
								?>
491 1d3bcd2a Matthew Grooms
									<option value="<?=$iface;?>" <?=$selected;?>>
492
										<?=htmlspecialchars($ifacename);?>
493
									</option>
494 d799787e Matthew Grooms
								<?php endforeach; ?>
495
							</select> <br>
496
						</td>
497
					</tr>
498 1d3bcd2a Matthew Grooms
					<tr>
499
						<td width="22%" valign="top" class="vncell"><?=gettext("Local port");?></td>
500
						<td width="78%" class="vtable">
501
							<input name="local_port" type="text" class="formfld unknown" size="5" value="<?=htmlspecialchars($pconfig['local_port']);?>"/>
502 d799787e Matthew Grooms
							<br/>
503 5708241f jim-p
							<?=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."); ?>
504 1d3bcd2a Matthew Grooms
						</td>
505
					</tr>
506 d799787e Matthew Grooms
					<tr>
507
						<td width="22%" valign="top" class="vncellreq"><?=gettext("Server host or address");?></td>
508
						<td width="78%" class="vtable">
509
							<input name="server_addr" type="text" class="formfld unknown" size="30" value="<?=htmlspecialchars($pconfig['server_addr']);?>"/>
510
						</td>
511
					</tr>
512
					<tr>
513
						<td width="22%" valign="top" class="vncellreq"><?=gettext("Server port");?></td>
514
						<td width="78%" class="vtable">
515
							<input name="server_port" type="text" class="formfld unknown" size="5" value="<?=htmlspecialchars($pconfig['server_port']);?>"/>
516
						</td>
517
					</tr>
518
					<tr>
519
						<td width="22%" valign="top" class="vncell"><?=gettext("Proxy host or address");?></td>
520
						<td width="78%" class="vtable">
521
							<input name="proxy_addr" type="text" class="formfld unknown" size="30" value="<?=htmlspecialchars($pconfig['proxy_addr']);?>"/>
522
						</td>
523
					</tr>
524
					<tr>
525
						<td width="22%" valign="top" class="vncell"><?=gettext("Proxy port");?></td>
526
						<td width="78%" class="vtable">
527
							<input name="proxy_port" type="text" class="formfld unknown" size="5" value="<?=htmlspecialchars($pconfig['proxy_port']);?>"/>
528
						</td>
529
					</tr>
530 762a24a3 Ermal Lu?i
					<tr>
531
						<td width="22%" valign="top" class="vncell"><?=gettext("Proxy authentication extra options");?></td>
532
						<td width="78%" class="vtable">
533
							<table border="0" cellpadding="2" cellspacing="0">
534
								<tr>
535
                                                                        <td align="right" width="25%">
536
                                                                                <span class="vexpl">
537 2fa7a468 Carlos Eduardo Ramos
                                                                                         &nbsp;<?=gettext("Authentication method"); ?> :&nbsp;
538 762a24a3 Ermal Lu?i
                                                                                </span>
539
                                                                        </td>
540
                                                                        <td>
541
										<select name="proxy_authtype" id="proxy_authtype" class="formfld select" onChange="useproxy_changed()">
542 2fa7a468 Carlos Eduardo Ramos
											<option value="none" <?php if ($pconfig['proxy_authtype'] == "none") echo "selected"; ?>><?=gettext("none"); ?></option>
543
											<option value="basic" <?php if ($pconfig['proxy_authtype'] == "basic") echo "selected"; ?>><?=gettext("basic"); ?></option>
544
											<option value="ntlm" <?php if ($pconfig['proxy_authtype'] == "ntlm") echo "selected"; ?>><?=gettext("ntlm"); ?></option>
545 762a24a3 Ermal Lu?i
										</select>
546
									</td>
547
								</tr>
548
							</table>
549
							<br />
550
							 <table border="0" cellpadding="2" cellspacing="0" id="proxy_authtype_opts" style="display:none">
551
                                                                <tr>
552
                                                                        <td align="right" width="25%">
553
                                                                                <span class="vexpl">
554 2fa7a468 Carlos Eduardo Ramos
                                                                                         &nbsp;<?=gettext("Username"); ?> :&nbsp;
555 762a24a3 Ermal Lu?i
                                                                                </span>
556
                                                                        </td>
557
                                                                        <td>
558
                                                                                <input name="proxy_user" id="proxy_user" class="formfld unknown" size="20" value="<?=htmlspecialchars($pconfig['proxy_user']);?>" />
559
                                                                        </td>
560
                                                                </tr>
561
                                                                <tr>
562
                                                                        <td align="right" width="25%">
563
                                                                                <span class="vexpl">
564 2fa7a468 Carlos Eduardo Ramos
                                                                                         &nbsp;<?=gettext("Password"); ?> :&nbsp;
565 762a24a3 Ermal Lu?i
                                                                                </span>
566
                                                                        </td>
567
                                                                        <td>
568
                                                                                <input name="proxy_passwd" id="proxy_passwd" type="password" class="formfld pwd" size="20" value="<?=htmlspecialchars($pconfig['proxy_passwd']);?>" />
569
                                                                        </td>
570
                                                                </tr>
571
                                                        </table>
572
						</td>
573
					</tr>
574 d799787e Matthew Grooms
					<tr>
575 2fa7a468 Carlos Eduardo Ramos
						<td width="22%" valign="top" class="vncell"><?=gettext("Server host name resolution"); ?></td>
576 d799787e Matthew Grooms
						<td width="78%" class="vtable">
577
							<table border="0" cellpadding="2" cellspacing="0">
578
								<tr>
579
									<td>
580
										<?php set_checked($pconfig['resolve_retry'],$chk); ?>
581 db2872a2 Ermal Lu?i
										<input name="resolve_retry" type="checkbox" value="yes" <?=$chk;?>>
582 d799787e Matthew Grooms
									</td>
583
									<td>
584
										<span class="vexpl">
585 2fa7a468 Carlos Eduardo Ramos
											<?=gettext("Infinitely resolve server"); ?>
586 d799787e Matthew Grooms
										</span>
587
									</td>
588
								</tr>
589
							</table>
590 2fa7a468 Carlos Eduardo Ramos
							<?=gettext("Continuously attempt to resolve the server host " .
591
							"name. Useful when communicating with a server " .
592
							"that is not permanently connected to the Internet"); ?>.
593 d799787e Matthew Grooms
						</td>
594
					</tr>
595
					<tr> 
596 2fa7a468 Carlos Eduardo Ramos
						<td width="22%" valign="top" class="vncell"><?=gettext("Description"); ?></td>
597 d799787e Matthew Grooms
						<td width="78%" class="vtable"> 
598
							<input name="description" type="text" class="formfld unknown" size="30" value="<?=htmlspecialchars($pconfig['description']);?>">
599
							<br>
600 2fa7a468 Carlos Eduardo Ramos
							<?=gettext("You may enter a description here for your reference (not parsed)"); ?>.
601 d799787e Matthew Grooms
						</td>
602
					</tr>
603
					<tr>
604
						<td colspan="2" class="list" height="12"></td>
605
					</tr>
606
					<tr>
607 2fa7a468 Carlos Eduardo Ramos
						<td colspan="2" valign="top" class="listtopic"><?=gettext("Cryptographic Settings"); ?></td>
608 d799787e Matthew Grooms
					</tr>
609 3c11bd3c Matthew Grooms
					<tr id="tls">
610 2fa7a468 Carlos Eduardo Ramos
						<td width="22%" valign="top" class="vncellreq"><?=gettext("TLS Authentication"); ?></td>
611 3c11bd3c Matthew Grooms
						<td width="78%" class="vtable">
612
							<table border="0" cellpadding="2" cellspacing="0">
613
								<tr>
614
									<td>
615
										<?php set_checked($pconfig['tlsauth_enable'],$chk); ?>
616
										<input name="tlsauth_enable" id="tlsauth_enable" type="checkbox" value="yes" <?=$chk;?> onClick="tlsauth_change()">
617
									</td>
618
									<td>
619
										<span class="vexpl">
620 2fa7a468 Carlos Eduardo Ramos
											<?=gettext("Enable authentication of TLS packets"); ?>.
621 3c11bd3c Matthew Grooms
										</span>
622
									</td>
623
								</tr>
624
							</table>
625
							<?php if (!$pconfig['tls']): ?>
626
							<table border="0" cellpadding="2" cellspacing="0" id='tlsauth_opts'>
627
								<tr>
628
									<td>
629
										<?php set_checked($pconfig['autotls_enable'],$chk); ?>
630
										<input name="autotls_enable" id="autotls_enable" type="checkbox" value="yes" <?=$chk;?> onClick="autotls_change()">
631
									</td>
632
									<td>
633
										<span class="vexpl">
634 2fa7a468 Carlos Eduardo Ramos
											<?=gettext("Automatically generate a shared TLS authentication key"); ?>.
635 3c11bd3c Matthew Grooms
										</span>
636
									</td>
637
								</tr>
638
							</table>
639
							<?php endif; ?>
640
							<table border="0" cellpadding="2" cellspacing="0" id='autotls_opts'>
641
								<tr>
642
									<td>
643
										<textarea name="tls" cols="65" rows="7" class="formpre"><?=htmlspecialchars($pconfig['tls']);?></textarea>
644
										<br/>
645 2fa7a468 Carlos Eduardo Ramos
										<?=gettext("Paste your shared key here"); ?>.
646 3c11bd3c Matthew Grooms
									</td>
647
								</tr>
648
							</table>
649
						</td>
650 d799787e Matthew Grooms
					</tr>
651 3c11bd3c Matthew Grooms
					<tr id="tls_ca">
652 2fa7a468 Carlos Eduardo Ramos
						<td width="22%" valign="top" class="vncellreq"><?=gettext("Peer Certificate Authority"); ?></td>
653 d799787e Matthew Grooms
							<td width="78%" class="vtable">
654 19cdeb3e jim-p
							<?php if (count($a_ca)): ?>
655 d799787e Matthew Grooms
							<select name='caref' class="formselect">
656
							<?php
657 428e66b6 jim-p
								foreach ($a_ca as $ca):
658 d799787e Matthew Grooms
									$selected = "";
659
									if ($pconfig['caref'] == $ca['refid'])
660
										$selected = "selected";
661
							?>
662 f2a86ca9 jim-p
								<option value="<?=$ca['refid'];?>" <?=$selected;?>><?=$ca['descr'];?></option>
663 d799787e Matthew Grooms
							<?php endforeach; ?>
664
							</select>
665 19cdeb3e jim-p
							<?php else: ?>
666
								<b>No Certificate Authorities defined.</b> <br/>Create one under <a href="system_camanager.php">System &gt; Cert Manager</a>.
667
							<?php endif; ?>
668 d799787e Matthew Grooms
							</td>
669
					</tr>
670 3c11bd3c Matthew Grooms
					<tr id="tls_cert">
671 2fa7a468 Carlos Eduardo Ramos
						<td width="22%" valign="top" class="vncellreq"><?=gettext("Client Certificate"); ?></td>
672 d799787e Matthew Grooms
							<td width="78%" class="vtable">
673 19cdeb3e jim-p
							<?php if (count($a_cert)): ?>
674 d799787e Matthew Grooms
							<select name='certref' class="formselect">
675
							<?php
676 428e66b6 jim-p
							foreach ($a_cert as $cert):
677 9e303f2f jim-p
								$selected = "";
678
								$caname = "";
679
								$inuse = "";
680
								$revoked = "";
681
								$ca = lookup_ca($cert['caref']);
682
								if ($ca)
683
									$caname = " (CA: {$ca['descr']})";
684
								if ($pconfig['certref'] == $cert['refid'])
685
									$selected = "selected";
686
								if (cert_in_use($cert['refid']))
687
									$inuse = " *In Use";
688
								if (is_cert_revoked($cert))
689
									$revoked = " *Revoked";
690 d799787e Matthew Grooms
							?>
691 6a0b3ea4 jim-p
								<option value="<?=$cert['refid'];?>" <?=$selected;?>><?=$cert['descr'] . $caname . $inuse . $revoked;?></option>
692 d799787e Matthew Grooms
							<?php endforeach; ?>
693
							</select>
694 19cdeb3e jim-p
							<?php else: ?>
695
								<b>No Certificates defined.</b> <br/>Create one under <a href="system_certmanager.php">System &gt; Cert Manager</a>.
696
							<?php endif; ?>
697 d799787e Matthew Grooms
						</td>
698
					</tr>
699
					<tr id="psk">
700 2fa7a468 Carlos Eduardo Ramos
						<td width="22%" valign="top" class="vncellreq"><?=gettext("Shared Key"); ?></td>
701 3c11bd3c Matthew Grooms
						<td width="78%" class="vtable">
702
							<?php if (!$pconfig['shared_key']): ?>
703
							<table border="0" cellpadding="2" cellspacing="0">
704
								<tr>
705
									<td>
706
										<?php set_checked($pconfig['autokey_enable'],$chk); ?>
707
										<input name="autokey_enable" type="checkbox" value="yes" <?=$chk;?> onClick="autokey_change()">
708
									</td>
709
									<td>
710
										<span class="vexpl">
711 2fa7a468 Carlos Eduardo Ramos
											<?=gettext("Automatically generate a shared key"); ?>.
712 3c11bd3c Matthew Grooms
										</span>
713
									</td>
714
								</tr>
715
							</table>
716
							<?php endif; ?>
717
							<table border="0" cellpadding="2" cellspacing="0" id='autokey_opts'>
718
								<tr>
719
									<td>
720
										<textarea name="shared_key" cols="65" rows="7" class="formpre"><?=htmlspecialchars($pconfig['shared_key']);?></textarea>
721
										<br/>
722 2fa7a468 Carlos Eduardo Ramos
										<?=gettext("Paste your shared key here"); ?>.
723 3c11bd3c Matthew Grooms
									</td>
724
								</tr>
725
							</table>
726 d799787e Matthew Grooms
						</td>
727
					</tr>
728
					<tr>
729 2fa7a468 Carlos Eduardo Ramos
						<td width="22%" valign="top" class="vncellreq"><?=gettext("Encryption algorithm"); ?></td>
730 d799787e Matthew Grooms
						<td width="78%" class="vtable">
731
							<select name="crypto" class="formselect">
732
								<?php
733
									$cipherlist = openvpn_get_cipherlist();
734
									foreach ($cipherlist as $name => $desc):
735
									$selected = '';
736
									if ($name == $pconfig['crypto'])
737
										$selected = ' selected';
738
								?>
739
								<option value="<?=$name;?>"<?=$selected?>>
740
									<?=htmlspecialchars($desc);?>
741
								</option>
742
								<?php endforeach; ?>
743
							</select>
744
						</td>
745
					</tr>
746 582c58ae jim-p
					<tr id="engine">
747
						<td width="22%" valign="top" class="vncellreq"><?=gettext("Hardware Crypto"); ?></td>
748
						<td width="78%" class="vtable">
749
							<select name="engine" class="formselect">
750
								<?php
751
									$engines = openvpn_get_engines();
752
									foreach ($engines as $name => $desc):
753
									$selected = '';
754
									if ($name == $pconfig['engine'])
755
										$selected = ' selected';
756
								?>
757
								<option value="<?=$name;?>"<?=$selected?>>
758
									<?=htmlspecialchars($desc);?>
759
								</option>
760
								<?php endforeach; ?>
761
							</select>
762
						</td>
763
					</tr>
764 d799787e Matthew Grooms
					<tr>
765
						<td colspan="2" class="list" height="12"></td>
766
					</tr>
767
					<tr>
768 2fa7a468 Carlos Eduardo Ramos
						<td colspan="2" valign="top" class="listtopic"><?=gettext("Tunnel Settings"); ?></td>
769 d799787e Matthew Grooms
					</tr>
770
					<tr>
771 4856df9b jim-p
						<td width="22%" valign="top" class="vncell"><?=gettext("IPv4 Tunnel Network"); ?></td>
772 d799787e Matthew Grooms
						<td width="78%" class="vtable">
773
							<input name="tunnel_network" type="text" class="formfld unknown" size="20" value="<?=htmlspecialchars($pconfig['tunnel_network']);?>">
774
							<br>
775 2fa7a468 Carlos Eduardo Ramos
							<?=gettext("This is the virtual network used for private " .
776
							"communications between this client and the " .
777
							"server expressed using CIDR (eg. 10.0.8.0/24). " .
778
							"The first network address is assumed to be the " .
779
							"server address and the second network address " .
780
							"will be assigned to the client virtual " .
781
							"interface"); ?>.
782 d799787e Matthew Grooms
						</td>
783
					</tr>
784
					<tr>
785 4856df9b jim-p
						<td width="22%" valign="top" class="vncell"><?=gettext("IPv6 Tunnel Network"); ?></td>
786
						<td width="78%" class="vtable">
787
							<input name="tunnel_networkv6" type="text" class="formfld unknown" size="20" value="<?=htmlspecialchars($pconfig['tunnel_networkv6']);?>">
788
							<br>
789
							<?=gettext("This is the IPv6 virtual network used for private " .
790
							"communications between this client and the " .
791
							"server expressed using CIDR (eg. fe80::/64). " .
792
							"The first network address is assumed to be the " .
793
							"server address and the second network address " .
794
							"will be assigned to the client virtual " .
795
							"interface"); ?>.
796
						</td>
797
					</tr>
798
					<tr>
799
						<td width="22%" valign="top" class="vncell"><?=gettext("IPv4 Remote Network"); ?></td>
800 d799787e Matthew Grooms
						<td width="78%" class="vtable">
801
							<input name="remote_network" type="text" class="formfld unknown" size="20" value="<?=htmlspecialchars($pconfig['remote_network']);?>">
802
							<br>
803 2fa7a468 Carlos Eduardo Ramos
							<?=gettext("This is a network that will be routed through " .
804
							"the tunnel, so that a site-to-site VPN can be " .
805
							"established without manually changing the " .
806
							"routing tables. Expressed as a CIDR range. If " .
807 e8d65d0f Phil Davis
							"this is a site-to-site VPN, enter the " .
808 2fa7a468 Carlos Eduardo Ramos
							"remote LAN here. You may leave this blank to " .
809
							"only communicate with other clients"); ?>.
810 d799787e Matthew Grooms
						</td>
811
					</tr>
812 4856df9b jim-p
					<tr>
813
						<td width="22%" valign="top" class="vncell"><?=gettext("IPv6 Remote Network"); ?></td>
814
						<td width="78%" class="vtable">
815
							<input name="remote_network" type="text" class="formfld unknown" size="20" value="<?=htmlspecialchars($pconfig['remote_network']);?>">
816
							<br>
817
							<?=gettext("This is an IPv6 network that will be routed through " .
818
							"the tunnel, so that a site-to-site VPN can be " .
819
							"established without manually changing the " .
820
							"routing tables. Expressed as an IP/PREFIX. If " .
821
							"this is a site-to-site VPN, enter the " .
822
							"remote LAN here. You may leave this blank to " .
823
							"only communicate with other clients"); ?>.
824
						</td>
825
					</tr>
826 d799787e Matthew Grooms
					<tr>
827
						<td width="22%" valign="top" class="vncell"><?=gettext("Limit outgoing bandwidth");?></td>
828
						<td width="78%" class="vtable">
829
							<input name="use_shaper" type="text" class="formfld unknown" size="5" value="<?=htmlspecialchars($pconfig['use_shaper']);?>"/>
830
							<br/>
831 2fa7a468 Carlos Eduardo Ramos
							<?=gettext("Maximum outgoing bandwidth for this tunnel. " .
832
							"Leave empty for no limit. The input value has " .
833
							"to be something between 100 bytes/sec and 100 " .
834
							"Mbytes/sec (entered as bytes per second)"); ?>.
835 d799787e Matthew Grooms
						</td>
836
					</tr>
837
					<tr>
838 2fa7a468 Carlos Eduardo Ramos
						<td width="22%" valign="top" class="vncell"><?=gettext("Compression"); ?></td>
839 d799787e Matthew Grooms
						<td width="78%" class="vtable">
840
							<table border="0" cellpadding="2" cellspacing="0">
841
								<tr>
842
									<td>
843
										<?php set_checked($pconfig['compression'],$chk); ?>
844
										<input name="compression" type="checkbox" value="yes" <?=$chk;?>>
845
									</td>
846
									<td>
847
										<span class="vexpl">
848 2fa7a468 Carlos Eduardo Ramos
											<?=gettext("Compress tunnel packets using the LZO algorithm"); ?>.
849 d799787e Matthew Grooms
										</span>
850
									</td>
851
								</tr>
852
							</table>
853
						</td>
854
					</tr>
855
					<tr>
856 2fa7a468 Carlos Eduardo Ramos
						<td width="22%" valign="top" class="vncell"><?=gettext("Type-of-Service"); ?></td>
857 d799787e Matthew Grooms
						<td width="78%" class="vtable">
858
							<table border="0" cellpadding="2" cellspacing="0">
859
								<tr>
860
									<td>
861 1cb0b40a Matthew Grooms
										<?php set_checked($pconfig['passtos'],$chk); ?>
862
										<input name="passtos" type="checkbox" value="yes" <?=$chk;?>>
863 d799787e Matthew Grooms
									</td>
864
									<td>
865
										<span class="vexpl">
866 2fa7a468 Carlos Eduardo Ramos
											<?=gettext("Set the TOS IP header value of tunnel packets to match the encapsulated packet value"); ?>.
867 d799787e Matthew Grooms
										</span>
868
									</td>
869
								</tr>
870
							</table>
871
						</td>
872
					</tr>
873 4856df9b jim-p
				</table>
874
875
				<table width="100%" border="0" cellpadding="6" cellspacing="0" id="client_opts">
876 c7323d81 sullrich
					<tr>
877
						<td colspan="2" class="list" height="12"></td>
878
					</tr>
879
					<tr>
880 2fa7a468 Carlos Eduardo Ramos
						<td colspan="2" valign="top" class="listtopic"><?=gettext("Advanced configuration"); ?></td>
881 c7323d81 sullrich
					</tr>
882
					<tr>
883 2fa7a468 Carlos Eduardo Ramos
						<td width="22%" valign="top" class="vncell"><?=gettext("Advanced"); ?></td>
884 c7323d81 sullrich
						<td width="78%" class="vtable">
885
							<table border="0" cellpadding="2" cellspacing="0">
886
								<tr>
887
									<td>
888 dd5bf424 Scott Ullrich
										<textarea rows="6" cols="78" name="custom_options" id="custom_options"><?=htmlspecialchars($pconfig['custom_options']);?></textarea><br/>
889 2fa7a468 Carlos Eduardo Ramos
										<?=gettext("Enter any additional options you would like to add to the OpenVPN client configuration here, separated by a semicolon"); ?><br/>
890
										<?=gettext("EXAMPLE: route 10.0.0.0 255.255.255.0;"); ?>
891 c7323d81 sullrich
									</td>
892
								</tr>
893
							</table>
894
						</td>
895 4856df9b jim-p
					</tr>
896
				</table>
897
898
				<br/>
899
				<table width="100%" border="0" cellpadding="6" cellspacing="0">
900 d799787e Matthew Grooms
					<tr>
901
						<td width="22%" valign="top">&nbsp;</td>
902
						<td width="78%"> 
903 2fa7a468 Carlos Eduardo Ramos
							<input name="save" type="submit" class="formbtn" value="<?=gettext("Save"); ?>"> 
904 d799787e Matthew Grooms
							<input name="act" type="hidden" value="<?=$act;?>">
905
							<?php if (isset($id) && $a_client[$id]): ?>
906
							<input name="id" type="hidden" value="<?=$id;?>">
907
							<?php endif; ?>
908
						</td>
909
					</tr>
910
				</table>
911
			</form>
912
913
			<?php else: ?>
914
915 79633b6c Evgeny Yurchenko
			<table class="sortable" width="100%" border="0" cellpadding="0" cellspacing="0">
916 7773b868 jim-p
				<thead>
917 d799787e Matthew Grooms
				<tr>
918 2fa7a468 Carlos Eduardo Ramos
					<td width="10%" class="listhdrr"><?=gettext("Disabled"); ?></td>
919
					<td width="10%" class="listhdrr"><?=gettext("Protocol"); ?></td>
920
					<td width="30%" class="listhdrr"><?=gettext("Server"); ?></td>
921
					<td width="40%" class="listhdrr"><?=gettext("Description"); ?></td>
922 d799787e Matthew Grooms
					<td width="10%" class="list"></td>
923
				</tr>
924 7773b868 jim-p
				</thead>
925
				<tbody>
926 d799787e Matthew Grooms
				<?php
927
					$i = 0;
928
					foreach($a_client as $client):
929
						$disabled = "NO";
930 8319ee63 jim-p
						if (isset($client['disable']))
931 d799787e Matthew Grooms
							$disabled = "YES";
932
						$server = "{$client['server_addr']}:{$client['server_port']}";
933
				?>
934 c67bbe04 Chris Buechler
				<tr ondblclick="document.location='vpn_openvpn_client.php?act=edit&id=<?=$i;?>'">
935 d799787e Matthew Grooms
					<td class="listlr">
936
						<?=$disabled;?>
937
					</td>
938
					<td class="listr">
939
						<?=htmlspecialchars($client['protocol']);?>
940
					</td>
941
					<td class="listr">
942
						<?=htmlspecialchars($server);?>
943
					</td>
944 296a3cb6 Scott Ullrich
					<td class="listbg">
945 d799787e Matthew Grooms
						<?=htmlspecialchars($client['description']);?>
946
					</td>
947
					<td valign="middle" nowrap class="list">
948
						<a href="vpn_openvpn_client.php?act=edit&id=<?=$i;?>">
949 2fa7a468 Carlos Eduardo Ramos
							<img src="./themes/<?=$g['theme'];?>/images/icons/icon_e.gif" title="<?=gettext("edit client"); ?>" width="17" height="17" border="0">
950 d799787e Matthew Grooms
						</a>
951
						&nbsp;
952 2fa7a468 Carlos Eduardo Ramos
						<a href="vpn_openvpn_client.php?act=del&id=<?=$i;?>" onclick="return confirm('<?=gettext("Do you really want to delete this client?"); ?>')">
953
							<img src="/themes/<?=$g['theme'];?>/images/icons/icon_x.gif" title="<?=gettext("delete client"); ?>" width="17" height="17" border="0">
954 d799787e Matthew Grooms
						</a>
955
					</td>
956
				</tr>
957
				<?php
958
					$i++;
959
					endforeach;
960
				?>
961 7773b868 jim-p
				</tbody>
962
				<tfoot>
963 d799787e Matthew Grooms
				<tr>
964
					<td class="list" colspan="4"></td>
965
					<td class="list">
966 2fa7a468 Carlos Eduardo Ramos
						<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">
967 d799787e Matthew Grooms
						</a>
968
					</td>
969
				</tr>
970
				<tr>
971
					<td colspan="4">
972
						<p>
973
							<?=gettext("Additional OpenVPN clients can be added here.");?>
974
						</p>
975
					</td>
976
				</tr>
977 7773b868 jim-p
				</tfoot>
978 d799787e Matthew Grooms
			</table>
979
980 ee9933b6 Renato Botelho
			<?php endif; ?>
981 d799787e Matthew Grooms
982
		</td>
983
	</tr>
984
</table>
985
<script language="JavaScript">
986
<!--
987 3c11bd3c Matthew Grooms
mode_change();
988
autokey_change();
989
tlsauth_change();
990 762a24a3 Ermal Lu?i
useproxy_changed();
991 d799787e Matthew Grooms
//-->
992
</script>
993
</body>
994
<?php include("fend.inc"); ?>
995
996
<?php
997
998
/* local utility functions */
999
1000
function set_checked($var,& $chk) {
1001
    if($var)
1002
        $chk = 'checked';
1003
    else
1004
        $chk = '';
1005
}
1006
1007 174ba22b smos
?>