Project

General

Profile

Download (25.5 KB) Statistics
| Branch: | Tag: | Revision:
1 d799787e Matthew Grooms
<?php 
2
/*
3
	vpn_openvpn_csc.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-csc
32
##|*NAME=OpenVPN: Client Specific Override page
33
##|*DESCR=Allow access to the 'OpenVPN: Client Specific Override' page.
34
##|*MATCH=vpn_openvpn_csc.php*
35
##|-PRIV
36
37
require("guiconfig.inc");
38 d84bd468 Ermal Lu?i
require_once("openvpn.inc");
39 d799787e Matthew Grooms
40 deeda874 Carlos Eduardo Ramos
$pgtitle = array(gettext("OpenVPN"), gettext("Client Specific Override"));
41 b32dd0a6 jim-p
$shortcut_section = "openvpn";
42 d799787e Matthew Grooms
43
if (!is_array($config['openvpn']['openvpn-csc']))
44
	$config['openvpn']['openvpn-csc'] = array();
45
46
$a_csc = &$config['openvpn']['openvpn-csc'];
47
48
$id = $_GET['id'];
49
if (isset($_POST['id']))
50
	$id = $_POST['id'];
51
52
$act = $_GET['act'];
53
if (isset($_POST['act']))
54
	$act = $_POST['act'];
55
56
if ($_GET['act'] == "del") {
57
58
	if (!$a_csc[$id]) {
59
		pfSenseHeader("vpn_openvpn_csc.php");
60
		exit;
61
	}
62
63 e6af6518 jim-p
	openvpn_delete_csc($a_csc[$id]);
64 d799787e Matthew Grooms
	unset($a_csc[$id]);
65
	write_config();
66
	$savemsg = gettext("Client Specific Override successfully deleted")."<br/>";
67
}
68
69
if($_GET['act']=="edit"){
70
71
	if (isset($id) && $a_csc[$id]) {
72 72d51890 Scott Ullrich
		$pconfig['custom_options'] = $a_csc[$id]['custom_options'];
73 0c88fc1e jim-p
		$pconfig['disable'] = isset($a_csc[$id]['disable']);
74 d799787e Matthew Grooms
		$pconfig['common_name'] = $a_csc[$id]['common_name'];
75
		$pconfig['block'] = $a_csc[$id]['block'];
76
		$pconfig['description'] = $a_csc[$id]['description'];
77
78
		$pconfig['tunnel_network'] = $a_csc[$id]['tunnel_network'];
79
		$pconfig['gwredir'] = $a_csc[$id]['gwredir'];
80
81
		$pconfig['push_reset'] = $a_csc[$id]['push_reset'];
82
83
		$pconfig['dns_domain'] = $a_csc[$id]['dns_domain'];
84
		if ($pconfig['dns_domain'])
85
			$pconfig['dns_domain_enable'] = true;
86
87
		$pconfig['dns_server1'] = $a_csc[$id]['dns_server1'];
88
		$pconfig['dns_server2'] = $a_csc[$id]['dns_server2'];
89
		$pconfig['dns_server3'] = $a_csc[$id]['dns_server3'];
90
		$pconfig['dns_server4'] = $a_csc[$id]['dns_server4'];
91
		if ($pconfig['dns_server1'] ||
92
			$pconfig['dns_server2'] ||
93
			$pconfig['dns_server3'] ||
94
			$pconfig['dns_server4'])
95
			$pconfig['dns_server_enable'] = true;
96
97
		$pconfig['ntp_server1'] = $a_csc[$id]['ntp_server1'];
98
		$pconfig['ntp_server2'] = $a_csc[$id]['ntp_server2'];
99
		if ($pconfig['ntp_server1'] ||
100
			$pconfig['ntp_server2'])
101
			$pconfig['ntp_server_enable'] = true;
102
103
		$pconfig['netbios_enable'] = $a_csc[$id]['netbios_enable'];
104
		$pconfig['netbios_ntype'] = $a_csc[$id]['netbios_ntype'];
105
		$pconfig['netbios_scope'] = $a_csc[$id]['netbios_scope'];
106
107
		$pconfig['wins_server1'] = $a_csc[$id]['wins_server1'];
108
		$pconfig['wins_server2'] = $a_csc[$id]['wins_server2'];
109
		if ($pconfig['wins_server1'] ||
110
			$pconfig['wins_server2'])
111
			$pconfig['wins_server_enable'] = true;
112
113
		$pconfig['nbdd_server1'] = $a_csc[$id]['nbdd_server1'];
114
		if ($pconfig['nbdd_server1'])
115
			$pconfig['nbdd_server_enable'] = true;
116
	}
117
}
118
119
if ($_POST) {
120
121
	unset($input_errors);
122
	$pconfig = $_POST;
123
124
	/* input validation */
125
	if ($result = openvpn_validate_cidr($pconfig['tunnel_network'], 'Tunnel network'))
126
		$input_errors[] = $result;
127
128
	if ($pconfig['dns_server_enable']) {
129
		if (!empty($pconfig['dns_server1']) && !is_ipaddr(trim($pconfig['dns_server1'])))
130 deeda874 Carlos Eduardo Ramos
			$input_errors[] = gettext("The field 'DNS Server #1' must contain a valid IP address");
131 d799787e Matthew Grooms
		if (!empty($pconfig['dns_server2']) && !is_ipaddr(trim($pconfig['dns_server2'])))
132 deeda874 Carlos Eduardo Ramos
			$input_errors[] = gettext("The field 'DNS Server #2' must contain a valid IP address");
133 d799787e Matthew Grooms
		if (!empty($pconfig['dns_server3']) && !is_ipaddr(trim($pconfig['dns_server3'])))
134 deeda874 Carlos Eduardo Ramos
			$input_errors[] = gettext("The field 'DNS Server #3' must contain a valid IP address");
135 d799787e Matthew Grooms
		if (!empty($pconfig['dns_server4']) && !is_ipaddr(trim($pconfig['dns_server4'])))
136 deeda874 Carlos Eduardo Ramos
			$input_errors[] = gettext("The field 'DNS Server #4' must contain a valid IP address");
137 d799787e Matthew Grooms
	}
138
139
	if ($pconfig['ntp_server_enable']) {
140
		if (!empty($pconfig['ntp_server1']) && !is_ipaddr(trim($pconfig['ntp_server1'])))
141 deeda874 Carlos Eduardo Ramos
			$input_errors[] = gettext("The field 'NTP Server #1' must contain a valid IP address");
142 d799787e Matthew Grooms
		if (!empty($pconfig['ntp_server2']) && !is_ipaddr(trim($pconfig['ntp_server2'])))
143 deeda874 Carlos Eduardo Ramos
			$input_errors[] = gettext("The field 'NTP Server #2' must contain a valid IP address");
144 d799787e Matthew Grooms
		if (!empty($pconfig['ntp_server3']) && !is_ipaddr(trim($pconfig['ntp_server3'])))
145 deeda874 Carlos Eduardo Ramos
			$input_errors[] = gettext("The field 'NTP Server #3' must contain a valid IP address");
146 d799787e Matthew Grooms
		if (!empty($pconfig['ntp_server4']) && !is_ipaddr(trim($pconfig['ntp_server4'])))
147 deeda874 Carlos Eduardo Ramos
			$input_errors[] = gettext("The field 'NTP Server #4' must contain a valid IP address");
148 d799787e Matthew Grooms
	}
149
150
	if ($pconfig['netbios_enable']) {
151
		if ($pconfig['wins_server_enable']) {
152
			if (!empty($pconfig['wins_server1']) && !is_ipaddr(trim($pconfig['wins_server1'])))
153 deeda874 Carlos Eduardo Ramos
				$input_errors[] = gettext("The field 'WINS Server #1' must contain a valid IP address");
154 d799787e Matthew Grooms
			if (!empty($pconfig['wins_server2']) && !is_ipaddr(trim($pconfig['wins_server2'])))
155 deeda874 Carlos Eduardo Ramos
				$input_errors[] = gettext("The field 'WINS Server #2' must contain a valid IP address");
156 d799787e Matthew Grooms
		}
157
		if ($pconfig['nbdd_server_enable'])
158
			if (!empty($pconfig['nbdd_server1']) && !is_ipaddr(trim($pconfig['nbdd_server1'])))
159 deeda874 Carlos Eduardo Ramos
				$input_errors[] = gettext("The field 'NetBIOS Data Distribution Server #1' must contain a valid IP address");
160 d799787e Matthew Grooms
	}
161
162 872d9195 Matthew Grooms
	$reqdfields[] = 'common_name';
163
	$reqdfieldsn[] = 'Common name';
164 d799787e Matthew Grooms
165
    do_input_validation($_POST, $reqdfields, $reqdfieldsn, &$input_errors);
166
167
	if (!$input_errors) {
168
169
		$csc = array();
170
171 72d51890 Scott Ullrich
		$csc['custom_options'] = $pconfig['custom_options'];
172 0c88fc1e jim-p
		if ($_POST['disable'] == "yes")
173
			$csc['disable'] = true;
174 d799787e Matthew Grooms
		$csc['common_name'] = $pconfig['common_name'];
175
		$csc['block'] = $pconfig['block'];
176
		$csc['description'] = $pconfig['description'];
177
178
		$csc['tunnel_network'] = $pconfig['tunnel_network'];
179
		$csc['gwredir'] = $pconfig['gwredir'];
180
181
		$csc['push_reset'] = $pconfig['push_reset'];
182
183
		if ($pconfig['dns_domain_enable'])
184
			$csc['dns_domain'] = $pconfig['dns_domain'];
185
186
		if ($pconfig['dns_server_enable']) {
187
			$csc['dns_server1'] = $pconfig['dns_server1'];
188
			$csc['dns_server2'] = $pconfig['dns_server2'];
189
			$csc['dns_server3'] = $pconfig['dns_server3'];
190
			$csc['dns_server4'] = $pconfig['dns_server4'];
191
		}
192
193
		if ($pconfig['ntp_server_enable']) {
194
			$csc['ntp_server1'] = $pconfig['ntp_server1'];
195
			$csc['ntp_server2'] = $pconfig['ntp_server2'];
196
		}
197
198
		$csc['netbios_enable'] = $pconfig['netbios_enable'];
199
		$csc['netbios_ntype'] = $pconfig['netbios_ntype'];
200
		$csc['netbios_scope'] = $pconfig['netbios_scope'];
201
202
		if ($pconfig['netbios_enable']) {
203
204
			if ($pconfig['wins_server_enable']) {
205
				$csc['wins_server1'] = $pconfig['wins_server1'];
206
				$csc['wins_server2'] = $pconfig['wins_server2'];
207
			}
208
209
			if ($pconfig['dns_server_enable'])
210
				$csc['nbdd_server1'] = $pconfig['nbdd_server1'];
211
		}
212
	
213
		if (isset($id) && $a_csc[$id])
214
			$a_csc[$id] = $csc;
215
		else
216
			$a_csc[] = $csc;
217
218 dc408939 Matthew Grooms
		openvpn_resync_csc($csc);
219 d799787e Matthew Grooms
		write_config();
220
		
221
		header("Location: vpn_openvpn_csc.php");
222
		exit;
223
	}
224
}
225
226
include("head.inc");
227
228
?>
229
230
<body link="#000000" vlink="#000000" alink="#000000" onload="<?= $jsevents["body"]["onload"] ?>">
231
<?php include("fbegin.inc"); ?>
232
<script language="JavaScript">
233
<!--
234
235
function dns_domain_change() {
236
237
	if (document.iform.dns_domain_enable.checked)
238
		document.getElementById("dns_domain_data").style.display="";
239
	else
240
		document.getElementById("dns_domain_data").style.display="none";
241
}
242
243
function dns_server_change() {
244
245
	if (document.iform.dns_server_enable.checked)
246
		document.getElementById("dns_server_data").style.display="";
247
	else
248
		document.getElementById("dns_server_data").style.display="none";
249
}
250
251
function wins_server_change() {
252
253
	if (document.iform.wins_server_enable.checked)
254
		document.getElementById("wins_server_data").style.display="";
255
	else
256
		document.getElementById("wins_server_data").style.display="none";
257
}
258
259
function ntp_server_change() {
260
261
	if (document.iform.ntp_server_enable.checked)
262
		document.getElementById("ntp_server_data").style.display="";
263
	else
264
		document.getElementById("ntp_server_data").style.display="none";
265
}
266
267
function netbios_change() {
268
269
	if (document.iform.netbios_enable.checked) {
270
		document.getElementById("netbios_data").style.display="";
271
		document.getElementById("wins_opts").style.display="";
272
	} else {
273
		document.getElementById("netbios_data").style.display="none";
274
		document.getElementById("wins_opts").style.display="none";
275
	}
276
}
277
278
//-->
279
</script>
280
<?php
281
	if ($input_errors)
282
		print_input_errors($input_errors);
283
	if ($savemsg)
284
		print_info_box($savemsg);
285
?>
286
<table width="100%" border="0" cellpadding="0" cellspacing="0">
287
 	<tr>
288
		<td class="tabnavtbl">
289
			<ul id="tabnav">
290
			<?php 
291
				$tab_array = array();
292
				$tab_array[] = array(gettext("Server"), false, "vpn_openvpn_server.php");
293
				$tab_array[] = array(gettext("Client"), false, "vpn_openvpn_client.php");
294
				$tab_array[] = array(gettext("Client Specific Overrides"), true, "vpn_openvpn_csc.php");
295 5540aee6 Ermal Lu?i
				$tab_array[] = array(gettext("Wizards"), false, "wizard.php?xml=openvpn_wizard.xml");
296 b63f2e8b Matthew Grooms
				add_package_tabs("OpenVPN", $tab_array);
297 d799787e Matthew Grooms
				display_top_tabs($tab_array);
298
			?>
299
			</ul>
300
		</td>
301
	</tr>    
302
	<tr>
303
		<td class="tabcont">
304
305
			<?php if($act=="new" || $act=="edit"): ?>
306
307
			<form action="vpn_openvpn_csc.php" method="post" name="iform" id="iform" onsubmit="presubmit()">
308
				<table width="100%" border="0" cellpadding="6" cellspacing="0">
309 47c00c09 Scott Ullrich
					<tr>
310 deeda874 Carlos Eduardo Ramos
						<td colspan="2" valign="top" class="listtopic"><?=gettext("General information"); ?></td>
311 47c00c09 Scott Ullrich
					</tr>	
312 d799787e Matthew Grooms
					<tr>
313 deeda874 Carlos Eduardo Ramos
						<td width="22%" valign="top" class="vncellreq"><?=gettext("Disabled"); ?></td>
314 d799787e Matthew Grooms
						<td width="78%" class="vtable">
315
							<table border="0" cellpadding="0" cellspacing="0">
316
								<tr>
317
									<td>
318 f3dc4bf1 jim-p
										<?php set_checked($pconfig['disable'],$chk); ?>
319 d799787e Matthew Grooms
										<input name="disable" type="checkbox" value="yes" <?=$chk;?>/>
320
									</td>
321
									<td>
322
										&nbsp;
323
										<span class="vexpl">
324 deeda874 Carlos Eduardo Ramos
											<strong><?=gettext("Disable this override"); ?></strong><br>
325 d799787e Matthew Grooms
										</span>
326
									</td>
327
								</tr>
328
							</table>
329 deeda874 Carlos Eduardo Ramos
							<?=gettext("Set this option to disable this client-specific override without removing it from the list"); ?>.
330 d799787e Matthew Grooms
						</td>
331
					</tr>
332
					<tr> 
333 deeda874 Carlos Eduardo Ramos
						<td width="22%" valign="top" class="vncellreq"><?=gettext("Common name"); ?></td>
334 d799787e Matthew Grooms
						<td width="78%" class="vtable"> 
335
							<input name="common_name" type="text" class="formfld unknown" size="30" value="<?=htmlspecialchars($pconfig['common_name']);?>">
336
							<br>
337 deeda874 Carlos Eduardo Ramos
							<?=gettext("Enter the client's X.509 common name here"); ?>.
338 d799787e Matthew Grooms
						</td>
339
					</tr>
340
					<tr> 
341 deeda874 Carlos Eduardo Ramos
						<td width="22%" valign="top" class="vncell"><?=gettext("Description"); ?></td>
342 d799787e Matthew Grooms
						<td width="78%" class="vtable"> 
343
							<input name="description" type="text" class="formfld unknown" size="30" value="<?=htmlspecialchars($pconfig['description']);?>">
344
							<br>
345 deeda874 Carlos Eduardo Ramos
							<?=gettext("You may enter a description here for your reference (not parsed)"); ?>.
346 d799787e Matthew Grooms
						</td>
347
					</tr>
348
					<tr>
349 deeda874 Carlos Eduardo Ramos
						<td width="22%" valign="top" class="vncell"><?=gettext("Connection blocking"); ?></td>
350 d799787e Matthew Grooms
						<td width="78%" class="vtable">
351
							<table border="0" cellpadding="2" cellspacing="0">
352
								<tr>
353
									<td>
354
										<?php set_checked($pconfig['block'],$chk); ?>
355
										<input name="block" type="checkbox" value="yes" <?=$chk;?>/>
356
									</td>
357
									<td>
358
										<span class="vexpl">
359 deeda874 Carlos Eduardo Ramos
											<?=gettext("Block this client connection based on its common name"); ?>.
360 d799787e Matthew Grooms
										</span>
361
									</td>
362
								</tr>
363
							</table>
364 deeda874 Carlos Eduardo Ramos
							<?=gettext("Don't use this option to permanently disable a " .
365
							"client due to a compromised key or password. " .
366
							"Use a CRL (certificate revocation list) instead"); ?>.
367 d799787e Matthew Grooms
						</td>
368
					</tr>
369
					<tr>
370
						<td colspan="2" class="list" height="12"></td>
371
					</tr>
372
					<tr>
373 deeda874 Carlos Eduardo Ramos
						<td colspan="2" valign="top" class="listtopic"><?=gettext("Tunnel Settings"); ?></td>
374 d799787e Matthew Grooms
					</tr>
375
					<tr>
376 deeda874 Carlos Eduardo Ramos
						<td width="22%" valign="top" class="vncell"><?=gettext("Tunnel Network"); ?></td>
377 d799787e Matthew Grooms
						<td width="78%" class="vtable">
378
							<input name="tunnel_network" type="text" class="formfld unknown" size="20" value="<?=htmlspecialchars($pconfig['tunnel_network']);?>">
379
							<br>
380 deeda874 Carlos Eduardo Ramos
							<?=gettext("This is the virtual network used for private " .
381
							"communications between this client and the " .
382
							"server expressed using CIDR (eg. 10.0.8.0/24). " .
383
							"The first network address is assumed to be the " .
384
							"server address and the second network address " .
385
							"will be assigned to the client virtual " .
386
							"interface"); ?>.
387 d799787e Matthew Grooms
						</td>
388
					</tr>
389
					<tr>
390 deeda874 Carlos Eduardo Ramos
						<td width="22%" valign="top" class="vncell"><?=gettext("Redirect Gateway"); ?></td>
391 d799787e Matthew Grooms
						<td width="78%" class="vtable">
392
							<table border="0" cellpadding="2" cellspacing="0">
393
								<tr>
394
									<td>
395
										<?php set_checked($pconfig['gwredir'],$chk); ?>
396
										<input name="gwredir" type="checkbox" value="yes" <?=$chk;?>/>
397
									</td>
398
									<td>
399
										<span class="vexpl">
400 deeda874 Carlos Eduardo Ramos
											<?=gettext("Force all client generated traffic through the tunnel"); ?>.
401 d799787e Matthew Grooms
										</span>
402
									</td>
403
								</tr>
404
							</table>
405
						</td>
406
					</tr>
407
					<tr>
408
						<td colspan="2" class="list" height="12"></td>
409
					</tr>
410
					<tr>
411 deeda874 Carlos Eduardo Ramos
						<td colspan="2" valign="top" class="listtopic"><?=gettext("Client Settings"); ?></td>
412 d799787e Matthew Grooms
					</tr>
413
					<tr>
414 deeda874 Carlos Eduardo Ramos
						<td width="22%" valign="top" class="vncell"><?=gettext("Server Definitions"); ?></td>
415 d799787e Matthew Grooms
						<td width="78%" class="vtable">
416
							<table border="0" cellpadding="2" cellspacing="0">
417
								<tr>
418
									<td>
419
										<?php set_checked($pconfig['push_reset'],$chk); ?>
420
										<input name="push_reset" type="checkbox" value="yes" <?=$chk;?>/>
421
									</td>
422
									<td>
423
										<span class="vexpl">
424 deeda874 Carlos Eduardo Ramos
											<?=gettext("Prevent this client from receiving any server-defined client settings"); ?>.
425 d799787e Matthew Grooms
										</span>
426
									</td>
427
								</tr>
428
							</table>
429
						</td>
430
					</tr>
431
					<tr>
432 deeda874 Carlos Eduardo Ramos
						<td width="22%" valign="top" class="vncell"><?=gettext("DNS Default Domain"); ?></td>
433 d799787e Matthew Grooms
						<td width="78%" class="vtable">
434
							<table border="0" cellpadding="2" cellspacing="0">
435
								<tr>
436
									<td>
437
										<?php set_checked($pconfig['dns_domain_enable'],$chk); ?>
438
										<input name="dns_domain_enable" type="checkbox" id="dns_domain_enable" value="yes" <?=$chk;?> onClick="dns_domain_change()">
439
									</td>
440
									<td>
441
										<span class="vexpl">
442 deeda874 Carlos Eduardo Ramos
	                                        <?=gettext("Provide a default domain name to clients"); ?><br>
443 d799787e Matthew Grooms
										</span>
444
									</td>
445
								</tr>
446
							</table>
447
							<table border="0" cellpadding="2" cellspacing="0" id="dns_domain_data">
448
								<tr>
449
									<td>
450
										<input name="dns_domain" type="text" class="formfld unknown" id="dns_domain" size="30" value="<?=htmlspecialchars($pconfig['dns_domain']);?>">
451
									</td>
452
								</tr>
453
							</table>
454
						</td>
455
					</tr>
456
					<tr>
457 deeda874 Carlos Eduardo Ramos
						<td width="22%" valign="top" class="vncell"><?=gettext("DNS Servers"); ?></td>
458 d799787e Matthew Grooms
						<td width="78%" class="vtable">
459
							<table border="0" cellpadding="2" cellspacing="0">
460
								<tr>
461
									<td>
462
										<?php set_checked($pconfig['dns_server_enable'],$chk); ?>
463
										<input name="dns_server_enable" type="checkbox" id="dns_server_enable" value="yes" <?=$chk;?> onClick="dns_server_change()">
464
									</td>
465
									<td>
466
										<span class="vexpl">
467 deeda874 Carlos Eduardo Ramos
											<?=gettext("Provide a DNS server list to clients"); ?><br>
468 d799787e Matthew Grooms
										</span>
469
									</td>
470
								</tr>
471
							</table>
472
							<table border="0" cellpadding="2" cellspacing="0" id="dns_server_data">
473
								<tr>
474
									<td>
475
										<span class="vexpl">
476 deeda874 Carlos Eduardo Ramos
											<?=gettext("Server"); ?> #1:&nbsp;
477 d799787e Matthew Grooms
										</span>
478 dd5bf424 Scott Ullrich
										<input name="dns_server1" type="text" class="formfld unknown" id="dns_server1" size="20" value="<?=htmlspecialchars($pconfig['dns_server1']);?>">
479 d799787e Matthew Grooms
									</td>
480
								</tr>
481
								<tr>
482
									<td>
483
										<span class="vexpl">
484 deeda874 Carlos Eduardo Ramos
											<?=gettext("Server"); ?> #2:&nbsp;
485 d799787e Matthew Grooms
										</span>
486 dd5bf424 Scott Ullrich
										<input name="dns_server2" type="text" class="formfld unknown" id="dns_server2" size="20" value="<?=htmlspecialchars($pconfig['dns_server2']);?>">
487 d799787e Matthew Grooms
									</td>
488
								</tr>
489
								<tr>
490
									<td>
491
										<span class="vexpl">
492 deeda874 Carlos Eduardo Ramos
											<?=gettext("Server"); ?> #3:&nbsp;
493 d799787e Matthew Grooms
										</span>
494 dd5bf424 Scott Ullrich
										<input name="dns_server3" type="text" class="formfld unknown" id="dns_server3" size="20" value="<?=htmlspecialchars($pconfig['dns_server3']);?>">
495 d799787e Matthew Grooms
									</td>
496
								</tr>
497
								<tr>
498
									<td>
499
										<span class="vexpl">
500 deeda874 Carlos Eduardo Ramos
											<?=gettext("Server"); ?> #4:&nbsp;
501 d799787e Matthew Grooms
										</span>
502 dd5bf424 Scott Ullrich
										<input name="dns_server4" type="text" class="formfld unknown" id="dns_server4" size="20" value="<?=htmlspecialchars($pconfig['dns_server4']);?>">
503 d799787e Matthew Grooms
									</td>
504
								</tr>
505
							</table>
506
						</td>
507
					</tr>
508
					<tr>
509 deeda874 Carlos Eduardo Ramos
						<td width="22%" valign="top" class="vncell"><?=gettext("NTP Servers"); ?></td>
510 d799787e Matthew Grooms
						<td width="78%" class="vtable">
511
							<table border="0" cellpadding="2" cellspacing="0">
512
								<tr>
513
									<td>
514
										<?php set_checked($pconfig['ntp_server_enable'],$chk); ?>
515
										<input name="ntp_server_enable" type="checkbox" id="ntp_server_enable" value="yes" <?=$chk;?> onClick="ntp_server_change()">
516
									</td>
517
									<td>
518
										<span class="vexpl">
519 deeda874 Carlos Eduardo Ramos
											<?=gettext("Provide a NTP server list to clients"); ?><br>
520 d799787e Matthew Grooms
										</span>
521
									</td>
522
								</tr>
523
							</table>
524
							<table border="0" cellpadding="2" cellspacing="0" id="ntp_server_data">
525
								<tr>
526
									<td>
527
										<span class="vexpl">
528 deeda874 Carlos Eduardo Ramos
											<?=gettext("Server"); ?> #1:&nbsp;
529 d799787e Matthew Grooms
										</span>
530
										<input name="ntp_server1" type="text" class="formfld unknown" id="ntp_server1" size="20" value="<?=$pconfig['ntp_server1'];?>">
531
									</td>
532
								</tr>
533
								<tr>
534
									<td>
535
										<span class="vexpl">
536 deeda874 Carlos Eduardo Ramos
											<?=gettext("Server"); ?> #2:&nbsp;
537 d799787e Matthew Grooms
										</span>
538
										<input name="ntp_server2" type="text" class="formfld unknown" id="ntp_server2" size="20" value="<?=$pconfig['ntp_server2'];?>">
539
									</td>
540
								</tr>
541
							</table>
542
						</td>
543
					</tr>
544
					<tr>
545 deeda874 Carlos Eduardo Ramos
						<td width="22%" valign="top" class="vncell"><?=gettext("NetBIOS Options"); ?></td>
546 d799787e Matthew Grooms
						<td width="78%" class="vtable">
547
							<table border="0" cellpadding="2" cellspacing="0">
548
								<tr>
549
									<td>
550
										<?php set_checked($pconfig['netbios_enable'],$chk); ?>
551
										<input name="netbios_enable" type="checkbox" id="netbios_enable" value="yes" <?=$chk;?> onClick="netbios_change()">
552
									</td>
553
									<td>
554
										<span class="vexpl">
555 deeda874 Carlos Eduardo Ramos
											<?=gettext("Enable NetBIOS over TCP/IP"); ?><br>
556 d799787e Matthew Grooms
										</span>
557
									</td>
558
								</tr>
559
							</table>
560 399e4b3f Warren Baker
							<?=gettext("If this option is not set, all NetBIOS-over-TCP/IP options (including WINS) will be disabled"); ?>.
561 d799787e Matthew Grooms
							<br/>
562
							<table border="0" cellpadding="2" cellspacing="0" id="netbios_data">
563
								<tr>
564
									<td>
565
										<br/>
566
										<span class="vexpl">
567 deeda874 Carlos Eduardo Ramos
											<?=gettext("Node Type"); ?>:&nbsp;
568 d799787e Matthew Grooms
										</span>
569
										<select name='netbios_ntype' class="formselect">
570
										<?php
571
											foreach ($netbios_nodetypes as $type => $name):
572
												$selected = "";
573
												if ($pconfig['netbios_ntype'] == $type)
574
													$selected = "selected";
575
										?>
576
											<option value="<?=$type;?>" <?=$selected;?>><?=$name;?></option>
577
										<?php endforeach; ?>
578
										</select>
579
										<br/>
580 deeda874 Carlos Eduardo Ramos
										<?=gettext("Possible options: b-node (broadcasts), p-node " .
581
										"(point-to-point name queries to a WINS server), " .
582
										"m-node (broadcast then query name server), and " .
583
										"h-node (query name server, then broadcast)"); ?>.
584 d799787e Matthew Grooms
									</td>
585
								</tr>
586
								<tr>
587
									<td>
588
										<br/>
589
										<span class="vexpl">
590
											Scope ID:&nbsp;
591
										</span>
592
										<input name="netbios_scope" type="text" class="formfld unknown" id="netbios_scope" size="30" value="<?=htmlspecialchars($pconfig['netbios_scope']);?>">
593
										<br/>
594 deeda874 Carlos Eduardo Ramos
										<?=gettext("A NetBIOS Scope	ID provides an extended naming " .
595
										"service for	NetBIOS over TCP/IP. The NetBIOS " .
596
										"scope ID isolates NetBIOS traffic on a single " .
597
										"network to only those nodes with the same " .
598
										"NetBIOS scope ID"); ?>.
599 d799787e Matthew Grooms
									</td>
600
								</tr>
601
							</table>
602
						</td>
603
					</tr>
604
					<tr id="wins_opts">
605 deeda874 Carlos Eduardo Ramos
						<td width="22%" valign="top" class="vncell"><?=gettext("WINS Servers"); ?></td>
606 d799787e Matthew Grooms
						<td width="78%" class="vtable">
607
							<table border="0" cellpadding="2" cellspacing="0">
608
								<tr>
609
									<td>
610
										<?php set_checked($pconfig['wins_server_enable'],$chk); ?>
611
										<input name="wins_server_enable" type="checkbox" id="wins_server_enable" value="yes" <?=$chk;?> onClick="wins_server_change()">
612
									</td>
613
									<td>
614
										<span class="vexpl">
615 deeda874 Carlos Eduardo Ramos
											<?=gettext("Provide a WINS server list to clients"); ?><br>
616 d799787e Matthew Grooms
										</span>
617
									</td>
618
								</tr>
619
							</table>
620
							<table border="0" cellpadding="2" cellspacing="0" id="wins_server_data">
621
								<tr>
622
									<td>
623
										<span class="vexpl">
624 deeda874 Carlos Eduardo Ramos
											<?=gettext("Server"); ?> #1:&nbsp;
625 d799787e Matthew Grooms
										</span>
626
										<input name="wins_server1" type="text" class="formfld unknown" id="wins_server1" size="20" value="<?=$pconfig['wins_server1'];?>">
627
									</td>
628
								</tr>
629
								<tr>
630
									<td>
631
										<span class="vexpl">
632 deeda874 Carlos Eduardo Ramos
											<?=gettext("Server"); ?> #2:&nbsp;
633 d799787e Matthew Grooms
										</span>
634
										<input name="wins_server2" type="text" class="formfld unknown" id="wins_server2" size="20" value="<?=$pconfig['wins_server2'];?>">
635
									</td>
636
								</tr>
637
							</table>
638
						</td>
639
					</tr>
640 72d51890 Scott Ullrich
					<tr>
641 deeda874 Carlos Eduardo Ramos
						<td width="22%" valign="top" class="vncell"><?=gettext("Advanced"); ?></td>
642 72d51890 Scott Ullrich
						<td width="78%" class="vtable">
643
							<table border="0" cellpadding="2" cellspacing="0">
644
								<tr>
645
									<td>
646
										<textarea rows="6" cols="78" name="custom_options" id="custom_options"><?=$pconfig['custom_options'];?></textarea><br/>
647 deeda874 Carlos Eduardo Ramos
										<?=gettext("Enter any additional options you would like to add for this client specific override, separated by a semicolon"); ?><br/>
648
										<?=gettext("EXAMPLE: push \"route 10.0.0.0 255.255.255.0\""); ?>;
649 72d51890 Scott Ullrich
									</td>
650
								</tr>
651
							</table>
652
						</td>
653
					</tr>
654 d799787e Matthew Grooms
					<tr>
655
						<td width="22%" valign="top">&nbsp;</td>
656
						<td width="78%"> 
657 deeda874 Carlos Eduardo Ramos
							<input name="save" type="submit" class="formbtn" value="<?=gettext("Save"); ?>"> 
658 d799787e Matthew Grooms
							<input name="act" type="hidden" value="<?=$act;?>">
659
							<?php if (isset($id) && $a_csc[$id]): ?>
660
							<input name="id" type="hidden" value="<?=$id;?>">
661
							<?php endif; ?>
662
						</td>
663
					</tr>
664
				</table>
665
			</form>
666
667
			<?php else: ?>
668
669
			<table width="100%" border="0" cellpadding="0" cellspacing="0">
670
				<tr>
671 deeda874 Carlos Eduardo Ramos
					<td width="10%" class="listhdrr"><?=gettext("Disabled"); ?></td>
672
					<td width="40%" class="listhdrr"><?=gettext("Common Name"); ?></td>
673
					<td width="40%" class="listhdrr"><?=gettext("Description"); ?></td>
674 d799787e Matthew Grooms
					<td width="10%" class="list"></td>
675
				</tr>
676
				<?php
677
					$i = 0;
678
					foreach($a_csc as $csc):
679
						$disabled = "NO";
680 0c88fc1e jim-p
						if (isset($csc['disable']))
681 d799787e Matthew Grooms
							$disabled = "YES";
682
				?>
683
				<tr>
684
					<td class="listlr">
685
						<?=$disabled;?>
686
					</td>
687
					<td class="listr">
688
						<?=htmlspecialchars($csc['common_name']);?>
689
					</td>
690 296a3cb6 Scott Ullrich
					<td class="listbg">
691 d799787e Matthew Grooms
						<?=htmlspecialchars($csc['description']);?>
692
					</td>
693
					<td valign="middle" nowrap class="list">
694
						<a href="vpn_openvpn_csc.php?act=edit&id=<?=$i;?>">
695 deeda874 Carlos Eduardo Ramos
							<img src="./themes/<?=$g['theme'];?>/images/icons/icon_e.gif" title="<?=gettext("edit csc"); ?>" width="17" height="17" border="0">
696 d799787e Matthew Grooms
						</a>
697
						&nbsp;
698 deeda874 Carlos Eduardo Ramos
						<a href="vpn_openvpn_csc.php?act=del&id=<?=$i;?>" onclick="return confirm('<?=gettext("Do you really want to delete this csc?"); ?>')">
699
							<img src="/themes/<?=$g['theme'];?>/images/icons/icon_x.gif" title="<?=gettext("delete csc"); ?>" width="17" height="17" border="0">
700 d799787e Matthew Grooms
						</a>
701
					</td>
702
				</tr>
703
				<?php
704
					$i++;
705
					endforeach;
706
				?>
707
				<tr>
708
					<td class="list" colspan="3"></td>
709
					<td class="list">
710 deeda874 Carlos Eduardo Ramos
						<a href="vpn_openvpn_csc.php?act=new"><img src="./themes/<?=$g['theme'];?>/images/icons/icon_plus.gif" title="<?=gettext("add csc"); ?>" width="17" height="17" border="0">
711 d799787e Matthew Grooms
						</a>
712
					</td>
713
				</tr>
714
				<tr>
715
					<td colspan="3">
716
						<p>
717
							<?=gettext("Additional OpenVPN client specific overrides can be added here.");?>
718
						</p>
719
					</td>
720
				</tr>
721
			</table>
722
723 ee9933b6 Renato Botelho
			<?php endif; ?>
724 d799787e Matthew Grooms
725
		</td>
726
	</tr>
727
</table>
728
<script language="JavaScript">
729
<!--
730
dns_domain_change();
731
dns_server_change();
732
wins_server_change();
733
ntp_server_change();
734
netbios_change();
735
//-->
736
</script>
737
</body>
738
<?php include("fend.inc"); ?>
739
740
<?php
741
742
/* local utility functions */
743
744
function set_checked($var,& $chk) {
745
    if($var)
746
        $chk = 'checked';
747
    else
748
        $chk = '';
749
}
750
751
?>