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
|
|
38
|
require("guiconfig.inc");
|
39
|
|
40
|
$pgtitle = array("OpenVPN", "Client");
|
41
|
|
42
|
if (!is_array($config['openvpn']['openvpn-client']))
|
43
|
$config['openvpn']['openvpn-client'] = array();
|
44
|
|
45
|
$a_client = &$config['openvpn']['openvpn-client'];
|
46
|
|
47
|
$id = $_GET['id'];
|
48
|
if (isset($_POST['id']))
|
49
|
$id = $_POST['id'];
|
50
|
|
51
|
$act = $_GET['act'];
|
52
|
if (isset($_POST['act']))
|
53
|
$act = $_POST['act'];
|
54
|
|
55
|
if ($_GET['act'] == "del") {
|
56
|
|
57
|
if (!$a_client[$id]) {
|
58
|
pfSenseHeader("vpn_openvpn_client.php");
|
59
|
exit;
|
60
|
}
|
61
|
|
62
|
openvpn_delete('client', $a_client[$id]);
|
63
|
unset($a_client[$id]);
|
64
|
write_config();
|
65
|
$savemsg = gettext("Client successfully deleted")."<br/>";
|
66
|
}
|
67
|
|
68
|
if($_GET['act']=="new"){
|
69
|
$pconfig['interface'] = "wan";
|
70
|
$pconfig['server_port'] = 1194;
|
71
|
}
|
72
|
|
73
|
if($_GET['act']=="edit"){
|
74
|
|
75
|
if (isset($id) && $a_client[$id]) {
|
76
|
|
77
|
$pconfig['disable'] = $a_client[$id]['disable'];
|
78
|
$pconfig['protocol'] = $a_client[$id]['protocol'];
|
79
|
$pconfig['interface'] = $a_client[$id]['interface'];
|
80
|
$pconfig['local_port'] = $a_client[$id]['local_port'];
|
81
|
$pconfig['server_addr'] = $a_client[$id]['server_addr'];
|
82
|
$pconfig['server_port'] = $a_client[$id]['server_port'];
|
83
|
$pconfig['resolve_retry'] = $a_client[$id]['resolve_retry'];
|
84
|
$pconfig['proxy_addr'] = $a_client[$id]['proxy_addr'];
|
85
|
$pconfig['proxy_port'] = $a_client[$id]['proxy_port'];
|
86
|
$pconfig['description'] = $a_client[$id]['description'];
|
87
|
|
88
|
$pconfig['auth_method'] = $a_client[$id]['auth_method'];
|
89
|
if ($pconfig['auth_method'] == "shared_key")
|
90
|
$pconfig['shared_key'] = base64_decode($a_client[$id]['shared_key']);
|
91
|
else {
|
92
|
$pconfig['caref'] = $a_client[$id]['caref'];
|
93
|
$pconfig['certref'] = $a_client[$id]['certref'];
|
94
|
}
|
95
|
$pconfig['crypto'] = $a_client[$id]['crypto'];
|
96
|
|
97
|
$pconfig['tunnel_network'] = $a_client[$id]['tunnel_network'];
|
98
|
$pconfig['remote_network'] = $a_client[$id]['remote_network'];
|
99
|
$pconfig['compression'] = $a_client[$id]['compression'];
|
100
|
$pconfig['settos'] = $a_client[$id]['settos'];
|
101
|
}
|
102
|
}
|
103
|
|
104
|
if ($_POST) {
|
105
|
|
106
|
unset($input_errors);
|
107
|
$pconfig = $_POST;
|
108
|
|
109
|
if (isset($id) && $a_client[$id])
|
110
|
$vpnid = $a_client[$id]['vpnid'];
|
111
|
else
|
112
|
$vpnid = 0;
|
113
|
|
114
|
/* input validation */
|
115
|
if ($pconfig['local_port']) {
|
116
|
|
117
|
if ($result = openvpn_validate_port($pconfig['local_port'], 'Local port'))
|
118
|
$input_errors[] = $result;
|
119
|
|
120
|
if (openvpn_port_used($pconfig['protocol'], $pconfig['local_port']) != $vpnid)
|
121
|
$input_errors[] = "The specified 'Local port' is in use. Please select another value";
|
122
|
}
|
123
|
|
124
|
if ($result = openvpn_validate_host($pconfig['server_addr'], 'Server host or address'))
|
125
|
$input_errors[] = $result;
|
126
|
|
127
|
if ($result = openvpn_validate_port($pconfig['server_port'], 'Server port'))
|
128
|
$input_errors[] = $result;
|
129
|
|
130
|
if ($pconfig['proxy_addr']) {
|
131
|
|
132
|
if ($result = openvpn_validate_host($pconfig['proxy_addr'], 'Proxy host or address'))
|
133
|
$input_errors[] = $result;
|
134
|
|
135
|
if ($result = openvpn_validate_port($pconfig['proxy_port'], 'Proxy port'))
|
136
|
$input_errors[] = $result;
|
137
|
}
|
138
|
|
139
|
if ($result = openvpn_validate_cidr($pconfig['tunnel_network'], 'Tunnel network'))
|
140
|
$input_errors[] = $result;
|
141
|
|
142
|
if ($result = openvpn_validate_cidr($pconfig['remote_network'], 'Remote network'))
|
143
|
$input_errors[] = $result;
|
144
|
|
145
|
if ($pconfig['auth_method'] == 'shared_key')
|
146
|
if (!strstr($pconfig['shared_key'], "-----BEGIN OpenVPN Static key V1-----") ||
|
147
|
!strstr($pconfig['shared_key'], "-----END OpenVPN Static key V1-----"))
|
148
|
$input_errors[] = "The field 'Shared Key' does not appear to be valid";
|
149
|
|
150
|
if ($pconfig['auth_method'] == 'shared_key') {
|
151
|
$reqdfields = array('shared_key');
|
152
|
$reqdfieldsn = array('Shared key');
|
153
|
} else {
|
154
|
$reqdfields = explode(" ", "caref certref");
|
155
|
$reqdfieldsn = explode(",", "Certificate Authority,Certificate");;
|
156
|
}
|
157
|
|
158
|
$reqdfields[] = 'tunnel_network';
|
159
|
$reqdfieldsn[] = 'Tunnel network';
|
160
|
|
161
|
do_input_validation($_POST, $reqdfields, $reqdfieldsn, &$input_errors);
|
162
|
|
163
|
if (!$input_errors) {
|
164
|
|
165
|
$client = array();
|
166
|
|
167
|
if ($vpnid)
|
168
|
$client['vpnid'] = $vpnid;
|
169
|
else
|
170
|
$client['vpnid'] = openvpn_vpnid_next();
|
171
|
|
172
|
$client['disable'] = $pconfig['disable'];
|
173
|
$client['protocol'] = $pconfig['protocol'];
|
174
|
$client['interface'] = $pconfig['interface'];
|
175
|
$client['local_port'] = $pconfig['local_port'];
|
176
|
$client['server_addr'] = $pconfig['server_addr'];
|
177
|
$client['server_port'] = $pconfig['server_port'];
|
178
|
$client['resolve_retry'] = $pconfig['resolve_retry'];
|
179
|
$client['proxy_addr'] = $pconfig['proxy_addr'];
|
180
|
$client['proxy_port'] = $pconfig['proxy_port'];
|
181
|
$client['description'] = $pconfig['description'];
|
182
|
|
183
|
$client['auth_method'] = $pconfig['auth_method'];
|
184
|
if ($client['auth_method'] == "shared_key")
|
185
|
$client['shared_key'] = base64_encode($pconfig['shared_key']);
|
186
|
else {
|
187
|
$client['caref'] = $pconfig['caref'];
|
188
|
$client['certref'] = $pconfig['certref'];
|
189
|
}
|
190
|
$client['crypto'] = $pconfig['crypto'];
|
191
|
|
192
|
$client['tunnel_network'] = $pconfig['tunnel_network'];
|
193
|
$client['remote_network'] = $pconfig['remote_network'];
|
194
|
$client['compression'] = $pconfig['compression'];
|
195
|
|
196
|
if (isset($id) && $a_client[$id])
|
197
|
$a_client[$id] = $client;
|
198
|
else
|
199
|
$a_client[] = $client;
|
200
|
|
201
|
openvpn_resync('client', $client);
|
202
|
write_config();
|
203
|
|
204
|
header("Location: vpn_openvpn_client.php");
|
205
|
exit;
|
206
|
}
|
207
|
}
|
208
|
|
209
|
include("head.inc");
|
210
|
|
211
|
?>
|
212
|
|
213
|
<body link="#000000" vlink="#000000" alink="#000000" onload="<?= $jsevents["body"]["onload"] ?>">
|
214
|
<?php include("fbegin.inc"); ?>
|
215
|
<script language="JavaScript">
|
216
|
<!--
|
217
|
|
218
|
function method_change() {
|
219
|
index = document.iform.auth_method.selectedIndex;
|
220
|
value = document.iform.auth_method.options[index].value;
|
221
|
switch(value) {
|
222
|
case "pki":
|
223
|
document.getElementById("pki_ca").style.display="";
|
224
|
document.getElementById("pki_cert").style.display="";
|
225
|
document.getElementById("psk").style.display="none";
|
226
|
break;
|
227
|
case "shared_key":
|
228
|
document.getElementById("pki_ca").style.display="none";
|
229
|
document.getElementById("pki_cert").style.display="none";
|
230
|
document.getElementById("psk").style.display="";
|
231
|
break;
|
232
|
}
|
233
|
}
|
234
|
|
235
|
//-->
|
236
|
</script>
|
237
|
<?php
|
238
|
if ($input_errors)
|
239
|
print_input_errors($input_errors);
|
240
|
if ($savemsg)
|
241
|
print_info_box($savemsg);
|
242
|
?>
|
243
|
<table width="100%" border="0" cellpadding="0" cellspacing="0">
|
244
|
<tr>
|
245
|
<td class="tabnavtbl">
|
246
|
<ul id="tabnav">
|
247
|
<?php
|
248
|
$tab_array = array();
|
249
|
$tab_array[] = array(gettext("Server"), false, "vpn_openvpn_server.php");
|
250
|
$tab_array[] = array(gettext("Client"), true, "vpn_openvpn_client.php");
|
251
|
$tab_array[] = array(gettext("Client Specific Overrides"), false, "vpn_openvpn_csc.php");
|
252
|
display_top_tabs($tab_array);
|
253
|
?>
|
254
|
</ul>
|
255
|
</td>
|
256
|
</tr>
|
257
|
<tr>
|
258
|
<td class="tabcont">
|
259
|
|
260
|
<?php if($act=="new" || $act=="edit"): ?>
|
261
|
|
262
|
<form action="vpn_openvpn_client.php" method="post" name="iform" id="iform" onsubmit="presubmit()">
|
263
|
<table width="100%" border="0" cellpadding="6" cellspacing="0">
|
264
|
<tr>
|
265
|
<td width="22%" valign="top" class="vncellreq">Disabled</td>
|
266
|
<td width="78%" class="vtable">
|
267
|
<table border="0" cellpadding="0" cellspacing="0">
|
268
|
<tr>
|
269
|
<td>
|
270
|
<?php set_checked($pconfig['disable'],$chk); ?>
|
271
|
<input name="disable" type="checkbox" value="yes" <?=$chk;?>/>
|
272
|
</td>
|
273
|
<td>
|
274
|
|
275
|
<span class="vexpl">
|
276
|
<strong>Disable this client</strong><br>
|
277
|
</span>
|
278
|
</td>
|
279
|
</tr>
|
280
|
</table>
|
281
|
Set this option to disable this client without removing it from the list.
|
282
|
</td>
|
283
|
</tr>
|
284
|
<tr>
|
285
|
<td width="22%" valign="top" class="vncellreq"><?=gettext("Protocol");?></td>
|
286
|
<td width="78%" class="vtable">
|
287
|
<select name='protocol' class="formselect">
|
288
|
<?php
|
289
|
foreach ($openvpn_prots as $prot):
|
290
|
$selected = "";
|
291
|
if ($pconfig['protocol'] == $prot)
|
292
|
$selected = "selected";
|
293
|
?>
|
294
|
<option value="<?=$prot;?>" <?=$selected;?>><?=$prot;?></option>
|
295
|
<?php endforeach; ?>
|
296
|
</select>
|
297
|
</td>
|
298
|
</tr>
|
299
|
<tr>
|
300
|
<td width="22%" valign="top" class="vncellreq">Interface</td>
|
301
|
<td width="78%" class="vtable">
|
302
|
<select name="interface" class="formselect">
|
303
|
<?php
|
304
|
$interfaces = get_configured_interface_with_descr();
|
305
|
$carpips = find_number_of_needed_carp_interfaces();
|
306
|
for ($i=0; $i<$carpips; $i++) {
|
307
|
$carpip = find_interface_ip("carp" . $i);
|
308
|
$interfaces['carp' . $i] = "CARP{$i} ({$carpip})";
|
309
|
}
|
310
|
foreach ($interfaces as $iface => $ifacename):
|
311
|
?>
|
312
|
<option value="<?=$iface;?>" <?php if ($iface == $pconfig['interface']) echo "selected"; ?>>
|
313
|
<?=htmlspecialchars($ifacename);?>
|
314
|
</option>
|
315
|
<?php endforeach; ?>
|
316
|
</select> <br>
|
317
|
</td>
|
318
|
</tr>
|
319
|
<tr>
|
320
|
<td width="22%" valign="top" class="vncell"><?=gettext("Local port");?></td>
|
321
|
<td width="78%" class="vtable">
|
322
|
<input name="local_port" type="text" class="formfld unknown" size="5" value="<?=htmlspecialchars($pconfig['local_port']);?>"/>
|
323
|
<br/>
|
324
|
Set this option if you would like to bind to a specific port.
|
325
|
</td>
|
326
|
</tr>
|
327
|
<tr>
|
328
|
<td width="22%" valign="top" class="vncellreq"><?=gettext("Server host or address");?></td>
|
329
|
<td width="78%" class="vtable">
|
330
|
<input name="server_addr" type="text" class="formfld unknown" size="30" value="<?=htmlspecialchars($pconfig['server_addr']);?>"/>
|
331
|
</td>
|
332
|
</tr>
|
333
|
<tr>
|
334
|
<td width="22%" valign="top" class="vncellreq"><?=gettext("Server port");?></td>
|
335
|
<td width="78%" class="vtable">
|
336
|
<input name="server_port" type="text" class="formfld unknown" size="5" value="<?=htmlspecialchars($pconfig['server_port']);?>"/>
|
337
|
</td>
|
338
|
</tr>
|
339
|
<tr>
|
340
|
<td width="22%" valign="top" class="vncell"><?=gettext("Proxy host or address");?></td>
|
341
|
<td width="78%" class="vtable">
|
342
|
<input name="proxy_addr" type="text" class="formfld unknown" size="30" value="<?=htmlspecialchars($pconfig['proxy_addr']);?>"/>
|
343
|
</td>
|
344
|
</tr>
|
345
|
<tr>
|
346
|
<td width="22%" valign="top" class="vncell"><?=gettext("Proxy port");?></td>
|
347
|
<td width="78%" class="vtable">
|
348
|
<input name="proxy_port" type="text" class="formfld unknown" size="5" value="<?=htmlspecialchars($pconfig['proxy_port']);?>"/>
|
349
|
</td>
|
350
|
</tr>
|
351
|
<tr>
|
352
|
<td width="22%" valign="top" class="vncell">Server host name resolution</td>
|
353
|
<td width="78%" class="vtable">
|
354
|
<table border="0" cellpadding="2" cellspacing="0">
|
355
|
<tr>
|
356
|
<td>
|
357
|
<?php set_checked($pconfig['resolve_retry'],$chk); ?>
|
358
|
<input name="compression" type="checkbox" value="yes" <?=$chk;?>>
|
359
|
</td>
|
360
|
<td>
|
361
|
<span class="vexpl">
|
362
|
Infinitely resolve server
|
363
|
</span>
|
364
|
</td>
|
365
|
</tr>
|
366
|
</table>
|
367
|
Continuously attempt to resolve the server host
|
368
|
name. Useful when communicating with a server
|
369
|
that is not permanently connected to the internet.
|
370
|
</td>
|
371
|
</tr>
|
372
|
<tr>
|
373
|
<td width="22%" valign="top" class="vncell">Description</td>
|
374
|
<td width="78%" class="vtable">
|
375
|
<input name="description" type="text" class="formfld unknown" size="30" value="<?=htmlspecialchars($pconfig['description']);?>">
|
376
|
<br>
|
377
|
You may enter a description here for your reference (not parsed).
|
378
|
</td>
|
379
|
</tr>
|
380
|
<tr>
|
381
|
<td colspan="2" class="list" height="12"></td>
|
382
|
</tr>
|
383
|
<tr>
|
384
|
<td colspan="2" valign="top" class="listtopic">Cryptographic Settings</td>
|
385
|
</tr>
|
386
|
<tr>
|
387
|
<td width="22%" valign="top" class="vncellreq">Authentication Method</td>
|
388
|
<td width="78%" class="vtable">
|
389
|
<select name='auth_method' id='auth_method' class="formselect" onchange='method_change()'>
|
390
|
<?php
|
391
|
foreach ($openvpn_auth_methods as $method => $name):
|
392
|
$selected = "";
|
393
|
if ($pconfig['auth_method'] == $method)
|
394
|
$selected = "selected";
|
395
|
?>
|
396
|
<option value="<?=$method;?>" <?=$selected;?>><?=$name;?></option>
|
397
|
<?php endforeach; ?>
|
398
|
</select>
|
399
|
</td>
|
400
|
</tr>
|
401
|
<tr id="pki_ca">
|
402
|
<td width="22%" valign="top" class="vncellreq">Certificate Authority</td>
|
403
|
<td width="78%" class="vtable">
|
404
|
<select name='caref' class="formselect">
|
405
|
<?php
|
406
|
foreach ($config['system']['ca'] as $ca):
|
407
|
$selected = "";
|
408
|
if ($pconfig['caref'] == $ca['refid'])
|
409
|
$selected = "selected";
|
410
|
?>
|
411
|
<option value="<?=$ca['refid'];?>" <?=$selected;?>><?=$ca['name'];?></option>
|
412
|
<?php endforeach; ?>
|
413
|
</select>
|
414
|
</td>
|
415
|
</tr>
|
416
|
<tr id="pki_cert">
|
417
|
<td width="22%" valign="top" class="vncellreq">Certificate</td>
|
418
|
<td width="78%" class="vtable">
|
419
|
<select name='certref' class="formselect">
|
420
|
<?php
|
421
|
foreach ($config['system']['cert'] as $cert):
|
422
|
$selected = "";
|
423
|
if ($pconfig['certref'] == $cert['refid'])
|
424
|
$selected = "selected";
|
425
|
?>
|
426
|
<option value="<?=$cert['refid'];?>" <?=$selected;?>><?=$cert['name'];?></option>
|
427
|
<?php endforeach; ?>
|
428
|
</select>
|
429
|
</td>
|
430
|
</tr>
|
431
|
<tr id="psk">
|
432
|
<td width="22%" valign="top" class="vncellreq">Shared Key</td>
|
433
|
<td width="78%" class="vtable">
|
434
|
<textarea name="shared_key" cols="65" rows="7" class="formpre"><?=htmlspecialchars($pconfig['shared_key']);?></textarea>
|
435
|
<br/>
|
436
|
Paste your shared key here.
|
437
|
</td>
|
438
|
</tr>
|
439
|
<tr>
|
440
|
<td width="22%" valign="top" class="vncellreq">Encryption algorithm</td>
|
441
|
<td width="78%" class="vtable">
|
442
|
<select name="crypto" class="formselect">
|
443
|
<?php
|
444
|
$cipherlist = openvpn_get_cipherlist();
|
445
|
foreach ($cipherlist as $name => $desc):
|
446
|
$selected = '';
|
447
|
if ($name == $pconfig['crypto'])
|
448
|
$selected = ' selected';
|
449
|
?>
|
450
|
<option value="<?=$name;?>"<?=$selected?>>
|
451
|
<?=htmlspecialchars($desc);?>
|
452
|
</option>
|
453
|
<?php endforeach; ?>
|
454
|
</select>
|
455
|
</td>
|
456
|
</tr>
|
457
|
<tr>
|
458
|
<td colspan="2" class="list" height="12"></td>
|
459
|
</tr>
|
460
|
<tr>
|
461
|
<td colspan="2" valign="top" class="listtopic">Tunnel Settings</td>
|
462
|
</tr>
|
463
|
<tr>
|
464
|
<td width="22%" valign="top" class="vncellreq">Tunnel Network</td>
|
465
|
<td width="78%" class="vtable">
|
466
|
<input name="tunnel_network" type="text" class="formfld unknown" size="20" value="<?=htmlspecialchars($pconfig['tunnel_network']);?>">
|
467
|
<br>
|
468
|
This is the virtual network used for private
|
469
|
communications between this client and the
|
470
|
server expressed using CIDR (eg. 10.0.8.0/24).
|
471
|
The first network address is assumed to be the
|
472
|
server address and the second network address
|
473
|
will be assigned to the client virtual
|
474
|
interface.
|
475
|
</td>
|
476
|
</tr>
|
477
|
<tr>
|
478
|
<td width="22%" valign="top" class="vncell">Remote Network</td>
|
479
|
<td width="78%" class="vtable">
|
480
|
<input name="remote_network" type="text" class="formfld unknown" size="20" value="<?=htmlspecialchars($pconfig['remote_network']);?>">
|
481
|
<br>
|
482
|
This is a network that will be routed through
|
483
|
the tunnel, so that a site-to-site VPN can be
|
484
|
established without manually changing the
|
485
|
routing tables. Expressed as a CIDR range. If
|
486
|
this is a site-to-site VPN, enter here the
|
487
|
remote LAN here. You may leave this blank to
|
488
|
only communicate with other clients.
|
489
|
</td>
|
490
|
</tr>
|
491
|
<tr>
|
492
|
<td width="22%" valign="top" class="vncell"><?=gettext("Limit outgoing bandwidth");?></td>
|
493
|
<td width="78%" class="vtable">
|
494
|
<input name="use_shaper" type="text" class="formfld unknown" size="5" value="<?=htmlspecialchars($pconfig['use_shaper']);?>"/>
|
495
|
<br/>
|
496
|
Maximum outgoing bandwidth for this tunnel.
|
497
|
Leave empty for no limit. The input value has
|
498
|
to be something between 100 bytes/sec and 100
|
499
|
Mbytes/sec (entered as bytes per second).
|
500
|
</td>
|
501
|
</tr>
|
502
|
<tr>
|
503
|
<td width="22%" valign="top" class="vncell">Compression</td>
|
504
|
<td width="78%" class="vtable">
|
505
|
<table border="0" cellpadding="2" cellspacing="0">
|
506
|
<tr>
|
507
|
<td>
|
508
|
<?php set_checked($pconfig['compression'],$chk); ?>
|
509
|
<input name="compression" type="checkbox" value="yes" <?=$chk;?>>
|
510
|
</td>
|
511
|
<td>
|
512
|
<span class="vexpl">
|
513
|
Compress tunnel packets using the LZO algorithm.
|
514
|
</span>
|
515
|
</td>
|
516
|
</tr>
|
517
|
</table>
|
518
|
</td>
|
519
|
</tr>
|
520
|
<tr>
|
521
|
<td width="22%" valign="top" class="vncell">Type-of-Service</td>
|
522
|
<td width="78%" class="vtable">
|
523
|
<table border="0" cellpadding="2" cellspacing="0">
|
524
|
<tr>
|
525
|
<td>
|
526
|
<?php set_checked($pconfig['settos'],$chk); ?>
|
527
|
<input name="settos" type="checkbox" value="yes" <?=$chk;?>>
|
528
|
</td>
|
529
|
<td>
|
530
|
<span class="vexpl">
|
531
|
Set the TOS IP header value of tunnel packets to match the encapsulated packet value.
|
532
|
</span>
|
533
|
</td>
|
534
|
</tr>
|
535
|
</table>
|
536
|
</td>
|
537
|
</tr>
|
538
|
<tr>
|
539
|
<td width="22%" valign="top"> </td>
|
540
|
<td width="78%">
|
541
|
<input name="save" type="submit" class="formbtn" value="Save">
|
542
|
<input name="act" type="hidden" value="<?=$act;?>">
|
543
|
<?php if (isset($id) && $a_client[$id]): ?>
|
544
|
<input name="id" type="hidden" value="<?=$id;?>">
|
545
|
<?php endif; ?>
|
546
|
</td>
|
547
|
</tr>
|
548
|
</table>
|
549
|
</form>
|
550
|
|
551
|
<?php else: ?>
|
552
|
|
553
|
<table width="100%" border="0" cellpadding="0" cellspacing="0">
|
554
|
<tr>
|
555
|
<td width="10%" class="listhdrr">Disabled</td>
|
556
|
<td width="10%" class="listhdrr">Protocol</td>
|
557
|
<td width="30%" class="listhdrr">Server</td>
|
558
|
<td width="40%" class="listhdrr">Description</td>
|
559
|
<td width="10%" class="list"></td>
|
560
|
</tr>
|
561
|
<?php
|
562
|
$i = 0;
|
563
|
foreach($a_client as $client):
|
564
|
$disabled = "NO";
|
565
|
if ($client['disable'])
|
566
|
$disabled = "YES";
|
567
|
$server = "{$client['server_addr']}:{$client['server_port']}";
|
568
|
?>
|
569
|
<tr>
|
570
|
<td class="listlr">
|
571
|
<?=$disabled;?>
|
572
|
</td>
|
573
|
<td class="listr">
|
574
|
<?=htmlspecialchars($client['protocol']);?>
|
575
|
</td>
|
576
|
<td class="listr">
|
577
|
<?=htmlspecialchars($server);?>
|
578
|
</td>
|
579
|
<td class="listr">
|
580
|
<?=htmlspecialchars($client['description']);?>
|
581
|
</td>
|
582
|
<td valign="middle" nowrap class="list">
|
583
|
<a href="vpn_openvpn_client.php?act=edit&id=<?=$i;?>">
|
584
|
<img src="./themes/<?=$g['theme'];?>/images/icons/icon_e.gif" title="edit client" width="17" height="17" border="0">
|
585
|
</a>
|
586
|
|
587
|
<a href="vpn_openvpn_client.php?act=del&id=<?=$i;?>" onclick="return confirm('Do you really want to delete this client?')">
|
588
|
<img src="/themes/<?=$g['theme'];?>/images/icons/icon_x.gif" title="delete client" width="17" height="17" border="0">
|
589
|
</a>
|
590
|
</td>
|
591
|
</tr>
|
592
|
<?php
|
593
|
$i++;
|
594
|
endforeach;
|
595
|
?>
|
596
|
<tr>
|
597
|
<td class="list" colspan="4"></td>
|
598
|
<td class="list">
|
599
|
<a href="vpn_openvpn_client.php?act=new"><img src="./themes/<?=$g['theme'];?>/images/icons/icon_plus.gif" title="add client" width="17" height="17" border="0">
|
600
|
</a>
|
601
|
</td>
|
602
|
</tr>
|
603
|
<tr>
|
604
|
<td colspan="4">
|
605
|
<p>
|
606
|
<?=gettext("Additional OpenVPN clients can be added here.");?>
|
607
|
</p>
|
608
|
</td>
|
609
|
</tr>
|
610
|
</table>
|
611
|
|
612
|
<? endif; ?>
|
613
|
|
614
|
</td>
|
615
|
</tr>
|
616
|
</table>
|
617
|
<script language="JavaScript">
|
618
|
<!--
|
619
|
method_change();
|
620
|
//-->
|
621
|
</script>
|
622
|
</body>
|
623
|
<?php include("fend.inc"); ?>
|
624
|
|
625
|
<?php
|
626
|
|
627
|
/* local utility functions */
|
628
|
|
629
|
function set_checked($var,& $chk) {
|
630
|
if($var)
|
631
|
$chk = 'checked';
|
632
|
else
|
633
|
$chk = '';
|
634
|
}
|
635
|
|
636
|
?>
|
637
|
|