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