Project

General

Profile

Download (25.5 KB) Statistics
| Branch: | Tag: | Revision:
1
<?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
require_once("openvpn.inc");
39

    
40
$pgtitle = array(gettext("OpenVPN"), gettext("Client Specific Override"));
41
$statusurl = "status_openvpn.php";
42
$logurl = "diag_logs_openvpn.php";
43

    
44
if (!is_array($config['openvpn']['openvpn-csc']))
45
	$config['openvpn']['openvpn-csc'] = array();
46

    
47
$a_csc = &$config['openvpn']['openvpn-csc'];
48

    
49
$id = $_GET['id'];
50
if (isset($_POST['id']))
51
	$id = $_POST['id'];
52

    
53
$act = $_GET['act'];
54
if (isset($_POST['act']))
55
	$act = $_POST['act'];
56

    
57
if ($_GET['act'] == "del") {
58

    
59
	if (!$a_csc[$id]) {
60
		pfSenseHeader("vpn_openvpn_csc.php");
61
		exit;
62
	}
63

    
64
	openvpn_delete_csc($$a_csc[$id]);
65
	unset($a_csc[$id]);
66
	write_config();
67
	$savemsg = gettext("Client Specific Override successfully deleted")."<br/>";
68
}
69

    
70
if($_GET['act']=="edit"){
71

    
72
	if (isset($id) && $a_csc[$id]) {
73
		$pconfig['custom_options'] = $a_csc[$id]['custom_options'];
74
		$pconfig['disable'] = isset($a_csc[$id]['disable']);
75
		$pconfig['common_name'] = $a_csc[$id]['common_name'];
76
		$pconfig['block'] = $a_csc[$id]['block'];
77
		$pconfig['description'] = $a_csc[$id]['description'];
78

    
79
		$pconfig['tunnel_network'] = $a_csc[$id]['tunnel_network'];
80
		$pconfig['gwredir'] = $a_csc[$id]['gwredir'];
81

    
82
		$pconfig['push_reset'] = $a_csc[$id]['push_reset'];
83

    
84
		$pconfig['dns_domain'] = $a_csc[$id]['dns_domain'];
85
		if ($pconfig['dns_domain'])
86
			$pconfig['dns_domain_enable'] = true;
87

    
88
		$pconfig['dns_server1'] = $a_csc[$id]['dns_server1'];
89
		$pconfig['dns_server2'] = $a_csc[$id]['dns_server2'];
90
		$pconfig['dns_server3'] = $a_csc[$id]['dns_server3'];
91
		$pconfig['dns_server4'] = $a_csc[$id]['dns_server4'];
92
		if ($pconfig['dns_server1'] ||
93
			$pconfig['dns_server2'] ||
94
			$pconfig['dns_server3'] ||
95
			$pconfig['dns_server4'])
96
			$pconfig['dns_server_enable'] = true;
97

    
98
		$pconfig['ntp_server1'] = $a_csc[$id]['ntp_server1'];
99
		$pconfig['ntp_server2'] = $a_csc[$id]['ntp_server2'];
100
		if ($pconfig['ntp_server1'] ||
101
			$pconfig['ntp_server2'])
102
			$pconfig['ntp_server_enable'] = true;
103

    
104
		$pconfig['netbios_enable'] = $a_csc[$id]['netbios_enable'];
105
		$pconfig['netbios_ntype'] = $a_csc[$id]['netbios_ntype'];
106
		$pconfig['netbios_scope'] = $a_csc[$id]['netbios_scope'];
107

    
108
		$pconfig['wins_server1'] = $a_csc[$id]['wins_server1'];
109
		$pconfig['wins_server2'] = $a_csc[$id]['wins_server2'];
110
		if ($pconfig['wins_server1'] ||
111
			$pconfig['wins_server2'])
112
			$pconfig['wins_server_enable'] = true;
113

    
114
		$pconfig['nbdd_server1'] = $a_csc[$id]['nbdd_server1'];
115
		if ($pconfig['nbdd_server1'])
116
			$pconfig['nbdd_server_enable'] = true;
117
	}
118
}
119

    
120
if ($_POST) {
121

    
122
	unset($input_errors);
123
	$pconfig = $_POST;
124

    
125
	/* input validation */
126
	if ($result = openvpn_validate_cidr($pconfig['tunnel_network'], 'Tunnel network'))
127
		$input_errors[] = $result;
128

    
129
	if ($pconfig['dns_server_enable']) {
130
		if (!empty($pconfig['dns_server1']) && !is_ipaddr(trim($pconfig['dns_server1'])))
131
			$input_errors[] = gettext("The field 'DNS Server #1' must contain a valid IP address");
132
		if (!empty($pconfig['dns_server2']) && !is_ipaddr(trim($pconfig['dns_server2'])))
133
			$input_errors[] = gettext("The field 'DNS Server #2' must contain a valid IP address");
134
		if (!empty($pconfig['dns_server3']) && !is_ipaddr(trim($pconfig['dns_server3'])))
135
			$input_errors[] = gettext("The field 'DNS Server #3' must contain a valid IP address");
136
		if (!empty($pconfig['dns_server4']) && !is_ipaddr(trim($pconfig['dns_server4'])))
137
			$input_errors[] = gettext("The field 'DNS Server #4' must contain a valid IP address");
138
	}
139

    
140
	if ($pconfig['ntp_server_enable']) {
141
		if (!empty($pconfig['ntp_server1']) && !is_ipaddr(trim($pconfig['ntp_server1'])))
142
			$input_errors[] = gettext("The field 'NTP Server #1' must contain a valid IP address");
143
		if (!empty($pconfig['ntp_server2']) && !is_ipaddr(trim($pconfig['ntp_server2'])))
144
			$input_errors[] = gettext("The field 'NTP Server #2' must contain a valid IP address");
145
		if (!empty($pconfig['ntp_server3']) && !is_ipaddr(trim($pconfig['ntp_server3'])))
146
			$input_errors[] = gettext("The field 'NTP Server #3' must contain a valid IP address");
147
		if (!empty($pconfig['ntp_server4']) && !is_ipaddr(trim($pconfig['ntp_server4'])))
148
			$input_errors[] = gettext("The field 'NTP Server #4' must contain a valid IP address");
149
	}
150

    
151
	if ($pconfig['netbios_enable']) {
152
		if ($pconfig['wins_server_enable']) {
153
			if (!empty($pconfig['wins_server1']) && !is_ipaddr(trim($pconfig['wins_server1'])))
154
				$input_errors[] = gettext("The field 'WINS Server #1' must contain a valid IP address");
155
			if (!empty($pconfig['wins_server2']) && !is_ipaddr(trim($pconfig['wins_server2'])))
156
				$input_errors[] = gettext("The field 'WINS Server #2' must contain a valid IP address");
157
		}
158
		if ($pconfig['nbdd_server_enable'])
159
			if (!empty($pconfig['nbdd_server1']) && !is_ipaddr(trim($pconfig['nbdd_server1'])))
160
				$input_errors[] = gettext("The field 'NetBIOS Data Distribution Server #1' must contain a valid IP address");
161
	}
162

    
163
	$reqdfields[] = 'common_name';
164
	$reqdfieldsn[] = 'Common name';
165

    
166
    do_input_validation($_POST, $reqdfields, $reqdfieldsn, &$input_errors);
167

    
168
	if (!$input_errors) {
169

    
170
		$csc = array();
171

    
172
		$csc['custom_options'] = $pconfig['custom_options'];
173
		if ($_POST['disable'] == "yes")
174
			$csc['disable'] = true;
175
		$csc['common_name'] = $pconfig['common_name'];
176
		$csc['block'] = $pconfig['block'];
177
		$csc['description'] = $pconfig['description'];
178

    
179
		$csc['tunnel_network'] = $pconfig['tunnel_network'];
180
		$csc['gwredir'] = $pconfig['gwredir'];
181

    
182
		$csc['push_reset'] = $pconfig['push_reset'];
183

    
184
		if ($pconfig['dns_domain_enable'])
185
			$csc['dns_domain'] = $pconfig['dns_domain'];
186

    
187
		if ($pconfig['dns_server_enable']) {
188
			$csc['dns_server1'] = $pconfig['dns_server1'];
189
			$csc['dns_server2'] = $pconfig['dns_server2'];
190
			$csc['dns_server3'] = $pconfig['dns_server3'];
191
			$csc['dns_server4'] = $pconfig['dns_server4'];
192
		}
193

    
194
		if ($pconfig['ntp_server_enable']) {
195
			$csc['ntp_server1'] = $pconfig['ntp_server1'];
196
			$csc['ntp_server2'] = $pconfig['ntp_server2'];
197
		}
198

    
199
		$csc['netbios_enable'] = $pconfig['netbios_enable'];
200
		$csc['netbios_ntype'] = $pconfig['netbios_ntype'];
201
		$csc['netbios_scope'] = $pconfig['netbios_scope'];
202

    
203
		if ($pconfig['netbios_enable']) {
204

    
205
			if ($pconfig['wins_server_enable']) {
206
				$csc['wins_server1'] = $pconfig['wins_server1'];
207
				$csc['wins_server2'] = $pconfig['wins_server2'];
208
			}
209

    
210
			if ($pconfig['dns_server_enable'])
211
				$csc['nbdd_server1'] = $pconfig['nbdd_server1'];
212
		}
213
	
214
		if (isset($id) && $a_csc[$id])
215
			$a_csc[$id] = $csc;
216
		else
217
			$a_csc[] = $csc;
218

    
219
		openvpn_resync_csc($csc);
220
		write_config();
221
		
222
		header("Location: vpn_openvpn_csc.php");
223
		exit;
224
	}
225
}
226

    
227
include("head.inc");
228

    
229
?>
230

    
231
<body link="#000000" vlink="#000000" alink="#000000" onload="<?= $jsevents["body"]["onload"] ?>">
232
<?php include("fbegin.inc"); ?>
233
<script language="JavaScript">
234
<!--
235

    
236
function dns_domain_change() {
237

    
238
	if (document.iform.dns_domain_enable.checked)
239
		document.getElementById("dns_domain_data").style.display="";
240
	else
241
		document.getElementById("dns_domain_data").style.display="none";
242
}
243

    
244
function dns_server_change() {
245

    
246
	if (document.iform.dns_server_enable.checked)
247
		document.getElementById("dns_server_data").style.display="";
248
	else
249
		document.getElementById("dns_server_data").style.display="none";
250
}
251

    
252
function wins_server_change() {
253

    
254
	if (document.iform.wins_server_enable.checked)
255
		document.getElementById("wins_server_data").style.display="";
256
	else
257
		document.getElementById("wins_server_data").style.display="none";
258
}
259

    
260
function ntp_server_change() {
261

    
262
	if (document.iform.ntp_server_enable.checked)
263
		document.getElementById("ntp_server_data").style.display="";
264
	else
265
		document.getElementById("ntp_server_data").style.display="none";
266
}
267

    
268
function netbios_change() {
269

    
270
	if (document.iform.netbios_enable.checked) {
271
		document.getElementById("netbios_data").style.display="";
272
		document.getElementById("wins_opts").style.display="";
273
	} else {
274
		document.getElementById("netbios_data").style.display="none";
275
		document.getElementById("wins_opts").style.display="none";
276
	}
277
}
278

    
279
//-->
280
</script>
281
<?php
282
	if ($input_errors)
283
		print_input_errors($input_errors);
284
	if ($savemsg)
285
		print_info_box($savemsg);
286
?>
287
<table width="100%" border="0" cellpadding="0" cellspacing="0">
288
 	<tr>
289
		<td class="tabnavtbl">
290
			<ul id="tabnav">
291
			<?php 
292
				$tab_array = array();
293
				$tab_array[] = array(gettext("Server"), false, "vpn_openvpn_server.php");
294
				$tab_array[] = array(gettext("Client"), false, "vpn_openvpn_client.php");
295
				$tab_array[] = array(gettext("Client Specific Overrides"), true, "vpn_openvpn_csc.php");
296
				$tab_array[] = array(gettext("Wizards"), false, "wizard.php?xml=openvpn_wizard.xml");
297
				add_package_tabs("OpenVPN", $tab_array);
298
				display_top_tabs($tab_array);
299
			?>
300
			</ul>
301
		</td>
302
	</tr>    
303
	<tr>
304
		<td class="tabcont">
305

    
306
			<?php if($act=="new" || $act=="edit"): ?>
307

    
308
			<form action="vpn_openvpn_csc.php" method="post" name="iform" id="iform" onsubmit="presubmit()">
309
				<table width="100%" border="0" cellpadding="6" cellspacing="0">
310
					<tr>
311
						<td colspan="2" valign="top" class="listtopic"><?=gettext("General information"); ?></td>
312
					</tr>	
313
					<tr>
314
						<td width="22%" valign="top" class="vncellreq"><?=gettext("Disabled"); ?></td>
315
						<td width="78%" class="vtable">
316
							<table border="0" cellpadding="0" cellspacing="0">
317
								<tr>
318
									<td>
319
										<?php set_checked($pconfig['disable'],$chk); ?>
320
										<input name="disable" type="checkbox" value="yes" <?=$chk;?>/>
321
									</td>
322
									<td>
323
										&nbsp;
324
										<span class="vexpl">
325
											<strong><?=gettext("Disable this override"); ?></strong><br>
326
										</span>
327
									</td>
328
								</tr>
329
							</table>
330
							<?=gettext("Set this option to disable this client-specific override without removing it from the list"); ?>.
331
						</td>
332
					</tr>
333
					<tr> 
334
						<td width="22%" valign="top" class="vncellreq"><?=gettext("Common name"); ?></td>
335
						<td width="78%" class="vtable"> 
336
							<input name="common_name" type="text" class="formfld unknown" size="30" value="<?=htmlspecialchars($pconfig['common_name']);?>">
337
							<br>
338
							<?=gettext("Enter the client's X.509 common name here"); ?>.
339
						</td>
340
					</tr>
341
					<tr> 
342
						<td width="22%" valign="top" class="vncell"><?=gettext("Description"); ?></td>
343
						<td width="78%" class="vtable"> 
344
							<input name="description" type="text" class="formfld unknown" size="30" value="<?=htmlspecialchars($pconfig['description']);?>">
345
							<br>
346
							<?=gettext("You may enter a description here for your reference (not parsed)"); ?>.
347
						</td>
348
					</tr>
349
					<tr>
350
						<td width="22%" valign="top" class="vncell"><?=gettext("Connection blocking"); ?></td>
351
						<td width="78%" class="vtable">
352
							<table border="0" cellpadding="2" cellspacing="0">
353
								<tr>
354
									<td>
355
										<?php set_checked($pconfig['block'],$chk); ?>
356
										<input name="block" type="checkbox" value="yes" <?=$chk;?>/>
357
									</td>
358
									<td>
359
										<span class="vexpl">
360
											<?=gettext("Block this client connection based on its common name"); ?>.
361
										</span>
362
									</td>
363
								</tr>
364
							</table>
365
							<?=gettext("Don't use this option to permanently disable a " .
366
							"client due to a compromised key or password. " .
367
							"Use a CRL (certificate revocation list) instead"); ?>.
368
						</td>
369
					</tr>
370
					<tr>
371
						<td colspan="2" class="list" height="12"></td>
372
					</tr>
373
					<tr>
374
						<td colspan="2" valign="top" class="listtopic"><?=gettext("Tunnel Settings"); ?></td>
375
					</tr>
376
					<tr>
377
						<td width="22%" valign="top" class="vncell"><?=gettext("Tunnel Network"); ?></td>
378
						<td width="78%" class="vtable">
379
							<input name="tunnel_network" type="text" class="formfld unknown" size="20" value="<?=htmlspecialchars($pconfig['tunnel_network']);?>">
380
							<br>
381
							<?=gettext("This is the virtual network used for private " .
382
							"communications between this client and the " .
383
							"server expressed using CIDR (eg. 10.0.8.0/24). " .
384
							"The first network address is assumed to be the " .
385
							"server address and the second network address " .
386
							"will be assigned to the client virtual " .
387
							"interface"); ?>.
388
						</td>
389
					</tr>
390
					<tr>
391
						<td width="22%" valign="top" class="vncell"><?=gettext("Redirect Gateway"); ?></td>
392
						<td width="78%" class="vtable">
393
							<table border="0" cellpadding="2" cellspacing="0">
394
								<tr>
395
									<td>
396
										<?php set_checked($pconfig['gwredir'],$chk); ?>
397
										<input name="gwredir" type="checkbox" value="yes" <?=$chk;?>/>
398
									</td>
399
									<td>
400
										<span class="vexpl">
401
											<?=gettext("Force all client generated traffic through the tunnel"); ?>.
402
										</span>
403
									</td>
404
								</tr>
405
							</table>
406
						</td>
407
					</tr>
408
					<tr>
409
						<td colspan="2" class="list" height="12"></td>
410
					</tr>
411
					<tr>
412
						<td colspan="2" valign="top" class="listtopic"><?=gettext("Client Settings"); ?></td>
413
					</tr>
414
					<tr>
415
						<td width="22%" valign="top" class="vncell"><?=gettext("Server Definitions"); ?></td>
416
						<td width="78%" class="vtable">
417
							<table border="0" cellpadding="2" cellspacing="0">
418
								<tr>
419
									<td>
420
										<?php set_checked($pconfig['push_reset'],$chk); ?>
421
										<input name="push_reset" type="checkbox" value="yes" <?=$chk;?>/>
422
									</td>
423
									<td>
424
										<span class="vexpl">
425
											<?=gettext("Prevent this client from receiving any server-defined client settings"); ?>.
426
										</span>
427
									</td>
428
								</tr>
429
							</table>
430
						</td>
431
					</tr>
432
					<tr>
433
						<td width="22%" valign="top" class="vncell"><?=gettext("DNS Default Domain"); ?></td>
434
						<td width="78%" class="vtable">
435
							<table border="0" cellpadding="2" cellspacing="0">
436
								<tr>
437
									<td>
438
										<?php set_checked($pconfig['dns_domain_enable'],$chk); ?>
439
										<input name="dns_domain_enable" type="checkbox" id="dns_domain_enable" value="yes" <?=$chk;?> onClick="dns_domain_change()">
440
									</td>
441
									<td>
442
										<span class="vexpl">
443
	                                        <?=gettext("Provide a default domain name to clients"); ?><br>
444
										</span>
445
									</td>
446
								</tr>
447
							</table>
448
							<table border="0" cellpadding="2" cellspacing="0" id="dns_domain_data">
449
								<tr>
450
									<td>
451
										<input name="dns_domain" type="text" class="formfld unknown" id="dns_domain" size="30" value="<?=htmlspecialchars($pconfig['dns_domain']);?>">
452
									</td>
453
								</tr>
454
							</table>
455
						</td>
456
					</tr>
457
					<tr>
458
						<td width="22%" valign="top" class="vncell"><?=gettext("DNS Servers"); ?></td>
459
						<td width="78%" class="vtable">
460
							<table border="0" cellpadding="2" cellspacing="0">
461
								<tr>
462
									<td>
463
										<?php set_checked($pconfig['dns_server_enable'],$chk); ?>
464
										<input name="dns_server_enable" type="checkbox" id="dns_server_enable" value="yes" <?=$chk;?> onClick="dns_server_change()">
465
									</td>
466
									<td>
467
										<span class="vexpl">
468
											<?=gettext("Provide a DNS server list to clients"); ?><br>
469
										</span>
470
									</td>
471
								</tr>
472
							</table>
473
							<table border="0" cellpadding="2" cellspacing="0" id="dns_server_data">
474
								<tr>
475
									<td>
476
										<span class="vexpl">
477
											<?=gettext("Server"); ?> #1:&nbsp;
478
										</span>
479
										<input name="dns_server1" type="text" class="formfld unknown" id="dns_server1" size="20" value="<?=$pconfig['dns_server1'];?>">
480
									</td>
481
								</tr>
482
								<tr>
483
									<td>
484
										<span class="vexpl">
485
											<?=gettext("Server"); ?> #2:&nbsp;
486
										</span>
487
										<input name="dns_server2" type="text" class="formfld unknown" id="dns_server2" size="20" value="<?=$pconfig['dns_server2'];?>">
488
									</td>
489
								</tr>
490
								<tr>
491
									<td>
492
										<span class="vexpl">
493
											<?=gettext("Server"); ?> #3:&nbsp;
494
										</span>
495
										<input name="dns_server3" type="text" class="formfld unknown" id="dns_server3" size="20" value="<?=$pconfig['dns_server3'];?>">
496
									</td>
497
								</tr>
498
								<tr>
499
									<td>
500
										<span class="vexpl">
501
											<?=gettext("Server"); ?> #4:&nbsp;
502
										</span>
503
										<input name="dns_server4" type="text" class="formfld unknown" id="dns_server4" size="20" value="<?=$pconfig['dns_server4'];?>">
504
									</td>
505
								</tr>
506
							</table>
507
						</td>
508
					</tr>
509
					<tr>
510
						<td width="22%" valign="top" class="vncell"><?=gettext("NTP Servers"); ?></td>
511
						<td width="78%" class="vtable">
512
							<table border="0" cellpadding="2" cellspacing="0">
513
								<tr>
514
									<td>
515
										<?php set_checked($pconfig['ntp_server_enable'],$chk); ?>
516
										<input name="ntp_server_enable" type="checkbox" id="ntp_server_enable" value="yes" <?=$chk;?> onClick="ntp_server_change()">
517
									</td>
518
									<td>
519
										<span class="vexpl">
520
											<?=gettext("Provide a NTP server list to clients"); ?><br>
521
										</span>
522
									</td>
523
								</tr>
524
							</table>
525
							<table border="0" cellpadding="2" cellspacing="0" id="ntp_server_data">
526
								<tr>
527
									<td>
528
										<span class="vexpl">
529
											<?=gettext("Server"); ?> #1:&nbsp;
530
										</span>
531
										<input name="ntp_server1" type="text" class="formfld unknown" id="ntp_server1" size="20" value="<?=$pconfig['ntp_server1'];?>">
532
									</td>
533
								</tr>
534
								<tr>
535
									<td>
536
										<span class="vexpl">
537
											<?=gettext("Server"); ?> #2:&nbsp;
538
										</span>
539
										<input name="ntp_server2" type="text" class="formfld unknown" id="ntp_server2" size="20" value="<?=$pconfig['ntp_server2'];?>">
540
									</td>
541
								</tr>
542
							</table>
543
						</td>
544
					</tr>
545
					<tr>
546
						<td width="22%" valign="top" class="vncell"><?=gettext("NetBIOS Options"); ?></td>
547
						<td width="78%" class="vtable">
548
							<table border="0" cellpadding="2" cellspacing="0">
549
								<tr>
550
									<td>
551
										<?php set_checked($pconfig['netbios_enable'],$chk); ?>
552
										<input name="netbios_enable" type="checkbox" id="netbios_enable" value="yes" <?=$chk;?> onClick="netbios_change()">
553
									</td>
554
									<td>
555
										<span class="vexpl">
556
											<?=gettext("Enable NetBIOS over TCP/IP"); ?><br>
557
										</span>
558
									</td>
559
								</tr>
560
							</table>
561
							<?=gettext("If this option is not set, all NetBIOS-over-TCP/IP options (includeing WINS) will be disabled"); ?>.
562
							<br/>
563
							<table border="0" cellpadding="2" cellspacing="0" id="netbios_data">
564
								<tr>
565
									<td>
566
										<br/>
567
										<span class="vexpl">
568
											<?=gettext("Node Type"); ?>:&nbsp;
569
										</span>
570
										<select name='netbios_ntype' class="formselect">
571
										<?php
572
											foreach ($netbios_nodetypes as $type => $name):
573
												$selected = "";
574
												if ($pconfig['netbios_ntype'] == $type)
575
													$selected = "selected";
576
										?>
577
											<option value="<?=$type;?>" <?=$selected;?>><?=$name;?></option>
578
										<?php endforeach; ?>
579
										</select>
580
										<br/>
581
										<?=gettext("Possible options: b-node (broadcasts), p-node " .
582
										"(point-to-point name queries to a WINS server), " .
583
										"m-node (broadcast then query name server), and " .
584
										"h-node (query name server, then broadcast)"); ?>.
585
									</td>
586
								</tr>
587
								<tr>
588
									<td>
589
										<br/>
590
										<span class="vexpl">
591
											Scope ID:&nbsp;
592
										</span>
593
										<input name="netbios_scope" type="text" class="formfld unknown" id="netbios_scope" size="30" value="<?=htmlspecialchars($pconfig['netbios_scope']);?>">
594
										<br/>
595
										<?=gettext("A NetBIOS Scope	ID provides an extended naming " .
596
										"service for	NetBIOS over TCP/IP. The NetBIOS " .
597
										"scope ID isolates NetBIOS traffic on a single " .
598
										"network to only those nodes with the same " .
599
										"NetBIOS scope ID"); ?>.
600
									</td>
601
								</tr>
602
							</table>
603
						</td>
604
					</tr>
605
					<tr id="wins_opts">
606
						<td width="22%" valign="top" class="vncell"><?=gettext("WINS Servers"); ?></td>
607
						<td width="78%" class="vtable">
608
							<table border="0" cellpadding="2" cellspacing="0">
609
								<tr>
610
									<td>
611
										<?php set_checked($pconfig['wins_server_enable'],$chk); ?>
612
										<input name="wins_server_enable" type="checkbox" id="wins_server_enable" value="yes" <?=$chk;?> onClick="wins_server_change()">
613
									</td>
614
									<td>
615
										<span class="vexpl">
616
											<?=gettext("Provide a WINS server list to clients"); ?><br>
617
										</span>
618
									</td>
619
								</tr>
620
							</table>
621
							<table border="0" cellpadding="2" cellspacing="0" id="wins_server_data">
622
								<tr>
623
									<td>
624
										<span class="vexpl">
625
											<?=gettext("Server"); ?> #1:&nbsp;
626
										</span>
627
										<input name="wins_server1" type="text" class="formfld unknown" id="wins_server1" size="20" value="<?=$pconfig['wins_server1'];?>">
628
									</td>
629
								</tr>
630
								<tr>
631
									<td>
632
										<span class="vexpl">
633
											<?=gettext("Server"); ?> #2:&nbsp;
634
										</span>
635
										<input name="wins_server2" type="text" class="formfld unknown" id="wins_server2" size="20" value="<?=$pconfig['wins_server2'];?>">
636
									</td>
637
								</tr>
638
							</table>
639
						</td>
640
					</tr>
641
					<tr>
642
						<td width="22%" valign="top" class="vncell"><?=gettext("Advanced"); ?></td>
643
						<td width="78%" class="vtable">
644
							<table border="0" cellpadding="2" cellspacing="0">
645
								<tr>
646
									<td>
647
										<textarea rows="6" cols="78" name="custom_options" id="custom_options"><?=$pconfig['custom_options'];?></textarea><br/>
648
										<?=gettext("Enter any additional options you would like to add for this client specific override, separated by a semicolon"); ?><br/>
649
										<?=gettext("EXAMPLE: push \"route 10.0.0.0 255.255.255.0\""); ?>;
650
									</td>
651
								</tr>
652
							</table>
653
						</td>
654
					</tr>
655
					<tr>
656
						<td width="22%" valign="top">&nbsp;</td>
657
						<td width="78%"> 
658
							<input name="save" type="submit" class="formbtn" value="<?=gettext("Save"); ?>"> 
659
							<input name="act" type="hidden" value="<?=$act;?>">
660
							<?php if (isset($id) && $a_csc[$id]): ?>
661
							<input name="id" type="hidden" value="<?=$id;?>">
662
							<?php endif; ?>
663
						</td>
664
					</tr>
665
				</table>
666
			</form>
667

    
668
			<?php else: ?>
669

    
670
			<table width="100%" border="0" cellpadding="0" cellspacing="0">
671
				<tr>
672
					<td width="10%" class="listhdrr"><?=gettext("Disabled"); ?></td>
673
					<td width="40%" class="listhdrr"><?=gettext("Common Name"); ?></td>
674
					<td width="40%" class="listhdrr"><?=gettext("Description"); ?></td>
675
					<td width="10%" class="list"></td>
676
				</tr>
677
				<?php
678
					$i = 0;
679
					foreach($a_csc as $csc):
680
						$disabled = "NO";
681
						if (isset($csc['disable']))
682
							$disabled = "YES";
683
				?>
684
				<tr>
685
					<td class="listlr">
686
						<?=$disabled;?>
687
					</td>
688
					<td class="listr">
689
						<?=htmlspecialchars($csc['common_name']);?>
690
					</td>
691
					<td class="listbg">
692
						<?=htmlspecialchars($csc['description']);?>
693
					</td>
694
					<td valign="middle" nowrap class="list">
695
						<a href="vpn_openvpn_csc.php?act=edit&id=<?=$i;?>">
696
							<img src="./themes/<?=$g['theme'];?>/images/icons/icon_e.gif" title="<?=gettext("edit csc"); ?>" width="17" height="17" border="0">
697
						</a>
698
						&nbsp;
699
						<a href="vpn_openvpn_csc.php?act=del&id=<?=$i;?>" onclick="return confirm('<?=gettext("Do you really want to delete this csc?"); ?>')">
700
							<img src="/themes/<?=$g['theme'];?>/images/icons/icon_x.gif" title="<?=gettext("delete csc"); ?>" width="17" height="17" border="0">
701
						</a>
702
					</td>
703
				</tr>
704
				<?php
705
					$i++;
706
					endforeach;
707
				?>
708
				<tr>
709
					<td class="list" colspan="3"></td>
710
					<td class="list">
711
						<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">
712
						</a>
713
					</td>
714
				</tr>
715
				<tr>
716
					<td colspan="3">
717
						<p>
718
							<?=gettext("Additional OpenVPN client specific overrides can be added here.");?>
719
						</p>
720
					</td>
721
				</tr>
722
			</table>
723

    
724
			<?php endif; ?>
725

    
726
		</td>
727
	</tr>
728
</table>
729
<script language="JavaScript">
730
<!--
731
dns_domain_change();
732
dns_server_change();
733
wins_server_change();
734
ntp_server_change();
735
netbios_change();
736
//-->
737
</script>
738
</body>
739
<?php include("fend.inc"); ?>
740

    
741
<?php
742

    
743
/* local utility functions */
744

    
745
function set_checked($var,& $chk) {
746
    if($var)
747
        $chk = 'checked';
748
    else
749
        $chk = '';
750
}
751

    
752
?>
753

    
(213-213/222)