1
|
<?php
|
2
|
/*
|
3
|
vpn_openvpn_server.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-server
|
32
|
##|*NAME=OpenVPN: Server page
|
33
|
##|*DESCR=Allow access to the 'OpenVPN: Server' page.
|
34
|
##|*MATCH=vpn_openvpn_server.php*
|
35
|
##|-PRIV
|
36
|
|
37
|
require("guiconfig.inc");
|
38
|
require_once("openvpn.inc");
|
39
|
|
40
|
if (!is_array($config['openvpn']['openvpn-server']))
|
41
|
$config['openvpn']['openvpn-server'] = array();
|
42
|
|
43
|
$a_server = &$config['openvpn']['openvpn-server'];
|
44
|
|
45
|
if (!is_array($config['ca']))
|
46
|
$config['ca'] = array();
|
47
|
|
48
|
$a_ca =& $config['ca'];
|
49
|
|
50
|
if (!is_array($config['cert']))
|
51
|
$config['cert'] = array();
|
52
|
|
53
|
$a_cert =& $config['cert'];
|
54
|
|
55
|
if (!is_array($config['crl']))
|
56
|
$config['crl'] = array();
|
57
|
|
58
|
$a_crl =& $config['crl'];
|
59
|
|
60
|
foreach ($a_crl as $cid => $acrl)
|
61
|
if (!isset($acrl['refid']))
|
62
|
unset ($a_crl[$cid]);
|
63
|
|
64
|
if (is_numericint($_GET['id']))
|
65
|
$id = $_GET['id'];
|
66
|
if (isset($_POST['id']) && is_numericint($_POST['id']))
|
67
|
$id = $_POST['id'];
|
68
|
|
69
|
$act = $_GET['act'];
|
70
|
if (isset($_POST['act']))
|
71
|
$act = $_POST['act'];
|
72
|
|
73
|
if (isset($id) && $a_server[$id])
|
74
|
$vpnid = $a_server[$id]['vpnid'];
|
75
|
else
|
76
|
$vpnid = 0;
|
77
|
|
78
|
if ($_GET['act'] == "del") {
|
79
|
|
80
|
if (!isset($a_server[$id])) {
|
81
|
pfSenseHeader("vpn_openvpn_server.php");
|
82
|
exit;
|
83
|
}
|
84
|
if (!empty($a_server[$id]))
|
85
|
openvpn_delete('server', $a_server[$id]);
|
86
|
unset($a_server[$id]);
|
87
|
write_config();
|
88
|
$savemsg = gettext("Server successfully deleted")."<br/>";
|
89
|
}
|
90
|
|
91
|
if($_GET['act']=="new"){
|
92
|
$pconfig['autokey_enable'] = "yes";
|
93
|
$pconfig['tlsauth_enable'] = "yes";
|
94
|
$pconfig['autotls_enable'] = "yes";
|
95
|
$pconfig['dh_length'] = 1024;
|
96
|
$pconfig['dev_mode'] = "tun";
|
97
|
$pconfig['interface'] = "wan";
|
98
|
$pconfig['local_port'] = openvpn_port_next('UDP');
|
99
|
$pconfig['pool_enable'] = "yes";
|
100
|
$pconfig['cert_depth'] = 1;
|
101
|
}
|
102
|
|
103
|
if($_GET['act']=="edit"){
|
104
|
|
105
|
if (isset($id) && $a_server[$id]) {
|
106
|
$pconfig['disable'] = isset($a_server[$id]['disable']);
|
107
|
$pconfig['mode'] = $a_server[$id]['mode'];
|
108
|
$pconfig['protocol'] = $a_server[$id]['protocol'];
|
109
|
$pconfig['authmode'] = $a_server[$id]['authmode'];
|
110
|
$pconfig['dev_mode'] = $a_server[$id]['dev_mode'];
|
111
|
$pconfig['interface'] = $a_server[$id]['interface'];
|
112
|
if (!empty($a_server[$id]['ipaddr'])) {
|
113
|
$pconfig['interface'] = $pconfig['interface'] . '|' . $a_server[$id]['ipaddr'];
|
114
|
}
|
115
|
$pconfig['local_port'] = $a_server[$id]['local_port'];
|
116
|
$pconfig['description'] = $a_server[$id]['description'];
|
117
|
$pconfig['custom_options'] = $a_server[$id]['custom_options'];
|
118
|
|
119
|
if ($pconfig['mode'] != "p2p_shared_key") {
|
120
|
if ($a_server[$id]['tls']) {
|
121
|
$pconfig['tlsauth_enable'] = "yes";
|
122
|
$pconfig['tls'] = base64_decode($a_server[$id]['tls']);
|
123
|
}
|
124
|
$pconfig['caref'] = $a_server[$id]['caref'];
|
125
|
$pconfig['crlref'] = $a_server[$id]['crlref'];
|
126
|
$pconfig['certref'] = $a_server[$id]['certref'];
|
127
|
$pconfig['dh_length'] = $a_server[$id]['dh_length'];
|
128
|
if (isset($a_server[$id]['cert_depth']))
|
129
|
$pconfig['cert_depth'] = $a_server[$id]['cert_depth'];
|
130
|
else
|
131
|
$pconfig['cert_depth'] = 1;
|
132
|
if ($pconfig['mode'] == "server_tls_user")
|
133
|
$pconfig['strictusercn'] = $a_server[$id]['strictusercn'];
|
134
|
} else
|
135
|
$pconfig['shared_key'] = base64_decode($a_server[$id]['shared_key']);
|
136
|
$pconfig['crypto'] = $a_server[$id]['crypto'];
|
137
|
$pconfig['engine'] = $a_server[$id]['engine'];
|
138
|
|
139
|
$pconfig['tunnel_network'] = $a_server[$id]['tunnel_network'];
|
140
|
$pconfig['tunnel_networkv6'] = $a_server[$id]['tunnel_networkv6'];
|
141
|
|
142
|
$pconfig['remote_network'] = $a_server[$id]['remote_network'];
|
143
|
$pconfig['remote_networkv6'] = $a_server[$id]['remote_networkv6'];
|
144
|
$pconfig['gwredir'] = $a_server[$id]['gwredir'];
|
145
|
$pconfig['local_network'] = $a_server[$id]['local_network'];
|
146
|
$pconfig['local_networkv6'] = $a_server[$id]['local_networkv6'];
|
147
|
$pconfig['maxclients'] = $a_server[$id]['maxclients'];
|
148
|
$pconfig['compression'] = $a_server[$id]['compression'];
|
149
|
$pconfig['passtos'] = $a_server[$id]['passtos'];
|
150
|
$pconfig['client2client'] = $a_server[$id]['client2client'];
|
151
|
|
152
|
$pconfig['dynamic_ip'] = $a_server[$id]['dynamic_ip'];
|
153
|
$pconfig['pool_enable'] = $a_server[$id]['pool_enable'];
|
154
|
$pconfig['topology_subnet'] = $a_server[$id]['topology_subnet'];
|
155
|
|
156
|
$pconfig['serverbridge_dhcp'] = $a_server[$id]['serverbridge_dhcp'];
|
157
|
$pconfig['serverbridge_interface'] = $a_server[$id]['serverbridge_interface'];
|
158
|
$pconfig['serverbridge_dhcp_start'] = $a_server[$id]['serverbridge_dhcp_start'];
|
159
|
$pconfig['serverbridge_dhcp_end'] = $a_server[$id]['serverbridge_dhcp_end'];
|
160
|
|
161
|
$pconfig['dns_domain'] = $a_server[$id]['dns_domain'];
|
162
|
if ($pconfig['dns_domain'])
|
163
|
$pconfig['dns_domain_enable'] = true;
|
164
|
|
165
|
$pconfig['dns_server1'] = $a_server[$id]['dns_server1'];
|
166
|
$pconfig['dns_server2'] = $a_server[$id]['dns_server2'];
|
167
|
$pconfig['dns_server3'] = $a_server[$id]['dns_server3'];
|
168
|
$pconfig['dns_server4'] = $a_server[$id]['dns_server4'];
|
169
|
if ($pconfig['dns_server1'] ||
|
170
|
$pconfig['dns_server2'] ||
|
171
|
$pconfig['dns_server3'] ||
|
172
|
$pconfig['dns_server4'])
|
173
|
$pconfig['dns_server_enable'] = true;
|
174
|
|
175
|
$pconfig['ntp_server1'] = $a_server[$id]['ntp_server1'];
|
176
|
$pconfig['ntp_server2'] = $a_server[$id]['ntp_server2'];
|
177
|
if ($pconfig['ntp_server1'] ||
|
178
|
$pconfig['ntp_server2'])
|
179
|
$pconfig['ntp_server_enable'] = true;
|
180
|
|
181
|
$pconfig['netbios_enable'] = $a_server[$id]['netbios_enable'];
|
182
|
$pconfig['netbios_ntype'] = $a_server[$id]['netbios_ntype'];
|
183
|
$pconfig['netbios_scope'] = $a_server[$id]['netbios_scope'];
|
184
|
|
185
|
$pconfig['wins_server1'] = $a_server[$id]['wins_server1'];
|
186
|
$pconfig['wins_server2'] = $a_server[$id]['wins_server2'];
|
187
|
if ($pconfig['wins_server1'] ||
|
188
|
$pconfig['wins_server2'])
|
189
|
$pconfig['wins_server_enable'] = true;
|
190
|
|
191
|
$pconfig['nbdd_server1'] = $a_server[$id]['nbdd_server1'];
|
192
|
if ($pconfig['nbdd_server1'])
|
193
|
$pconfig['nbdd_server_enable'] = true;
|
194
|
|
195
|
// just in case the modes switch
|
196
|
$pconfig['autokey_enable'] = "yes";
|
197
|
$pconfig['autotls_enable'] = "yes";
|
198
|
|
199
|
$pconfig['duplicate_cn'] = isset($a_server[$id]['duplicate_cn']);
|
200
|
}
|
201
|
}
|
202
|
if ($_POST) {
|
203
|
|
204
|
unset($input_errors);
|
205
|
$pconfig = $_POST;
|
206
|
|
207
|
if (isset($id) && $a_server[$id])
|
208
|
$vpnid = $a_server[$id]['vpnid'];
|
209
|
else
|
210
|
$vpnid = 0;
|
211
|
|
212
|
list($iv_iface, $iv_ip) = explode ("|",$pconfig['interface']);
|
213
|
if (is_ipaddrv4($iv_ip) && (stristr($pconfig['protocol'], "6") !== false)) {
|
214
|
$input_errors[] = gettext("Protocol and IP address families do not match. You cannot select an IPv6 protocol and an IPv4 IP address.");
|
215
|
} elseif (is_ipaddrv6($iv_ip) && (stristr($pconfig['protocol'], "6") === false)) {
|
216
|
$input_errors[] = gettext("Protocol and IP address families do not match. You cannot select an IPv4 protocol and an IPv6 IP address.");
|
217
|
} elseif ((stristr($pconfig['protocol'], "6") === false) && !get_interface_ip($iv_iface) && ($pconfig['interface'] != "any")) {
|
218
|
$input_errors[] = gettext("An IPv4 protocol was selected, but the selected interface has no IPv4 address.");
|
219
|
} elseif ((stristr($pconfig['protocol'], "6") !== false) && !get_interface_ipv6($iv_iface) && ($pconfig['interface'] != "any")) {
|
220
|
$input_errors[] = gettext("An IPv6 protocol was selected, but the selected interface has no IPv6 address.");
|
221
|
}
|
222
|
|
223
|
if ($pconfig['mode'] != "p2p_shared_key")
|
224
|
$tls_mode = true;
|
225
|
else
|
226
|
$tls_mode = false;
|
227
|
|
228
|
if (empty($pconfig['authmode']) && (($pconfig['mode'] == "server_user") || ($pconfig['mode'] == "server_tls_user")))
|
229
|
$input_errors[] = gettext("You must select a Backend for Authentication if the server mode requires User Auth.");
|
230
|
|
231
|
/* input validation */
|
232
|
if ($result = openvpn_validate_port($pconfig['local_port'], 'Local port'))
|
233
|
$input_errors[] = $result;
|
234
|
|
235
|
if ($result = openvpn_validate_cidr($pconfig['tunnel_network'], 'IPv4 Tunnel Network', false, "ipv4"))
|
236
|
$input_errors[] = $result;
|
237
|
|
238
|
if ($result = openvpn_validate_cidr($pconfig['tunnel_networkv6'], 'IPv6 Tunnel Network', false, "ipv6"))
|
239
|
$input_errors[] = $result;
|
240
|
|
241
|
if ($result = openvpn_validate_cidr($pconfig['remote_network'], 'IPv4 Remote Network', true, "ipv4"))
|
242
|
$input_errors[] = $result;
|
243
|
|
244
|
if ($result = openvpn_validate_cidr($pconfig['remote_networkv6'], 'IPv6 Remote Network', true, "ipv6"))
|
245
|
$input_errors[] = $result;
|
246
|
|
247
|
if ($result = openvpn_validate_cidr($pconfig['local_network'], 'IPv4 Local Network', true, "ipv4"))
|
248
|
$input_errors[] = $result;
|
249
|
|
250
|
if ($result = openvpn_validate_cidr($pconfig['local_networkv6'], 'IPv6 Local Network', true, "ipv6"))
|
251
|
$input_errors[] = $result;
|
252
|
|
253
|
$portused = openvpn_port_used($pconfig['protocol'], $pconfig['interface'], $pconfig['local_port'], $vpnid);
|
254
|
if (($portused != $vpnid) && ($portused != 0))
|
255
|
$input_errors[] = gettext("The specified 'Local port' is in use. Please select another value");
|
256
|
|
257
|
if ($pconfig['autokey_enable'])
|
258
|
$pconfig['shared_key'] = openvpn_create_key();
|
259
|
|
260
|
if (!$tls_mode && !$pconfig['autokey_enable'])
|
261
|
if (!strstr($pconfig['shared_key'], "-----BEGIN OpenVPN Static key V1-----") ||
|
262
|
!strstr($pconfig['shared_key'], "-----END OpenVPN Static key V1-----"))
|
263
|
$input_errors[] = gettext("The field 'Shared Key' does not appear to be valid");
|
264
|
|
265
|
if ($tls_mode && $pconfig['tlsauth_enable'] && !$pconfig['autotls_enable'])
|
266
|
if (!strstr($pconfig['tls'], "-----BEGIN OpenVPN Static key V1-----") ||
|
267
|
!strstr($pconfig['tls'], "-----END OpenVPN Static key V1-----"))
|
268
|
$input_errors[] = gettext("The field 'TLS Authentication Key' does not appear to be valid");
|
269
|
|
270
|
if ($pconfig['dns_server_enable']) {
|
271
|
if (!empty($pconfig['dns_server1']) && !is_ipaddr(trim($pconfig['dns_server1'])))
|
272
|
$input_errors[] = gettext("The field 'DNS Server #1' must contain a valid IP address");
|
273
|
if (!empty($pconfig['dns_server2']) && !is_ipaddr(trim($pconfig['dns_server2'])))
|
274
|
$input_errors[] = gettext("The field 'DNS Server #2' must contain a valid IP address");
|
275
|
if (!empty($pconfig['dns_server3']) && !is_ipaddr(trim($pconfig['dns_server3'])))
|
276
|
$input_errors[] = gettext("The field 'DNS Server #3' must contain a valid IP address");
|
277
|
if (!empty($pconfig['dns_server4']) && !is_ipaddr(trim($pconfig['dns_server4'])))
|
278
|
$input_errors[] = gettext("The field 'DNS Server #4' must contain a valid IP address");
|
279
|
}
|
280
|
|
281
|
if ($pconfig['ntp_server_enable']) {
|
282
|
if (!empty($pconfig['ntp_server1']) && !is_ipaddr(trim($pconfig['ntp_server1'])))
|
283
|
$input_errors[] = gettext("The field 'NTP Server #1' must contain a valid IP address");
|
284
|
if (!empty($pconfig['ntp_server2']) && !is_ipaddr(trim($pconfig['ntp_server2'])))
|
285
|
$input_errors[] = gettext("The field 'NTP Server #2' must contain a valid IP address");
|
286
|
if (!empty($pconfig['ntp_server3']) && !is_ipaddr(trim($pconfig['ntp_server3'])))
|
287
|
$input_errors[] = gettext("The field 'NTP Server #3' must contain a valid IP address");
|
288
|
if (!empty($pconfig['ntp_server4']) && !is_ipaddr(trim($pconfig['ntp_server4'])))
|
289
|
$input_errors[] = gettext("The field 'NTP Server #4' must contain a valid IP address");
|
290
|
}
|
291
|
|
292
|
if ($pconfig['netbios_enable']) {
|
293
|
if ($pconfig['wins_server_enable']) {
|
294
|
if (!empty($pconfig['wins_server1']) && !is_ipaddr(trim($pconfig['wins_server1'])))
|
295
|
$input_errors[] = gettext("The field 'WINS Server #1' must contain a valid IP address");
|
296
|
if (!empty($pconfig['wins_server2']) && !is_ipaddr(trim($pconfig['wins_server2'])))
|
297
|
$input_errors[] = gettext("The field 'WINS Server #2' must contain a valid IP address");
|
298
|
}
|
299
|
if ($pconfig['nbdd_server_enable'])
|
300
|
if (!empty($pconfig['nbdd_server1']) && !is_ipaddr(trim($pconfig['nbdd_server1'])))
|
301
|
$input_errors[] = gettext("The field 'NetBIOS Data Distribution Server #1' must contain a valid IP address");
|
302
|
}
|
303
|
|
304
|
if ($pconfig['maxclients'] && !is_numeric($pconfig['maxclients']))
|
305
|
$input_errors[] = gettext("The field 'Concurrent connections' must be numeric.");
|
306
|
|
307
|
/* If we are not in shared key mode, then we need the CA/Cert. */
|
308
|
if ($pconfig['mode'] != "p2p_shared_key") {
|
309
|
$reqdfields = explode(" ", "caref certref");
|
310
|
$reqdfieldsn = array(gettext("Certificate Authority"),gettext("Certificate"));
|
311
|
} elseif (!$pconfig['autokey_enable']) {
|
312
|
/* We only need the shared key filled in if we are in shared key mode and autokey is not selected. */
|
313
|
$reqdfields = array('shared_key');
|
314
|
$reqdfieldsn = array(gettext('Shared key'));
|
315
|
}
|
316
|
|
317
|
if ($pconfig['dev_mode'] != "tap") {
|
318
|
$reqdfields[] = 'tunnel_network';
|
319
|
$reqdfieldsn[] = gettext('Tunnel network');
|
320
|
} else {
|
321
|
if ($pconfig['serverbridge_dhcp'] && $pconfig['tunnel_network'])
|
322
|
$input_errors[] = gettext("Using a tunnel network and server bridge settings together is not allowed.");
|
323
|
if (($pconfig['serverbridge_dhcp_start'] && !$pconfig['serverbridge_dhcp_end'])
|
324
|
|| (!$pconfig['serverbridge_dhcp_start'] && $pconfig['serverbridge_dhcp_end']))
|
325
|
$input_errors[] = gettext("Server Bridge DHCP Start and End must both be empty, or defined.");
|
326
|
if (($pconfig['serverbridge_dhcp_start'] && !is_ipaddrv4($pconfig['serverbridge_dhcp_start'])))
|
327
|
$input_errors[] = gettext("Server Bridge DHCP Start must be an IPv4 address.");
|
328
|
if (($pconfig['serverbridge_dhcp_end'] && !is_ipaddrv4($pconfig['serverbridge_dhcp_end'])))
|
329
|
$input_errors[] = gettext("Server Bridge DHCP End must be an IPv4 address.");
|
330
|
if (ip2ulong($pconfig['serverbridge_dhcp_start']) > ip2ulong($pconfig['serverbridge_dhcp_end']))
|
331
|
$input_errors[] = gettext("The Server Bridge DHCP range is invalid (start higher than end).");
|
332
|
}
|
333
|
do_input_validation($_POST, $reqdfields, $reqdfieldsn, &$input_errors);
|
334
|
|
335
|
if (!$input_errors) {
|
336
|
|
337
|
$server = array();
|
338
|
|
339
|
if ($id && $pconfig['dev_mode'] <> $a_server[$id]['dev_mode'])
|
340
|
openvpn_delete('server', $a_server[$id]);// delete(rename) old interface so a new TUN or TAP interface can be created.
|
341
|
|
342
|
if ($vpnid)
|
343
|
$server['vpnid'] = $vpnid;
|
344
|
else
|
345
|
$server['vpnid'] = openvpn_vpnid_next();
|
346
|
|
347
|
if ($_POST['disable'] == "yes")
|
348
|
$server['disable'] = true;
|
349
|
$server['mode'] = $pconfig['mode'];
|
350
|
if (!empty($pconfig['authmode']))
|
351
|
$server['authmode'] = implode(",", $pconfig['authmode']);
|
352
|
$server['protocol'] = $pconfig['protocol'];
|
353
|
$server['dev_mode'] = $pconfig['dev_mode'];
|
354
|
list($server['interface'], $server['ipaddr']) = explode ("|",$pconfig['interface']);
|
355
|
$server['local_port'] = $pconfig['local_port'];
|
356
|
$server['description'] = $pconfig['description'];
|
357
|
$server['custom_options'] = str_replace("\r\n", "\n", $pconfig['custom_options']);
|
358
|
|
359
|
if ($tls_mode) {
|
360
|
if ($pconfig['tlsauth_enable']) {
|
361
|
if ($pconfig['autotls_enable'])
|
362
|
$pconfig['tls'] = openvpn_create_key();
|
363
|
$server['tls'] = base64_encode($pconfig['tls']);
|
364
|
}
|
365
|
$server['caref'] = $pconfig['caref'];
|
366
|
$server['crlref'] = $pconfig['crlref'];
|
367
|
$server['certref'] = $pconfig['certref'];
|
368
|
$server['dh_length'] = $pconfig['dh_length'];
|
369
|
$server['cert_depth'] = $pconfig['cert_depth'];
|
370
|
if ($pconfig['mode'] == "server_tls_user")
|
371
|
$server['strictusercn'] = $pconfig['strictusercn'];
|
372
|
} else {
|
373
|
$server['shared_key'] = base64_encode($pconfig['shared_key']);
|
374
|
}
|
375
|
$server['crypto'] = $pconfig['crypto'];
|
376
|
$server['engine'] = $pconfig['engine'];
|
377
|
|
378
|
$server['tunnel_network'] = $pconfig['tunnel_network'];
|
379
|
$server['tunnel_networkv6'] = $pconfig['tunnel_networkv6'];
|
380
|
$server['remote_network'] = $pconfig['remote_network'];
|
381
|
$server['remote_networkv6'] = $pconfig['remote_networkv6'];
|
382
|
$server['gwredir'] = $pconfig['gwredir'];
|
383
|
$server['local_network'] = $pconfig['local_network'];
|
384
|
$server['local_networkv6'] = $pconfig['local_networkv6'];
|
385
|
$server['maxclients'] = $pconfig['maxclients'];
|
386
|
$server['compression'] = $pconfig['compression'];
|
387
|
$server['passtos'] = $pconfig['passtos'];
|
388
|
$server['client2client'] = $pconfig['client2client'];
|
389
|
|
390
|
$server['dynamic_ip'] = $pconfig['dynamic_ip'];
|
391
|
$server['pool_enable'] = $pconfig['pool_enable'];
|
392
|
$server['topology_subnet'] = $pconfig['topology_subnet'];
|
393
|
|
394
|
$server['serverbridge_dhcp'] = $pconfig['serverbridge_dhcp'];
|
395
|
$server['serverbridge_interface'] = $pconfig['serverbridge_interface'];
|
396
|
$server['serverbridge_dhcp_start'] = $pconfig['serverbridge_dhcp_start'];
|
397
|
$server['serverbridge_dhcp_end'] = $pconfig['serverbridge_dhcp_end'];
|
398
|
|
399
|
if ($pconfig['dns_domain_enable'])
|
400
|
$server['dns_domain'] = $pconfig['dns_domain'];
|
401
|
|
402
|
if ($pconfig['dns_server_enable']) {
|
403
|
$server['dns_server1'] = $pconfig['dns_server1'];
|
404
|
$server['dns_server2'] = $pconfig['dns_server2'];
|
405
|
$server['dns_server3'] = $pconfig['dns_server3'];
|
406
|
$server['dns_server4'] = $pconfig['dns_server4'];
|
407
|
}
|
408
|
|
409
|
if ($pconfig['ntp_server_enable']) {
|
410
|
$server['ntp_server1'] = $pconfig['ntp_server1'];
|
411
|
$server['ntp_server2'] = $pconfig['ntp_server2'];
|
412
|
}
|
413
|
|
414
|
$server['netbios_enable'] = $pconfig['netbios_enable'];
|
415
|
$server['netbios_ntype'] = $pconfig['netbios_ntype'];
|
416
|
$server['netbios_scope'] = $pconfig['netbios_scope'];
|
417
|
|
418
|
if ($pconfig['netbios_enable']) {
|
419
|
|
420
|
if ($pconfig['wins_server_enable']) {
|
421
|
$server['wins_server1'] = $pconfig['wins_server1'];
|
422
|
$server['wins_server2'] = $pconfig['wins_server2'];
|
423
|
}
|
424
|
|
425
|
if ($pconfig['dns_server_enable'])
|
426
|
$server['nbdd_server1'] = $pconfig['nbdd_server1'];
|
427
|
}
|
428
|
|
429
|
if ($_POST['duplicate_cn'] == "yes")
|
430
|
$server['duplicate_cn'] = true;
|
431
|
|
432
|
if (isset($id) && $a_server[$id])
|
433
|
$a_server[$id] = $server;
|
434
|
else
|
435
|
$a_server[] = $server;
|
436
|
|
437
|
openvpn_resync('server', $server);
|
438
|
write_config();
|
439
|
|
440
|
header("Location: vpn_openvpn_server.php");
|
441
|
exit;
|
442
|
}
|
443
|
if (!empty($pconfig['authmode']))
|
444
|
$pconfig['authmode'] = implode(",", $pconfig['authmode']);
|
445
|
}
|
446
|
$pgtitle = array(gettext("OpenVPN"), gettext("Server"));
|
447
|
$shortcut_section = "openvpn";
|
448
|
|
449
|
include("head.inc");
|
450
|
|
451
|
?>
|
452
|
|
453
|
<body link="#000000" vlink="#000000" alink="#000000" onload="<?= $jsevents["body"]["onload"] ?>">
|
454
|
<?php include("fbegin.inc"); ?>
|
455
|
<script type="text/JavaScript">
|
456
|
<!--
|
457
|
|
458
|
function mode_change() {
|
459
|
index = document.iform.mode.selectedIndex;
|
460
|
value = document.iform.mode.options[index].value;
|
461
|
switch(value) {
|
462
|
case "p2p_tls":
|
463
|
case "server_tls":
|
464
|
case "server_user":
|
465
|
document.getElementById("tls").style.display="";
|
466
|
document.getElementById("tls_ca").style.display="";
|
467
|
document.getElementById("tls_crl").style.display="";
|
468
|
document.getElementById("tls_cert").style.display="";
|
469
|
document.getElementById("tls_dh").style.display="";
|
470
|
document.getElementById("cert_depth").style.display="";
|
471
|
document.getElementById("strictusercn").style.display="none";
|
472
|
document.getElementById("psk").style.display="none";
|
473
|
break;
|
474
|
case "server_tls_user":
|
475
|
document.getElementById("tls").style.display="";
|
476
|
document.getElementById("tls_ca").style.display="";
|
477
|
document.getElementById("tls_crl").style.display="";
|
478
|
document.getElementById("tls_cert").style.display="";
|
479
|
document.getElementById("tls_dh").style.display="";
|
480
|
document.getElementById("cert_depth").style.display="";
|
481
|
document.getElementById("strictusercn").style.display="";
|
482
|
document.getElementById("psk").style.display="none";
|
483
|
break;
|
484
|
case "p2p_shared_key":
|
485
|
document.getElementById("tls").style.display="none";
|
486
|
document.getElementById("tls_ca").style.display="none";
|
487
|
document.getElementById("tls_crl").style.display="none";
|
488
|
document.getElementById("tls_cert").style.display="none";
|
489
|
document.getElementById("tls_dh").style.display="none";
|
490
|
document.getElementById("cert_depth").style.display="none";
|
491
|
document.getElementById("strictusercn").style.display="none";
|
492
|
document.getElementById("psk").style.display="";
|
493
|
break;
|
494
|
}
|
495
|
switch(value) {
|
496
|
case "p2p_shared_key":
|
497
|
document.getElementById("client_opts").style.display="none";
|
498
|
document.getElementById("adv_confg").style.display="";
|
499
|
document.getElementById("remote_optsv4").style.display="";
|
500
|
document.getElementById("remote_optsv6").style.display="";
|
501
|
document.getElementById("gwredir_opts").style.display="none";
|
502
|
document.getElementById("local_optsv4").style.display="none";
|
503
|
document.getElementById("local_optsv6").style.display="none";
|
504
|
document.getElementById("authmodetr").style.display="none";
|
505
|
document.getElementById("inter_client_communication").style.display="none";
|
506
|
break;
|
507
|
case "p2p_tls":
|
508
|
document.getElementById("client_opts").style.display="none";
|
509
|
document.getElementById("adv_confg").style.display="";
|
510
|
document.getElementById("remote_optsv4").style.display="";
|
511
|
document.getElementById("remote_optsv6").style.display="";
|
512
|
document.getElementById("gwredir_opts").style.display="";
|
513
|
document.getElementById("local_optsv4").style.display="";
|
514
|
document.getElementById("local_optsv6").style.display="";
|
515
|
document.getElementById("authmodetr").style.display="none";
|
516
|
document.getElementById("inter_client_communication").style.display="none";
|
517
|
break;
|
518
|
case "server_user":
|
519
|
case "server_tls_user":
|
520
|
document.getElementById("authmodetr").style.display="";
|
521
|
document.getElementById("adv_confg").style.display="";
|
522
|
document.getElementById("client_opts").style.display="";
|
523
|
document.getElementById("remote_optsv4").style.display="none";
|
524
|
document.getElementById("remote_optsv6").style.display="none";
|
525
|
document.getElementById("gwredir_opts").style.display="";
|
526
|
document.getElementById("local_optsv4").style.display="";
|
527
|
document.getElementById("local_optsv6").style.display="";
|
528
|
document.getElementById("inter_client_communication").style.display="";
|
529
|
break;
|
530
|
case "server_tls":
|
531
|
document.getElementById("authmodetr").style.display="none";
|
532
|
default:
|
533
|
document.getElementById("client_opts").style.display="";
|
534
|
document.getElementById("adv_confg").style.display="";
|
535
|
document.getElementById("remote_optsv4").style.display="none";
|
536
|
document.getElementById("remote_optsv6").style.display="none";
|
537
|
document.getElementById("gwredir_opts").style.display="";
|
538
|
document.getElementById("local_optsv4").style.display="";
|
539
|
document.getElementById("local_optsv6").style.display="";
|
540
|
document.getElementById("inter_client_communication").style.display="";
|
541
|
break;
|
542
|
}
|
543
|
gwredir_change();
|
544
|
}
|
545
|
|
546
|
function autokey_change() {
|
547
|
|
548
|
if ((document.iform.autokey_enable != null) && (document.iform.autokey_enable.checked))
|
549
|
document.getElementById("autokey_opts").style.display="none";
|
550
|
else
|
551
|
document.getElementById("autokey_opts").style.display="";
|
552
|
}
|
553
|
|
554
|
function tlsauth_change() {
|
555
|
|
556
|
<?php if (!$pconfig['tls']): ?>
|
557
|
if (document.iform.tlsauth_enable.checked)
|
558
|
document.getElementById("tlsauth_opts").style.display="";
|
559
|
else
|
560
|
document.getElementById("tlsauth_opts").style.display="none";
|
561
|
<?php endif; ?>
|
562
|
|
563
|
autotls_change();
|
564
|
}
|
565
|
|
566
|
function autotls_change() {
|
567
|
|
568
|
<?php if (!$pconfig['tls']): ?>
|
569
|
autocheck = document.iform.autotls_enable.checked;
|
570
|
<?php else: ?>
|
571
|
autocheck = false;
|
572
|
<?php endif; ?>
|
573
|
|
574
|
if (document.iform.tlsauth_enable.checked && !autocheck)
|
575
|
document.getElementById("autotls_opts").style.display="";
|
576
|
else
|
577
|
document.getElementById("autotls_opts").style.display="none";
|
578
|
}
|
579
|
|
580
|
function gwredir_change() {
|
581
|
|
582
|
if (document.iform.gwredir.checked) {
|
583
|
document.getElementById("local_optsv4").style.display="none";
|
584
|
document.getElementById("local_optsv6").style.display="none";
|
585
|
} else {
|
586
|
document.getElementById("local_optsv4").style.display="";
|
587
|
document.getElementById("local_optsv6").style.display="";
|
588
|
}
|
589
|
}
|
590
|
|
591
|
function dns_domain_change() {
|
592
|
|
593
|
if (document.iform.dns_domain_enable.checked)
|
594
|
document.getElementById("dns_domain_data").style.display="";
|
595
|
else
|
596
|
document.getElementById("dns_domain_data").style.display="none";
|
597
|
}
|
598
|
|
599
|
function dns_server_change() {
|
600
|
|
601
|
if (document.iform.dns_server_enable.checked)
|
602
|
document.getElementById("dns_server_data").style.display="";
|
603
|
else
|
604
|
document.getElementById("dns_server_data").style.display="none";
|
605
|
}
|
606
|
|
607
|
function wins_server_change() {
|
608
|
|
609
|
if (document.iform.wins_server_enable.checked)
|
610
|
document.getElementById("wins_server_data").style.display="";
|
611
|
else
|
612
|
document.getElementById("wins_server_data").style.display="none";
|
613
|
}
|
614
|
|
615
|
function ntp_server_change() {
|
616
|
|
617
|
if (document.iform.ntp_server_enable.checked)
|
618
|
document.getElementById("ntp_server_data").style.display="";
|
619
|
else
|
620
|
document.getElementById("ntp_server_data").style.display="none";
|
621
|
}
|
622
|
|
623
|
function netbios_change() {
|
624
|
|
625
|
if (document.iform.netbios_enable.checked) {
|
626
|
document.getElementById("netbios_data").style.display="";
|
627
|
document.getElementById("wins_opts").style.display="";
|
628
|
} else {
|
629
|
document.getElementById("netbios_data").style.display="none";
|
630
|
document.getElementById("wins_opts").style.display="none";
|
631
|
}
|
632
|
}
|
633
|
|
634
|
function tuntap_change() {
|
635
|
|
636
|
mindex = document.iform.mode.selectedIndex;
|
637
|
mvalue = document.iform.mode.options[mindex].value;
|
638
|
|
639
|
switch(mvalue) {
|
640
|
case "p2p_tls":
|
641
|
case "p2p_shared_key":
|
642
|
p2p = true;
|
643
|
break;
|
644
|
default:
|
645
|
p2p = false;
|
646
|
break;
|
647
|
}
|
648
|
|
649
|
index = document.iform.dev_mode.selectedIndex;
|
650
|
value = document.iform.dev_mode.options[index].value;
|
651
|
switch(value) {
|
652
|
case "tun":
|
653
|
document.getElementById("ipv4_tunnel_network").className="vncellreq";
|
654
|
document.getElementById("serverbridge_dhcp").style.display="none";
|
655
|
document.getElementById("serverbridge_interface").style.display="none";
|
656
|
document.getElementById("serverbridge_dhcp_start").style.display="none";
|
657
|
document.getElementById("serverbridge_dhcp_end").style.display="none";
|
658
|
document.getElementById("topology_subnet_opt").style.display="";
|
659
|
break;
|
660
|
case "tap":
|
661
|
document.getElementById("ipv4_tunnel_network").className="vncell";
|
662
|
if (!p2p) {
|
663
|
document.getElementById("serverbridge_dhcp").style.display="";
|
664
|
document.getElementById("serverbridge_interface").style.display="";
|
665
|
document.getElementById("serverbridge_dhcp_start").style.display="";
|
666
|
document.getElementById("serverbridge_dhcp_end").style.display="";
|
667
|
document.getElementById("topology_subnet_opt").style.display="none";
|
668
|
document.iform.serverbridge_dhcp.disabled = false;
|
669
|
if (document.iform.serverbridge_dhcp.checked) {
|
670
|
document.iform.serverbridge_interface.disabled = false;
|
671
|
document.iform.serverbridge_dhcp_start.disabled = false;
|
672
|
document.iform.serverbridge_dhcp_end.disabled = false;
|
673
|
} else {
|
674
|
document.iform.serverbridge_interface.disabled = true;
|
675
|
document.iform.serverbridge_dhcp_start.disabled = true;
|
676
|
document.iform.serverbridge_dhcp_end.disabled = true;
|
677
|
}
|
678
|
} else {
|
679
|
document.getElementById("topology_subnet_opt").style.display="none";
|
680
|
document.iform.serverbridge_dhcp.disabled = true;
|
681
|
document.iform.serverbridge_interface.disabled = true;
|
682
|
document.iform.serverbridge_dhcp_start.disabled = true;
|
683
|
document.iform.serverbridge_dhcp_end.disabled = true;
|
684
|
}
|
685
|
break;
|
686
|
}
|
687
|
}
|
688
|
//-->
|
689
|
</script>
|
690
|
<?php
|
691
|
if (!$savemsg)
|
692
|
$savemsg = "";
|
693
|
|
694
|
if ($input_errors)
|
695
|
print_input_errors($input_errors);
|
696
|
if ($savemsg)
|
697
|
print_info_box_np($savemsg);
|
698
|
?>
|
699
|
<table width="100%" border="0" cellpadding="0" cellspacing="0">
|
700
|
<tr>
|
701
|
<ul id="tabnav"><li>
|
702
|
<ul id="tabnav">
|
703
|
<?php
|
704
|
$tab_array = array();
|
705
|
$tab_array[] = array(gettext("Server"), true, "vpn_openvpn_server.php");
|
706
|
$tab_array[] = array(gettext("Client"), false, "vpn_openvpn_client.php");
|
707
|
$tab_array[] = array(gettext("Client Specific Overrides"), false, "vpn_openvpn_csc.php");
|
708
|
$tab_array[] = array(gettext("Wizards"), false, "wizard.php?xml=openvpn_wizard.xml");
|
709
|
add_package_tabs("OpenVPN", $tab_array);
|
710
|
display_top_tabs($tab_array);
|
711
|
?>
|
712
|
</li></ul>
|
713
|
</td>
|
714
|
</tr>
|
715
|
<tr>
|
716
|
<td class="tabcont">
|
717
|
|
718
|
<?php if($act=="new" || $act=="edit"): ?>
|
719
|
|
720
|
<form action="vpn_openvpn_server.php" method="post" name="iform" id="iform" onsubmit="presubmit()">
|
721
|
<table width="100%" border="0" cellpadding="6" cellspacing="0">
|
722
|
<tr>
|
723
|
<td colspan="2" valign="top" class="listtopic"><?=gettext("General information"); ?></td>
|
724
|
</tr>
|
725
|
<tr>
|
726
|
<td width="22%" valign="top" class="vncellreq"><?=gettext("Disabled"); ?></td>
|
727
|
<td width="78%" class="vtable">
|
728
|
<table border="0" cellpadding="0" cellspacing="0">
|
729
|
<tr>
|
730
|
<td>
|
731
|
<?php set_checked($pconfig['disable'],$chk); ?>
|
732
|
<input name="disable" type="checkbox" value="yes" <?=$chk;?>/>
|
733
|
</td>
|
734
|
<td>
|
735
|
|
736
|
<span class="vexpl">
|
737
|
<strong><?=gettext("Disable this server"); ?></strong><br />
|
738
|
</span>
|
739
|
</td>
|
740
|
</tr>
|
741
|
</table>
|
742
|
<?=gettext("Set this option to disable this server without removing it from the list"); ?>.
|
743
|
</td>
|
744
|
</tr>
|
745
|
<tr>
|
746
|
<td width="22%" valign="top" class="vncellreq"><?=gettext("Server Mode");?></td>
|
747
|
<td width="78%" class="vtable">
|
748
|
<select name='mode' id='mode' class="formselect" onchange='mode_change(); tuntap_change()'>
|
749
|
<?php
|
750
|
foreach ($openvpn_server_modes as $name => $desc):
|
751
|
$selected = "";
|
752
|
if ($pconfig['mode'] == $name)
|
753
|
$selected = "selected=\"selected\"";
|
754
|
?>
|
755
|
<option value="<?=$name;?>" <?=$selected;?>><?=$desc;?></option>
|
756
|
<?php endforeach; ?>
|
757
|
</select>
|
758
|
</td>
|
759
|
</tr>
|
760
|
<tr id="authmodetr" style="display:none">
|
761
|
<td width="22%" valign="top" class="vncellreq"><?=gettext("Backend for authentication");?></td>
|
762
|
<td width="78%" class="vtable">
|
763
|
<select name='authmode[]' id='authmode' class="formselect" multiple="multiple" size="<?php echo count($auth_servers); ?>">
|
764
|
<?php $authmodes = explode(",", $pconfig['authmode']); ?>
|
765
|
<?php
|
766
|
$auth_servers = auth_get_authserver_list();
|
767
|
foreach ($auth_servers as $auth_server):
|
768
|
$selected = "";
|
769
|
if (in_array($auth_server['name'], $authmodes))
|
770
|
$selected = "selected=\"selected\"";
|
771
|
?>
|
772
|
<option value="<?=$auth_server['name'];?>" <?=$selected;?>><?=$auth_server['name'];?></option>
|
773
|
<?php endforeach; ?>
|
774
|
</select>
|
775
|
</td>
|
776
|
</tr>
|
777
|
<tr>
|
778
|
<td width="22%" valign="top" class="vncellreq"><?=gettext("Protocol");?></td>
|
779
|
<td width="78%" class="vtable">
|
780
|
<select name='protocol' class="formselect">
|
781
|
<?php
|
782
|
foreach ($openvpn_prots as $prot):
|
783
|
$selected = "";
|
784
|
if ($pconfig['protocol'] == $prot)
|
785
|
$selected = "selected=\"selected\"";
|
786
|
?>
|
787
|
<option value="<?=$prot;?>" <?=$selected;?>><?=$prot;?></option>
|
788
|
<?php endforeach; ?>
|
789
|
</select>
|
790
|
</td>
|
791
|
</tr>
|
792
|
<tr>
|
793
|
<td width="22%" valign="top" class="vncellreq"><?=gettext("Device Mode"); ?></td>
|
794
|
<td width="78%" class="vtable">
|
795
|
<select name="dev_mode" class="formselect" onchange='tuntap_change()'>
|
796
|
<?php
|
797
|
foreach ($openvpn_dev_mode as $device):
|
798
|
$selected = "";
|
799
|
if (! empty($pconfig['dev_mode'])) {
|
800
|
if ($pconfig['dev_mode'] == $device)
|
801
|
$selected = "selected=\"selected\"";
|
802
|
} else {
|
803
|
if ($device == "tun")
|
804
|
$selected = "selected=\"selected\"";
|
805
|
}
|
806
|
?>
|
807
|
<option value="<?=$device;?>" <?=$selected;?>><?=$device;?></option>
|
808
|
<?php endforeach; ?>
|
809
|
</select>
|
810
|
</td>
|
811
|
</tr>
|
812
|
<tr>
|
813
|
<td width="22%" valign="top" class="vncellreq"><?=gettext("Interface"); ?></td>
|
814
|
<td width="78%" class="vtable">
|
815
|
<select name="interface" class="formselect">
|
816
|
<?php
|
817
|
$interfaces = get_configured_interface_with_descr();
|
818
|
$carplist = get_configured_carp_interface_list();
|
819
|
foreach ($carplist as $cif => $carpip)
|
820
|
$interfaces[$cif.'|'.$carpip] = $carpip." (".get_vip_descr($carpip).")";
|
821
|
$aliaslist = get_configured_ip_aliases_list();
|
822
|
foreach ($aliaslist as $aliasip => $aliasif)
|
823
|
$interfaces[$aliasif.'|'.$aliasip] = $aliasip." (".get_vip_descr($aliasip).")";
|
824
|
$grouplist = return_gateway_groups_array();
|
825
|
foreach ($grouplist as $name => $group) {
|
826
|
if($group['ipprotocol'] != inet)
|
827
|
continue;
|
828
|
if($group[0]['vip'] <> "")
|
829
|
$vipif = $group[0]['vip'];
|
830
|
else
|
831
|
$vipif = $group[0]['int'];
|
832
|
$interfaces[$name] = "GW Group {$name}";
|
833
|
}
|
834
|
$interfaces['lo0'] = "Localhost";
|
835
|
$interfaces['any'] = "any";
|
836
|
foreach ($interfaces as $iface => $ifacename):
|
837
|
$selected = "";
|
838
|
if ($iface == $pconfig['interface'])
|
839
|
$selected = "selected=\"selected\"";
|
840
|
?>
|
841
|
<option value="<?=$iface;?>" <?=$selected;?>>
|
842
|
<?=htmlspecialchars($ifacename);?>
|
843
|
</option>
|
844
|
<?php endforeach; ?>
|
845
|
</select> <br />
|
846
|
</td>
|
847
|
</tr>
|
848
|
<tr>
|
849
|
<td width="22%" valign="top" class="vncellreq"><?=gettext("Local port");?></td>
|
850
|
<td width="78%" class="vtable">
|
851
|
<input name="local_port" type="text" class="formfld unknown" size="5" value="<?=htmlspecialchars($pconfig['local_port']);?>"/>
|
852
|
</td>
|
853
|
</tr>
|
854
|
<tr>
|
855
|
<td width="22%" valign="top" class="vncell"><?=gettext("Description"); ?></td>
|
856
|
<td width="78%" class="vtable">
|
857
|
<input name="description" type="text" class="formfld unknown" size="30" value="<?=htmlspecialchars($pconfig['description']);?>"/>
|
858
|
<br />
|
859
|
<?=gettext("You may enter a description here for your reference (not parsed)"); ?>.
|
860
|
</td>
|
861
|
</tr>
|
862
|
<tr>
|
863
|
<td colspan="2" class="list" height="12"></td>
|
864
|
</tr>
|
865
|
<tr>
|
866
|
<td colspan="2" valign="top" class="listtopic"><?=gettext("Cryptographic Settings"); ?></td>
|
867
|
</tr>
|
868
|
<tr id="tls">
|
869
|
<td width="22%" valign="top" class="vncellreq"><?=gettext("TLS Authentication"); ?></td>
|
870
|
<td width="78%" class="vtable">
|
871
|
<table border="0" cellpadding="2" cellspacing="0">
|
872
|
<tr>
|
873
|
<td>
|
874
|
<?php set_checked($pconfig['tlsauth_enable'],$chk); ?>
|
875
|
<input name="tlsauth_enable" id="tlsauth_enable" type="checkbox" value="yes" <?=$chk;?> onclick="tlsauth_change()"/>
|
876
|
</td>
|
877
|
<td>
|
878
|
<span class="vexpl">
|
879
|
<?=gettext("Enable authentication of TLS packets"); ?>.
|
880
|
</span>
|
881
|
</td>
|
882
|
</tr>
|
883
|
</table>
|
884
|
<?php if (!$pconfig['tls']): ?>
|
885
|
<table border="0" cellpadding="2" cellspacing="0" id='tlsauth_opts'>
|
886
|
<tr>
|
887
|
<td>
|
888
|
<?php set_checked($pconfig['autotls_enable'],$chk); ?>
|
889
|
<input name="autotls_enable" id="autotls_enable" type="checkbox" value="yes" <?=$chk;?> onclick="autotls_change()"/>
|
890
|
</td>
|
891
|
<td>
|
892
|
<span class="vexpl">
|
893
|
<?=gettext("Automatically generate a shared TLS authentication key"); ?>.
|
894
|
</span>
|
895
|
</td>
|
896
|
</tr>
|
897
|
</table>
|
898
|
<?php endif; ?>
|
899
|
<table border="0" cellpadding="2" cellspacing="0" id='autotls_opts'>
|
900
|
<tr>
|
901
|
<td>
|
902
|
<textarea name="tls" cols="65" rows="7" class="formpre"><?=htmlspecialchars($pconfig['tls']);?></textarea>
|
903
|
<br/>
|
904
|
<?=gettext("Paste your shared key here"); ?>.
|
905
|
</td>
|
906
|
</tr>
|
907
|
</table>
|
908
|
</td>
|
909
|
</tr>
|
910
|
<tr id="tls_ca">
|
911
|
<td width="22%" valign="top" class="vncellreq"><?=gettext("Peer Certificate Authority"); ?></td>
|
912
|
<td width="78%" class="vtable">
|
913
|
<?php if (count($a_ca)): ?>
|
914
|
<select name='caref' class="formselect">
|
915
|
<?php
|
916
|
foreach ($a_ca as $ca):
|
917
|
$selected = "";
|
918
|
if ($pconfig['caref'] == $ca['refid'])
|
919
|
$selected = "selected=\"selected\"";
|
920
|
?>
|
921
|
<option value="<?=$ca['refid'];?>" <?=$selected;?>><?=$ca['descr'];?></option>
|
922
|
<?php endforeach; ?>
|
923
|
</select>
|
924
|
<?php else: ?>
|
925
|
<b>No Certificate Authorities defined.</b> <br/>Create one under <a href="system_camanager.php">System > Cert Manager</a>.
|
926
|
<?php endif; ?>
|
927
|
</td>
|
928
|
</tr>
|
929
|
<tr id="tls_crl">
|
930
|
<td width="22%" valign="top" class="vncellreq"><?=gettext("Peer Certificate Revocation List"); ?></td>
|
931
|
<td width="78%" class="vtable">
|
932
|
<?php if (count($a_crl)): ?>
|
933
|
<select name='crlref' class="formselect">
|
934
|
<option value="">None</option>
|
935
|
<?php
|
936
|
foreach ($a_crl as $crl):
|
937
|
$selected = "";
|
938
|
$caname = "";
|
939
|
$ca = lookup_ca($crl['caref']);
|
940
|
if ($ca) {
|
941
|
$caname = " (CA: {$ca['descr']})";
|
942
|
if ($pconfig['crlref'] == $crl['refid'])
|
943
|
$selected = "selected=\"selected\"";
|
944
|
}
|
945
|
?>
|
946
|
<option value="<?=$crl['refid'];?>" <?=$selected;?>><?=$crl['descr'] . $caname;?></option>
|
947
|
<?php endforeach; ?>
|
948
|
</select>
|
949
|
<?php else: ?>
|
950
|
<b>No Certificate Revocation Lists (CRLs) defined.</b> <br/>Create one under <a href="system_crlmanager.php">System > Cert Manager</a>.
|
951
|
<?php endif; ?>
|
952
|
</td>
|
953
|
</tr>
|
954
|
<tr id="tls_cert">
|
955
|
<td width="22%" valign="top" class="vncellreq"><?=gettext("Server Certificate"); ?></td>
|
956
|
<td width="78%" class="vtable">
|
957
|
<?php if (count($a_cert)): ?>
|
958
|
<select name='certref' class="formselect">
|
959
|
<?php
|
960
|
foreach ($a_cert as $cert):
|
961
|
$selected = "";
|
962
|
$caname = "";
|
963
|
$inuse = "";
|
964
|
$revoked = "";
|
965
|
$ca = lookup_ca($cert['caref']);
|
966
|
if ($ca)
|
967
|
$caname = " (CA: {$ca['descr']})";
|
968
|
if ($pconfig['certref'] == $cert['refid'])
|
969
|
$selected = "selected=\"selected\"";
|
970
|
if (cert_in_use($cert['refid']))
|
971
|
$inuse = " *In Use";
|
972
|
if (is_cert_revoked($cert))
|
973
|
$revoked = " *Revoked";
|
974
|
?>
|
975
|
<option value="<?=$cert['refid'];?>" <?=$selected;?>><?=$cert['descr'] . $caname . $inuse . $revoked;?></option>
|
976
|
<?php endforeach; ?>
|
977
|
</select>
|
978
|
<?php else: ?>
|
979
|
<b>No Certificates defined.</b> <br/>Create one under <a href="system_certmanager.php">System > Cert Manager</a>.
|
980
|
<?php endif; ?>
|
981
|
</td>
|
982
|
</tr>
|
983
|
<tr id="tls_dh">
|
984
|
<td width="22%" valign="top" class="vncellreq"><?=gettext("DH Parameters Length"); ?></td>
|
985
|
<td width="78%" class="vtable">
|
986
|
<select name="dh_length" class="formselect">
|
987
|
<?php
|
988
|
foreach ($openvpn_dh_lengths as $length):
|
989
|
$selected = '';
|
990
|
if ($length == $pconfig['dh_length'])
|
991
|
$selected = 'selected="selected"';
|
992
|
?>
|
993
|
<option <?=$selected?>> <?=$length;?></option>
|
994
|
<?php endforeach; ?>
|
995
|
</select>
|
996
|
<span class="vexpl">
|
997
|
<?=gettext("bits"); ?>
|
998
|
</span>
|
999
|
</td>
|
1000
|
</tr>
|
1001
|
<tr id="psk">
|
1002
|
<td width="22%" valign="top" class="vncellreq"><?=gettext("Shared Key"); ?></td>
|
1003
|
<td width="78%" class="vtable">
|
1004
|
<?php if (!$pconfig['shared_key']): ?>
|
1005
|
<table border="0" cellpadding="2" cellspacing="0">
|
1006
|
<tr>
|
1007
|
<td>
|
1008
|
<?php set_checked($pconfig['autokey_enable'],$chk); ?>
|
1009
|
<input name="autokey_enable" type="checkbox" value="yes" <?=$chk;?> onclick="autokey_change()"/>
|
1010
|
</td>
|
1011
|
<td>
|
1012
|
<span class="vexpl">
|
1013
|
<?=gettext("Automatically generate a shared key"); ?>.
|
1014
|
</span>
|
1015
|
</td>
|
1016
|
</tr>
|
1017
|
</table>
|
1018
|
<?php endif; ?>
|
1019
|
<table border="0" cellpadding="2" cellspacing="0" id='autokey_opts'>
|
1020
|
<tr>
|
1021
|
<td>
|
1022
|
<textarea name="shared_key" cols="65" rows="7" class="formpre"><?=htmlspecialchars($pconfig['shared_key']);?></textarea>
|
1023
|
<br/>
|
1024
|
<?=gettext("Paste your shared key here"); ?>.
|
1025
|
</td>
|
1026
|
</tr>
|
1027
|
</table>
|
1028
|
</td>
|
1029
|
</tr>
|
1030
|
<tr>
|
1031
|
<td width="22%" valign="top" class="vncellreq"><?=gettext("Encryption algorithm"); ?></td>
|
1032
|
<td width="78%" class="vtable">
|
1033
|
<select name="crypto" class="formselect">
|
1034
|
<?php
|
1035
|
$cipherlist = openvpn_get_cipherlist();
|
1036
|
foreach ($cipherlist as $name => $desc):
|
1037
|
$selected = '';
|
1038
|
if ($name == $pconfig['crypto'])
|
1039
|
$selected = 'selected="selected"';
|
1040
|
?>
|
1041
|
<option value="<?=$name;?>" <?=$selected?>>
|
1042
|
<?=htmlspecialchars($desc);?>
|
1043
|
</option>
|
1044
|
<?php endforeach; ?>
|
1045
|
</select>
|
1046
|
</td>
|
1047
|
</tr>
|
1048
|
<tr id="engine">
|
1049
|
<td width="22%" valign="top" class="vncellreq"><?=gettext("Hardware Crypto"); ?></td>
|
1050
|
<td width="78%" class="vtable">
|
1051
|
<select name="engine" class="formselect">
|
1052
|
<?php
|
1053
|
$engines = openvpn_get_engines();
|
1054
|
foreach ($engines as $name => $desc):
|
1055
|
$selected = '';
|
1056
|
if ($name == $pconfig['engine'])
|
1057
|
$selected = 'selected="selected"';
|
1058
|
?>
|
1059
|
<option value="<?=$name;?>" <?=$selected?>>
|
1060
|
<?=htmlspecialchars($desc);?>
|
1061
|
</option>
|
1062
|
<?php endforeach; ?>
|
1063
|
</select>
|
1064
|
</td>
|
1065
|
</tr>
|
1066
|
<tr id="cert_depth">
|
1067
|
<td width="22%" valign="top" class="vncell"><?=gettext("Certificate Depth"); ?></td>
|
1068
|
<td width="78%" class="vtable">
|
1069
|
<table border="0" cellpadding="2" cellspacing="0">
|
1070
|
<tr><td>
|
1071
|
<select name="cert_depth" class="formselect">
|
1072
|
<option value="">Do Not Check</option>
|
1073
|
<?php
|
1074
|
foreach ($openvpn_cert_depths as $depth => $depthdesc):
|
1075
|
$selected = '';
|
1076
|
if ($depth == $pconfig['cert_depth'])
|
1077
|
$selected = 'selected="selected"';
|
1078
|
?>
|
1079
|
<option value="<?= $depth ?>" <?= $selected ?>><?= $depthdesc ?></option>
|
1080
|
<?php endforeach; ?>
|
1081
|
</select>
|
1082
|
</td></tr>
|
1083
|
<tr><td>
|
1084
|
<span class="vexpl">
|
1085
|
<?=gettext("When a certificate-based client logs in, do not accept certificates below this depth. Useful for denying certificates made with intermediate CAs generated from the same CA as the server."); ?>
|
1086
|
</span>
|
1087
|
</td></tr>
|
1088
|
</table>
|
1089
|
</td>
|
1090
|
</tr>
|
1091
|
<tr id="strictusercn">
|
1092
|
<td width="22%" valign="top" class="vncell"><?=gettext("Strict User/CN Matching"); ?></td>
|
1093
|
<td width="78%" class="vtable">
|
1094
|
<table border="0" cellpadding="2" cellspacing="0">
|
1095
|
<tr>
|
1096
|
<td>
|
1097
|
<?php set_checked($pconfig['strictusercn'],$chk); ?>
|
1098
|
<input name="strictusercn" type="checkbox" value="yes" <?=$chk;?>/>
|
1099
|
</td>
|
1100
|
<td>
|
1101
|
<span class="vexpl">
|
1102
|
<?=gettext("When authenticating users, enforce a match between the common name of the client certificate and the username given at login."); ?>
|
1103
|
</span>
|
1104
|
</td>
|
1105
|
</tr>
|
1106
|
</table>
|
1107
|
</td>
|
1108
|
</tr>
|
1109
|
<tr>
|
1110
|
<td colspan="2" class="list" height="12"></td>
|
1111
|
</tr>
|
1112
|
<tr>
|
1113
|
<td colspan="2" valign="top" class="listtopic"><?=gettext("Tunnel Settings"); ?></td>
|
1114
|
</tr>
|
1115
|
<tr>
|
1116
|
<td width="22%" valign="top" class="vncellreq" id="ipv4_tunnel_network"><?=gettext("IPv4 Tunnel Network"); ?></td>
|
1117
|
<td width="78%" class="vtable">
|
1118
|
<input name="tunnel_network" type="text" class="formfld unknown" size="20" value="<?=htmlspecialchars($pconfig['tunnel_network']);?>"/>
|
1119
|
<br />
|
1120
|
<?=gettext("This is the IPv4 virtual network used for private " .
|
1121
|
"communications between this server and client " .
|
1122
|
"hosts expressed using CIDR (eg. 10.0.8.0/24). " .
|
1123
|
"The first network address will be assigned to " .
|
1124
|
"the server virtual interface. The remaining " .
|
1125
|
"network addresses can optionally be assigned " .
|
1126
|
"to connecting clients. (see Address Pool)"); ?>
|
1127
|
</td>
|
1128
|
</tr>
|
1129
|
<tr>
|
1130
|
<td width="22%" valign="top" class="vncell"><?=gettext("IPv6 Tunnel Network"); ?></td>
|
1131
|
<td width="78%" class="vtable">
|
1132
|
<input name="tunnel_networkv6" type="text" class="formfld unknown" size="20" value="<?=htmlspecialchars($pconfig['tunnel_networkv6']);?>"/>
|
1133
|
<br />
|
1134
|
<?=gettext("This is the IPv6 virtual network used for private " .
|
1135
|
"communications between this server and client " .
|
1136
|
"hosts expressed using CIDR (eg. fe80::/64). " .
|
1137
|
"The first network address will be assigned to " .
|
1138
|
"the server virtual interface. The remaining " .
|
1139
|
"network addresses can optionally be assigned " .
|
1140
|
"to connecting clients. (see Address Pool)"); ?>
|
1141
|
</td>
|
1142
|
</tr>
|
1143
|
<tr id="serverbridge_dhcp">
|
1144
|
<td width="22%" valign="top" class="vncell"><?=gettext("Bridge DHCP"); ?></td>
|
1145
|
<td width="78%" class="vtable">
|
1146
|
<table border="0" cellpadding="2" cellspacing="0">
|
1147
|
<tr>
|
1148
|
<td>
|
1149
|
<?php set_checked($pconfig['serverbridge_dhcp'],$chk); ?>
|
1150
|
<input name="serverbridge_dhcp" type="checkbox" value="yes" <?=$chk;?> onchange='tuntap_change()' />
|
1151
|
</td>
|
1152
|
<td>
|
1153
|
<span class="vexpl">
|
1154
|
<?=gettext("Allow clients on the bridge to obtain DHCP."); ?><br />
|
1155
|
</span>
|
1156
|
</td>
|
1157
|
</tr>
|
1158
|
</table>
|
1159
|
</td>
|
1160
|
</tr>
|
1161
|
<tr id="serverbridge_interface">
|
1162
|
<td width="22%" valign="top" class="vncell"><?=gettext("Bridge Interface"); ?></td>
|
1163
|
<td width="78%" class="vtable">
|
1164
|
<select name="serverbridge_interface" class="formselect">
|
1165
|
<?php
|
1166
|
$serverbridge_interface['none'] = "none";
|
1167
|
$serverbridge_interface = array_merge($serverbridge_interface, get_configured_interface_with_descr());
|
1168
|
$carplist = get_configured_carp_interface_list();
|
1169
|
foreach ($carplist as $cif => $carpip)
|
1170
|
$serverbridge_interface[$cif.'|'.$carpip] = $carpip." (".get_vip_descr($carpip).")";
|
1171
|
$aliaslist = get_configured_ip_aliases_list();
|
1172
|
foreach ($aliaslist as $aliasip => $aliasif)
|
1173
|
$serverbridge_interface[$aliasif.'|'.$aliasip] = $aliasip." (".get_vip_descr($aliasip).")";
|
1174
|
foreach ($serverbridge_interface as $iface => $ifacename):
|
1175
|
$selected = "";
|
1176
|
if ($iface == $pconfig['serverbridge_interface'])
|
1177
|
$selected = "selected=\"selected\"";
|
1178
|
?>
|
1179
|
<option value="<?=$iface;?>" <?=$selected;?>>
|
1180
|
<?=htmlspecialchars($ifacename);?>
|
1181
|
</option>
|
1182
|
<?php endforeach; ?>
|
1183
|
</select> <br />
|
1184
|
<?=gettext("The interface to which this tap instance will be " .
|
1185
|
"bridged. This is not done automatically. You must assign this " .
|
1186
|
"interface and create the bridge separately. " .
|
1187
|
"This setting controls which existing IP address and subnet " .
|
1188
|
"mask are used by OpenVPN for the bridge. Setting this to " .
|
1189
|
"'none' will cause the Server Bridge DHCP settings below to be ignored."); ?>
|
1190
|
</td>
|
1191
|
</tr>
|
1192
|
<tr id="serverbridge_dhcp_start">
|
1193
|
<td width="22%" valign="top" class="vncell"><?=gettext("Server Bridge DHCP Start"); ?></td>
|
1194
|
<td width="78%" class="vtable">
|
1195
|
<input name="serverbridge_dhcp_start" type="text" class="formfld unknown" size="20" value="<?=htmlspecialchars($pconfig['serverbridge_dhcp_start']);?>"/>
|
1196
|
<br />
|
1197
|
<?=gettext("When using tap mode as a multi-point server, " .
|
1198
|
"you may optionally supply a DHCP range to use on the " .
|
1199
|
"interface to which this tap instance is bridged. " .
|
1200
|
"If these settings are left blank, DHCP will be passed " .
|
1201
|
"through to the LAN, and the interface setting above " .
|
1202
|
"will be ignored."); ?>
|
1203
|
</td>
|
1204
|
</tr>
|
1205
|
<tr id="serverbridge_dhcp_end">
|
1206
|
<td width="22%" valign="top" class="vncell"><?=gettext("Server Bridge DHCP End"); ?></td>
|
1207
|
<td width="78%" class="vtable">
|
1208
|
<input name="serverbridge_dhcp_end" type="text" class="formfld unknown" size="20" value="<?=htmlspecialchars($pconfig['serverbridge_dhcp_end']);?>"/>
|
1209
|
<br />
|
1210
|
</td>
|
1211
|
</tr>
|
1212
|
<tr id="gwredir_opts">
|
1213
|
<td width="22%" valign="top" class="vncell"><?=gettext("Redirect Gateway"); ?></td>
|
1214
|
<td width="78%" class="vtable">
|
1215
|
<table border="0" cellpadding="2" cellspacing="0">
|
1216
|
<tr>
|
1217
|
<td>
|
1218
|
<?php set_checked($pconfig['gwredir'],$chk); ?>
|
1219
|
<input name="gwredir" type="checkbox" value="yes" <?=$chk;?> onclick="gwredir_change()"/>
|
1220
|
</td>
|
1221
|
<td>
|
1222
|
<span class="vexpl">
|
1223
|
<?=gettext("Force all client generated traffic through the tunnel"); ?>.
|
1224
|
</span>
|
1225
|
</td>
|
1226
|
</tr>
|
1227
|
</table>
|
1228
|
</td>
|
1229
|
</tr>
|
1230
|
<tr id="local_optsv4">
|
1231
|
<td width="22%" valign="top" class="vncell"><?=gettext("IPv4 Local Network/s"); ?></td>
|
1232
|
<td width="78%" class="vtable">
|
1233
|
<input name="local_network" type="text" class="formfld unknown" size="40" value="<?=htmlspecialchars($pconfig['local_network']);?>"/>
|
1234
|
<br />
|
1235
|
<?=gettext("These are the IPv4 networks that will be accessible " .
|
1236
|
"from the remote endpoint. Expressed as a comma-separated list of one or more CIDR ranges. " .
|
1237
|
"You may leave this blank if you don't " .
|
1238
|
"want to add a route to the local network " .
|
1239
|
"through this tunnel on the remote machine. " .
|
1240
|
"This is generally set to your LAN network"); ?>.
|
1241
|
</td>
|
1242
|
</tr>
|
1243
|
<tr id="local_optsv6">
|
1244
|
<td width="22%" valign="top" class="vncell"><?=gettext("IPv6 Local Network/s"); ?></td>
|
1245
|
<td width="78%" class="vtable">
|
1246
|
<input name="local_networkv6" type="text" class="formfld unknown" size="40" value="<?=htmlspecialchars($pconfig['local_networkv6']);?>"/>
|
1247
|
<br />
|
1248
|
<?=gettext("These are the IPv6 networks that will be accessible " .
|
1249
|
"from the remote endpoint. Expressed as a comma-separated list of one or more IP/PREFIX. " .
|
1250
|
"You may leave this blank if you don't " .
|
1251
|
"want to add a route to the local network " .
|
1252
|
"through this tunnel on the remote machine. " .
|
1253
|
"This is generally set to your LAN network"); ?>.
|
1254
|
</td>
|
1255
|
</tr>
|
1256
|
<tr id="remote_optsv4">
|
1257
|
<td width="22%" valign="top" class="vncell"><?=gettext("IPv4 Remote Network/s"); ?></td>
|
1258
|
<td width="78%" class="vtable">
|
1259
|
<input name="remote_network" type="text" class="formfld unknown" size="40" value="<?=htmlspecialchars($pconfig['remote_network']);?>"/>
|
1260
|
<br />
|
1261
|
<?=gettext("These are the IPv4 networks that will be routed through " .
|
1262
|
"the tunnel, so that a site-to-site VPN can be " .
|
1263
|
"established without manually changing the routing tables. " .
|
1264
|
"Expressed as a comma-separated list of one or more CIDR ranges. " .
|
1265
|
"If this is a site-to-site VPN, enter the " .
|
1266
|
"remote LAN/s here. You may leave this blank if " .
|
1267
|
"you don't want a site-to-site VPN"); ?>.
|
1268
|
</td>
|
1269
|
</tr>
|
1270
|
<tr id="remote_optsv6">
|
1271
|
<td width="22%" valign="top" class="vncell"><?=gettext("IPv6 Remote Network/s"); ?></td>
|
1272
|
<td width="78%" class="vtable">
|
1273
|
<input name="remote_networkv6" type="text" class="formfld unknown" size="40" value="<?=htmlspecialchars($pconfig['remote_networkv6']);?>"/>
|
1274
|
<br />
|
1275
|
<?=gettext("These are the IPv6 networks that will be routed through " .
|
1276
|
"the tunnel, so that a site-to-site VPN can be " .
|
1277
|
"established without manually changing the routing tables. " .
|
1278
|
"Expressed as a comma-separated list of one or more IP/PREFIX. " .
|
1279
|
"If this is a site-to-site VPN, enter the " .
|
1280
|
"remote LAN/s here. You may leave this blank if " .
|
1281
|
"you don't want a site-to-site VPN"); ?>.
|
1282
|
</td>
|
1283
|
</tr>
|
1284
|
<tr>
|
1285
|
<td width="22%" valign="top" class="vncell"><?=gettext("Concurrent connections");?></td>
|
1286
|
<td width="78%" class="vtable">
|
1287
|
<input name="maxclients" type="text" class="formfld unknown" size="5" value="<?=htmlspecialchars($pconfig['maxclients']);?>"/>
|
1288
|
<br/>
|
1289
|
<?=gettext("Specify the maximum number of clients allowed to concurrently connect to this server"); ?>.
|
1290
|
</td>
|
1291
|
</tr>
|
1292
|
<tr>
|
1293
|
<td width="22%" valign="top" class="vncell"><?=gettext("Compression"); ?></td>
|
1294
|
<td width="78%" class="vtable">
|
1295
|
<table border="0" cellpadding="2" cellspacing="0">
|
1296
|
<tr>
|
1297
|
<td>
|
1298
|
<?php set_checked($pconfig['compression'],$chk); ?>
|
1299
|
<input name="compression" type="checkbox" value="yes" <?=$chk;?>/>
|
1300
|
</td>
|
1301
|
<td>
|
1302
|
<span class="vexpl">
|
1303
|
<?=gettext("Compress tunnel packets using the LZO algorithm"); ?>.
|
1304
|
</span>
|
1305
|
</td>
|
1306
|
</tr>
|
1307
|
</table>
|
1308
|
</td>
|
1309
|
</tr>
|
1310
|
<tr>
|
1311
|
<td width="22%" valign="top" class="vncell"><?=gettext("Type-of-Service"); ?></td>
|
1312
|
<td width="78%" class="vtable">
|
1313
|
<table border="0" cellpadding="2" cellspacing="0">
|
1314
|
<tr>
|
1315
|
<td>
|
1316
|
<?php set_checked($pconfig['passtos'],$chk); ?>
|
1317
|
<input name="passtos" type="checkbox" value="yes" <?=$chk;?>/>
|
1318
|
</td>
|
1319
|
<td>
|
1320
|
<span class="vexpl">
|
1321
|
<?=gettext("Set the TOS IP header value of tunnel packets to match the encapsulated packet value"); ?>.
|
1322
|
</span>
|
1323
|
</td>
|
1324
|
</tr>
|
1325
|
</table>
|
1326
|
</td>
|
1327
|
</tr>
|
1328
|
<tr id="inter_client_communication">
|
1329
|
<td width="22%" valign="top" class="vncell"><?=gettext("Inter-client communication"); ?></td>
|
1330
|
<td width="78%" class="vtable">
|
1331
|
<table border="0" cellpadding="2" cellspacing="0">
|
1332
|
<tr>
|
1333
|
<td>
|
1334
|
<?php set_checked($pconfig['client2client'],$chk); ?>
|
1335
|
<input name="client2client" type="checkbox" value="yes" <?=$chk;?>/>
|
1336
|
</td>
|
1337
|
<td>
|
1338
|
<span class="vexpl">
|
1339
|
<?=gettext("Allow communication between clients connected to this server"); ?>
|
1340
|
</span>
|
1341
|
</td>
|
1342
|
</tr>
|
1343
|
</table>
|
1344
|
</td>
|
1345
|
</tr>
|
1346
|
<tr id="duplicate_cn">
|
1347
|
<td width="22%" valign="top" class="vncell"><?=gettext("Duplicate Connections"); ?></td>
|
1348
|
<td width="78%" class="vtable">
|
1349
|
<table border="0" cellpadding="2" cellspacing="0">
|
1350
|
<tr>
|
1351
|
<td>
|
1352
|
<?php set_checked($pconfig['duplicate_cn'],$chk); ?>
|
1353
|
<input name="duplicate_cn" type="checkbox" value="yes" <?=$chk;?>/>
|
1354
|
</td>
|
1355
|
<td>
|
1356
|
<span class="vexpl">
|
1357
|
<?=gettext("Allow multiple concurrent connections from clients using the same Common Name.<br/>NOTE: This is not generally recommended, but may be needed for some scenarios."); ?>
|
1358
|
</span>
|
1359
|
</td>
|
1360
|
</tr>
|
1361
|
</table>
|
1362
|
</td>
|
1363
|
</tr>
|
1364
|
</table>
|
1365
|
|
1366
|
<table width="100%" border="0" cellpadding="6" cellspacing="0" id="client_opts">
|
1367
|
<tr>
|
1368
|
<td colspan="2" class="list" height="12"></td>
|
1369
|
</tr>
|
1370
|
<tr>
|
1371
|
<td colspan="2" valign="top" class="listtopic"><?=gettext("Client Settings"); ?></td>
|
1372
|
</tr>
|
1373
|
<tr>
|
1374
|
<td width="22%" valign="top" class="vncell"><?=gettext("Dynamic IP"); ?></td>
|
1375
|
<td width="78%" class="vtable">
|
1376
|
<table border="0" cellpadding="2" cellspacing="0">
|
1377
|
<tr>
|
1378
|
<td>
|
1379
|
<?php set_checked($pconfig['dynamic_ip'],$chk); ?>
|
1380
|
<input name="dynamic_ip" type="checkbox" id="dynamic_ip" value="yes" <?=$chk;?>/>
|
1381
|
</td>
|
1382
|
<td>
|
1383
|
<span class="vexpl">
|
1384
|
<?=gettext("Allow connected clients to retain their connections if their IP address changes"); ?>.<br />
|
1385
|
</span>
|
1386
|
</td>
|
1387
|
</tr>
|
1388
|
</table>
|
1389
|
</td>
|
1390
|
</tr>
|
1391
|
<tr>
|
1392
|
<td width="22%" valign="top" class="vncell"><?=gettext("Address Pool"); ?></td>
|
1393
|
<td width="78%" class="vtable">
|
1394
|
<table border="0" cellpadding="2" cellspacing="0">
|
1395
|
<tr>
|
1396
|
<td>
|
1397
|
<?php set_checked($pconfig['pool_enable'],$chk); ?>
|
1398
|
<input name="pool_enable" type="checkbox" id="pool_enable" value="yes" <?=$chk;?>/>
|
1399
|
</td>
|
1400
|
<td>
|
1401
|
<span class="vexpl">
|
1402
|
<?=gettext("Provide a virtual adapter IP address to clients (see Tunnel Network)"); ?><br />
|
1403
|
</span>
|
1404
|
</td>
|
1405
|
</tr>
|
1406
|
</table>
|
1407
|
</td>
|
1408
|
</tr>
|
1409
|
<tr id="topology_subnet_opt">
|
1410
|
<td width="22%" valign="top" class="vncell"><?=gettext("Topology"); ?></td>
|
1411
|
<td width="78%" class="vtable">
|
1412
|
<table border="0" cellpadding="2" cellspacing="0">
|
1413
|
<tr>
|
1414
|
<td>
|
1415
|
<?php set_checked($pconfig['topology_subnet'],$chk); ?>
|
1416
|
<input name="topology_subnet" type="checkbox" id="topology_subnet" value="yes" <?=$chk;?>/>
|
1417
|
</td>
|
1418
|
<td>
|
1419
|
<span class="vexpl">
|
1420
|
<?=gettext("Allocate only one IP per client (topology subnet), rather than an isolated subnet per client (topology net30)."); ?><br/>
|
1421
|
</span>
|
1422
|
</td>
|
1423
|
</tr>
|
1424
|
<tr>
|
1425
|
<td> </td>
|
1426
|
<td>
|
1427
|
<?=gettext("Relevant when supplying a virtual adapter IP address to clients when using tun mode on IPv4."); ?><br/>
|
1428
|
<?=gettext("Some clients may require this even for IPv6, such as OpenVPN Connect (iOS/Android). Others may break if it is present, such as older versions of OpenVPN or clients such as Yealink phones."); ?><br />
|
1429
|
</td>
|
1430
|
</tr>
|
1431
|
</table>
|
1432
|
</td>
|
1433
|
</tr>
|
1434
|
<tr>
|
1435
|
<td width="22%" valign="top" class="vncell"><?=gettext("DNS Default Domain"); ?></td>
|
1436
|
<td width="78%" class="vtable">
|
1437
|
<table border="0" cellpadding="2" cellspacing="0">
|
1438
|
<tr>
|
1439
|
<td>
|
1440
|
<?php set_checked($pconfig['dns_domain_enable'],$chk); ?>
|
1441
|
<input name="dns_domain_enable" type="checkbox" id="dns_domain_enable" value="yes" <?=$chk;?> onclick="dns_domain_change()"/>
|
1442
|
</td>
|
1443
|
<td>
|
1444
|
<span class="vexpl">
|
1445
|
<?=gettext("Provide a default domain name to clients"); ?><br>
|
1446
|
</span>
|
1447
|
</td>
|
1448
|
</tr>
|
1449
|
</table>
|
1450
|
<table border="0" cellpadding="2" cellspacing="0" id="dns_domain_data">
|
1451
|
<tr>
|
1452
|
<td>
|
1453
|
<input name="dns_domain" type="text" class="formfld unknown" id="dns_domain" size="30" value="<?=htmlspecialchars($pconfig['dns_domain']);?>"/>
|
1454
|
</td>
|
1455
|
</tr>
|
1456
|
</table>
|
1457
|
</td>
|
1458
|
</tr>
|
1459
|
<tr>
|
1460
|
<td width="22%" valign="top" class="vncell"><?=gettext("DNS Servers"); ?></td>
|
1461
|
<td width="78%" class="vtable">
|
1462
|
<table border="0" cellpadding="2" cellspacing="0">
|
1463
|
<tr>
|
1464
|
<td>
|
1465
|
<?php set_checked($pconfig['dns_server_enable'],$chk); ?>
|
1466
|
<input name="dns_server_enable" type="checkbox" id="dns_server_enable" value="yes" <?=$chk;?> onclick="dns_server_change()"/>
|
1467
|
</td>
|
1468
|
<td>
|
1469
|
<span class="vexpl">
|
1470
|
<?=gettext("Provide a DNS server list to clients"); ?><br />
|
1471
|
</span>
|
1472
|
</td>
|
1473
|
</tr>
|
1474
|
</table>
|
1475
|
<table border="0" cellpadding="2" cellspacing="0" id="dns_server_data">
|
1476
|
<tr>
|
1477
|
<td>
|
1478
|
<span class="vexpl">
|
1479
|
<?=gettext("Server"); ?> #1:
|
1480
|
</span>
|
1481
|
<input name="dns_server1" type="text" class="formfld unknown" id="dns_server1" size="20" value="<?=htmlspecialchars($pconfig['dns_server1']);?>"/>
|
1482
|
</td>
|
1483
|
</tr>
|
1484
|
<tr>
|
1485
|
<td>
|
1486
|
<span class="vexpl">
|
1487
|
<?=gettext("Server"); ?> #2:
|
1488
|
</span>
|
1489
|
<input name="dns_server2" type="text" class="formfld unknown" id="dns_server2" size="20" value="<?=htmlspecialchars($pconfig['dns_server2']);?>"/>
|
1490
|
</td>
|
1491
|
</tr>
|
1492
|
<tr>
|
1493
|
<td>
|
1494
|
<span class="vexpl">
|
1495
|
<?=gettext("Server"); ?> #3:
|
1496
|
</span>
|
1497
|
<input name="dns_server3" type="text" class="formfld unknown" id="dns_server3" size="20" value="<?=htmlspecialchars($pconfig['dns_server3']);?>"/>
|
1498
|
</td>
|
1499
|
</tr>
|
1500
|
<tr>
|
1501
|
<td>
|
1502
|
<span class="vexpl">
|
1503
|
<?=gettext("Server"); ?> #4:
|
1504
|
</span>
|
1505
|
<input name="dns_server4" type="text" class="formfld unknown" id="dns_server4" size="20" value="<?=htmlspecialchars($pconfig['dns_server4']);?>"/>
|
1506
|
</td>
|
1507
|
</tr>
|
1508
|
</table>
|
1509
|
</td>
|
1510
|
</tr>
|
1511
|
<tr>
|
1512
|
<td width="22%" valign="top" class="vncell"><?=gettext("NTP Servers"); ?></td>
|
1513
|
<td width="78%" class="vtable">
|
1514
|
<table border="0" cellpadding="2" cellspacing="0">
|
1515
|
<tr>
|
1516
|
<td>
|
1517
|
<?php set_checked($pconfig['ntp_server_enable'],$chk); ?>
|
1518
|
<input name="ntp_server_enable" type="checkbox" id="ntp_server_enable" value="yes" <?=$chk;?> onclick="ntp_server_change()"/>
|
1519
|
</td>
|
1520
|
<td>
|
1521
|
<span class="vexpl">
|
1522
|
<?=gettext("Provide a NTP server list to clients"); ?><br />
|
1523
|
</span>
|
1524
|
</td>
|
1525
|
</tr>
|
1526
|
</table>
|
1527
|
<table border="0" cellpadding="2" cellspacing="0" id="ntp_server_data">
|
1528
|
<tr>
|
1529
|
<td>
|
1530
|
<span class="vexpl">
|
1531
|
<?=gettext("Server"); ?> #1:
|
1532
|
</span>
|
1533
|
<input name="ntp_server1" type="text" class="formfld unknown" id="ntp_server1" size="20" value="<?=htmlspecialchars($pconfig['ntp_server1']);?>"/>
|
1534
|
</td>
|
1535
|
</tr>
|
1536
|
<tr>
|
1537
|
<td>
|
1538
|
<span class="vexpl">
|
1539
|
<?=gettext("Server"); ?> #2:
|
1540
|
</span>
|
1541
|
<input name="ntp_server2" type="text" class="formfld unknown" id="ntp_server2" size="20" value="<?=htmlspecialchars($pconfig['ntp_server2']);?>"/>
|
1542
|
</td>
|
1543
|
</tr>
|
1544
|
</table>
|
1545
|
</td>
|
1546
|
</tr>
|
1547
|
<tr>
|
1548
|
<td width="22%" valign="top" class="vncell"><?=gettext("NetBIOS Options"); ?></td>
|
1549
|
<td width="78%" class="vtable">
|
1550
|
<table border="0" cellpadding="2" cellspacing="0">
|
1551
|
<tr>
|
1552
|
<td>
|
1553
|
<?php set_checked($pconfig['netbios_enable'],$chk); ?>
|
1554
|
<input name="netbios_enable" type="checkbox" id="netbios_enable" value="yes" <?=$chk;?> onclick="netbios_change()"/>
|
1555
|
</td>
|
1556
|
<td>
|
1557
|
<span class="vexpl">
|
1558
|
<?=gettext("Enable NetBIOS over TCP/IP"); ?><br />
|
1559
|
</span>
|
1560
|
</td>
|
1561
|
</tr>
|
1562
|
</table>
|
1563
|
<?=gettext("If this option is not set, all NetBIOS-over-TCP/IP options (including WINS) will be disabled"); ?>.
|
1564
|
<br/>
|
1565
|
<table border="0" cellpadding="2" cellspacing="0" id="netbios_data">
|
1566
|
<tr>
|
1567
|
<td>
|
1568
|
<br/>
|
1569
|
<span class="vexpl">
|
1570
|
<?=gettext("Node Type"); ?>:
|
1571
|
</span>
|
1572
|
<select name='netbios_ntype' class="formselect">
|
1573
|
<?php
|
1574
|
foreach ($netbios_nodetypes as $type => $name):
|
1575
|
$selected = "";
|
1576
|
if ($pconfig['netbios_ntype'] == $type)
|
1577
|
$selected = "selected=\"selected\"";
|
1578
|
?>
|
1579
|
<option value="<?=$type;?>" <?=$selected;?>><?=$name;?></option>
|
1580
|
<?php endforeach; ?>
|
1581
|
</select>
|
1582
|
<br/>
|
1583
|
<?=gettext("Possible options: b-node (broadcasts), p-node " .
|
1584
|
"(point-to-point name queries to a WINS server), " .
|
1585
|
"m-node (broadcast then query name server), and " .
|
1586
|
"h-node (query name server, then broadcast)"); ?>.
|
1587
|
</td>
|
1588
|
</tr>
|
1589
|
<tr>
|
1590
|
<td>
|
1591
|
<br/>
|
1592
|
<span class="vexpl">
|
1593
|
<?=gettext("Scope ID"); ?>:
|
1594
|
</span>
|
1595
|
<input name="netbios_scope" type="text" class="formfld unknown" id="netbios_scope" size="30" value="<?=htmlspecialchars($pconfig['netbios_scope']);?>"/>
|
1596
|
<br/>
|
1597
|
<?=gettext("A NetBIOS Scope ID provides an extended naming " .
|
1598
|
"service for NetBIOS over TCP/IP. The NetBIOS " .
|
1599
|
"scope ID isolates NetBIOS traffic on a single " .
|
1600
|
"network to only those nodes with the same " .
|
1601
|
"NetBIOS scope ID"); ?>.
|
1602
|
</td>
|
1603
|
</tr>
|
1604
|
</table>
|
1605
|
</td>
|
1606
|
</tr>
|
1607
|
<tr id="wins_opts">
|
1608
|
<td width="22%" valign="top" class="vncell"><?=gettext("WINS Servers"); ?></td>
|
1609
|
<td width="78%" class="vtable">
|
1610
|
<table border="0" cellpadding="2" cellspacing="0">
|
1611
|
<tr>
|
1612
|
<td>
|
1613
|
<?php set_checked($pconfig['wins_server_enable'],$chk); ?>
|
1614
|
<input name="wins_server_enable" type="checkbox" id="wins_server_enable" value="yes" <?=$chk;?> onclick="wins_server_change()"/>
|
1615
|
</td>
|
1616
|
<td>
|
1617
|
<span class="vexpl">
|
1618
|
<?=gettext("Provide a WINS server list to clients"); ?><br />
|
1619
|
</span>
|
1620
|
</td>
|
1621
|
</tr>
|
1622
|
</table>
|
1623
|
<table border="0" cellpadding="2" cellspacing="0" id="wins_server_data">
|
1624
|
<tr>
|
1625
|
<td>
|
1626
|
<span class="vexpl">
|
1627
|
<?=gettext("Server"); ?> #1:
|
1628
|
</span>
|
1629
|
<input name="wins_server1" type="text" class="formfld unknown" id="wins_server1" size="20" value="<?=htmlspecialchars($pconfig['wins_server1']);?>"/>
|
1630
|
</td>
|
1631
|
</tr>
|
1632
|
<tr>
|
1633
|
<td>
|
1634
|
<span class="vexpl">
|
1635
|
<?=gettext("Server"); ?> #2:
|
1636
|
</span>
|
1637
|
<input name="wins_server2" type="text" class="formfld unknown" id="wins_server2" size="20" value="<?=htmlspecialchars($pconfig['wins_server2']);?>"/>
|
1638
|
</td>
|
1639
|
</tr>
|
1640
|
</table>
|
1641
|
</td>
|
1642
|
</tr>
|
1643
|
</table>
|
1644
|
|
1645
|
<table width="100%" border="0" cellpadding="6" cellspacing="0" id="adv_confg">
|
1646
|
<tr>
|
1647
|
<td colspan="2" class="list" height="12"></td>
|
1648
|
</tr>
|
1649
|
<tr>
|
1650
|
<td colspan="2" valign="top" class="listtopic"><?=gettext("Advanced configuration"); ?></td>
|
1651
|
</tr>
|
1652
|
<tr>
|
1653
|
<td width="22%" valign="top" class="vncell"><?=gettext("Advanced"); ?></td>
|
1654
|
<td width="78%" class="vtable">
|
1655
|
<table border="0" cellpadding="2" cellspacing="0">
|
1656
|
<tr>
|
1657
|
<td>
|
1658
|
<textarea rows="6" cols="78" name="custom_options" id="custom_options"><?=htmlspecialchars($pconfig['custom_options']);?></textarea><br/>
|
1659
|
<?=gettext("Enter any additional options you would like to add to the OpenVPN server configuration here, separated by a semicolon"); ?><br/>
|
1660
|
<?=gettext("EXAMPLE: push \"route 10.0.0.0 255.255.255.0\""); ?>;
|
1661
|
</td>
|
1662
|
</tr>
|
1663
|
</table>
|
1664
|
</td>
|
1665
|
</tr>
|
1666
|
</table>
|
1667
|
|
1668
|
<br/>
|
1669
|
<table width="100%" border="0" cellpadding="6" cellspacing="0">
|
1670
|
<tr>
|
1671
|
<td width="22%" valign="top"> </td>
|
1672
|
<td width="78%">
|
1673
|
<input name="save" type="submit" class="formbtn" value="<?=gettext("Save"); ?>"/>
|
1674
|
<input name="act" type="hidden" value="<?=$act;?>"/>
|
1675
|
<?php if (isset($id) && $a_server[$id]): ?>
|
1676
|
<input name="id" type="hidden" value="<?=htmlspecialchars($id);?>">
|
1677
|
<?php endif; ?>
|
1678
|
</td>
|
1679
|
</tr>
|
1680
|
</table>
|
1681
|
</form>
|
1682
|
|
1683
|
<?php else: ?>
|
1684
|
|
1685
|
<table class="sortable" width="100%" border="0" cellpadding="0" cellspacing="0">
|
1686
|
<thead>
|
1687
|
<tr>
|
1688
|
<td width="10%" class="listhdrr"><?=gettext("Disabled"); ?></td>
|
1689
|
<td width="10%" class="listhdrr"><?=gettext("Protocol / Port"); ?></td>
|
1690
|
<td width="30%" class="listhdrr"><?=gettext("Tunnel Network"); ?></td>
|
1691
|
<td width="40%" class="listhdrr"><?=gettext("Description"); ?></td>
|
1692
|
<td width="10%" class="list"></td>
|
1693
|
</tr>
|
1694
|
</thead>
|
1695
|
<tfoot>
|
1696
|
<tr>
|
1697
|
<td class="list" colspan="4"></td>
|
1698
|
<td class="list">
|
1699
|
<a href="vpn_openvpn_server.php?act=new"><img src="./themes/<?=$g['theme'];?>/images/icons/icon_plus.gif" title="<?=gettext("add server"); ?>" alt="" width="17" height="17" border="0" />
|
1700
|
</a>
|
1701
|
</td>
|
1702
|
</tr>
|
1703
|
</tfoot>
|
1704
|
<tbody>
|
1705
|
<?php
|
1706
|
$i = 0;
|
1707
|
foreach($a_server as $server):
|
1708
|
$disabled = "NO";
|
1709
|
if (isset($server['disable']))
|
1710
|
$disabled = "YES";
|
1711
|
?>
|
1712
|
<tr>
|
1713
|
<td class="listlr" ondblclick="document.location='vpn_openvpn_server.php?act=edit&id=<?=$i;?>'">
|
1714
|
<?=$disabled;?>
|
1715
|
</td>
|
1716
|
<td class="listr" ondblclick="document.location='vpn_openvpn_server.php?act=edit&id=<?=$i;?>'">
|
1717
|
<?=htmlspecialchars($server['protocol']);?> / <?=htmlspecialchars($server['local_port']);?>
|
1718
|
</td>
|
1719
|
<td class="listr" ondblclick="document.location='vpn_openvpn_server.php?act=edit&id=<?=$i;?>'">
|
1720
|
<?=htmlspecialchars($server['tunnel_network']);?><br/>
|
1721
|
<?=htmlspecialchars($server['tunnel_networkv6']);?><br/>
|
1722
|
</td>
|
1723
|
<td class="listbg" ondblclick="document.location='vpn_openvpn_server.php?act=edit&id=<?=$i;?>'">
|
1724
|
<?=htmlspecialchars($server['description']);?>
|
1725
|
</td>
|
1726
|
<td valign="middle" nowrap="nowrap" class="list">
|
1727
|
<a href="vpn_openvpn_server.php?act=edit&id=<?=$i;?>">
|
1728
|
<img src="./themes/<?=$g['theme'];?>/images/icons/icon_e.gif" title="<?=gettext("edit server"); ?>" alt="" width="17" height="17" border="0" />
|
1729
|
</a>
|
1730
|
|
1731
|
<a href="vpn_openvpn_server.php?act=del&id=<?=$i;?>" onclick="return confirm('<?=gettext("Do you really want to delete this server?"); ?>')">
|
1732
|
<img src="/themes/<?=$g['theme'];?>/images/icons/icon_x.gif" title="<?=gettext("delete server"); ?>" alt="" width="17" height="17" border="0" />
|
1733
|
</a>
|
1734
|
</td>
|
1735
|
</tr>
|
1736
|
<?php
|
1737
|
$i++;
|
1738
|
endforeach;
|
1739
|
if ($i == 0)
|
1740
|
echo "<tr><td></td></tr>";
|
1741
|
?>
|
1742
|
</tbody>
|
1743
|
</table>
|
1744
|
|
1745
|
<?=gettext("Additional OpenVPN servers can be added here.");?>
|
1746
|
|
1747
|
<?php endif; ?>
|
1748
|
|
1749
|
</td>
|
1750
|
</tr>
|
1751
|
</table>
|
1752
|
<script type="text/JavaScript">
|
1753
|
<!--
|
1754
|
mode_change();
|
1755
|
autokey_change();
|
1756
|
tlsauth_change();
|
1757
|
gwredir_change();
|
1758
|
dns_domain_change();
|
1759
|
dns_server_change();
|
1760
|
wins_server_change();
|
1761
|
ntp_server_change();
|
1762
|
netbios_change();
|
1763
|
tuntap_change();
|
1764
|
//-->
|
1765
|
</script>
|
1766
|
<?php include("fend.inc"); ?>
|
1767
|
|
1768
|
<?php
|
1769
|
|
1770
|
/* local utility functions */
|
1771
|
|
1772
|
function set_checked($var,& $chk) {
|
1773
|
if($var)
|
1774
|
$chk = 'checked="checked"';
|
1775
|
else
|
1776
|
$chk = '';
|
1777
|
}
|
1778
|
|
1779
|
?>
|
1780
|
</body>
|
1781
|
</html>
|