Project

General

Profile

Download (23.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

    
38
require("guiconfig.inc");
39
require_once("openvpn.inc");
40

    
41
$pgtitle = array("OpenVPN", "Client Specific Override");
42

    
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
	openvpn_delete_csc($$a_csc[$id]);
64
	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

    
73
		$pconfig['disable'] = $a_csc[$id]['disable'];
74
		$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
			$input_errors[] = "The field 'DNS Server #1' must contain a valid IP address";
131
		if (!empty($pconfig['dns_server2']) && !is_ipaddr(trim($pconfig['dns_server2'])))
132
			$input_errors[] = "The field 'DNS Server #2' must contain a valid IP address";
133
		if (!empty($pconfig['dns_server3']) && !is_ipaddr(trim($pconfig['dns_server3'])))
134
			$input_errors[] = "The field 'DNS Server #3' must contain a valid IP address";
135
		if (!empty($pconfig['dns_server4']) && !is_ipaddr(trim($pconfig['dns_server4'])))
136
			$input_errors[] = "The field 'DNS Server #4' must contain a valid IP address";
137
	}
138

    
139
	if ($pconfig['ntp_server_enable']) {
140
		if (!empty($pconfig['ntp_server1']) && !is_ipaddr(trim($pconfig['ntp_server1'])))
141
			$input_errors[] = "The field 'NTP Server #1' must contain a valid IP address";
142
		if (!empty($pconfig['ntp_server2']) && !is_ipaddr(trim($pconfig['ntp_server2'])))
143
			$input_errors[] = "The field 'NTP Server #2' must contain a valid IP address";
144
		if (!empty($pconfig['ntp_server3']) && !is_ipaddr(trim($pconfig['ntp_server3'])))
145
			$input_errors[] = "The field 'NTP Server #3' must contain a valid IP address";
146
		if (!empty($pconfig['ntp_server4']) && !is_ipaddr(trim($pconfig['ntp_server4'])))
147
			$input_errors[] = "The field 'NTP Server #4' must contain a valid IP address";
148
	}
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
				$input_errors[] = "The field 'WINS Server #1' must contain a valid IP address";
154
			if (!empty($pconfig['wins_server2']) && !is_ipaddr(trim($pconfig['wins_server2'])))
155
				$input_errors[] = "The field 'WINS Server #2' must contain a valid IP address";
156
		}
157
		if ($pconfig['nbdd_server_enable'])
158
			if (!empty($pconfig['nbdd_server1']) && !is_ipaddr(trim($pconfig['nbdd_server1'])))
159
				$input_errors[] = "The field 'NetBIOS Data Distribution Server #1' must contain a valid IP address";
160
	}
161

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

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

    
167
	if (!$input_errors) {
168

    
169
		$csc = array();
170

    
171
		$csc['disable'] = $pconfig['disable'];
172
		$csc['common_name'] = $pconfig['common_name'];
173
		$csc['block'] = $pconfig['block'];
174
		$csc['description'] = $pconfig['description'];
175

    
176
		$csc['tunnel_network'] = $pconfig['tunnel_network'];
177
		$csc['gwredir'] = $pconfig['gwredir'];
178

    
179
		$csc['push_reset'] = $pconfig['push_reset'];
180

    
181
		if ($pconfig['dns_domain_enable'])
182
			$csc['dns_domain'] = $pconfig['dns_domain'];
183

    
184
		if ($pconfig['dns_server_enable']) {
185
			$csc['dns_server1'] = $pconfig['dns_server1'];
186
			$csc['dns_server2'] = $pconfig['dns_server2'];
187
			$csc['dns_server3'] = $pconfig['dns_server3'];
188
			$csc['dns_server4'] = $pconfig['dns_server4'];
189
		}
190

    
191
		if ($pconfig['ntp_server_enable']) {
192
			$csc['ntp_server1'] = $pconfig['ntp_server1'];
193
			$csc['ntp_server2'] = $pconfig['ntp_server2'];
194
		}
195

    
196
		$csc['netbios_enable'] = $pconfig['netbios_enable'];
197
		$csc['netbios_ntype'] = $pconfig['netbios_ntype'];
198
		$csc['netbios_scope'] = $pconfig['netbios_scope'];
199

    
200
		if ($pconfig['netbios_enable']) {
201

    
202
			if ($pconfig['wins_server_enable']) {
203
				$csc['wins_server1'] = $pconfig['wins_server1'];
204
				$csc['wins_server2'] = $pconfig['wins_server2'];
205
			}
206

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

    
216
		openvpn_resync_csc($csc);
217
		write_config();
218
		
219
		header("Location: vpn_openvpn_csc.php");
220
		exit;
221
	}
222
}
223

    
224
include("head.inc");
225

    
226
?>
227

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

    
233
function dns_domain_change() {
234

    
235
	if (document.iform.dns_domain_enable.checked)
236
		document.getElementById("dns_domain_data").style.display="";
237
	else
238
		document.getElementById("dns_domain_data").style.display="none";
239
}
240

    
241
function dns_server_change() {
242

    
243
	if (document.iform.dns_server_enable.checked)
244
		document.getElementById("dns_server_data").style.display="";
245
	else
246
		document.getElementById("dns_server_data").style.display="none";
247
}
248

    
249
function wins_server_change() {
250

    
251
	if (document.iform.wins_server_enable.checked)
252
		document.getElementById("wins_server_data").style.display="";
253
	else
254
		document.getElementById("wins_server_data").style.display="none";
255
}
256

    
257
function ntp_server_change() {
258

    
259
	if (document.iform.ntp_server_enable.checked)
260
		document.getElementById("ntp_server_data").style.display="";
261
	else
262
		document.getElementById("ntp_server_data").style.display="none";
263
}
264

    
265
function netbios_change() {
266

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

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

    
302
			<?php if($act=="new" || $act=="edit"): ?>
303

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

    
650
			<?php else: ?>
651

    
652
			<table width="100%" border="0" cellpadding="0" cellspacing="0">
653
				<tr>
654
					<td width="10%" class="listhdrr">Disabled</td>
655
					<td width="40%" class="listhdrr">Common Name</td>
656
					<td width="40%" class="listhdrr">Description</td>
657
					<td width="10%" class="list"></td>
658
				</tr>
659
				<?php
660
					$i = 0;
661
					foreach($a_csc as $csc):
662
						$disabled = "NO";
663
						if ($csc['disable'])
664
							$disabled = "YES";
665
				?>
666
				<tr>
667
					<td class="listlr">
668
						<?=$disabled;?>
669
					</td>
670
					<td class="listr">
671
						<?=htmlspecialchars($csc['common_name']);?>
672
					</td>
673
					<td class="listbg">
674
						<?=htmlspecialchars($csc['description']);?>
675
					</td>
676
					<td valign="middle" nowrap class="list">
677
						<a href="vpn_openvpn_csc.php?act=edit&id=<?=$i;?>">
678
							<img src="./themes/<?=$g['theme'];?>/images/icons/icon_e.gif" title="edit csc" width="17" height="17" border="0">
679
						</a>
680
						&nbsp;
681
						<a href="vpn_openvpn_csc.php?act=del&id=<?=$i;?>" onclick="return confirm('Do you really want to delete this csc?')">
682
							<img src="/themes/<?=$g['theme'];?>/images/icons/icon_x.gif" title="delete csc" width="17" height="17" border="0">
683
						</a>
684
					</td>
685
				</tr>
686
				<?php
687
					$i++;
688
					endforeach;
689
				?>
690
				<tr>
691
					<td class="list" colspan="3"></td>
692
					<td class="list">
693
						<a href="vpn_openvpn_csc.php?act=new"><img src="./themes/<?=$g['theme'];?>/images/icons/icon_plus.gif" title="add csc" width="17" height="17" border="0">
694
						</a>
695
					</td>
696
				</tr>
697
				<tr>
698
					<td colspan="3">
699
						<p>
700
							<?=gettext("Additional OpenVPN client specific overrides can be added here.");?>
701
						</p>
702
					</td>
703
				</tr>
704
			</table>
705

    
706
			<? endif; ?>
707

    
708
		</td>
709
	</tr>
710
</table>
711
<script language="JavaScript">
712
<!--
713
dns_domain_change();
714
dns_server_change();
715
wins_server_change();
716
ntp_server_change();
717
netbios_change();
718
//-->
719
</script>
720
</body>
721
<?php include("fend.inc"); ?>
722

    
723
<?php
724

    
725
/* local utility functions */
726

    
727
function set_checked($var,& $chk) {
728
    if($var)
729
        $chk = 'checked';
730
    else
731
        $chk = '';
732
}
733

    
734
?>
735

    
(208-208/217)