Project

General

Profile

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