Project

General

Profile

Download (54.2 KB) Statistics
| Branch: | Tag: | Revision:
1 d799787e Matthew Grooms
<?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 d84bd468 Ermal Lu?i
require_once("openvpn.inc");
39 d799787e Matthew Grooms
40 4d8b3382 Carlos Eduardo Ramos
$pgtitle = array(gettext("OpenVPN"), gettext("Server"));
41 efe2be81 jim-p
$statusurl = "status_openvpn.php";
42
$logurl = "diag_logs_openvpn.php";
43 d799787e Matthew Grooms
44
if (!is_array($config['openvpn']['openvpn-server']))
45
	$config['openvpn']['openvpn-server'] = array();
46
47
$a_server = &$config['openvpn']['openvpn-server'];
48
49 428e66b6 jim-p
if (!is_array($config['ca']))
50
	$config['ca'] = array();
51
52
$a_ca =& $config['ca'];
53
54
if (!is_array($config['cert']))
55
	$config['cert'] = array();
56
57
$a_cert =& $config['cert'];
58
59
if (!is_array($config['crl']))
60
	$config['crl'] = array();
61
62
$a_crl =& $config['crl'];
63
64 c1f95f5c jim-p
foreach ($a_crl as $cid => $acrl)
65
	if (!isset($acrl['refid']))
66
		unset ($a_crl[$cid]);
67
68 d799787e Matthew Grooms
$id = $_GET['id'];
69
if (isset($_POST['id']))
70
	$id = $_POST['id'];
71
72
$act = $_GET['act'];
73
if (isset($_POST['act']))
74
	$act = $_POST['act'];
75
76
if ($_GET['act'] == "del") {
77
78
	if (!$a_server[$id]) {
79
		pfSenseHeader("vpn_openvpn_server.php");
80
		exit;
81
	}
82
83 dc408939 Matthew Grooms
	openvpn_delete('server', $a_server[$id]);
84 d799787e Matthew Grooms
	unset($a_server[$id]);
85
	write_config();
86
	$savemsg = gettext("Server successfully deleted")."<br/>";
87
}
88
89 f432e364 Matthew Grooms
if($_GET['act']=="new"){
90 3c11bd3c Matthew Grooms
	$pconfig['autokey_enable'] = "yes";
91
	$pconfig['tlsauth_enable'] = "yes";
92
	$pconfig['autotls_enable'] = "yes";
93 fe787fc7 Matthew Grooms
	$pconfig['dh_length'] = 1024;
94 4936ff53 jim-p
	$pconfig['dev_mode'] = "tun";
95 f432e364 Matthew Grooms
	$pconfig['interface'] = "wan";
96 8cd0a3fa jim-p
	$pconfig['local_port'] = openvpn_port_next('UDP');
97 f432e364 Matthew Grooms
	$pconfig['pool_enable'] = "yes";
98
}
99
100 d799787e Matthew Grooms
if($_GET['act']=="edit"){
101
102
	if (isset($id) && $a_server[$id]) {
103
104 870318b9 Ermal Lu?i
		$pconfig['disable'] = isset($a_server[$id]['disable']);
105 3c11bd3c Matthew Grooms
		$pconfig['mode'] = $a_server[$id]['mode'];
106 d799787e Matthew Grooms
		$pconfig['protocol'] = $a_server[$id]['protocol'];
107 e8a58de4 Ermal Lu?i
		$pconfig['authmode'] = $a_server[$id]['authmode'];
108 4936ff53 jim-p
		$pconfig['dev_mode'] = $a_server[$id]['dev_mode'];
109 d799787e Matthew Grooms
		$pconfig['interface'] = $a_server[$id]['interface'];
110 67b0902f pierrepomes
		if (!empty($a_server[$id]['ipaddr'])) {
111
			$pconfig['interface'] = $pconfig['interface'] . '|' . $a_server[$id]['ipaddr'];
112
		}
113 d799787e Matthew Grooms
		$pconfig['local_port'] = $a_server[$id]['local_port'];
114
		$pconfig['description'] = $a_server[$id]['description'];
115 a9a613dd Scott Ullrich
		$pconfig['custom_options'] = $a_server[$id]['custom_options'];
116 d799787e Matthew Grooms
117 3c11bd3c Matthew Grooms
		if ($pconfig['mode'] != "p2p_shared_key") {
118
			if ($a_server[$id]['tls']) {
119
				$pconfig['tlsauth_enable'] = "yes";
120
				$pconfig['tls'] = base64_decode($a_server[$id]['tls']);
121
			}
122 fe787fc7 Matthew Grooms
			$pconfig['caref'] = $a_server[$id]['caref'];
123 6db02381 jim-p
			$pconfig['crlref'] = $a_server[$id]['crlref'];
124 fe787fc7 Matthew Grooms
			$pconfig['certref'] = $a_server[$id]['certref'];
125
			$pconfig['dh_length'] = $a_server[$id]['dh_length'];
126 94823361 jim-p
			if ($pconfig['mode'] == "server_tls_user")
127
				$pconfig['strictusercn'] = $a_server[$id]['strictusercn'];
128 3c11bd3c Matthew Grooms
		} else
129
			$pconfig['shared_key'] = base64_decode($a_server[$id]['shared_key']);
130 d799787e Matthew Grooms
		$pconfig['crypto'] = $a_server[$id]['crypto'];
131 582c58ae jim-p
		$pconfig['engine'] = $a_server[$id]['engine'];
132 d799787e Matthew Grooms
133
		$pconfig['tunnel_network'] = $a_server[$id]['tunnel_network'];
134
		$pconfig['remote_network'] = $a_server[$id]['remote_network'];
135
		$pconfig['gwredir'] = $a_server[$id]['gwredir'];
136
		$pconfig['local_network'] = $a_server[$id]['local_network'];
137
		$pconfig['maxclients'] = $a_server[$id]['maxclients'];
138
		$pconfig['compression'] = $a_server[$id]['compression'];
139 1cb0b40a Matthew Grooms
		$pconfig['passtos'] = $a_server[$id]['passtos'];
140 d799787e Matthew Grooms
		$pconfig['client2client'] = $a_server[$id]['client2client'];
141
142 65ff8497 jim-p
		$pconfig['dynamic_ip'] = $a_server[$id]['dynamic_ip'];
143 d799787e Matthew Grooms
		$pconfig['pool_enable'] = $a_server[$id]['pool_enable'];
144
145
		$pconfig['dns_domain'] = $a_server[$id]['dns_domain'];
146
		if ($pconfig['dns_domain'])
147
			$pconfig['dns_domain_enable'] = true;
148
149
		$pconfig['dns_server1'] = $a_server[$id]['dns_server1'];
150
		$pconfig['dns_server2'] = $a_server[$id]['dns_server2'];
151
		$pconfig['dns_server3'] = $a_server[$id]['dns_server3'];
152
		$pconfig['dns_server4'] = $a_server[$id]['dns_server4'];
153
		if ($pconfig['dns_server1'] ||
154
			$pconfig['dns_server2'] ||
155
			$pconfig['dns_server3'] ||
156
			$pconfig['dns_server4'])
157
			$pconfig['dns_server_enable'] = true;
158
159
		$pconfig['ntp_server1'] = $a_server[$id]['ntp_server1'];
160
		$pconfig['ntp_server2'] = $a_server[$id]['ntp_server2'];
161
		if ($pconfig['ntp_server1'] ||
162
			$pconfig['ntp_server2'])
163
			$pconfig['ntp_server_enable'] = true;
164
165
		$pconfig['netbios_enable'] = $a_server[$id]['netbios_enable'];
166
		$pconfig['netbios_ntype'] = $a_server[$id]['netbios_ntype'];
167
		$pconfig['netbios_scope'] = $a_server[$id]['netbios_scope'];
168
169
		$pconfig['wins_server1'] = $a_server[$id]['wins_server1'];
170
		$pconfig['wins_server2'] = $a_server[$id]['wins_server2'];
171
		if ($pconfig['wins_server1'] ||
172
			$pconfig['wins_server2'])
173
			$pconfig['wins_server_enable'] = true;
174
175
		$pconfig['nbdd_server1'] = $a_server[$id]['nbdd_server1'];
176
		if ($pconfig['nbdd_server1'])
177
			$pconfig['nbdd_server_enable'] = true;
178 3c11bd3c Matthew Grooms
179
		// just in case the modes switch
180
		$pconfig['autokey_enable'] = "yes";
181
		$pconfig['autotls_enable'] = "yes";
182 bca35cff jim-p
183
		$pconfig['duplicate_cn'] = isset($a_server[$id]['duplicate_cn']);
184 d799787e Matthew Grooms
	}
185
}
186
187
if ($_POST) {
188
189
	unset($input_errors);
190
	$pconfig = $_POST;
191
192 f432e364 Matthew Grooms
	if (isset($id) && $a_server[$id])
193
		$vpnid = $a_server[$id]['vpnid'];
194
	else
195
		$vpnid = 0;
196
197 98c0c87a jim-p
	if ($pconfig['mode'] != "p2p_shared_key")
198 3c11bd3c Matthew Grooms
		$tls_mode = true;
199
	else
200
		$tls_mode = false;
201
202 b0b6d575 jim-p
	if (empty($pconfig['authmode']) && (($pconfig['mode'] == "server_user") || ($pconfig['mode'] == "server_tls_user")))
203
		$input_errors[] = gettext("You must select a Backend for Authentication if the server mode requires User Auth.");
204
205 d799787e Matthew Grooms
	/* input validation */
206
	if ($result = openvpn_validate_port($pconfig['local_port'], 'Local port'))
207
		$input_errors[] = $result;
208
209
	if ($result = openvpn_validate_cidr($pconfig['tunnel_network'], 'Tunnel network'))
210
		$input_errors[] = $result;
211
212
	if ($result = openvpn_validate_cidr($pconfig['remote_network'], 'Remote network'))
213
		$input_errors[] = $result;
214
215
	if ($result = openvpn_validate_cidr($pconfig['local_network'], 'Local network'))
216
		$input_errors[] = $result;
217
218 5accf130 jim-p
	$portused = openvpn_port_used($pconfig['protocol'], $pconfig['local_port']);
219
	if (($portused != $vpnid) && ($portused != 0))
220 4d8b3382 Carlos Eduardo Ramos
		$input_errors[] = gettext("The specified 'Local port' is in use. Please select another value");
221 f432e364 Matthew Grooms
222 89e6e210 jim-p
	if ($pconfig['autokey_enable'])
223
		$pconfig['shared_key'] = openvpn_create_key();
224
225 3c11bd3c Matthew Grooms
	if (!$tls_mode && !$pconfig['autokey_enable'])
226 d799787e Matthew Grooms
		if (!strstr($pconfig['shared_key'], "-----BEGIN OpenVPN Static key V1-----") ||
227
			!strstr($pconfig['shared_key'], "-----END OpenVPN Static key V1-----"))
228 4d8b3382 Carlos Eduardo Ramos
			$input_errors[] = gettext("The field 'Shared Key' does not appear to be valid");
229 3c11bd3c Matthew Grooms
230
	if ($tls_mode && $pconfig['tlsauth_enable'] && !$pconfig['autotls_enable'])
231
		if (!strstr($pconfig['tls'], "-----BEGIN OpenVPN Static key V1-----") ||
232
			!strstr($pconfig['tls'], "-----END OpenVPN Static key V1-----"))
233 4d8b3382 Carlos Eduardo Ramos
			$input_errors[] = gettext("The field 'TLS Authentication Key' does not appear to be valid");
234 d799787e Matthew Grooms
235
	if ($pconfig['dns_server_enable']) {
236
		if (!empty($pconfig['dns_server1']) && !is_ipaddr(trim($pconfig['dns_server1'])))
237 4d8b3382 Carlos Eduardo Ramos
			$input_errors[] = gettext("The field 'DNS Server #1' must contain a valid IP address");
238 d799787e Matthew Grooms
		if (!empty($pconfig['dns_server2']) && !is_ipaddr(trim($pconfig['dns_server2'])))
239 4d8b3382 Carlos Eduardo Ramos
			$input_errors[] = gettext("The field 'DNS Server #2' must contain a valid IP address");
240 d799787e Matthew Grooms
		if (!empty($pconfig['dns_server3']) && !is_ipaddr(trim($pconfig['dns_server3'])))
241 4d8b3382 Carlos Eduardo Ramos
			$input_errors[] = gettext("The field 'DNS Server #3' must contain a valid IP address");
242 d799787e Matthew Grooms
		if (!empty($pconfig['dns_server4']) && !is_ipaddr(trim($pconfig['dns_server4'])))
243 4d8b3382 Carlos Eduardo Ramos
			$input_errors[] = gettext("The field 'DNS Server #4' must contain a valid IP address");
244 d799787e Matthew Grooms
	}
245
246
	if ($pconfig['ntp_server_enable']) {
247
		if (!empty($pconfig['ntp_server1']) && !is_ipaddr(trim($pconfig['ntp_server1'])))
248 4d8b3382 Carlos Eduardo Ramos
			$input_errors[] = gettext("The field 'NTP Server #1' must contain a valid IP address");
249 d799787e Matthew Grooms
		if (!empty($pconfig['ntp_server2']) && !is_ipaddr(trim($pconfig['ntp_server2'])))
250 4d8b3382 Carlos Eduardo Ramos
			$input_errors[] = gettext("The field 'NTP Server #2' must contain a valid IP address");
251 d799787e Matthew Grooms
		if (!empty($pconfig['ntp_server3']) && !is_ipaddr(trim($pconfig['ntp_server3'])))
252 4d8b3382 Carlos Eduardo Ramos
			$input_errors[] = gettext("The field 'NTP Server #3' must contain a valid IP address");
253 d799787e Matthew Grooms
		if (!empty($pconfig['ntp_server4']) && !is_ipaddr(trim($pconfig['ntp_server4'])))
254 4d8b3382 Carlos Eduardo Ramos
			$input_errors[] = gettext("The field 'NTP Server #4' must contain a valid IP address");
255 d799787e Matthew Grooms
	}
256
257
	if ($pconfig['netbios_enable']) {
258
		if ($pconfig['wins_server_enable']) {
259
			if (!empty($pconfig['wins_server1']) && !is_ipaddr(trim($pconfig['wins_server1'])))
260 4d8b3382 Carlos Eduardo Ramos
				$input_errors[] = gettext("The field 'WINS Server #1' must contain a valid IP address");
261 d799787e Matthew Grooms
			if (!empty($pconfig['wins_server2']) && !is_ipaddr(trim($pconfig['wins_server2'])))
262 4d8b3382 Carlos Eduardo Ramos
				$input_errors[] = gettext("The field 'WINS Server #2' must contain a valid IP address");
263 d799787e Matthew Grooms
		}
264
		if ($pconfig['nbdd_server_enable'])
265
			if (!empty($pconfig['nbdd_server1']) && !is_ipaddr(trim($pconfig['nbdd_server1'])))
266 4d8b3382 Carlos Eduardo Ramos
				$input_errors[] = gettext("The field 'NetBIOS Data Distribution Server #1' must contain a valid IP address");
267 d799787e Matthew Grooms
	}
268
269
	if ($pconfig['maxclients'] && !is_numeric($pconfig['maxclients']))
270 4d8b3382 Carlos Eduardo Ramos
		$input_errors[] = gettext("The field 'Concurrent connections' must be numeric.");
271 d799787e Matthew Grooms
272 21c776dd jim-p
	/* If we are not in shared key mode, then we need the CA/Cert. */
273
	if ($pconfig['mode'] != "p2p_shared_key") {
274 872d9195 Matthew Grooms
		$reqdfields = explode(" ", "caref certref");
275 fe6d7a55 jim-p
		$reqdfieldsn = array(gettext("Certificate Authority"),gettext("Certificate"));
276 21c776dd jim-p
	} elseif (!$pconfig['autokey_enable']) {
277
		/* We only need the shared key filled in if we are in shared key mode and autokey is not selected. */
278
		$reqdfields = array('shared_key');
279 4d8b3382 Carlos Eduardo Ramos
		$reqdfieldsn = array(gettext('Shared key'));
280 d799787e Matthew Grooms
	}
281
282 872d9195 Matthew Grooms
	$reqdfields[] = 'tunnel_network';
283 4d8b3382 Carlos Eduardo Ramos
	$reqdfieldsn[] = gettext('Tunnel network');
284 872d9195 Matthew Grooms
285 d799787e Matthew Grooms
	do_input_validation($_POST, $reqdfields, $reqdfieldsn, &$input_errors);
286
	
287
	if (!$input_errors) {
288
289
		$server = array();
290
291 f432e364 Matthew Grooms
		if ($vpnid)
292
			$server['vpnid'] = $vpnid;
293 e28120e5 Matthew Grooms
		else
294 d799787e Matthew Grooms
			$server['vpnid'] = openvpn_vpnid_next();
295
296 870318b9 Ermal Lu?i
		if ($_POST['disable'] == "yes")
297
			$server['disable'] = true;
298 3c11bd3c Matthew Grooms
		$server['mode'] = $pconfig['mode'];
299 8a47c190 Ermal Lu?i
		if (!empty($pconfig['authmode']))
300
			$server['authmode'] = implode(",", $pconfig['authmode']);
301 d799787e Matthew Grooms
		$server['protocol'] = $pconfig['protocol'];
302 4936ff53 jim-p
		$server['dev_mode'] = $pconfig['dev_mode'];
303 67b0902f pierrepomes
		list($server['interface'], $server['ipaddr']) = explode ("|",$pconfig['interface']);
304 d799787e Matthew Grooms
		$server['local_port'] = $pconfig['local_port'];
305
		$server['description'] = $pconfig['description'];
306 e3bbd29a Ermal
		$server['custom_options'] = str_replace("\r\n", "\n", $pconfig['custom_options']);
307 d799787e Matthew Grooms
308 3c11bd3c Matthew Grooms
		if ($tls_mode) {
309
			if ($pconfig['tlsauth_enable']) {
310
				if ($pconfig['autotls_enable'])
311
					$pconfig['tls'] = openvpn_create_key();
312
				$server['tls'] = base64_encode($pconfig['tls']);
313
			}
314 fe787fc7 Matthew Grooms
			$server['caref'] = $pconfig['caref'];
315 6db02381 jim-p
			$server['crlref'] = $pconfig['crlref'];
316 fe787fc7 Matthew Grooms
			$server['certref'] = $pconfig['certref'];
317
			$server['dh_length'] = $pconfig['dh_length'];
318 94823361 jim-p
			if ($pconfig['mode'] == "server_tls_user")
319
				$server['strictusercn'] = $pconfig['strictusercn'];
320 3c11bd3c Matthew Grooms
		} else {
321
			$server['shared_key'] = base64_encode($pconfig['shared_key']);
322 d799787e Matthew Grooms
		}
323
		$server['crypto'] = $pconfig['crypto'];
324 582c58ae jim-p
		$server['engine'] = $pconfig['engine'];
325 d799787e Matthew Grooms
326
		$server['tunnel_network'] = $pconfig['tunnel_network'];
327
		$server['remote_network'] = $pconfig['remote_network'];
328
		$server['gwredir'] = $pconfig['gwredir'];
329
		$server['local_network'] = $pconfig['local_network'];
330
		$server['maxclients'] = $pconfig['maxclients'];
331
		$server['compression'] = $pconfig['compression'];
332 1cb0b40a Matthew Grooms
		$server['passtos'] = $pconfig['passtos'];
333 d799787e Matthew Grooms
		$server['client2client'] = $pconfig['client2client'];
334
335 65ff8497 jim-p
		$server['dynamic_ip'] = $pconfig['dynamic_ip'];
336 d799787e Matthew Grooms
		$server['pool_enable'] = $pconfig['pool_enable'];
337
338
		if ($pconfig['dns_domain_enable'])
339
			$server['dns_domain'] = $pconfig['dns_domain'];
340
341
		if ($pconfig['dns_server_enable']) {
342
			$server['dns_server1'] = $pconfig['dns_server1'];
343
			$server['dns_server2'] = $pconfig['dns_server2'];
344
			$server['dns_server3'] = $pconfig['dns_server3'];
345
			$server['dns_server4'] = $pconfig['dns_server4'];
346
		}
347
348
		if ($pconfig['ntp_server_enable']) {
349
			$server['ntp_server1'] = $pconfig['ntp_server1'];
350
			$server['ntp_server2'] = $pconfig['ntp_server2'];
351
		}
352
353
		$server['netbios_enable'] = $pconfig['netbios_enable'];
354
		$server['netbios_ntype'] = $pconfig['netbios_ntype'];
355
		$server['netbios_scope'] = $pconfig['netbios_scope'];
356
357
		if ($pconfig['netbios_enable']) {
358
359
			if ($pconfig['wins_server_enable']) {
360
				$server['wins_server1'] = $pconfig['wins_server1'];
361
				$server['wins_server2'] = $pconfig['wins_server2'];
362
			}
363
364
			if ($pconfig['dns_server_enable'])
365
				$server['nbdd_server1'] = $pconfig['nbdd_server1'];
366
		}
367 bca35cff jim-p
368
		if ($_POST['duplicate_cn'] == "yes")
369
			$server['duplicate_cn'] = true;
370
371 d799787e Matthew Grooms
		if (isset($id) && $a_server[$id])
372
			$a_server[$id] = $server;
373
		else
374
			$a_server[] = $server;
375
376 dc408939 Matthew Grooms
		openvpn_resync('server', $server);
377 d799787e Matthew Grooms
		write_config();
378
		
379
		header("Location: vpn_openvpn_server.php");
380
		exit;
381
	}
382 8a47c190 Ermal Lu?i
	if (!empty($pconfig['authmode']))
383
		$pconfig['authmode'] = implode(",", $pconfig['authmode']);
384 d799787e Matthew Grooms
}
385
386
include("head.inc");
387
388
?>
389
390
<body link="#000000" vlink="#000000" alink="#000000" onload="<?= $jsevents["body"]["onload"] ?>">
391
<?php include("fbegin.inc"); ?>
392
<script language="JavaScript">
393
<!--
394
395 3c11bd3c Matthew Grooms
function mode_change() {
396
	index = document.iform.mode.selectedIndex;
397
	value = document.iform.mode.options[index].value;
398 d799787e Matthew Grooms
	switch(value) {
399 3c11bd3c Matthew Grooms
		case "p2p_tls":
400
		case "server_tls":
401
		case "server_user":
402 94823361 jim-p
			document.getElementById("tls").style.display="";
403
			document.getElementById("tls_ca").style.display="";
404
			document.getElementById("tls_crl").style.display="";
405
			document.getElementById("tls_cert").style.display="";
406
			document.getElementById("tls_dh").style.display="";
407
			document.getElementById("strictusercn").style.display="none";
408
			document.getElementById("psk").style.display="none";
409
			break;
410 3c11bd3c Matthew Grooms
		case "server_tls_user":
411
			document.getElementById("tls").style.display="";
412
			document.getElementById("tls_ca").style.display="";
413 6db02381 jim-p
			document.getElementById("tls_crl").style.display="";
414 3c11bd3c Matthew Grooms
			document.getElementById("tls_cert").style.display="";
415 fe787fc7 Matthew Grooms
			document.getElementById("tls_dh").style.display="";
416 94823361 jim-p
			document.getElementById("strictusercn").style.display="";
417 d799787e Matthew Grooms
			document.getElementById("psk").style.display="none";
418
			break;
419 3c11bd3c Matthew Grooms
		case "p2p_shared_key":
420
			document.getElementById("tls").style.display="none";
421
			document.getElementById("tls_ca").style.display="none";
422 6db02381 jim-p
			document.getElementById("tls_crl").style.display="none";
423 3c11bd3c Matthew Grooms
			document.getElementById("tls_cert").style.display="none";
424 fe787fc7 Matthew Grooms
			document.getElementById("tls_dh").style.display="none";
425 94823361 jim-p
			document.getElementById("strictusercn").style.display="none";
426 d799787e Matthew Grooms
			document.getElementById("psk").style.display="";
427
			break;
428
	}
429 3c11bd3c Matthew Grooms
	switch(value) {
430
		case "p2p_shared_key":
431
			document.getElementById("client_opts").style.display="none";
432
			document.getElementById("remote_opts").style.display="";
433 a2ff08f8 jim-p
			document.getElementById("gwredir_opts").style.display="none";
434 b008c1eb jim-p
			document.getElementById("local_opts").style.display="none";
435
			document.getElementById("authmodetr").style.display="none";
436 107794cc jim-p
			document.getElementById("inter_client_communication").style.display="none";
437 b008c1eb jim-p
			break;
438
		case "p2p_tls":
439
			document.getElementById("client_opts").style.display="none";
440
			document.getElementById("remote_opts").style.display="";
441 a2ff08f8 jim-p
			document.getElementById("gwredir_opts").style.display="";
442 b008c1eb jim-p
			document.getElementById("local_opts").style.display="";
443 e8a58de4 Ermal Lu?i
			document.getElementById("authmodetr").style.display="none";
444 107794cc jim-p
			document.getElementById("inter_client_communication").style.display="none";
445 3c11bd3c Matthew Grooms
			break;
446 e8a58de4 Ermal Lu?i
		case "server_user":
447
                case "server_tls_user":
448
			document.getElementById("authmodetr").style.display="";
449 54b9de56 Ermal Lu?i
			document.getElementById("client_opts").style.display="";
450
			document.getElementById("remote_opts").style.display="none";
451 a2ff08f8 jim-p
			document.getElementById("gwredir_opts").style.display="";
452 b008c1eb jim-p
			document.getElementById("local_opts").style.display="";
453 107794cc jim-p
			document.getElementById("inter_client_communication").style.display="";
454 54b9de56 Ermal Lu?i
			break;
455
		case "server_tls":
456
			document.getElementById("authmodetr").style.display="none";
457 3c11bd3c Matthew Grooms
		default:
458
			document.getElementById("client_opts").style.display="";
459
			document.getElementById("remote_opts").style.display="none";
460 a2ff08f8 jim-p
			document.getElementById("gwredir_opts").style.display="";
461 b008c1eb jim-p
			document.getElementById("local_opts").style.display="";
462 107794cc jim-p
			document.getElementById("inter_client_communication").style.display="";
463 3c11bd3c Matthew Grooms
			break;
464
	}
465 a2ff08f8 jim-p
	gwredir_change();
466 3c11bd3c Matthew Grooms
}
467
468
function autokey_change() {
469
470
	if (document.iform.autokey_enable.checked)
471
		document.getElementById("autokey_opts").style.display="none";
472
	else
473
		document.getElementById("autokey_opts").style.display="";
474
}
475
476
function tlsauth_change() {
477
478
<?php if (!$pconfig['tls']): ?>
479
	if (document.iform.tlsauth_enable.checked)
480
		document.getElementById("tlsauth_opts").style.display="";
481
	else
482
		document.getElementById("tlsauth_opts").style.display="none";
483
<?php endif; ?>
484
485
	autotls_change();
486
}
487
488
function autotls_change() {
489
490
<?php if (!$pconfig['tls']): ?>
491
	autocheck = document.iform.autotls_enable.checked;
492
<?php else: ?>
493
	autocheck = false;
494
<?php endif; ?>
495
496
	if (document.iform.tlsauth_enable.checked && !autocheck)
497
		document.getElementById("autotls_opts").style.display="";
498
	else
499
		document.getElementById("autotls_opts").style.display="none";
500 d799787e Matthew Grooms
}
501
502
function gwredir_change() {
503
504
	if (document.iform.gwredir.checked)
505
		document.getElementById("local_opts").style.display="none";
506
	else
507
		document.getElementById("local_opts").style.display="";
508
}
509
510
function dns_domain_change() {
511
512
	if (document.iform.dns_domain_enable.checked)
513
		document.getElementById("dns_domain_data").style.display="";
514
	else
515
		document.getElementById("dns_domain_data").style.display="none";
516
}
517
518
function dns_server_change() {
519
520
	if (document.iform.dns_server_enable.checked)
521
		document.getElementById("dns_server_data").style.display="";
522
	else
523
		document.getElementById("dns_server_data").style.display="none";
524
}
525
526
function wins_server_change() {
527
528
	if (document.iform.wins_server_enable.checked)
529
		document.getElementById("wins_server_data").style.display="";
530
	else
531
		document.getElementById("wins_server_data").style.display="none";
532
}
533
534
function ntp_server_change() {
535
536
	if (document.iform.ntp_server_enable.checked)
537
		document.getElementById("ntp_server_data").style.display="";
538
	else
539
		document.getElementById("ntp_server_data").style.display="none";
540
}
541
542
function netbios_change() {
543
544
	if (document.iform.netbios_enable.checked) {
545
		document.getElementById("netbios_data").style.display="";
546
		document.getElementById("wins_opts").style.display="";
547
	} else {
548
		document.getElementById("netbios_data").style.display="none";
549
		document.getElementById("wins_opts").style.display="none";
550
	}
551
}
552
553
//-->
554
</script>
555
<?php
556 428e66b6 jim-p
if (!$savemsg)
557
	$savemsg = "";
558
559
if ($input_errors)
560
	print_input_errors($input_errors);
561
if ($savemsg)
562
	print_info_box_np($savemsg);
563 d799787e Matthew Grooms
?>
564
<table width="100%" border="0" cellpadding="0" cellspacing="0">
565 5a3b0d3b mgrooms
	<tr>
566 d799787e Matthew Grooms
		<td class="tabnavtbl">
567
			<ul id="tabnav">
568
			<?php 
569
				$tab_array = array();
570
				$tab_array[] = array(gettext("Server"), true, "vpn_openvpn_server.php");
571
				$tab_array[] = array(gettext("Client"), false, "vpn_openvpn_client.php");
572
				$tab_array[] = array(gettext("Client Specific Overrides"), false, "vpn_openvpn_csc.php");
573 5540aee6 Ermal Lu?i
				$tab_array[] = array(gettext("Wizards"), false, "wizard.php?xml=openvpn_wizard.xml");
574 b63f2e8b Matthew Grooms
				add_package_tabs("OpenVPN", $tab_array);
575 d799787e Matthew Grooms
				display_top_tabs($tab_array);
576
			?>
577
			</ul>
578
		</td>
579
	</tr>    
580
	<tr>
581
		<td class="tabcont">
582
583
			<?php if($act=="new" || $act=="edit"): ?>
584
585
			<form action="vpn_openvpn_server.php" method="post" name="iform" id="iform" onsubmit="presubmit()">
586
				<table width="100%" border="0" cellpadding="6" cellspacing="0">
587 47c00c09 Scott Ullrich
					<tr>
588 4d8b3382 Carlos Eduardo Ramos
						<td colspan="2" valign="top" class="listtopic"><?=gettext("General information"); ?></td>
589 b63f2e8b Matthew Grooms
					</tr>
590 d799787e Matthew Grooms
					<tr>
591 4d8b3382 Carlos Eduardo Ramos
						<td width="22%" valign="top" class="vncellreq"><?=gettext("Disabled"); ?></td>
592 d799787e Matthew Grooms
						<td width="78%" class="vtable">
593
							<table border="0" cellpadding="0" cellspacing="0">
594
								<tr>
595
									<td>
596
										<?php set_checked($pconfig['disable'],$chk); ?>
597
										<input name="disable" type="checkbox" value="yes" <?=$chk;?>/>
598
									</td>
599
									<td>
600
										&nbsp;
601
										<span class="vexpl">
602 4d8b3382 Carlos Eduardo Ramos
											<strong><?=gettext("Disable this server"); ?></strong><br>
603 d799787e Matthew Grooms
										</span>
604
									</td>
605
								</tr>
606
							</table>
607 4d8b3382 Carlos Eduardo Ramos
							<?=gettext("Set this option to disable this server without removing it from the list"); ?>.
608 d799787e Matthew Grooms
						</td>
609
					</tr>
610 3c11bd3c Matthew Grooms
					<tr>
611
						<td width="22%" valign="top" class="vncellreq"><?=gettext("Server Mode");?></td>
612
							<td width="78%" class="vtable">
613
							<select name='mode' id='mode' class="formselect" onchange='mode_change()'>
614
							<?php
615
								foreach ($openvpn_server_modes as $name => $desc):
616
									$selected = "";
617
									if ($pconfig['mode'] == $name)
618
										$selected = "selected";
619
							?>
620
								<option value="<?=$name;?>" <?=$selected;?>><?=$desc;?></option>
621
							<?php endforeach; ?>
622
							</select>
623
						</td>
624
					</tr>
625 e8a58de4 Ermal Lu?i
					<tr id="authmodetr" style="display:none">
626
                                                <td width="22%" valign="top" class="vncellreq"><?=gettext("Backend for authentication");?></td>
627
                                                        <td width="78%" class="vtable">
628 6306b5dd Ermal Lu?i
                                                        <select name='authmode[]' id='authmode' class="formselect" multiple="true" size="<?php echo count($auth_servers); ?>">
629 c61e4626 Ermal Lu?i
							<?php $authmodes = explode(",", $pconfig['authmode']); ?>
630 e8a58de4 Ermal Lu?i
                                                        <?php
631 6306b5dd Ermal Lu?i
								$auth_servers = auth_get_authserver_list();
632 e8a58de4 Ermal Lu?i
                                                                foreach ($auth_servers as $auth_server):
633
                                                                        $selected = "";
634 c61e4626 Ermal Lu?i
                                                                        if (in_array($auth_server['name'], $authmodes))
635 e8a58de4 Ermal Lu?i
                                                                                $selected = "selected";
636
                                                        ?>
637
                                                                <option value="<?=$auth_server['name'];?>" <?=$selected;?>><?=$auth_server['name'];?></option>
638
                                                        <?php 	endforeach; ?>
639
                                                        </select>
640
                                                </td>
641
                                        </tr>
642 d799787e Matthew Grooms
					<tr>
643
						<td width="22%" valign="top" class="vncellreq"><?=gettext("Protocol");?></td>
644
							<td width="78%" class="vtable">
645
							<select name='protocol' class="formselect">
646
							<?php
647
								foreach ($openvpn_prots as $prot):
648
									$selected = "";
649
									if ($pconfig['protocol'] == $prot)
650
										$selected = "selected";
651
							?>
652
								<option value="<?=$prot;?>" <?=$selected;?>><?=$prot;?></option>
653
							<?php endforeach; ?>
654
							</select>
655
							</td>
656
					</tr>
657 bf87b4d7 lgcosta
					<tr>
658
						<td width="22%" valign="top" class="vncellreq"><?=gettext("Device Mode"); ?></td>
659
						<td width="78%" class="vtable">
660 4936ff53 jim-p
							<select name="dev_mode" class="formselect">
661 bf87b4d7 lgcosta
                                                        <?php
662
                                                                foreach ($openvpn_dev_mode as $device):
663 71edee5e lgcosta
                                                                       $selected = "";
664 4936ff53 jim-p
                                                                       if (! empty($pconfig['dev_mode'])) {
665
                                                                               if ($pconfig['dev_mode'] == $device)
666 71edee5e lgcosta
                                                                                       $selected = "selected";
667
                                                                       } else {
668
                                                                               if ($device == "tun")
669
                                                                                       $selected = "selected";
670
                                                                       }
671 bf87b4d7 lgcosta
                                                        ?>
672
                                                                <option value="<?=$device;?>" <?=$selected;?>><?=$device;?></option>
673
                                                        <?php endforeach; ?>
674
                                                        </select>
675
                                                        </td>
676
                                        </tr>
677 d799787e Matthew Grooms
					<tr>
678 4d8b3382 Carlos Eduardo Ramos
						<td width="22%" valign="top" class="vncellreq"><?=gettext("Interface"); ?></td>
679 d799787e Matthew Grooms
						<td width="78%" class="vtable">
680
							<select name="interface" class="formselect">
681
								<?php
682
									$interfaces = get_configured_interface_with_descr();
683 3d06e8f0 pierrepomes
									$carplist = get_configured_carp_interface_list();
684
									foreach ($carplist as $cif => $carpip)
685 dd62256f Pierre POMES
										$interfaces[$cif.'|'.$carpip] = $carpip." (".get_vip_descr($carpip).")";
686 67b0902f pierrepomes
									$aliaslist = get_configured_ip_aliases_list();
687
									foreach ($aliaslist as $aliasip => $aliasif)
688 dd62256f Pierre POMES
										$interfaces[$aliasif.'|'.$aliasip] = $aliasip." (".get_vip_descr($aliasip).")";
689 67b0902f pierrepomes
									$interfaces['any'] = "any";
690 d799787e Matthew Grooms
									foreach ($interfaces as $iface => $ifacename):
691 1d3bcd2a Matthew Grooms
										$selected = "";
692
										if ($iface == $pconfig['interface'])
693
											$selected = "selected";
694 d799787e Matthew Grooms
								?>
695 1d3bcd2a Matthew Grooms
									<option value="<?=$iface;?>" <?=$selected;?>>
696
										<?=htmlspecialchars($ifacename);?>
697
									</option>
698 d799787e Matthew Grooms
								<?php endforeach; ?>
699
							</select> <br>
700
						</td>
701
					</tr>
702
					<tr>
703
						<td width="22%" valign="top" class="vncellreq"><?=gettext("Local port");?></td>
704
						<td width="78%" class="vtable">
705
							<input name="local_port" type="text" class="formfld unknown" size="5" value="<?=htmlspecialchars($pconfig['local_port']);?>"/>
706
						</td>
707
					</tr>
708
					<tr> 
709 4d8b3382 Carlos Eduardo Ramos
						<td width="22%" valign="top" class="vncell"><?=gettext("Description"); ?></td>
710 d799787e Matthew Grooms
						<td width="78%" class="vtable"> 
711
							<input name="description" type="text" class="formfld unknown" size="30" value="<?=htmlspecialchars($pconfig['description']);?>">
712
							<br>
713 4d8b3382 Carlos Eduardo Ramos
							<?=gettext("You may enter a description here for your reference (not parsed)"); ?>.
714 d799787e Matthew Grooms
						</td>
715
					</tr>
716
					<tr>
717
						<td colspan="2" class="list" height="12"></td>
718
					</tr>
719
					<tr>
720 4d8b3382 Carlos Eduardo Ramos
						<td colspan="2" valign="top" class="listtopic"><?=gettext("Cryptographic Settings"); ?></td>
721 d799787e Matthew Grooms
					</tr>
722 3c11bd3c Matthew Grooms
					<tr id="tls">
723 4d8b3382 Carlos Eduardo Ramos
						<td width="22%" valign="top" class="vncellreq"><?=gettext("TLS Authentication"); ?></td>
724 3c11bd3c Matthew Grooms
						<td width="78%" class="vtable">
725
							<table border="0" cellpadding="2" cellspacing="0">
726
								<tr>
727
									<td>
728
										<?php set_checked($pconfig['tlsauth_enable'],$chk); ?>
729
										<input name="tlsauth_enable" id="tlsauth_enable" type="checkbox" value="yes" <?=$chk;?> onClick="tlsauth_change()">
730
									</td>
731
									<td>
732
										<span class="vexpl">
733 4d8b3382 Carlos Eduardo Ramos
											<?=gettext("Enable authentication of TLS packets"); ?>.
734 3c11bd3c Matthew Grooms
										</span>
735
									</td>
736
								</tr>
737
							</table>
738
							<?php if (!$pconfig['tls']): ?>
739
							<table border="0" cellpadding="2" cellspacing="0" id='tlsauth_opts'>
740
								<tr>
741
									<td>
742
										<?php set_checked($pconfig['autotls_enable'],$chk); ?>
743
										<input name="autotls_enable" id="autotls_enable" type="checkbox" value="yes" <?=$chk;?> onClick="autotls_change()">
744
									</td>
745
									<td>
746
										<span class="vexpl">
747 4d8b3382 Carlos Eduardo Ramos
											<?=gettext("Automatically generate a shared TLS authentication key"); ?>.
748 3c11bd3c Matthew Grooms
										</span>
749
									</td>
750
								</tr>
751
							</table>
752
							<?php endif; ?>
753
							<table border="0" cellpadding="2" cellspacing="0" id='autotls_opts'>
754
								<tr>
755
									<td>
756
										<textarea name="tls" cols="65" rows="7" class="formpre"><?=htmlspecialchars($pconfig['tls']);?></textarea>
757
										<br/>
758 4d8b3382 Carlos Eduardo Ramos
										<?=gettext("Paste your shared key here"); ?>.
759 3c11bd3c Matthew Grooms
									</td>
760
								</tr>
761
							</table>
762
						</td>
763 d799787e Matthew Grooms
					</tr>
764 3c11bd3c Matthew Grooms
					<tr id="tls_ca">
765 4d8b3382 Carlos Eduardo Ramos
						<td width="22%" valign="top" class="vncellreq"><?=gettext("Peer Certificate Authority"); ?></td>
766 d799787e Matthew Grooms
							<td width="78%" class="vtable">
767 19cdeb3e jim-p
							<?php if (count($a_ca)): ?>
768 d799787e Matthew Grooms
							<select name='caref' class="formselect">
769
							<?php
770 428e66b6 jim-p
								foreach ($a_ca as $ca):
771 d799787e Matthew Grooms
									$selected = "";
772
									if ($pconfig['caref'] == $ca['refid'])
773
										$selected = "selected";
774
							?>
775 f2a86ca9 jim-p
								<option value="<?=$ca['refid'];?>" <?=$selected;?>><?=$ca['descr'];?></option>
776 d799787e Matthew Grooms
							<?php endforeach; ?>
777
							</select>
778 19cdeb3e jim-p
							<?php else: ?>
779
								<b>No Certificate Authorities defined.</b> <br/>Create one under <a href="system_camanager.php">System &gt; Cert Manager</a>.
780
							<?php endif; ?>
781 d799787e Matthew Grooms
							</td>
782
					</tr>
783 6db02381 jim-p
					<tr id="tls_crl">
784
						<td width="22%" valign="top" class="vncellreq"><?=gettext("Peer Certificate Revocation List"); ?></td>
785
							<td width="78%" class="vtable">
786 19cdeb3e jim-p
							<?php if (count($a_crl)): ?>
787 6db02381 jim-p
							<select name='crlref' class="formselect">
788
								<option value="">None</option>
789
							<?php
790 428e66b6 jim-p
								foreach ($a_crl as $crl):
791 6db02381 jim-p
									$selected = "";
792 f02c3e1d jim-p
									$caname = "";
793
									$ca = lookup_ca($crl['caref']);
794
									if ($ca) {
795
										$caname = " (CA: {$ca['descr']})";
796
										if ($pconfig['crlref'] == $crl['refid'])
797
											$selected = "selected";
798
									}
799 6db02381 jim-p
							?>
800 f02c3e1d jim-p
								<option value="<?=$crl['refid'];?>" <?=$selected;?>><?=$crl['descr'] . $caname;?></option>
801 6db02381 jim-p
							<?php endforeach; ?>
802
							</select>
803 19cdeb3e jim-p
							<?php else: ?>
804
								<b>No Certificate Revocation Lists (CRLs) defined.</b> <br/>Create one under <a href="system_crlmanager.php">System &gt; Cert Manager</a>.
805
							<?php endif; ?>
806 6db02381 jim-p
							</td>
807
					</tr>
808 3c11bd3c Matthew Grooms
					<tr id="tls_cert">
809 4d8b3382 Carlos Eduardo Ramos
						<td width="22%" valign="top" class="vncellreq"><?=gettext("Server Certificate"); ?></td>
810 d799787e Matthew Grooms
							<td width="78%" class="vtable">
811 19cdeb3e jim-p
							<?php if (count($a_cert)): ?>
812 d799787e Matthew Grooms
							<select name='certref' class="formselect">
813
							<?php
814 428e66b6 jim-p
							foreach ($a_cert as $cert):
815 9e303f2f jim-p
								$selected = "";
816
								$caname = "";
817
								$inuse = "";
818
								$revoked = "";
819
								$ca = lookup_ca($cert['caref']);
820
								if ($ca)
821
									$caname = " (CA: {$ca['descr']})";
822
								if ($pconfig['certref'] == $cert['refid'])
823
									$selected = "selected";
824
								if (cert_in_use($cert['refid']))
825
									$inuse = " *In Use";
826
								if (is_cert_revoked($cert))
827
								$revoked = " *Revoked";
828 d799787e Matthew Grooms
							?>
829 6a0b3ea4 jim-p
								<option value="<?=$cert['refid'];?>" <?=$selected;?>><?=$cert['descr'] . $caname . $inuse . $revoked;?></option>
830 d799787e Matthew Grooms
							<?php endforeach; ?>
831
							</select>
832 19cdeb3e jim-p
							<?php else: ?>
833
								<b>No Certificates defined.</b> <br/>Create one under <a href="system_certmanager.php">System &gt; Cert Manager</a>.
834
							<?php endif; ?>
835 d799787e Matthew Grooms
						</td>
836
					</tr>
837 fe787fc7 Matthew Grooms
					<tr id="tls_dh">
838 4d8b3382 Carlos Eduardo Ramos
						<td width="22%" valign="top" class="vncellreq"><?=gettext("DH Parameters Length"); ?></td>
839 fe787fc7 Matthew Grooms
						<td width="78%" class="vtable">
840
							<select name="dh_length" class="formselect">
841
								<?php
842
									foreach ($openvpn_dh_lengths as $length):
843
									$selected = '';
844
									if ($length == $pconfig['dh_length'])
845
										$selected = ' selected';
846
								?>
847
								<option<?=$selected?>><?=$length;?></option>
848
								<?php endforeach; ?>
849
							</select>
850
							<span class="vexpl">
851 1c83021a Carlos Eduardo Ramos
								<?=gettext("bits"); ?>
852 fe787fc7 Matthew Grooms
							</span>
853
						</td>
854
					</tr>
855 d799787e Matthew Grooms
					<tr id="psk">
856 4d8b3382 Carlos Eduardo Ramos
						<td width="22%" valign="top" class="vncellreq"><?=gettext("Shared Key"); ?></td>
857 3c11bd3c Matthew Grooms
						<td width="78%" class="vtable">
858
							<?php if (!$pconfig['shared_key']): ?>
859
							<table border="0" cellpadding="2" cellspacing="0">
860
								<tr>
861
									<td>
862
										<?php set_checked($pconfig['autokey_enable'],$chk); ?>
863
										<input name="autokey_enable" type="checkbox" value="yes" <?=$chk;?> onClick="autokey_change()">
864
									</td>
865
									<td>
866
										<span class="vexpl">
867 4d8b3382 Carlos Eduardo Ramos
											<?=gettext("Automatically generate a shared key"); ?>.
868 3c11bd3c Matthew Grooms
										</span>
869
									</td>
870
								</tr>
871
							</table>
872
							<?php endif; ?>
873
							<table border="0" cellpadding="2" cellspacing="0" id='autokey_opts'>
874
								<tr>
875
									<td>
876
										<textarea name="shared_key" cols="65" rows="7" class="formpre"><?=htmlspecialchars($pconfig['shared_key']);?></textarea>
877
										<br/>
878 4d8b3382 Carlos Eduardo Ramos
										<?=gettext("Paste your shared key here"); ?>.
879 3c11bd3c Matthew Grooms
									</td>
880
								</tr>
881
							</table>
882 d799787e Matthew Grooms
						</td>
883
					</tr>
884
					<tr>
885 4d8b3382 Carlos Eduardo Ramos
						<td width="22%" valign="top" class="vncellreq"><?=gettext("Encryption algorithm"); ?></td>
886 d799787e Matthew Grooms
						<td width="78%" class="vtable">
887
							<select name="crypto" class="formselect">
888
								<?php
889
									$cipherlist = openvpn_get_cipherlist();
890
									foreach ($cipherlist as $name => $desc):
891
									$selected = '';
892
									if ($name == $pconfig['crypto'])
893
										$selected = ' selected';
894
								?>
895
								<option value="<?=$name;?>"<?=$selected?>>
896
									<?=htmlspecialchars($desc);?>
897
								</option>
898
								<?php endforeach; ?>
899 582c58ae jim-p
							</select>
900
						</td>
901
					</tr>
902
					<tr id="engine">
903
						<td width="22%" valign="top" class="vncellreq"><?=gettext("Hardware Crypto"); ?></td>
904
						<td width="78%" class="vtable">
905
							<select name="engine" class="formselect">
906
								<?php
907
									$engines = openvpn_get_engines();
908
									foreach ($engines as $name => $desc):
909
									$selected = '';
910
									if ($name == $pconfig['engine'])
911
										$selected = ' selected';
912
								?>
913
								<option value="<?=$name;?>"<?=$selected?>>
914
									<?=htmlspecialchars($desc);?>
915
								</option>
916
								<?php endforeach; ?>
917 d799787e Matthew Grooms
							</select>
918
						</td>
919
					</tr>
920 94823361 jim-p
					<tr id="strictusercn">
921
						<td width="22%" valign="top" class="vncell"><?=gettext("Strict User/CN Matching"); ?></td>
922
						<td width="78%" class="vtable">
923
							<table border="0" cellpadding="2" cellspacing="0">
924
								<tr>
925
									<td>
926
										<?php set_checked($pconfig['strictusercn'],$chk); ?>
927
										<input name="strictusercn" type="checkbox" value="yes" <?=$chk;?>/>
928
									</td>
929
									<td>
930
										<span class="vexpl">
931
											<?=gettext("When authenticating users, enforce a match between the common name of the client certificate and the username given at login."); ?>
932
										</span>
933
									</td>
934
								</tr>
935
							</table>
936
						</td>
937
					</tr>
938 d799787e Matthew Grooms
					<tr>
939
						<td colspan="2" class="list" height="12"></td>
940
					</tr>
941
					<tr>
942 4d8b3382 Carlos Eduardo Ramos
						<td colspan="2" valign="top" class="listtopic"><?=gettext("Tunnel Settings"); ?></td>
943 d799787e Matthew Grooms
					</tr>
944
					<tr>
945 4d8b3382 Carlos Eduardo Ramos
						<td width="22%" valign="top" class="vncellreq"><?=gettext("Tunnel Network"); ?></td>
946 d799787e Matthew Grooms
						<td width="78%" class="vtable">
947
							<input name="tunnel_network" type="text" class="formfld unknown" size="20" value="<?=htmlspecialchars($pconfig['tunnel_network']);?>">
948
							<br>
949 4d8b3382 Carlos Eduardo Ramos
							<?=gettext("This is the virtual network used for private " .
950
							"communications between this server and client " .
951
							"hosts expressed using CIDR (eg. 10.0.8.0/24). " .
952
							"The first network address will be assigned to " .
953
							"the	server virtual interface. The remaining " .
954
							"network addresses can optionally be assigned " .
955
							"to connecting clients. (see Address Pool)"); ?>
956 d799787e Matthew Grooms
						</td>
957
					</tr>
958 a2ff08f8 jim-p
					<tr id="gwredir_opts">
959 4d8b3382 Carlos Eduardo Ramos
						<td width="22%" valign="top" class="vncell"><?=gettext("Redirect Gateway"); ?></td>
960 d799787e Matthew Grooms
						<td width="78%" class="vtable">
961
							<table border="0" cellpadding="2" cellspacing="0">
962
								<tr>
963
									<td>
964
										<?php set_checked($pconfig['gwredir'],$chk); ?>
965
										<input name="gwredir" type="checkbox" value="yes" <?=$chk;?> onClick="gwredir_change()"/>
966
									</td>
967
									<td>
968
										<span class="vexpl">
969 4d8b3382 Carlos Eduardo Ramos
											<?=gettext("Force all client generated traffic through the tunnel"); ?>.
970 d799787e Matthew Grooms
										</span>
971
									</td>
972
								</tr>
973
							</table>
974
						</td>
975
					</tr>
976
					<tr id="local_opts">
977 4d8b3382 Carlos Eduardo Ramos
						<td width="22%" valign="top" class="vncell"><?=gettext("Local Network"); ?></td>
978 d799787e Matthew Grooms
						<td width="78%" class="vtable">
979
							<input name="local_network" type="text" class="formfld unknown" size="20" value="<?=htmlspecialchars($pconfig['local_network']);?>">
980
							<br>
981 4d8b3382 Carlos Eduardo Ramos
							<?=gettext("This is the network that will be accessible " .
982
							"from the remote endpoint. Expressed as a CIDR " .
983
							"range. You may leave this blank if you don't " .
984
							"want to add a route to the local network " .
985
							"through this tunnel on the remote machine. " .
986
							"This is generally set to your LAN network"); ?>.
987 d799787e Matthew Grooms
						</td>
988
					</tr>
989 3c11bd3c Matthew Grooms
					<tr id="remote_opts">
990 4d8b3382 Carlos Eduardo Ramos
						<td width="22%" valign="top" class="vncell"><?=gettext("Remote Network"); ?></td>
991 3c11bd3c Matthew Grooms
						<td width="78%" class="vtable">
992
							<input name="remote_network" type="text" class="formfld unknown" size="20" value="<?=htmlspecialchars($pconfig['remote_network']);?>">
993
							<br>
994 4d8b3382 Carlos Eduardo Ramos
							<?=gettext("This is a network that will be routed through " .
995
							"the tunnel, so that a site-to-site VPN can be " .
996
							"established without manually changing the " .
997
							"routing tables. Expressed as a CIDR range. If " .
998
							"this is a site-to-site VPN, enter here the " .
999
							"remote LAN here. You may leave this blank if " .
1000
							"you don't want a site-to-site VPN"); ?>.
1001 3c11bd3c Matthew Grooms
						</td>
1002
					</tr>
1003 d799787e Matthew Grooms
					<tr>
1004
						<td width="22%" valign="top" class="vncell"><?=gettext("Concurrent connections");?></td>
1005
						<td width="78%" class="vtable">
1006
							<input name="maxclients" type="text" class="formfld unknown" size="5" value="<?=htmlspecialchars($pconfig['maxclients']);?>"/>
1007
							<br/>
1008 4d8b3382 Carlos Eduardo Ramos
							<?=gettext("Specify the maximum number of clients allowed to concurrently connect to this server"); ?>.
1009 d799787e Matthew Grooms
						</td>
1010
					</tr>
1011
					<tr>
1012 4d8b3382 Carlos Eduardo Ramos
						<td width="22%" valign="top" class="vncell"><?=gettext("Compression"); ?></td>
1013 d799787e Matthew Grooms
						<td width="78%" class="vtable">
1014
							<table border="0" cellpadding="2" cellspacing="0">
1015
								<tr>
1016
									<td>
1017
										<?php set_checked($pconfig['compression'],$chk); ?>
1018
										<input name="compression" type="checkbox" value="yes" <?=$chk;?>>
1019
									</td>
1020
									<td>
1021
										<span class="vexpl">
1022 4d8b3382 Carlos Eduardo Ramos
											<?=gettext("Compress tunnel packets using the LZO algorithm"); ?>.
1023 d799787e Matthew Grooms
										</span>
1024
									</td>
1025
								</tr>
1026
							</table>
1027
						</td>
1028
					</tr>
1029
					<tr>
1030 4d8b3382 Carlos Eduardo Ramos
						<td width="22%" valign="top" class="vncell"><?=gettext("Type-of-Service"); ?></td>
1031 d799787e Matthew Grooms
						<td width="78%" class="vtable">
1032
							<table border="0" cellpadding="2" cellspacing="0">
1033
								<tr>
1034
									<td>
1035 1cb0b40a Matthew Grooms
										<?php set_checked($pconfig['passtos'],$chk); ?>
1036
										<input name="passtos" type="checkbox" value="yes" <?=$chk;?>>
1037 d799787e Matthew Grooms
									</td>
1038
									<td>
1039
										<span class="vexpl">
1040 4d8b3382 Carlos Eduardo Ramos
											<?=gettext("Set the TOS IP header value of tunnel packets to match the encapsulated packet value"); ?>.
1041 d799787e Matthew Grooms
										</span>
1042
									</td>
1043
								</tr>
1044
							</table>
1045
						</td>
1046
					</tr>
1047 107794cc jim-p
					<tr id="inter_client_communication">
1048 4d8b3382 Carlos Eduardo Ramos
						<td width="22%" valign="top" class="vncell"><?=gettext("Inter-client communication"); ?></td>
1049 d799787e Matthew Grooms
						<td width="78%" class="vtable">
1050
							<table border="0" cellpadding="2" cellspacing="0">
1051
								<tr>
1052
									<td>
1053
										<?php set_checked($pconfig['client2client'],$chk); ?>
1054
										<input name="client2client" type="checkbox" value="yes" <?=$chk;?>/>
1055
									</td>
1056
									<td>
1057
										<span class="vexpl">
1058 4d8b3382 Carlos Eduardo Ramos
											<?=gettext("Allow communication between clients connected to this server"); ?>
1059 d799787e Matthew Grooms
										</span>
1060
									</td>
1061
								</tr>
1062
							</table>
1063
						</td>
1064
					</tr>
1065 bca35cff jim-p
					<tr id="duplicate_cn">
1066
						<td width="22%" valign="top" class="vncell"><?=gettext("Duplicate Connections"); ?></td>
1067
						<td width="78%" class="vtable">
1068
							<table border="0" cellpadding="2" cellspacing="0">
1069
								<tr>
1070
									<td>
1071
										<?php set_checked($pconfig['duplicate_cn'],$chk); ?>
1072
										<input name="duplicate_cn" type="checkbox" value="yes" <?=$chk;?>/>
1073
									</td>
1074
									<td>
1075
										<span class="vexpl">
1076
											<?=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."); ?>
1077
										</span>
1078
									</td>
1079
								</tr>
1080
							</table>
1081
						</td>
1082
					</tr>
1083 3c11bd3c Matthew Grooms
				</table>
1084
1085
				<table width="100%" border="0" cellpadding="6" cellspacing="0" id="client_opts">
1086 d799787e Matthew Grooms
					<tr>
1087
						<td colspan="2" class="list" height="12"></td>
1088
					</tr>
1089
					<tr>
1090 4d8b3382 Carlos Eduardo Ramos
						<td colspan="2" valign="top" class="listtopic"><?=gettext("Client Settings"); ?></td>
1091 d799787e Matthew Grooms
					</tr>
1092 65ff8497 jim-p
					<tr>
1093 4d8b3382 Carlos Eduardo Ramos
						<td width="22%" valign="top" class="vncell"><?=gettext("Dynamic IP"); ?></td>
1094 65ff8497 jim-p
						<td width="78%" class="vtable">
1095
							<table border="0" cellpadding="2" cellspacing="0">
1096
								<tr>
1097
									<td>
1098
										<?php set_checked($pconfig['dynamic_ip'],$chk); ?>
1099 b3cf36d7 Erik Fonnesbeck
										<input name="dynamic_ip" type="checkbox" id="dynamic_ip" value="yes" <?=$chk;?>/>
1100 65ff8497 jim-p
									</td>
1101
									<td>
1102
										<span class="vexpl">
1103 4d8b3382 Carlos Eduardo Ramos
											<?=gettext("Allow connected clients to retain their connections if their IP address changes"); ?>.<br>
1104 65ff8497 jim-p
										</span>
1105
									</td>
1106
								</tr>
1107
							</table>
1108
						</td>
1109
					</tr>
1110 d799787e Matthew Grooms
					<tr>
1111 4d8b3382 Carlos Eduardo Ramos
						<td width="22%" valign="top" class="vncell"><?=gettext("Address Pool"); ?></td>
1112 d799787e Matthew Grooms
						<td width="78%" class="vtable">
1113
							<table border="0" cellpadding="2" cellspacing="0">
1114
								<tr>
1115
									<td>
1116
										<?php set_checked($pconfig['pool_enable'],$chk); ?>
1117 b3cf36d7 Erik Fonnesbeck
										<input name="pool_enable" type="checkbox" id="pool_enable" value="yes" <?=$chk;?>/>
1118 d799787e Matthew Grooms
									</td>
1119
									<td>
1120
										<span class="vexpl">
1121 4d8b3382 Carlos Eduardo Ramos
											<?=gettext("Provide a virtual adapter IP address to clients (see Tunnel Network)"); ?><br>
1122 d799787e Matthew Grooms
										</span>
1123
									</td>
1124
								</tr>
1125
							</table>
1126
						</td>
1127
					</tr>
1128
					<tr>
1129 4d8b3382 Carlos Eduardo Ramos
						<td width="22%" valign="top" class="vncell"><?=gettext("DNS Default Domain"); ?></td>
1130 d799787e Matthew Grooms
						<td width="78%" class="vtable">
1131
							<table border="0" cellpadding="2" cellspacing="0">
1132
								<tr>
1133
									<td>
1134
										<?php set_checked($pconfig['dns_domain_enable'],$chk); ?>
1135
										<input name="dns_domain_enable" type="checkbox" id="dns_domain_enable" value="yes" <?=$chk;?> onClick="dns_domain_change()">
1136
									</td>
1137
									<td>
1138
										<span class="vexpl">
1139 4d8b3382 Carlos Eduardo Ramos
	                                        <?=gettext("Provide a default domain name to clients"); ?><br>
1140 d799787e Matthew Grooms
										</span>
1141
									</td>
1142
								</tr>
1143
							</table>
1144
							<table border="0" cellpadding="2" cellspacing="0" id="dns_domain_data">
1145
								<tr>
1146
									<td>
1147
										<input name="dns_domain" type="text" class="formfld unknown" id="dns_domain" size="30" value="<?=htmlspecialchars($pconfig['dns_domain']);?>">
1148
									</td>
1149
								</tr>
1150
							</table>
1151
						</td>
1152
					</tr>
1153
					<tr>
1154 4d8b3382 Carlos Eduardo Ramos
						<td width="22%" valign="top" class="vncell"><?=gettext("DNS Servers"); ?></td>
1155 d799787e Matthew Grooms
						<td width="78%" class="vtable">
1156
							<table border="0" cellpadding="2" cellspacing="0">
1157
								<tr>
1158
									<td>
1159
										<?php set_checked($pconfig['dns_server_enable'],$chk); ?>
1160
										<input name="dns_server_enable" type="checkbox" id="dns_server_enable" value="yes" <?=$chk;?> onClick="dns_server_change()">
1161
									</td>
1162
									<td>
1163
										<span class="vexpl">
1164 4d8b3382 Carlos Eduardo Ramos
											<?=gettext("Provide a DNS server list to clients"); ?><br>
1165 d799787e Matthew Grooms
										</span>
1166
									</td>
1167
								</tr>
1168
							</table>
1169
							<table border="0" cellpadding="2" cellspacing="0" id="dns_server_data">
1170
								<tr>
1171
									<td>
1172
										<span class="vexpl">
1173 4d8b3382 Carlos Eduardo Ramos
											<?=gettext("Server"); ?> #1:&nbsp;
1174 d799787e Matthew Grooms
										</span>
1175 dd5bf424 Scott Ullrich
										<input name="dns_server1" type="text" class="formfld unknown" id="dns_server1" size="20" value="<?=htmlspecialchars($pconfig['dns_server1']);?>">
1176 d799787e Matthew Grooms
									</td>
1177
								</tr>
1178
								<tr>
1179
									<td>
1180
										<span class="vexpl">
1181 4d8b3382 Carlos Eduardo Ramos
											<?=gettext("Server"); ?> #2:&nbsp;
1182 d799787e Matthew Grooms
										</span>
1183 dd5bf424 Scott Ullrich
										<input name="dns_server2" type="text" class="formfld unknown" id="dns_server2" size="20" value="<?=htmlspecialchars($pconfig['dns_server2']);?>">
1184 d799787e Matthew Grooms
									</td>
1185
								</tr>
1186
								<tr>
1187
									<td>
1188
										<span class="vexpl">
1189 4d8b3382 Carlos Eduardo Ramos
											<?=gettext("Server"); ?> #3:&nbsp;
1190 d799787e Matthew Grooms
										</span>
1191 dd5bf424 Scott Ullrich
										<input name="dns_server3" type="text" class="formfld unknown" id="dns_server3" size="20" value="<?=htmlspecialchars($pconfig['dns_server3']);?>">
1192 d799787e Matthew Grooms
									</td>
1193
								</tr>
1194
								<tr>
1195
									<td>
1196
										<span class="vexpl">
1197 4d8b3382 Carlos Eduardo Ramos
											<?=gettext("Server"); ?> #4:&nbsp;
1198 d799787e Matthew Grooms
										</span>
1199 dd5bf424 Scott Ullrich
										<input name="dns_server4" type="text" class="formfld unknown" id="dns_server4" size="20" value="<?=htmlspecialchars($pconfig['dns_server4']);?>">
1200 d799787e Matthew Grooms
									</td>
1201
								</tr>
1202
							</table>
1203
						</td>
1204
					</tr>
1205
					<tr>
1206 4d8b3382 Carlos Eduardo Ramos
						<td width="22%" valign="top" class="vncell"><?=gettext("NTP Servers"); ?></td>
1207 d799787e Matthew Grooms
						<td width="78%" class="vtable">
1208
							<table border="0" cellpadding="2" cellspacing="0">
1209
								<tr>
1210
									<td>
1211
										<?php set_checked($pconfig['ntp_server_enable'],$chk); ?>
1212
										<input name="ntp_server_enable" type="checkbox" id="ntp_server_enable" value="yes" <?=$chk;?> onClick="ntp_server_change()">
1213
									</td>
1214
									<td>
1215
										<span class="vexpl">
1216 4d8b3382 Carlos Eduardo Ramos
											<?=gettext("Provide a NTP server list to clients"); ?><br>
1217 d799787e Matthew Grooms
										</span>
1218
									</td>
1219
								</tr>
1220
							</table>
1221
							<table border="0" cellpadding="2" cellspacing="0" id="ntp_server_data">
1222
								<tr>
1223
									<td>
1224
										<span class="vexpl">
1225 4d8b3382 Carlos Eduardo Ramos
											<?=gettext("Server"); ?> #1:&nbsp;
1226 d799787e Matthew Grooms
										</span>
1227 dd5bf424 Scott Ullrich
										<input name="ntp_server1" type="text" class="formfld unknown" id="ntp_server1" size="20" value="<?=htmlspecialchars($pconfig['ntp_server1']);?>">
1228 d799787e Matthew Grooms
									</td>
1229
								</tr>
1230
								<tr>
1231
									<td>
1232
										<span class="vexpl">
1233 4d8b3382 Carlos Eduardo Ramos
											<?=gettext("Server"); ?> #2:&nbsp;
1234 d799787e Matthew Grooms
										</span>
1235 dd5bf424 Scott Ullrich
										<input name="ntp_server2" type="text" class="formfld unknown" id="ntp_server2" size="20" value="<?=htmlspecialchars($pconfig['ntp_server2']);?>">
1236 d799787e Matthew Grooms
									</td>
1237
								</tr>
1238
							</table>
1239
						</td>
1240
					</tr>
1241
					<tr>
1242 4d8b3382 Carlos Eduardo Ramos
						<td width="22%" valign="top" class="vncell"><?=gettext("NetBIOS Options"); ?></td>
1243 d799787e Matthew Grooms
						<td width="78%" class="vtable">
1244
							<table border="0" cellpadding="2" cellspacing="0">
1245
								<tr>
1246
									<td>
1247
										<?php set_checked($pconfig['netbios_enable'],$chk); ?>
1248
										<input name="netbios_enable" type="checkbox" id="netbios_enable" value="yes" <?=$chk;?> onClick="netbios_change()">
1249
									</td>
1250
									<td>
1251
										<span class="vexpl">
1252 4d8b3382 Carlos Eduardo Ramos
											<?=gettext("Enable NetBIOS over TCP/IP"); ?><br>
1253 d799787e Matthew Grooms
										</span>
1254
									</td>
1255
								</tr>
1256
							</table>
1257 4d8b3382 Carlos Eduardo Ramos
							<?=gettext("If this option is not set, all NetBIOS-over-TCP/IP options (including WINS) will be disabled"); ?>.
1258 d799787e Matthew Grooms
							<br/>
1259
							<table border="0" cellpadding="2" cellspacing="0" id="netbios_data">
1260
								<tr>
1261
									<td>
1262
										<br/>
1263
										<span class="vexpl">
1264 4d8b3382 Carlos Eduardo Ramos
											<?=gettext("Node Type"); ?>:&nbsp;
1265 d799787e Matthew Grooms
										</span>
1266
										<select name='netbios_ntype' class="formselect">
1267
										<?php
1268
											foreach ($netbios_nodetypes as $type => $name):
1269
												$selected = "";
1270
												if ($pconfig['netbios_ntype'] == $type)
1271
													$selected = "selected";
1272
										?>
1273
											<option value="<?=$type;?>" <?=$selected;?>><?=$name;?></option>
1274
										<?php endforeach; ?>
1275
										</select>
1276
										<br/>
1277 4d8b3382 Carlos Eduardo Ramos
										<?=gettext("Possible options: b-node (broadcasts), p-node " .
1278
										"(point-to-point name queries to a WINS server), " .
1279
										"m-node (broadcast then query name server), and " .
1280
										"h-node (query name server, then broadcast)"); ?>.
1281 d799787e Matthew Grooms
									</td>
1282
								</tr>
1283
								<tr>
1284
									<td>
1285
										<br/>
1286
										<span class="vexpl">
1287 4d8b3382 Carlos Eduardo Ramos
											<?=gettext("Scope ID"); ?>:&nbsp;
1288 d799787e Matthew Grooms
										</span>
1289
										<input name="netbios_scope" type="text" class="formfld unknown" id="netbios_scope" size="30" value="<?=htmlspecialchars($pconfig['netbios_scope']);?>">
1290
										<br/>
1291 4d8b3382 Carlos Eduardo Ramos
										<?=gettext("A NetBIOS Scope	ID provides an extended naming " .
1292
										"service for	NetBIOS over TCP/IP. The NetBIOS " .
1293
										"scope ID isolates NetBIOS traffic on a single " .
1294
										"network to only those nodes with the same " .
1295
										"NetBIOS scope ID"); ?>.
1296 d799787e Matthew Grooms
									</td>
1297
								</tr>
1298
							</table>
1299
						</td>
1300
					</tr>
1301
					<tr id="wins_opts">
1302 4d8b3382 Carlos Eduardo Ramos
						<td width="22%" valign="top" class="vncell"><?=gettext("WINS Servers"); ?></td>
1303 d799787e Matthew Grooms
						<td width="78%" class="vtable">
1304
							<table border="0" cellpadding="2" cellspacing="0">
1305
								<tr>
1306
									<td>
1307
										<?php set_checked($pconfig['wins_server_enable'],$chk); ?>
1308
										<input name="wins_server_enable" type="checkbox" id="wins_server_enable" value="yes" <?=$chk;?> onClick="wins_server_change()">
1309
									</td>
1310
									<td>
1311
										<span class="vexpl">
1312 4d8b3382 Carlos Eduardo Ramos
											<?=gettext("Provide a WINS server list to clients"); ?><br>
1313 d799787e Matthew Grooms
										</span>
1314
									</td>
1315
								</tr>
1316
							</table>
1317
							<table border="0" cellpadding="2" cellspacing="0" id="wins_server_data">
1318
								<tr>
1319
									<td>
1320
										<span class="vexpl">
1321 4d8b3382 Carlos Eduardo Ramos
											<?=gettext("Server"); ?> #1:&nbsp;
1322 d799787e Matthew Grooms
										</span>
1323 dd5bf424 Scott Ullrich
										<input name="wins_server1" type="text" class="formfld unknown" id="wins_server1" size="20" value="<?=htmlspecialchars($pconfig['wins_server1']);?>">
1324 d799787e Matthew Grooms
									</td>
1325
								</tr>
1326
								<tr>
1327
									<td>
1328
										<span class="vexpl">
1329 4d8b3382 Carlos Eduardo Ramos
											<?=gettext("Server"); ?> #2:&nbsp;
1330 d799787e Matthew Grooms
										</span>
1331 dd5bf424 Scott Ullrich
										<input name="wins_server2" type="text" class="formfld unknown" id="wins_server2" size="20" value="<?=htmlspecialchars($pconfig['wins_server2']);?>">
1332 d799787e Matthew Grooms
									</td>
1333
								</tr>
1334
							</table>
1335
						</td>
1336
					</tr>
1337 3c11bd3c Matthew Grooms
				</table>
1338
1339 2f4f30ee Scott Ullrich
				<table width="100%" border="0" cellpadding="6" cellspacing="0" id="client_opts">
1340
					<tr>
1341
						<td colspan="2" class="list" height="12"></td>
1342
					</tr>
1343
					<tr>
1344 4d8b3382 Carlos Eduardo Ramos
						<td colspan="2" valign="top" class="listtopic"><?=gettext("Advanced configuration"); ?></td>
1345 2f4f30ee Scott Ullrich
					</tr>
1346
					<tr>
1347 4d8b3382 Carlos Eduardo Ramos
						<td width="22%" valign="top" class="vncell"><?=gettext("Advanced"); ?></td>
1348 2f4f30ee Scott Ullrich
						<td width="78%" class="vtable">
1349
							<table border="0" cellpadding="2" cellspacing="0">
1350
								<tr>
1351
									<td>
1352 dd5bf424 Scott Ullrich
										<textarea rows="6" cols="78" name="custom_options" id="custom_options"><?=htmlspecialchars($pconfig['custom_options']);?></textarea><br/>
1353 4d8b3382 Carlos Eduardo Ramos
										<?=gettext("Enter any additional options you would like to add to the OpenVPN server configuration here, separated by a semicolon"); ?><br/>
1354
										<?=gettext("EXAMPLE: push \"route 10.0.0.0 255.255.255.0\""); ?>;
1355 2f4f30ee Scott Ullrich
									</td>
1356
								</tr>
1357
							</table>
1358
						</td>
1359
					</tr>
1360
				</table>
1361
1362 f68fc963 Scott Ullrich
				<br/>
1363
1364 3c11bd3c Matthew Grooms
				<table width="100%" border="0" cellpadding="6" cellspacing="0" id="client_opts">
1365 d799787e Matthew Grooms
					<tr>
1366
						<td width="22%" valign="top">&nbsp;</td>
1367
						<td width="78%"> 
1368 4d8b3382 Carlos Eduardo Ramos
							<input name="save" type="submit" class="formbtn" value="<?=gettext("Save"); ?>"> 
1369 d799787e Matthew Grooms
							<input name="act" type="hidden" value="<?=$act;?>">
1370
							<?php if (isset($id) && $a_server[$id]): ?>
1371
							<input name="id" type="hidden" value="<?=$id;?>">
1372
							<?php endif; ?>
1373
						</td>
1374
					</tr>
1375
				</table>
1376
			</form>
1377
1378
			<?php else: ?>
1379
1380 79633b6c Evgeny Yurchenko
			<table class="sortable" width="100%" border="0" cellpadding="0" cellspacing="0">
1381 80fa045a jim-p
				<thead>
1382 d799787e Matthew Grooms
				<tr>
1383 4d8b3382 Carlos Eduardo Ramos
					<td width="10%" class="listhdrr"><?=gettext("Disabled"); ?></td>
1384
					<td width="10%" class="listhdrr"><?=gettext("Protocol / Port"); ?></td>
1385
					<td width="30%" class="listhdrr"><?=gettext("Tunnel Network"); ?></td>
1386
					<td width="40%" class="listhdrr"><?=gettext("Description"); ?></td>
1387 d799787e Matthew Grooms
					<td width="10%" class="list"></td>
1388
				</tr>
1389 80fa045a jim-p
				</thead>
1390
				<tbody>
1391 d799787e Matthew Grooms
				<?php
1392
					$i = 0;
1393
					foreach($a_server as $server):
1394
						$disabled = "NO";
1395 870318b9 Ermal Lu?i
						if (isset($server['disable']))
1396 d799787e Matthew Grooms
							$disabled = "YES";
1397
				?>
1398
				<tr>
1399 d3d9b0ee Scott Ullrich
					<td class="listlr" ondblclick="document.location='vpn_openvpn_server.php?act=edit&id=<?=$i;?>'">
1400 d799787e Matthew Grooms
						<?=$disabled;?>
1401
					</td>
1402 d3d9b0ee Scott Ullrich
					<td class="listr" ondblclick="document.location='vpn_openvpn_server.php?act=edit&id=<?=$i;?>'">
1403 43cea754 Chris Buechler
						<?=htmlspecialchars($server['protocol']);?> / <?=htmlspecialchars($server['local_port']);?>
1404 d799787e Matthew Grooms
					</td>
1405 d3d9b0ee Scott Ullrich
					<td class="listr" ondblclick="document.location='vpn_openvpn_server.php?act=edit&id=<?=$i;?>'">
1406 d799787e Matthew Grooms
						<?=htmlspecialchars($server['tunnel_network']);?>
1407
					</td>
1408 d3d9b0ee Scott Ullrich
					<td class="listbg" ondblclick="document.location='vpn_openvpn_server.php?act=edit&id=<?=$i;?>'">
1409 d799787e Matthew Grooms
						<?=htmlspecialchars($server['description']);?>
1410
					</td>
1411
					<td valign="middle" nowrap class="list">
1412
						<a href="vpn_openvpn_server.php?act=edit&id=<?=$i;?>">
1413 4d8b3382 Carlos Eduardo Ramos
							<img src="./themes/<?=$g['theme'];?>/images/icons/icon_e.gif" title="<?=gettext("edit server"); ?>" width="17" height="17" border="0">
1414 d799787e Matthew Grooms
						</a>
1415
						&nbsp;
1416 4d8b3382 Carlos Eduardo Ramos
						<a href="vpn_openvpn_server.php?act=del&id=<?=$i;?>" onclick="return confirm('<?=gettext("Do you really want to delete this server?"); ?>')">
1417
							<img src="/themes/<?=$g['theme'];?>/images/icons/icon_x.gif" title="<?=gettext("delete server"); ?>" width="17" height="17" border="0">
1418 d799787e Matthew Grooms
						</a>
1419
					</td>
1420
				</tr>
1421
				<?php
1422
					$i++;
1423
					endforeach;
1424
				?>
1425 80fa045a jim-p
				</tbody>
1426
				<tfoot>
1427 d799787e Matthew Grooms
				<tr>
1428
					<td class="list" colspan="4"></td>
1429
					<td class="list">
1430 4d8b3382 Carlos Eduardo Ramos
						<a href="vpn_openvpn_server.php?act=new"><img src="./themes/<?=$g['theme'];?>/images/icons/icon_plus.gif" title="<?=gettext("add server"); ?>" width="17" height="17" border="0">
1431 d799787e Matthew Grooms
						</a>
1432
					</td>
1433
				</tr>
1434 80fa045a jim-p
				</tfoot>
1435 d799787e Matthew Grooms
			</table>
1436
1437 7128ed17 Scott Ullrich
			<?=gettext("Additional OpenVPN servers can be added here.");?>
1438
1439 ee9933b6 Renato Botelho
			<?php endif; ?>
1440 d799787e Matthew Grooms
1441
		</td>
1442
	</tr>
1443
</table>
1444
<script language="JavaScript">
1445
<!--
1446 3c11bd3c Matthew Grooms
mode_change();
1447
autokey_change();
1448
tlsauth_change();
1449 d799787e Matthew Grooms
gwredir_change();
1450
dns_domain_change();
1451
dns_server_change();
1452
wins_server_change();
1453
ntp_server_change();
1454
netbios_change();
1455
//-->
1456
</script>
1457
</body>
1458
<?php include("fend.inc"); ?>
1459
1460
<?php
1461
1462
/* local utility functions */
1463
1464
function set_checked($var,& $chk) {
1465
    if($var)
1466
        $chk = 'checked';
1467
    else
1468
        $chk = '';
1469
}
1470
1471 4d8b3382 Carlos Eduardo Ramos
?>