1
|
<?php
|
2
|
/*
|
3
|
vpn_openvpn_server.php
|
4
|
|
5
|
Copyright (C) 2008 Shrew Soft Inc.
|
6
|
Copyright (C) 2013-2015 Electric Sheep Fencing, LP
|
7
|
All rights reserved.
|
8
|
|
9
|
Redistribution and use in source and binary forms, with or without
|
10
|
modification, are permitted provided that the following conditions are met:
|
11
|
|
12
|
1. Redistributions of source code must retain the above copyright notice,
|
13
|
this list of conditions and the following disclaimer.
|
14
|
|
15
|
2. Redistributions in binary form must reproduce the above copyright
|
16
|
notice, this list of conditions and the following disclaimer in the
|
17
|
documentation and/or other materials provided with the distribution.
|
18
|
|
19
|
THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
20
|
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
|
21
|
AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
22
|
AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
|
23
|
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
24
|
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
25
|
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
26
|
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
27
|
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
28
|
POSSIBILITY OF SUCH DAMAGE.
|
29
|
*/
|
30
|
|
31
|
##|+PRIV
|
32
|
##|*IDENT=page-openvpn-server
|
33
|
##|*NAME=OpenVPN: Server page
|
34
|
##|*DESCR=Allow access to the 'OpenVPN: Server' page.
|
35
|
##|*MATCH=vpn_openvpn_server.php*
|
36
|
##|-PRIV
|
37
|
|
38
|
require("guiconfig.inc");
|
39
|
require_once("openvpn.inc");
|
40
|
|
41
|
if (!is_array($config['openvpn']['openvpn-server']))
|
42
|
$config['openvpn']['openvpn-server'] = array();
|
43
|
|
44
|
$a_server = &$config['openvpn']['openvpn-server'];
|
45
|
|
46
|
if (!is_array($config['ca']))
|
47
|
$config['ca'] = array();
|
48
|
|
49
|
$a_ca =& $config['ca'];
|
50
|
|
51
|
if (!is_array($config['cert']))
|
52
|
$config['cert'] = array();
|
53
|
|
54
|
$a_cert =& $config['cert'];
|
55
|
|
56
|
if (!is_array($config['crl']))
|
57
|
$config['crl'] = array();
|
58
|
|
59
|
$a_crl =& $config['crl'];
|
60
|
|
61
|
foreach ($a_crl as $cid => $acrl) {
|
62
|
if (!isset($acrl['refid']))
|
63
|
unset ($a_crl[$cid]);
|
64
|
}
|
65
|
|
66
|
if (is_numericint($_GET['id']))
|
67
|
$id = $_GET['id'];
|
68
|
|
69
|
if (isset($_POST['id']) && is_numericint($_POST['id']))
|
70
|
$id = $_POST['id'];
|
71
|
|
72
|
$act = $_GET['act'];
|
73
|
|
74
|
if (isset($_POST['act']))
|
75
|
$act = $_POST['act'];
|
76
|
|
77
|
if (isset($id) && $a_server[$id])
|
78
|
$vpnid = $a_server[$id]['vpnid'];
|
79
|
else
|
80
|
$vpnid = 0;
|
81
|
|
82
|
if ($_GET['act'] == "del") {
|
83
|
|
84
|
if (!isset($a_server[$id])) {
|
85
|
pfSenseHeader("vpn_openvpn_server.php");
|
86
|
exit;
|
87
|
}
|
88
|
|
89
|
if (!empty($a_server[$id]))
|
90
|
openvpn_delete('server', $a_server[$id]);
|
91
|
|
92
|
unset($a_server[$id]);
|
93
|
write_config();
|
94
|
$savemsg = gettext("Server successfully deleted")."<br />";
|
95
|
}
|
96
|
|
97
|
if($_GET['act']=="new") {
|
98
|
$pconfig['autokey_enable'] = "yes";
|
99
|
$pconfig['tlsauth_enable'] = "yes";
|
100
|
$pconfig['autotls_enable'] = "yes";
|
101
|
$pconfig['dh_length'] = 1024;
|
102
|
$pconfig['dev_mode'] = "tun";
|
103
|
$pconfig['interface'] = "wan";
|
104
|
$pconfig['local_port'] = openvpn_port_next('UDP');
|
105
|
$pconfig['pool_enable'] = "yes";
|
106
|
$pconfig['cert_depth'] = 1;
|
107
|
$pconfig['verbosity_level'] = 1; // Default verbosity is 1
|
108
|
// OpenVPN Defaults to SHA1
|
109
|
$pconfig['digest'] = "SHA1";
|
110
|
}
|
111
|
|
112
|
if($_GET['act']=="edit") {
|
113
|
|
114
|
if (isset($id) && $a_server[$id]) {
|
115
|
$pconfig['disable'] = isset($a_server[$id]['disable']);
|
116
|
$pconfig['mode'] = $a_server[$id]['mode'];
|
117
|
$pconfig['protocol'] = $a_server[$id]['protocol'];
|
118
|
$pconfig['authmode'] = $a_server[$id]['authmode'];
|
119
|
$pconfig['dev_mode'] = $a_server[$id]['dev_mode'];
|
120
|
$pconfig['interface'] = $a_server[$id]['interface'];
|
121
|
|
122
|
if (!empty($a_server[$id]['ipaddr'])) {
|
123
|
$pconfig['interface'] = $pconfig['interface'] . '|' . $a_server[$id]['ipaddr'];
|
124
|
}
|
125
|
|
126
|
$pconfig['local_port'] = $a_server[$id]['local_port'];
|
127
|
$pconfig['description'] = $a_server[$id]['description'];
|
128
|
$pconfig['custom_options'] = $a_server[$id]['custom_options'];
|
129
|
|
130
|
if ($pconfig['mode'] != "p2p_shared_key") {
|
131
|
if ($a_server[$id]['tls']) {
|
132
|
$pconfig['tlsauth_enable'] = "yes";
|
133
|
$pconfig['tls'] = base64_decode($a_server[$id]['tls']);
|
134
|
}
|
135
|
|
136
|
$pconfig['caref'] = $a_server[$id]['caref'];
|
137
|
$pconfig['crlref'] = $a_server[$id]['crlref'];
|
138
|
$pconfig['certref'] = $a_server[$id]['certref'];
|
139
|
$pconfig['dh_length'] = $a_server[$id]['dh_length'];
|
140
|
|
141
|
if (isset($a_server[$id]['cert_depth']))
|
142
|
$pconfig['cert_depth'] = $a_server[$id]['cert_depth'];
|
143
|
else
|
144
|
$pconfig['cert_depth'] = 1;
|
145
|
|
146
|
if ($pconfig['mode'] == "server_tls_user")
|
147
|
$pconfig['strictusercn'] = $a_server[$id]['strictusercn'];
|
148
|
} else
|
149
|
$pconfig['shared_key'] = base64_decode($a_server[$id]['shared_key']);
|
150
|
|
151
|
$pconfig['crypto'] = $a_server[$id]['crypto'];
|
152
|
// OpenVPN Defaults to SHA1 if unset
|
153
|
$pconfig['digest'] = !empty($a_server[$id]['digest']) ? $a_server[$id]['digest'] : "SHA1";
|
154
|
$pconfig['engine'] = $a_server[$id]['engine'];
|
155
|
|
156
|
$pconfig['tunnel_network'] = $a_server[$id]['tunnel_network'];
|
157
|
$pconfig['tunnel_networkv6'] = $a_server[$id]['tunnel_networkv6'];
|
158
|
|
159
|
$pconfig['remote_network'] = $a_server[$id]['remote_network'];
|
160
|
$pconfig['remote_networkv6'] = $a_server[$id]['remote_networkv6'];
|
161
|
$pconfig['gwredir'] = $a_server[$id]['gwredir'];
|
162
|
$pconfig['local_network'] = $a_server[$id]['local_network'];
|
163
|
$pconfig['local_networkv6'] = $a_server[$id]['local_networkv6'];
|
164
|
$pconfig['maxclients'] = $a_server[$id]['maxclients'];
|
165
|
$pconfig['compression'] = $a_server[$id]['compression'];
|
166
|
$pconfig['passtos'] = $a_server[$id]['passtos'];
|
167
|
$pconfig['client2client'] = $a_server[$id]['client2client'];
|
168
|
|
169
|
$pconfig['dynamic_ip'] = $a_server[$id]['dynamic_ip'];
|
170
|
$pconfig['pool_enable'] = $a_server[$id]['pool_enable'];
|
171
|
$pconfig['topology_subnet'] = $a_server[$id]['topology_subnet'];
|
172
|
|
173
|
$pconfig['serverbridge_dhcp'] = $a_server[$id]['serverbridge_dhcp'];
|
174
|
$pconfig['serverbridge_interface'] = $a_server[$id]['serverbridge_interface'];
|
175
|
$pconfig['serverbridge_dhcp_start'] = $a_server[$id]['serverbridge_dhcp_start'];
|
176
|
$pconfig['serverbridge_dhcp_end'] = $a_server[$id]['serverbridge_dhcp_end'];
|
177
|
|
178
|
$pconfig['dns_domain'] = $a_server[$id]['dns_domain'];
|
179
|
|
180
|
if ($pconfig['dns_domain'])
|
181
|
$pconfig['dns_domain_enable'] = true;
|
182
|
|
183
|
$pconfig['dns_server1'] = $a_server[$id]['dns_server1'];
|
184
|
$pconfig['dns_server2'] = $a_server[$id]['dns_server2'];
|
185
|
$pconfig['dns_server3'] = $a_server[$id]['dns_server3'];
|
186
|
$pconfig['dns_server4'] = $a_server[$id]['dns_server4'];
|
187
|
|
188
|
if ($pconfig['dns_server1'] ||
|
189
|
$pconfig['dns_server2'] ||
|
190
|
$pconfig['dns_server3'] ||
|
191
|
$pconfig['dns_server4'])
|
192
|
$pconfig['dns_server_enable'] = true;
|
193
|
|
194
|
$pconfig['ntp_server1'] = $a_server[$id]['ntp_server1'];
|
195
|
$pconfig['ntp_server2'] = $a_server[$id]['ntp_server2'];
|
196
|
|
197
|
if ($pconfig['ntp_server1'] ||
|
198
|
$pconfig['ntp_server2'])
|
199
|
$pconfig['ntp_server_enable'] = true;
|
200
|
|
201
|
$pconfig['netbios_enable'] = $a_server[$id]['netbios_enable'];
|
202
|
$pconfig['netbios_ntype'] = $a_server[$id]['netbios_ntype'];
|
203
|
$pconfig['netbios_scope'] = $a_server[$id]['netbios_scope'];
|
204
|
|
205
|
$pconfig['wins_server1'] = $a_server[$id]['wins_server1'];
|
206
|
$pconfig['wins_server2'] = $a_server[$id]['wins_server2'];
|
207
|
|
208
|
if ($pconfig['wins_server1'] ||
|
209
|
$pconfig['wins_server2'])
|
210
|
$pconfig['wins_server_enable'] = true;
|
211
|
|
212
|
$pconfig['client_mgmt_port'] = $a_server[$id]['client_mgmt_port'];
|
213
|
|
214
|
if ($pconfig['client_mgmt_port'])
|
215
|
$pconfig['client_mgmt_port_enable'] = true;
|
216
|
|
217
|
$pconfig['nbdd_server1'] = $a_server[$id]['nbdd_server1'];
|
218
|
|
219
|
if ($pconfig['nbdd_server1'])
|
220
|
$pconfig['nbdd_server_enable'] = true;
|
221
|
|
222
|
// just in case the modes switch
|
223
|
$pconfig['autokey_enable'] = "yes";
|
224
|
$pconfig['autotls_enable'] = "yes";
|
225
|
|
226
|
$pconfig['duplicate_cn'] = isset($a_server[$id]['duplicate_cn']);
|
227
|
|
228
|
$pconfig['no_tun_ipv6'] = $a_server[$id]['no_tun_ipv6'];
|
229
|
|
230
|
if (isset($a_server[$id]['verbosity_level']))
|
231
|
$pconfig['verbosity_level'] = $a_server[$id]['verbosity_level'];
|
232
|
else
|
233
|
$pconfig['verbosity_level'] = 1; // Default verbosity is 1
|
234
|
|
235
|
$pconfig['push_register_dns'] = $a_server[$id]['push_register_dns'];
|
236
|
}
|
237
|
}
|
238
|
if ($_POST) {
|
239
|
|
240
|
unset($input_errors);
|
241
|
$pconfig = $_POST;
|
242
|
|
243
|
if (isset($id) && $a_server[$id])
|
244
|
$vpnid = $a_server[$id]['vpnid'];
|
245
|
else
|
246
|
$vpnid = 0;
|
247
|
|
248
|
list($iv_iface, $iv_ip) = explode ("|",$pconfig['interface']);
|
249
|
|
250
|
if (is_ipaddrv4($iv_ip) && (stristr($pconfig['protocol'], "6") !== false)) {
|
251
|
$input_errors[] = gettext("Protocol and IP address families do not match. You cannot select an IPv6 protocol and an IPv4 IP address.");
|
252
|
} elseif (is_ipaddrv6($iv_ip) && (stristr($pconfig['protocol'], "6") === false)) {
|
253
|
$input_errors[] = gettext("Protocol and IP address families do not match. You cannot select an IPv4 protocol and an IPv6 IP address.");
|
254
|
} elseif ((stristr($pconfig['protocol'], "6") === false) && !get_interface_ip($iv_iface) && ($pconfig['interface'] != "any")) {
|
255
|
$input_errors[] = gettext("An IPv4 protocol was selected, but the selected interface has no IPv4 address.");
|
256
|
} elseif ((stristr($pconfig['protocol'], "6") !== false) && !get_interface_ipv6($iv_iface) && ($pconfig['interface'] != "any")) {
|
257
|
$input_errors[] = gettext("An IPv6 protocol was selected, but the selected interface has no IPv6 address.");
|
258
|
}
|
259
|
|
260
|
if ($pconfig['mode'] != "p2p_shared_key")
|
261
|
$tls_mode = true;
|
262
|
else
|
263
|
$tls_mode = false;
|
264
|
|
265
|
if (empty($pconfig['authmode']) && (($pconfig['mode'] == "server_user") || ($pconfig['mode'] == "server_tls_user")))
|
266
|
$input_errors[] = gettext("You must select a Backend for Authentication if the server mode requires User Auth.");
|
267
|
|
268
|
/* input validation */
|
269
|
if ($result = openvpn_validate_port($pconfig['local_port'], 'Local port'))
|
270
|
$input_errors[] = $result;
|
271
|
|
272
|
if ($result = openvpn_validate_cidr($pconfig['tunnel_network'], 'IPv4 Tunnel Network', false, "ipv4"))
|
273
|
$input_errors[] = $result;
|
274
|
|
275
|
if ($result = openvpn_validate_cidr($pconfig['tunnel_networkv6'], 'IPv6 Tunnel Network', false, "ipv6"))
|
276
|
$input_errors[] = $result;
|
277
|
|
278
|
if ($result = openvpn_validate_cidr($pconfig['remote_network'], 'IPv4 Remote Network', true, "ipv4"))
|
279
|
$input_errors[] = $result;
|
280
|
|
281
|
if ($result = openvpn_validate_cidr($pconfig['remote_networkv6'], 'IPv6 Remote Network', true, "ipv6"))
|
282
|
$input_errors[] = $result;
|
283
|
|
284
|
if ($result = openvpn_validate_cidr($pconfig['local_network'], 'IPv4 Local Network', true, "ipv4"))
|
285
|
$input_errors[] = $result;
|
286
|
|
287
|
if ($result = openvpn_validate_cidr($pconfig['local_networkv6'], 'IPv6 Local Network', true, "ipv6"))
|
288
|
$input_errors[] = $result;
|
289
|
|
290
|
$portused = openvpn_port_used($pconfig['protocol'], $pconfig['interface'], $pconfig['local_port'], $vpnid);
|
291
|
|
292
|
if (($portused != $vpnid) && ($portused != 0))
|
293
|
$input_errors[] = gettext("The specified 'Local port' is in use. Please select another value");
|
294
|
|
295
|
if ($pconfig['autokey_enable'])
|
296
|
$pconfig['shared_key'] = openvpn_create_key();
|
297
|
|
298
|
if (!$tls_mode && !$pconfig['autokey_enable']) {
|
299
|
if (!strstr($pconfig['shared_key'], "-----BEGIN OpenVPN Static key V1-----") ||
|
300
|
!strstr($pconfig['shared_key'], "-----END OpenVPN Static key V1-----"))
|
301
|
$input_errors[] = gettext("The field 'Shared Key' does not appear to be valid");
|
302
|
}
|
303
|
|
304
|
if ($tls_mode && $pconfig['tlsauth_enable'] && !$pconfig['autotls_enable']) {
|
305
|
if (!strstr($pconfig['tls'], "-----BEGIN OpenVPN Static key V1-----") ||
|
306
|
!strstr($pconfig['tls'], "-----END OpenVPN Static key V1-----"))
|
307
|
$input_errors[] = gettext("The field 'TLS Authentication Key' does not appear to be valid");
|
308
|
}
|
309
|
|
310
|
if ($pconfig['dns_server_enable']) {
|
311
|
if (!empty($pconfig['dns_server1']) && !is_ipaddr(trim($pconfig['dns_server1'])))
|
312
|
$input_errors[] = gettext("The field 'DNS Server #1' must contain a valid IP address");
|
313
|
if (!empty($pconfig['dns_server2']) && !is_ipaddr(trim($pconfig['dns_server2'])))
|
314
|
$input_errors[] = gettext("The field 'DNS Server #2' must contain a valid IP address");
|
315
|
if (!empty($pconfig['dns_server3']) && !is_ipaddr(trim($pconfig['dns_server3'])))
|
316
|
$input_errors[] = gettext("The field 'DNS Server #3' must contain a valid IP address");
|
317
|
if (!empty($pconfig['dns_server4']) && !is_ipaddr(trim($pconfig['dns_server4'])))
|
318
|
$input_errors[] = gettext("The field 'DNS Server #4' must contain a valid IP address");
|
319
|
}
|
320
|
|
321
|
if ($pconfig['ntp_server_enable']) {
|
322
|
if (!empty($pconfig['ntp_server1']) && !is_ipaddr(trim($pconfig['ntp_server1'])))
|
323
|
$input_errors[] = gettext("The field 'NTP Server #1' must contain a valid IP address");
|
324
|
if (!empty($pconfig['ntp_server2']) && !is_ipaddr(trim($pconfig['ntp_server2'])))
|
325
|
$input_errors[] = gettext("The field 'NTP Server #2' must contain a valid IP address");
|
326
|
if (!empty($pconfig['ntp_server3']) && !is_ipaddr(trim($pconfig['ntp_server3'])))
|
327
|
$input_errors[] = gettext("The field 'NTP Server #3' must contain a valid IP address");
|
328
|
if (!empty($pconfig['ntp_server4']) && !is_ipaddr(trim($pconfig['ntp_server4'])))
|
329
|
$input_errors[] = gettext("The field 'NTP Server #4' must contain a valid IP address");
|
330
|
}
|
331
|
|
332
|
if ($pconfig['netbios_enable']) {
|
333
|
if ($pconfig['wins_server_enable']) {
|
334
|
if (!empty($pconfig['wins_server1']) && !is_ipaddr(trim($pconfig['wins_server1'])))
|
335
|
$input_errors[] = gettext("The field 'WINS Server #1' must contain a valid IP address");
|
336
|
if (!empty($pconfig['wins_server2']) && !is_ipaddr(trim($pconfig['wins_server2'])))
|
337
|
$input_errors[] = gettext("The field 'WINS Server #2' must contain a valid IP address");
|
338
|
}
|
339
|
if ($pconfig['nbdd_server_enable'])
|
340
|
if (!empty($pconfig['nbdd_server1']) && !is_ipaddr(trim($pconfig['nbdd_server1'])))
|
341
|
$input_errors[] = gettext("The field 'NetBIOS Data Distribution Server #1' must contain a valid IP address");
|
342
|
}
|
343
|
|
344
|
if ($pconfig['client_mgmt_port_enable']) {
|
345
|
if ($result = openvpn_validate_port($pconfig['client_mgmt_port'], 'Client management port'))
|
346
|
$input_errors[] = $result;
|
347
|
}
|
348
|
|
349
|
if ($pconfig['maxclients'] && !is_numeric($pconfig['maxclients']))
|
350
|
$input_errors[] = gettext("The field 'Concurrent connections' must be numeric.");
|
351
|
|
352
|
/* If we are not in shared key mode, then we need the CA/Cert. */
|
353
|
if ($pconfig['mode'] != "p2p_shared_key") {
|
354
|
$reqdfields = explode(" ", "caref certref");
|
355
|
$reqdfieldsn = array(gettext("Certificate Authority"),gettext("Certificate"));
|
356
|
} elseif (!$pconfig['autokey_enable']) {
|
357
|
/* We only need the shared key filled in if we are in shared key mode and autokey is not selected. */
|
358
|
$reqdfields = array('shared_key');
|
359
|
$reqdfieldsn = array(gettext('Shared key'));
|
360
|
}
|
361
|
|
362
|
if ($pconfig['dev_mode'] != "tap") {
|
363
|
$reqdfields[] = 'tunnel_network';
|
364
|
$reqdfieldsn[] = gettext('Tunnel network');
|
365
|
} else {
|
366
|
if ($pconfig['serverbridge_dhcp'] && $pconfig['tunnel_network'])
|
367
|
$input_errors[] = gettext("Using a tunnel network and server bridge settings together is not allowed.");
|
368
|
if (($pconfig['serverbridge_dhcp_start'] && !$pconfig['serverbridge_dhcp_end'])
|
369
|
|| (!$pconfig['serverbridge_dhcp_start'] && $pconfig['serverbridge_dhcp_end']))
|
370
|
$input_errors[] = gettext("Server Bridge DHCP Start and End must both be empty, or defined.");
|
371
|
if (($pconfig['serverbridge_dhcp_start'] && !is_ipaddrv4($pconfig['serverbridge_dhcp_start'])))
|
372
|
$input_errors[] = gettext("Server Bridge DHCP Start must be an IPv4 address.");
|
373
|
if (($pconfig['serverbridge_dhcp_end'] && !is_ipaddrv4($pconfig['serverbridge_dhcp_end'])))
|
374
|
$input_errors[] = gettext("Server Bridge DHCP End must be an IPv4 address.");
|
375
|
if (ip2ulong($pconfig['serverbridge_dhcp_start']) > ip2ulong($pconfig['serverbridge_dhcp_end']))
|
376
|
$input_errors[] = gettext("The Server Bridge DHCP range is invalid (start higher than end).");
|
377
|
}
|
378
|
do_input_validation($_POST, $reqdfields, $reqdfieldsn, $input_errors);
|
379
|
|
380
|
if (!$input_errors) {
|
381
|
|
382
|
$server = array();
|
383
|
|
384
|
if ($id && $pconfig['dev_mode'] != $a_server[$id]['dev_mode'])
|
385
|
openvpn_delete('server', $a_server[$id]);// delete(rename) old interface so a new TUN or TAP interface can be created.
|
386
|
|
387
|
if ($vpnid)
|
388
|
$server['vpnid'] = $vpnid;
|
389
|
else
|
390
|
$server['vpnid'] = openvpn_vpnid_next();
|
391
|
|
392
|
if ($_POST['disable'] == "yes")
|
393
|
$server['disable'] = true;
|
394
|
|
395
|
$server['mode'] = $pconfig['mode'];
|
396
|
if (!empty($pconfig['authmode']) && (($pconfig['mode'] == "server_user") || ($pconfig['mode'] == "server_tls_user")))
|
397
|
$server['authmode'] = implode(",", $pconfig['authmode']);
|
398
|
|
399
|
$server['protocol'] = $pconfig['protocol'];
|
400
|
$server['dev_mode'] = $pconfig['dev_mode'];
|
401
|
list($server['interface'], $server['ipaddr']) = explode ("|",$pconfig['interface']);
|
402
|
$server['local_port'] = $pconfig['local_port'];
|
403
|
$server['description'] = $pconfig['description'];
|
404
|
$server['custom_options'] = str_replace("\r\n", "\n", $pconfig['custom_options']);
|
405
|
|
406
|
if ($tls_mode) {
|
407
|
if ($pconfig['tlsauth_enable']) {
|
408
|
if ($pconfig['autotls_enable'])
|
409
|
$pconfig['tls'] = openvpn_create_key();
|
410
|
$server['tls'] = base64_encode($pconfig['tls']);
|
411
|
}
|
412
|
$server['caref'] = $pconfig['caref'];
|
413
|
$server['crlref'] = $pconfig['crlref'];
|
414
|
$server['certref'] = $pconfig['certref'];
|
415
|
$server['dh_length'] = $pconfig['dh_length'];
|
416
|
$server['cert_depth'] = $pconfig['cert_depth'];
|
417
|
|
418
|
if ($pconfig['mode'] == "server_tls_user")
|
419
|
$server['strictusercn'] = $pconfig['strictusercn'];
|
420
|
} else {
|
421
|
$server['shared_key'] = base64_encode($pconfig['shared_key']);
|
422
|
}
|
423
|
|
424
|
$server['crypto'] = $pconfig['crypto'];
|
425
|
$server['digest'] = $pconfig['digest'];
|
426
|
$server['engine'] = $pconfig['engine'];
|
427
|
|
428
|
$server['tunnel_network'] = $pconfig['tunnel_network'];
|
429
|
$server['tunnel_networkv6'] = $pconfig['tunnel_networkv6'];
|
430
|
$server['remote_network'] = $pconfig['remote_network'];
|
431
|
$server['remote_networkv6'] = $pconfig['remote_networkv6'];
|
432
|
$server['gwredir'] = $pconfig['gwredir'];
|
433
|
$server['local_network'] = $pconfig['local_network'];
|
434
|
$server['local_networkv6'] = $pconfig['local_networkv6'];
|
435
|
$server['maxclients'] = $pconfig['maxclients'];
|
436
|
$server['compression'] = $pconfig['compression'];
|
437
|
$server['passtos'] = $pconfig['passtos'];
|
438
|
$server['client2client'] = $pconfig['client2client'];
|
439
|
|
440
|
$server['dynamic_ip'] = $pconfig['dynamic_ip'];
|
441
|
$server['pool_enable'] = $pconfig['pool_enable'];
|
442
|
$server['topology_subnet'] = $pconfig['topology_subnet'];
|
443
|
|
444
|
$server['serverbridge_dhcp'] = $pconfig['serverbridge_dhcp'];
|
445
|
$server['serverbridge_interface'] = $pconfig['serverbridge_interface'];
|
446
|
$server['serverbridge_dhcp_start'] = $pconfig['serverbridge_dhcp_start'];
|
447
|
$server['serverbridge_dhcp_end'] = $pconfig['serverbridge_dhcp_end'];
|
448
|
|
449
|
if ($pconfig['dns_domain_enable'])
|
450
|
$server['dns_domain'] = $pconfig['dns_domain'];
|
451
|
|
452
|
if ($pconfig['dns_server_enable']) {
|
453
|
$server['dns_server1'] = $pconfig['dns_server1'];
|
454
|
$server['dns_server2'] = $pconfig['dns_server2'];
|
455
|
$server['dns_server3'] = $pconfig['dns_server3'];
|
456
|
$server['dns_server4'] = $pconfig['dns_server4'];
|
457
|
}
|
458
|
|
459
|
if ($pconfig['push_register_dns'])
|
460
|
$server['push_register_dns'] = $pconfig['push_register_dns'];
|
461
|
|
462
|
if ($pconfig['ntp_server_enable']) {
|
463
|
$server['ntp_server1'] = $pconfig['ntp_server1'];
|
464
|
$server['ntp_server2'] = $pconfig['ntp_server2'];
|
465
|
}
|
466
|
|
467
|
$server['netbios_enable'] = $pconfig['netbios_enable'];
|
468
|
$server['netbios_ntype'] = $pconfig['netbios_ntype'];
|
469
|
$server['netbios_scope'] = $pconfig['netbios_scope'];
|
470
|
|
471
|
$server['no_tun_ipv6'] = $pconfig['no_tun_ipv6'];
|
472
|
$server['verbosity_level'] = $pconfig['verbosity_level'];
|
473
|
|
474
|
if ($pconfig['netbios_enable']) {
|
475
|
|
476
|
if ($pconfig['wins_server_enable']) {
|
477
|
$server['wins_server1'] = $pconfig['wins_server1'];
|
478
|
$server['wins_server2'] = $pconfig['wins_server2'];
|
479
|
}
|
480
|
|
481
|
if ($pconfig['dns_server_enable'])
|
482
|
$server['nbdd_server1'] = $pconfig['nbdd_server1'];
|
483
|
}
|
484
|
|
485
|
if ($pconfig['client_mgmt_port_enable'])
|
486
|
$server['client_mgmt_port'] = $pconfig['client_mgmt_port'];
|
487
|
|
488
|
if ($_POST['duplicate_cn'] == "yes")
|
489
|
$server['duplicate_cn'] = true;
|
490
|
|
491
|
if (isset($id) && $a_server[$id])
|
492
|
$a_server[$id] = $server;
|
493
|
else
|
494
|
$a_server[] = $server;
|
495
|
|
496
|
openvpn_resync('server', $server);
|
497
|
write_config();
|
498
|
|
499
|
header("Location: vpn_openvpn_server.php");
|
500
|
exit;
|
501
|
}
|
502
|
|
503
|
if (!empty($pconfig['authmode']))
|
504
|
$pconfig['authmode'] = implode(",", $pconfig['authmode']);
|
505
|
}
|
506
|
|
507
|
$pgtitle = array(gettext("OpenVPN"), gettext("Server"));
|
508
|
$shortcut_section = "openvpn";
|
509
|
|
510
|
include("head.inc");
|
511
|
|
512
|
function build_mode_list() {
|
513
|
global $openvpn_server_modes;
|
514
|
|
515
|
$list = array();
|
516
|
|
517
|
foreach ($openvpn_server_modes as $name => $desc)
|
518
|
$list[$name] = $desc;
|
519
|
|
520
|
return($list);
|
521
|
}
|
522
|
|
523
|
function build_if_list() {
|
524
|
$list = array();
|
525
|
|
526
|
$interfaces = get_configured_interface_with_descr();
|
527
|
$carplist = get_configured_carp_interface_list();
|
528
|
|
529
|
foreach ($carplist as $cif => $carpip)
|
530
|
$interfaces[$cif.'|'.$carpip] = $carpip." (".get_vip_descr($carpip).")";
|
531
|
|
532
|
$aliaslist = get_configured_ip_aliases_list();
|
533
|
|
534
|
foreach ($aliaslist as $aliasip => $aliasif)
|
535
|
$interfaces[$aliasif.'|'.$aliasip] = $aliasip." (".get_vip_descr($aliasip).")";
|
536
|
|
537
|
$grouplist = return_gateway_groups_array();
|
538
|
|
539
|
foreach ($grouplist as $name => $group) {
|
540
|
if($group['ipprotocol'] != inet)
|
541
|
continue;
|
542
|
|
543
|
if($group[0]['vip'] != "")
|
544
|
$vipif = $group[0]['vip'];
|
545
|
else
|
546
|
$vipif = $group[0]['int'];
|
547
|
|
548
|
$interfaces[$name] = "GW Group {$name}";
|
549
|
}
|
550
|
|
551
|
$interfaces['lo0'] = "Localhost";
|
552
|
$interfaces['any'] = "any";
|
553
|
|
554
|
foreach ($interfaces as $iface => $ifacename)
|
555
|
$list[$iface] = $ifacename;
|
556
|
|
557
|
return($list);
|
558
|
}
|
559
|
|
560
|
function build_crl_list() {
|
561
|
global $a_crl;
|
562
|
|
563
|
$list = array('' => 'None');
|
564
|
|
565
|
foreach ($a_crl as $crl) {
|
566
|
$caname = "";
|
567
|
$ca = lookup_ca($crl['caref']);
|
568
|
|
569
|
if ($ca)
|
570
|
$caname = " (CA: {$ca['descr']})";
|
571
|
|
572
|
$list[$crl['refid']] = $crl['descr'] . $caname;
|
573
|
}
|
574
|
|
575
|
return($list);
|
576
|
}
|
577
|
|
578
|
function build_cert_list() {
|
579
|
global $a_cert;
|
580
|
|
581
|
$list = array();
|
582
|
|
583
|
foreach ($a_cert as $cert) {
|
584
|
$caname = "";
|
585
|
$inuse = "";
|
586
|
$revoked = "";
|
587
|
$ca = lookup_ca($cert['caref']);
|
588
|
|
589
|
if ($ca)
|
590
|
$caname = " (CA: {$ca['descr']})";
|
591
|
|
592
|
if ($pconfig['certref'] == $cert['refid'])
|
593
|
$selected = "selected=\"selected\"";
|
594
|
|
595
|
if (cert_in_use($cert['refid']))
|
596
|
$inuse = " *In Use";
|
597
|
|
598
|
if (is_cert_revoked($cert))
|
599
|
$revoked = " *Revoked";
|
600
|
|
601
|
$list[$cert['refid']] = $cert['descr'] . $caname . $inuse . $revoked;
|
602
|
}
|
603
|
|
604
|
return($list);
|
605
|
}
|
606
|
|
607
|
function build_bridge_list() {
|
608
|
$list = array();
|
609
|
|
610
|
$serverbridge_interface['none'] = "none";
|
611
|
$serverbridge_interface = array_merge($serverbridge_interface, get_configured_interface_with_descr());
|
612
|
$carplist = get_configured_carp_interface_list();
|
613
|
|
614
|
foreach ($carplist as $cif => $carpip)
|
615
|
$serverbridge_interface[$cif.'|'.$carpip] = $carpip." (".get_vip_descr($carpip).")";
|
616
|
|
617
|
$aliaslist = get_configured_ip_aliases_list();
|
618
|
|
619
|
foreach ($aliaslist as $aliasip => $aliasif)
|
620
|
$serverbridge_interface[$aliasif.'|'.$aliasip] = $aliasip." (".get_vip_descr($aliasip).")";
|
621
|
|
622
|
foreach ($serverbridge_interface as $iface => $ifacename)
|
623
|
$list[$iface] = htmlspecialchars($ifacename);
|
624
|
|
625
|
return($list);
|
626
|
}
|
627
|
|
628
|
if (!$savemsg)
|
629
|
$savemsg = "";
|
630
|
|
631
|
if ($input_errors)
|
632
|
print_input_errors($input_errors);
|
633
|
|
634
|
if ($savemsg)
|
635
|
print_info_box_np($savemsg, 'success');
|
636
|
|
637
|
$tab_array = array();
|
638
|
$tab_array[] = array(gettext("Server"), true, "vpn_openvpn_server.php");
|
639
|
$tab_array[] = array(gettext("Client"), false, "vpn_openvpn_client.php");
|
640
|
$tab_array[] = array(gettext("Client Specific Overrides"), false, "vpn_openvpn_csc.php");
|
641
|
$tab_array[] = array(gettext("Wizards"), false, "wizard.php?xml=openvpn_wizard.xml");
|
642
|
add_package_tabs("OpenVPN", $tab_array);
|
643
|
display_top_tabs($tab_array);
|
644
|
|
645
|
require('classes/Form.class.php');
|
646
|
|
647
|
$form = new Form();
|
648
|
|
649
|
if($act=="new" || $act=="edit") :
|
650
|
$section = new Form_Section('General Information');
|
651
|
|
652
|
$section->addInput(new Form_checkbox(
|
653
|
'disable',
|
654
|
'Disabled',
|
655
|
'Disable this server',
|
656
|
$pconfig['disable']
|
657
|
))->setHelp('Set this option to disable this server without removing it from the list');
|
658
|
|
659
|
$section->addInput(new Form_Select(
|
660
|
'mode',
|
661
|
'Server mode',
|
662
|
$pconfig['mode'],
|
663
|
build_mode_list()
|
664
|
));
|
665
|
|
666
|
$section->addInput(new Form_Select(
|
667
|
'dev_mode',
|
668
|
'Device mode',
|
669
|
empty($pconfig['dev_mode']) ? 'tun':$pconfig['dev_mode'],
|
670
|
array_combine($openvpn_dev_mode, $openvpn_dev_mode)
|
671
|
));
|
672
|
|
673
|
$section->addInput(new Form_Select(
|
674
|
'interface',
|
675
|
'Interface',
|
676
|
$pconfig['interface'],
|
677
|
build_if_list()
|
678
|
));
|
679
|
|
680
|
$section->addInput(new Form_Input(
|
681
|
'local_port',
|
682
|
'Local port',
|
683
|
'number',
|
684
|
$pconfig['local_port']
|
685
|
));
|
686
|
|
687
|
$section->addInput(new Form_Input(
|
688
|
'description',
|
689
|
'Description',
|
690
|
'text',
|
691
|
$pconfig['description']
|
692
|
))->setHelp('You may enter a description here for your reference (not parsed).');
|
693
|
|
694
|
$form->add($section);
|
695
|
|
696
|
$section = new Form_Section('Cryptographic settings');
|
697
|
|
698
|
$section->addInput(new Form_checkbox(
|
699
|
'tlsauth_enable',
|
700
|
'TLS authentication',
|
701
|
'Enable authentication of TLS packets.',
|
702
|
$pconfig['tlsauth_enable']
|
703
|
));
|
704
|
|
705
|
if (!$pconfig['tls']) {
|
706
|
$section->addInput(new Form_checkbox(
|
707
|
'autotls_enable',
|
708
|
null,
|
709
|
'Automatically generate a shared TLS authentication key.',
|
710
|
$pconfig['autotls_enable']
|
711
|
));
|
712
|
}
|
713
|
|
714
|
$section->addInput(new Form_TextArea(
|
715
|
'tls',
|
716
|
'Key',
|
717
|
$pconfig['tls']
|
718
|
))->setHelp('Paste your shared key here');
|
719
|
|
720
|
$section->addInput(new Form_Select(
|
721
|
'caref',
|
722
|
'Peer Certifiacte Authority',
|
723
|
$pconfig['caref'],
|
724
|
count($a_ca) ? array_combine($a_ca, $a_ca) : ['' => 'None']
|
725
|
))->setHelp(count($a_ca) ? '':sprintf('No Certificate Authorities defined. You may create one here: %s', '<a href="system_camanager.php">System > Cert Manager</a>'));
|
726
|
|
727
|
$section->addInput(new Form_Select(
|
728
|
'crlref',
|
729
|
'Peer Certifiacte Revocation list',
|
730
|
$pconfig['crlref'],
|
731
|
build_crl_list()
|
732
|
))->setHelp(count($a_crl) ? '':sprintf('No Certificate Revocation Lists defined. You may create one here: %s', '<a href="system_camanager.php">System > Cert Manager</a>'));
|
733
|
|
734
|
$section->addInput(new Form_Select(
|
735
|
'certref',
|
736
|
'Peer Certifiacte Authority',
|
737
|
$pconfig['certref'],
|
738
|
build_cert_list()
|
739
|
))->setHelp(count($a_cert) ? '':sprintf('No Certificates defined. You may create one here: %s', '<a href="system_camanager.php">System > Cert Manager</a>'));
|
740
|
|
741
|
$section->addInput(new Form_Select(
|
742
|
'dh_length',
|
743
|
'DH Parameter length (bits)',
|
744
|
$pconfig['dh_length'],
|
745
|
array_combine($openvpn_dh_lengths,$openvpn_dh_lengths)
|
746
|
))->setHelp(count($a_cert) ? '':sprintf('No Certificates defined. You may create one here: %s', '<a href="system_camanager.php">System > Cert Manager</a>'));
|
747
|
|
748
|
if (!$pconfig['shared_key']) {
|
749
|
$section->addInput(new Form_checkbox(
|
750
|
'autokey_enable',
|
751
|
'Auto generate',
|
752
|
'Automatically generate a shared key',
|
753
|
$pconfig['autokey_enable']
|
754
|
));
|
755
|
}
|
756
|
|
757
|
$section->addInput(new Form_TextArea(
|
758
|
'shared_key',
|
759
|
'Shared Key',
|
760
|
$pconfig['shared_key']
|
761
|
))->setHelp('Paste your shared key here');
|
762
|
|
763
|
$section->addInput(new Form_Select(
|
764
|
'crypto',
|
765
|
'Encryption Algorithm',
|
766
|
$pconfig['crypto'],
|
767
|
openvpn_get_cipherlist()
|
768
|
));
|
769
|
|
770
|
$section->addInput(new Form_Select(
|
771
|
'digest',
|
772
|
'Auth digest algorithm',
|
773
|
$pconfig['digest'],
|
774
|
openvpn_get_digestlist()
|
775
|
))->setHelp('Leave this set to SHA1 unless all clients are set to match. SHA1 is the default for OpenVPN. ');
|
776
|
|
777
|
$section->addInput(new Form_Select(
|
778
|
'engine',
|
779
|
'Hardware Crypto',
|
780
|
$pconfig['engine'],
|
781
|
openvpn_get_engines()
|
782
|
));
|
783
|
|
784
|
$section->addInput(new Form_Select(
|
785
|
'cert_depth',
|
786
|
'Certificate Depth',
|
787
|
$pconfig['cert_depth'],
|
788
|
$openvpn_cert_depths
|
789
|
))->setHelp('When a certificate-based client logs in, do not accept certificates below this depth. ' .
|
790
|
'Useful for denying certificates made with intermediate CAs generated from the same CA as the server.');
|
791
|
|
792
|
$section->addInput(new Form_checkbox(
|
793
|
'strictusercn',
|
794
|
'Strict User-CN Matching',
|
795
|
null,
|
796
|
$pconfig['strictusercn']
|
797
|
))->setHelp('When authenticating users, enforce a match between the common name of the client certificate and the username given at login.');
|
798
|
|
799
|
$form->add($section);
|
800
|
|
801
|
$section = new Form_Section('Tunnel settings');
|
802
|
|
803
|
$section->addInput(new Form_Input(
|
804
|
'tunnel_network',
|
805
|
'IPv4 Tunnel Network',
|
806
|
'text',
|
807
|
$pconfig['tunnel_network']
|
808
|
))->setHelp('This is the IPv4 virtual network used for private communications between this server and client ' .
|
809
|
'hosts expressed using CIDR (eg. 10.0.8.0/24). The first network address will be assigned to ' .
|
810
|
'the server virtual interface. The remaining network addresses can optionally be assigned ' .
|
811
|
'to connecting clients. (see Address Pool)');
|
812
|
|
813
|
$section->addInput(new Form_Input(
|
814
|
'tunnel_networkv6',
|
815
|
'IPv6 Tunnel Network',
|
816
|
'text',
|
817
|
$pconfig['tunnel_networkv6']
|
818
|
))->setHelp('This is the IPv6 virtual network used for private ' .
|
819
|
'communications between this server and client hosts expressed using CIDR (eg. fe80::/64). ' .
|
820
|
'The first network address will be assigned to the server virtual interface. The remaining ' .
|
821
|
'network addresses can optionally be assigned to connecting clients. (see Address Pool)');
|
822
|
|
823
|
$section->addInput(new Form_checkbox(
|
824
|
'serverbridge_dhcp',
|
825
|
'Bridge DHCP',
|
826
|
'Allow clients on the bridge to obtain DHCP.',
|
827
|
$pconfig['serverbridge_dhcp']
|
828
|
));
|
829
|
|
830
|
$section->addInput(new Form_Select(
|
831
|
'serberbridge_inerface',
|
832
|
'Bridge Interface',
|
833
|
$pconfig['serberbridge_inerface'],
|
834
|
build_bridge_list()
|
835
|
))->setHelp('The interface to which this tap instance will be bridged. This is not done automatically. You must assign this ' .
|
836
|
'interface and create the bridge separately. This setting controls which existing IP address and subnet ' .
|
837
|
'mask are used by OpenVPN for the bridge. Setting this to "none" will cause the Server Bridge DHCP settings below to be ignored.');
|
838
|
|
839
|
$section->addInput(new Form_Input(
|
840
|
'serverbridge_dhcp_start',
|
841
|
'Server Bridge DHCP Start',
|
842
|
'text',
|
843
|
$pconfig['serverbridge_dhcp_start']
|
844
|
))->setHelp('When using tap mode as a multi-point server, you may optionally supply a DHCP range to use on the ' .
|
845
|
'interface to which this tap instance is bridged. If these settings are left blank, DHCP will be passed ' .
|
846
|
'through to the LAN, and the interface setting above will be ignored.');
|
847
|
|
848
|
$section->addInput(new Form_Input(
|
849
|
'serverbridge_dhcp_end',
|
850
|
'Server Bridge DHCP End',
|
851
|
'text',
|
852
|
$pconfig['serverbridge_dhcp_end']
|
853
|
));
|
854
|
|
855
|
$section->addInput(new Form_checkbox(
|
856
|
'gwredir',
|
857
|
'Redirect Gateway',
|
858
|
'Force all client generated traffic through the tunnel.',
|
859
|
$pconfig['gwredit']
|
860
|
));
|
861
|
|
862
|
$section->addInput(new Form_Input(
|
863
|
'local_network',
|
864
|
'IPv4 Local network(s)',
|
865
|
'text',
|
866
|
$pconfig['local_network']
|
867
|
))->setHelp('IPv4 networks that will be accessible from the remote endpoint. ' .
|
868
|
'Expressed as a comma-separated list of one or more CIDR ranges. ' .
|
869
|
'You may leave this blank if you don\'t want to add a route to the local network through this tunnel on the remote machine. ' .
|
870
|
'This is generally set to your LAN network.');
|
871
|
|
872
|
$section->addInput(new Form_Input(
|
873
|
'local_networkv6',
|
874
|
'IPv6 Local network(s)',
|
875
|
'text',
|
876
|
$pconfig['local_networkv6']
|
877
|
))->setHelp('IPv6 networks that will be accessible from the remote endpoint. ' .
|
878
|
'Expressed as a comma-separated list of one or more IP/PREFIX. You may leave this blank if you don\'t want to add a ' .
|
879
|
'route to the local network through this tunnel on the remote machine. This is generally set to your LAN network.');
|
880
|
|
881
|
$section->addInput(new Form_Input(
|
882
|
'remote_network',
|
883
|
'IPv4 Remote network(s)',
|
884
|
'text',
|
885
|
$pconfig['remote_network']
|
886
|
))->setHelp('IPv4 networks that will be routed through the tunnel, so that a site-to-site VPN can be established without manually ' .
|
887
|
'changing the routing tables. Expressed as a comma-separated list of one or more CIDR ranges. ' .
|
888
|
'If this is a site-to-site VPN, enter the remote LAN/s here. You may leave this blank if you don\'t want a site-to-site VPN.');
|
889
|
|
890
|
$section->addInput(new Form_Input(
|
891
|
'remote_networkv6',
|
892
|
'IPv6 Remote network(s)',
|
893
|
'text',
|
894
|
$pconfig['remote_networkv6']
|
895
|
))->setHelp('These are the IPv6 networks that will be routed through the tunnel, so that a site-to-site VPN can be established without manually ' .
|
896
|
'changing the routing tables. Expressed as a comma-separated list of one or more IP/PREFIX. ' .
|
897
|
'If this is a site-to-site VPN, enter the remote LAN/s here. You may leave this blank if you don\'t want a site-to-site VPN.');
|
898
|
|
899
|
$section->addInput(new Form_Input(
|
900
|
'maxclients',
|
901
|
'Concurrent connections',
|
902
|
'number',
|
903
|
$pconfig['maxclients']
|
904
|
))->setHelp('Specify the maximum number of clients allowed to concurrently connect to this server.');
|
905
|
|
906
|
$section->addInput(new Form_Select(
|
907
|
'compression',
|
908
|
'Compression',
|
909
|
$pconfig['compression'],
|
910
|
$openvpn_compression_modes
|
911
|
))->setHelp('Compress tunnel packets using the LZO algorithm. ' .
|
912
|
'Adaptive compression will dynamically disable compression for a period of time if OpenVPN detects that the data in the ' .
|
913
|
'packets is not being compressed efficiently"');
|
914
|
|
915
|
$section->addInput(new Form_checkbox(
|
916
|
'passtos',
|
917
|
'Type-of-Service',
|
918
|
'Set the TOS IP header value of tunnel packets to match the encapsulated packet value.',
|
919
|
$pconfig['passtos']
|
920
|
));
|
921
|
|
922
|
$section->addInput(new Form_checkbox(
|
923
|
'client2client',
|
924
|
'Inter-client communication',
|
925
|
'Allow communication between clients connected to this server',
|
926
|
$pconfig['client2client']
|
927
|
));
|
928
|
|
929
|
$section->addInput(new Form_checkbox(
|
930
|
'duplicate_cn',
|
931
|
'Duplicate Connection',
|
932
|
'Allow multiple concurrent connections from clients using the same Common Name.',
|
933
|
$pconfig['duplicate_cn']
|
934
|
))->setHelp('(This is not generally recommended, but may be needed for some scenarios.)');
|
935
|
|
936
|
$section->addInput(new Form_checkbox(
|
937
|
'no_tun_ipv6',
|
938
|
'Disable IPv6',
|
939
|
'Don\'t forward IPv6 traffic. ',
|
940
|
$pconfig['no_tun_ipv6']
|
941
|
));
|
942
|
|
943
|
$form->add($section);
|
944
|
|
945
|
$section = new Form_Section('Client Settings');
|
946
|
|
947
|
$section->addInput(new Form_checkbox(
|
948
|
'dynamic_ip',
|
949
|
'Dynamic IP',
|
950
|
'Allow connected clients to retain their connections if their IP address changes',
|
951
|
$pconfig['dynamic_ip']
|
952
|
));
|
953
|
|
954
|
$section->addInput(new Form_checkbox(
|
955
|
'pool_enable',
|
956
|
'Address Pool',
|
957
|
'Provide a virtual adapter IP address to clients (see Tunnel Network)',
|
958
|
$pconfig['pool_enable']
|
959
|
));
|
960
|
|
961
|
$section->addInput(new Form_checkbox(
|
962
|
'topology_subnet',
|
963
|
'Topology',
|
964
|
'Allocate only one IP per client (topology subnet), rather than an isolated subnet per client (topology net30).',
|
965
|
$pconfig['topology_subnet']
|
966
|
))->setHelp('Relevant when supplying a virtual adapter IP address to clients when using tun mode on IPv4.").' . '<br />' .
|
967
|
'Some clients may require this even for IPv6, such as OpenVPN Connect (iOS/Android). ' .
|
968
|
'Others may break if it is present, such as older versions of OpenVPN or clients such as Yealink phones.');
|
969
|
|
970
|
$section->addInput(new Form_checkbox(
|
971
|
'dns_domain_enable',
|
972
|
'DNS Default Domain',
|
973
|
'Provide a default domain name to clients',
|
974
|
$pconfig['dns_domain_enable']
|
975
|
));
|
976
|
|
977
|
$section->addInput(new Form_Input(
|
978
|
'dns_domain',
|
979
|
'DNS Default Domain',
|
980
|
'text',
|
981
|
$pconfig['dns_domain']
|
982
|
));
|
983
|
|
984
|
$section->addInput(new Form_checkbox(
|
985
|
'dns_server_enable',
|
986
|
'DNS Server enable',
|
987
|
'Provide a DNS server list to clients',
|
988
|
$pconfig['dns_server_enable']
|
989
|
));
|
990
|
|
991
|
$section->addInput(new Form_Input(
|
992
|
'dns_server1',
|
993
|
'DNS Server 1',
|
994
|
'text',
|
995
|
$pconfig['dns_server1']
|
996
|
));
|
997
|
|
998
|
$section->addInput(new Form_Input(
|
999
|
'dns_server2',
|
1000
|
'DNS Server 2',
|
1001
|
'text',
|
1002
|
$pconfig['dns_server2']
|
1003
|
));
|
1004
|
|
1005
|
$section->addInput(new Form_Input(
|
1006
|
'dns_server3',
|
1007
|
'DNS Server 3',
|
1008
|
'text',
|
1009
|
$pconfig['dns_server3']
|
1010
|
));
|
1011
|
|
1012
|
$section->addInput(new Form_Input(
|
1013
|
'dns_server4',
|
1014
|
'DNS Server 4',
|
1015
|
'text',
|
1016
|
$pconfig['dns_server4']
|
1017
|
));
|
1018
|
|
1019
|
$section->addInput(new Form_checkbox(
|
1020
|
'push_register_dns',
|
1021
|
'Force DNS cache update',
|
1022
|
'Run "net stop dnscache", "net start dnscache", "ipconfig /flushdns" and "ipconfig /registerdns" on connection initiation.',
|
1023
|
$pconfig['push_register_dns']
|
1024
|
))->setHelp('This is known to kick Windows into recognizing pushed DNS servers.');
|
1025
|
|
1026
|
$section->addInput(new Form_checkbox(
|
1027
|
'ntp_server_enable',
|
1028
|
'NTP Server enable',
|
1029
|
'Provide an NTP server list to clients',
|
1030
|
$pconfig['ntp_server_enable']
|
1031
|
));
|
1032
|
|
1033
|
$section->addInput(new Form_Input(
|
1034
|
'ntp_server1',
|
1035
|
'NTP Server 1',
|
1036
|
'text',
|
1037
|
$pconfig['ntp_server1']
|
1038
|
));
|
1039
|
|
1040
|
$section->addInput(new Form_Input(
|
1041
|
'ntp_server2',
|
1042
|
'NTP Server 2',
|
1043
|
'text',
|
1044
|
$pconfig['ntp_server2']
|
1045
|
));
|
1046
|
|
1047
|
$form->add($section);
|
1048
|
|
1049
|
$section = new Form_Section('Netbios Options');
|
1050
|
|
1051
|
$section->addInput(new Form_checkbox(
|
1052
|
'netbios_enable',
|
1053
|
'Netbios enable',
|
1054
|
'Enable NetBIOS over TCP/IP',
|
1055
|
$pconfig['ntp_server_enable']
|
1056
|
))->setHelp('If this option is not set, all NetBIOS-over-TCP/IP options (including WINS) will be disabled');
|
1057
|
|
1058
|
$section->addInput(new Form_Select(
|
1059
|
'netbios_ntype',
|
1060
|
'Node Type',
|
1061
|
$pconfig['nbios_ntype'],
|
1062
|
$netbios_nodetypes
|
1063
|
))->setHelp('Possible options: b-node (broadcasts), p-node (point-to-point name queries to a WINS server), ' .
|
1064
|
'm-node (broadcast then query name server), and h-node (query name server, then broadcast)');
|
1065
|
|
1066
|
$section->addInput(new Form_Input(
|
1067
|
'netbios_scope',
|
1068
|
'Scope ID',
|
1069
|
'text',
|
1070
|
$pconfig['netbios_scope']
|
1071
|
))->setHelp('A NetBIOS Scope ID provides an extended naming service for NetBIOS over TCP/IP. The NetBIOS ' .
|
1072
|
'scope ID isolates NetBIOS traffic on a single network to only those nodes with the same ' .
|
1073
|
'NetBIOS scope ID');
|
1074
|
|
1075
|
$section->addInput(new Form_checkbox(
|
1076
|
'wins_server_enable',
|
1077
|
'WINS server enable',
|
1078
|
'Provide a WINS server list to clients',
|
1079
|
$pconfig['wins_server_enable']
|
1080
|
));
|
1081
|
|
1082
|
$section->addInput(new Form_Input(
|
1083
|
'wins_server1',
|
1084
|
'WINS Server 1',
|
1085
|
'text',
|
1086
|
$pconfig['wins_server1']
|
1087
|
));
|
1088
|
|
1089
|
$section->addInput(new Form_Input(
|
1090
|
'wins_server2',
|
1091
|
'WINS Server 2',
|
1092
|
'text',
|
1093
|
$pconfig['wins_server2']
|
1094
|
));
|
1095
|
|
1096
|
$section->addInput(new Form_checkbox(
|
1097
|
'client_mgmt_port_enable',
|
1098
|
'Enable custom port ',
|
1099
|
'Use a different management port for clients.',
|
1100
|
$pconfig['client_mgmt_port_enable']
|
1101
|
));
|
1102
|
|
1103
|
$section->addInput(new Form_Input(
|
1104
|
'client_mgmt_port',
|
1105
|
'Management port',
|
1106
|
'number',
|
1107
|
$pconfig['client_mgmt_port']
|
1108
|
))->setHelp('The default port is 166. Specify a different port if the client machines need to select from multiple OpenVPN links.');
|
1109
|
|
1110
|
|
1111
|
$form->add($section);
|
1112
|
|
1113
|
$section = new Form_Section('Advanced Configuration');
|
1114
|
$section->addClass('advanced');
|
1115
|
|
1116
|
$section->addInput(new Form_TextArea(
|
1117
|
'custom_options',
|
1118
|
'Custom options',
|
1119
|
$pconfig['custom_options']
|
1120
|
))->setHelp('Enter any additional options you would like to add to the OpenVPN server configuration here, separated by semicolon' . '<br />' .
|
1121
|
'EXAMPLE: push "route 10.0.0.0 255.255.255.0"');
|
1122
|
|
1123
|
$section->addInput(new Form_Select(
|
1124
|
'verbosity_level',
|
1125
|
'Verbosity level',
|
1126
|
$pconfig['verbosity_level'],
|
1127
|
$openvpn_verbosity_level
|
1128
|
))->setHelp('Each level shows all info from the previous levels. Level 3 is recommended if you want a good summary of what\'s happening without being swamped by output' . '<br /><br />' .
|
1129
|
'None: Only fatal errors' . '<br />' .
|
1130
|
'Default: Normal usage range' . '<br />' .
|
1131
|
'5: Output R and W characters to the console for each packet read and write, uppercase is used for TCP/UDP packets and lowercase is used for TUN/TAP packets' .'<br />' .
|
1132
|
'6: Debug info range');
|
1133
|
|
1134
|
$section->addInput(new Form_Input(
|
1135
|
'act',
|
1136
|
null,
|
1137
|
'hidden',
|
1138
|
$act
|
1139
|
));
|
1140
|
|
1141
|
if (isset($id) && $a_server[$id]) {
|
1142
|
$section->addInput(new Form_Input(
|
1143
|
'id',
|
1144
|
null,
|
1145
|
'hidden',
|
1146
|
$id
|
1147
|
));
|
1148
|
}
|
1149
|
|
1150
|
$form->add($section);
|
1151
|
print($form);
|
1152
|
|
1153
|
else:
|
1154
|
?>
|
1155
|
<div class="panel panel-default">
|
1156
|
<div class="panel-heading"><?=gettext('OpenVPN Servers')?></div>
|
1157
|
<div class="panel-body table-responsive">
|
1158
|
<table class="table table-striped table-hover table-condensed">
|
1159
|
<thead>
|
1160
|
<tr>
|
1161
|
<th><?=gettext("Protocol / Port")?></th>
|
1162
|
<th><?=gettext("Tunnel Network")?></th>
|
1163
|
<th><?=gettext("Description")?></th>
|
1164
|
<th><!-- Buttons --></th>
|
1165
|
</tr>
|
1166
|
</thead>
|
1167
|
|
1168
|
<tbody>
|
1169
|
<?php
|
1170
|
$i = 0;
|
1171
|
foreach($a_server as $server):
|
1172
|
?>
|
1173
|
<tr <?=isset($server['disable']) ? 'class="disabled"':''?>>
|
1174
|
<td>
|
1175
|
<?=htmlspecialchars($server['protocol'])?> / <?=htmlspecialchars($server['local_port'])?>
|
1176
|
</td>
|
1177
|
<td>
|
1178
|
<?=htmlspecialchars($server['tunnel_network'])?><br />
|
1179
|
<?=htmlspecialchars($server['tunnel_networkv6'])?>
|
1180
|
</td>
|
1181
|
<td>
|
1182
|
<?=htmlspecialchars($server['description'])?>
|
1183
|
</td>
|
1184
|
<td>
|
1185
|
<a href="vpn_openvpn_server.php?act=edit&id=<?=$i?>" class="btn btn-xs btn-info"><?=gettext("Edit")?></a>
|
1186
|
<a href="vpn_openvpn_server.php?act=del&id=<?=$i?>" class="btn btn-xs btn-danger"><?=gettext("Delete")?></a>
|
1187
|
</td>
|
1188
|
</tr>
|
1189
|
<?php
|
1190
|
$i++;
|
1191
|
endforeach;
|
1192
|
?>
|
1193
|
</tbody>
|
1194
|
</table>
|
1195
|
</div>
|
1196
|
</div>
|
1197
|
|
1198
|
<nav class="action-buttons">
|
1199
|
<a href="vpn_openvpn_server.php?act=new" class="btn btn-sm btn-success">
|
1200
|
<?=gettext("Add server")?>
|
1201
|
</a>
|
1202
|
</nav>
|
1203
|
|
1204
|
<?php
|
1205
|
endif;
|
1206
|
|
1207
|
// Note:
|
1208
|
// The following *_change() functions were converted from Javascript/DOM to JQuery but otherwise
|
1209
|
// mostly left unchanged. The logic on this form is complex andthis works!
|
1210
|
?>
|
1211
|
|
1212
|
<script type="text/javascript">
|
1213
|
//<![CDATA[
|
1214
|
events.push(function(){
|
1215
|
|
1216
|
function mode_change() {
|
1217
|
value = $('#mode').val();
|
1218
|
|
1219
|
switch(value) {
|
1220
|
case "p2p_tls":
|
1221
|
case "server_tls":
|
1222
|
case "server_user":
|
1223
|
hideCheckbox('tlsauth_enable', false);
|
1224
|
hideCheckbox('auto_tls_enable', false);
|
1225
|
hideInput('tls', false);
|
1226
|
hideInput('ca_ref', false);
|
1227
|
hideInput('crl_ref', false);
|
1228
|
hideInput('certref', false);
|
1229
|
hideInput('dh_length', false);
|
1230
|
hideInput('cert_depth', false);
|
1231
|
hideInput('strictusercn', true);
|
1232
|
hideInput('autokey_enable', false);
|
1233
|
hideInput('shared_key', false);
|
1234
|
break;
|
1235
|
case "server_tls_user":
|
1236
|
hideCheckbox('tlsauth_enable', false);
|
1237
|
hideCheckbox('auto_tls_enable', false);
|
1238
|
hideInput('tls', false);
|
1239
|
hideInput('ca_ref', false);
|
1240
|
hideInput('crl_ref', false);
|
1241
|
hideInput('certref', false);
|
1242
|
hideInput('dh_length', false);
|
1243
|
hideInput('cert_depth', false);
|
1244
|
hideInput('strictusercn', false);
|
1245
|
hideInput('autokey_enable', true);
|
1246
|
hideInput('shared_key', true);
|
1247
|
break;
|
1248
|
case "p2p_shared_key":
|
1249
|
hideCheckbox('tlsauth_enable', true);
|
1250
|
hideCheckbox('auto_tls_enable', true);
|
1251
|
hideInput('tls', true);
|
1252
|
hideInput('ca_ref', true);
|
1253
|
hideInput('crl_ref', true);
|
1254
|
hideInput('certref', true);
|
1255
|
hideInput('dh_length', true);
|
1256
|
hideInput('cert_depth', true);
|
1257
|
hideInput('strictusercn', true);
|
1258
|
hideInput('autokey_enable', false);
|
1259
|
hideInput('shared_key', false);
|
1260
|
break;
|
1261
|
}
|
1262
|
|
1263
|
switch(value) {
|
1264
|
case "p2p_shared_key":
|
1265
|
hideClass('advanced', true);
|
1266
|
hideInput('remote_network', false);
|
1267
|
hideInput('remote_networkv6', false);
|
1268
|
hideInput('gwredir', true);
|
1269
|
hideInput('local_network', true);
|
1270
|
hideInput('local_networkv6', true);
|
1271
|
hideInput('authmode', true);
|
1272
|
hideInput('client2client', true);
|
1273
|
break;
|
1274
|
case "p2p_tls":
|
1275
|
hideClass('advanced', true);
|
1276
|
hideInput('remote_network', false);
|
1277
|
hideInput('remote_networkv6', false);
|
1278
|
hideInput('gwredir', false);
|
1279
|
hideInput('local_network', false);
|
1280
|
hideInput('local_networkv6', false);
|
1281
|
hideInput('authmode', true);
|
1282
|
hideInput('client2client', true);
|
1283
|
break;
|
1284
|
case "server_user":
|
1285
|
case "server_tls_user":
|
1286
|
hideClass('advanced', false);
|
1287
|
hideInput('remote_network', true);
|
1288
|
hideInput('remote_networkv6', true);
|
1289
|
hideInput('gwredir', false);
|
1290
|
hideInput('local_network', false);
|
1291
|
hideInput('local_networkv6', false);
|
1292
|
hideInput('authmode', false);
|
1293
|
hideInput('client2client', false);
|
1294
|
break;
|
1295
|
case "server_tls":
|
1296
|
hideInput('authmode', true);
|
1297
|
default:
|
1298
|
hideInput('custom_options', false);
|
1299
|
hideInput('verbosity_level', false);
|
1300
|
hideInput('remote_network', true);
|
1301
|
hideInput('remote_networkv6', true);
|
1302
|
hideInput('gwredir', false);
|
1303
|
hideInput('local_network', false);
|
1304
|
hideInput('local_networkv6', false);
|
1305
|
hideInput('client2client', false);
|
1306
|
break;
|
1307
|
}
|
1308
|
|
1309
|
gwredir_change();
|
1310
|
}
|
1311
|
|
1312
|
function autokey_change() {
|
1313
|
var hide = ! $('#autokey_enable').prop('checked')
|
1314
|
|
1315
|
hideInput('shared_key', hide);
|
1316
|
}
|
1317
|
|
1318
|
function tlsauth_change() {
|
1319
|
var hide = ! $('#tlsauth_enable').prop('checked')
|
1320
|
|
1321
|
<?php if (!$pconfig['tls']): ?>
|
1322
|
hideCheckbox('autotls_enable', hide);
|
1323
|
<?php endif; ?>
|
1324
|
|
1325
|
autotls_change();
|
1326
|
}
|
1327
|
|
1328
|
function autotls_change() {
|
1329
|
|
1330
|
<?php if (!$pconfig['tls']): ?>
|
1331
|
autocheck = $('#autotls_enable').prop('checked');
|
1332
|
<?php else: ?>
|
1333
|
autocheck = false;
|
1334
|
<?php endif; ?>
|
1335
|
|
1336
|
if ($('#tlsauth_enable').prop('checked') && !autocheck)
|
1337
|
hideInput('tls', false);
|
1338
|
else
|
1339
|
hideInput('tls', true);
|
1340
|
}
|
1341
|
|
1342
|
function gwredir_change() {
|
1343
|
var hide = ! $('#gwredir').prop('checked')
|
1344
|
|
1345
|
hideInput('local_network', hide);
|
1346
|
hideInput('local_networkv6', hide);
|
1347
|
hideInput('remote_network', hide);
|
1348
|
hideInput('remote_networkv6', hide);
|
1349
|
}
|
1350
|
|
1351
|
function dns_domain_change() {
|
1352
|
var hide = ! $('#dns_domain_enable').prop('checked')
|
1353
|
|
1354
|
hideInput('dns_domain', hide);
|
1355
|
}
|
1356
|
|
1357
|
function dns_server_change() {
|
1358
|
var hide = ! $('#dns_server_enable').prop('checked')
|
1359
|
|
1360
|
hideInput('dns_server1', hide);
|
1361
|
hideInput('dns_server2', hide);
|
1362
|
hideInput('dns_server3', hide);
|
1363
|
hideInput('dns_server4', hide);
|
1364
|
}
|
1365
|
|
1366
|
function wins_server_change() {
|
1367
|
var hide = ! $('#wins_server_enable').prop('checked')
|
1368
|
|
1369
|
hideInput('wins_server1', hide);
|
1370
|
hideInput('wins_server2', hide);
|
1371
|
}
|
1372
|
|
1373
|
function client_mgmt_port_change() {
|
1374
|
var hide = ! $('#client_mgmt_port_enable').prop('checked')
|
1375
|
|
1376
|
hideInput('client_mgmt_port', hide);
|
1377
|
}
|
1378
|
|
1379
|
function ntp_server_change() {
|
1380
|
var hide = ! $('#ntp_server_enable').prop('checked')
|
1381
|
|
1382
|
hideInput('ntp_server1', hide);
|
1383
|
hideInput('ntp_server2', hide);
|
1384
|
}
|
1385
|
|
1386
|
function netbios_change() {
|
1387
|
var hide = ! $('#netbios_enable').prop('checked')
|
1388
|
|
1389
|
hideInput('netbios_ntype', hide);
|
1390
|
hideInput('netbios_scope', hide);
|
1391
|
hideCheckbox('wins_server_enable', hide);
|
1392
|
wins_server_change();
|
1393
|
hideCheckbox('client_mgmt_port_enable', hide);
|
1394
|
client_mgmt_port_change();
|
1395
|
}
|
1396
|
|
1397
|
function tuntap_change() {
|
1398
|
|
1399
|
mvalue = $('#mode').val();
|
1400
|
|
1401
|
switch(mvalue) {
|
1402
|
case "p2p_tls":
|
1403
|
case "p2p_shared_key":
|
1404
|
p2p = true;
|
1405
|
break;
|
1406
|
default:
|
1407
|
p2p = false;
|
1408
|
break;
|
1409
|
}
|
1410
|
|
1411
|
value = $('#dev_mode').val();
|
1412
|
|
1413
|
switch(value) {
|
1414
|
case "tun":
|
1415
|
hideCheckbox('no_tun_ipv6', false);
|
1416
|
hideInput('tunnel_network', false);
|
1417
|
hideCheckbox('serverbridge_dhcp', true);
|
1418
|
hideInput('serverbridge_interface', true);
|
1419
|
hideInput('serverbridge_dhcp_start', true);
|
1420
|
hideInput('serverbridge_dhcp_end', true);
|
1421
|
hideInput('topology_subnet', false);
|
1422
|
break;
|
1423
|
|
1424
|
case "tap":
|
1425
|
hideCheckbox('no_tun_ipv6', true);
|
1426
|
hideInput('tunnel_network', false);
|
1427
|
|
1428
|
if (!p2p) {
|
1429
|
hideCheckbox('serverbridge_dhcp', false);
|
1430
|
hideInput('serverbridge_interface', false);
|
1431
|
hideInput('serverbridge_dhcp_start', false);
|
1432
|
hideInput('serverbridge_dhcp_end', false);
|
1433
|
hideInput('topology_subnet', false);
|
1434
|
|
1435
|
if( $('#serverbridge_dhcp').prop('checked')) {
|
1436
|
disableInput('serverbridge_interface', false);
|
1437
|
disableInput('serverbridge_dhcp_start', false);
|
1438
|
disableInput('serverbridge_dhcp_end', false);
|
1439
|
} else {
|
1440
|
disableInput('serverbridge_interface', true);
|
1441
|
disableInput('serverbridge_dhcp_start', true);
|
1442
|
disableInput('serverbridge_dhcp_end', true);
|
1443
|
}
|
1444
|
} else {
|
1445
|
hideInput('topology_subnet', true);
|
1446
|
disableInput('serverbridge_dhcp', true);
|
1447
|
disableInput('serverbridge_interface', true);
|
1448
|
disableInput('serverbridge_dhcp_start', true);
|
1449
|
disableInput('serverbridge_dhcp_end', true);
|
1450
|
}
|
1451
|
|
1452
|
break;
|
1453
|
}
|
1454
|
}
|
1455
|
|
1456
|
// ---------- Library of show/hide functions ----------------------------------------------------------------------
|
1457
|
|
1458
|
// Hides the <div> in which the specified input element lives so that the input,
|
1459
|
// its label and help text are hidden
|
1460
|
function hideInput(id, hide) {
|
1461
|
if(hide)
|
1462
|
$('#' + id).parent().parent('div').addClass('hidden');
|
1463
|
else
|
1464
|
$('#' + id).parent().parent('div').removeClass('hidden');
|
1465
|
}
|
1466
|
|
1467
|
// Hides the <div> in which the specified checkbox lives so that the checkbox,
|
1468
|
// its label and help text are hidden
|
1469
|
function hideCheckbox(id, hide) {
|
1470
|
if(hide)
|
1471
|
$('#' + id).parent().parent().parent('div').addClass('hidden');
|
1472
|
else
|
1473
|
$('#' + id).parent().parent().parent('div').removeClass('hidden');
|
1474
|
}
|
1475
|
|
1476
|
// Disables the specified input element
|
1477
|
function disableInput(id, disable) {
|
1478
|
$('#' + id).prop("disabled", disable);
|
1479
|
}
|
1480
|
|
1481
|
// Hides all elements of the specified class. This will usually be a section or group
|
1482
|
function hideClass(s_class, hide) {
|
1483
|
if(hide)
|
1484
|
$('.' + s_class).hide();
|
1485
|
else
|
1486
|
$('.' + s_class).show();
|
1487
|
}
|
1488
|
|
1489
|
// ---------- Monitor elements for change and call the appropriate display functions ------------------------------
|
1490
|
|
1491
|
// NTP
|
1492
|
$('#ntp_server_enable').click(function () {
|
1493
|
ntp_server_change();
|
1494
|
});
|
1495
|
|
1496
|
// Netbios
|
1497
|
$('#netbios_enable').click(function () {
|
1498
|
netbios_change();
|
1499
|
});
|
1500
|
|
1501
|
// Client management port
|
1502
|
$('#client_mgmt_port_enable').click(function () {
|
1503
|
client_mgmt_port_change();
|
1504
|
});
|
1505
|
|
1506
|
// Wins server port
|
1507
|
$('#wins_server_enable').click(function () {
|
1508
|
wins_server_change();
|
1509
|
});
|
1510
|
|
1511
|
// DNS server port
|
1512
|
$('#dns_server_enable').click(function () {
|
1513
|
dns_server_change();
|
1514
|
});
|
1515
|
|
1516
|
// DNS server port
|
1517
|
$('#dns_domain_enable').click(function () {
|
1518
|
dns_domain_change();
|
1519
|
});
|
1520
|
|
1521
|
// Gateway redirect
|
1522
|
$('#gwredir').click(function () {
|
1523
|
gwredir_change();
|
1524
|
});
|
1525
|
|
1526
|
// Auto TLSkey generation
|
1527
|
$('#autotls_enable').click(function () {
|
1528
|
autotls_change();
|
1529
|
});
|
1530
|
|
1531
|
// TLS Authorization
|
1532
|
$('#tlsauth_enable').click(function () {
|
1533
|
tlsauth_change();
|
1534
|
});
|
1535
|
|
1536
|
// Auto key
|
1537
|
$('#autokey_enable').click(function () {
|
1538
|
autokey_change();
|
1539
|
});
|
1540
|
|
1541
|
// Mode
|
1542
|
$('#mode').click(function () {
|
1543
|
mode_change();
|
1544
|
});
|
1545
|
|
1546
|
// Tun/tap mode
|
1547
|
$('#dev_mode').click(function () {
|
1548
|
tuntap_change();
|
1549
|
});
|
1550
|
|
1551
|
// ---------- Set initial page display state ----------------------------------------------------------------------
|
1552
|
mode_change();
|
1553
|
autokey_change();
|
1554
|
tlsauth_change();
|
1555
|
gwredir_change();
|
1556
|
dns_domain_change();
|
1557
|
dns_server_change();
|
1558
|
wins_server_change();
|
1559
|
client_mgmt_port_change();
|
1560
|
ntp_server_change();
|
1561
|
netbios_change();
|
1562
|
tuntap_change();
|
1563
|
});
|
1564
|
//]]>
|
1565
|
</script>
|
1566
|
<?php
|
1567
|
|
1568
|
include("foot.inc");
|