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
require("guiconfig.inc");
38
require_once("openvpn.inc");
39

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

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

    
45
$a_csc = &$config['openvpn']['openvpn-csc'];
46

    
47
$id = $_GET['id'];
48
if (isset($_POST['id']))
49
	$id = $_POST['id'];
50

    
51
$act = $_GET['act'];
52
if (isset($_POST['act']))
53
	$act = $_POST['act'];
54

    
55
if ($_GET['act'] == "del") {
56

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

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

    
68
if($_GET['act']=="edit"){
69

    
70
	if (isset($id) && $a_csc[$id]) {
71

    
72
		$pconfig['disable'] = $a_csc[$id]['disable'];
73
		$pconfig['common_name'] = $a_csc[$id]['common_name'];
74
		$pconfig['block'] = $a_csc[$id]['block'];
75
		$pconfig['description'] = $a_csc[$id]['description'];
76

    
77
		$pconfig['tunnel_network'] = $a_csc[$id]['tunnel_network'];
78
		$pconfig['gwredir'] = $a_csc[$id]['gwredir'];
79

    
80
		$pconfig['push_reset'] = $a_csc[$id]['push_reset'];
81

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

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

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

    
102
		$pconfig['netbios_enable'] = $a_csc[$id]['netbios_enable'];
103
		$pconfig['netbios_ntype'] = $a_csc[$id]['netbios_ntype'];
104
		$pconfig['netbios_scope'] = $a_csc[$id]['netbios_scope'];
105

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

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

    
118
if ($_POST) {
119

    
120
	unset($input_errors);
121
	$pconfig = $_POST;
122

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

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

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

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

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

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

    
166
	if (!$input_errors) {
167

    
168
		$csc = array();
169

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

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

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

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

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

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

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

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

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

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

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

    
223
include("head.inc");
224

    
225
?>
226

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

    
232
function dns_domain_change() {
233

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

    
240
function dns_server_change() {
241

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

    
248
function wins_server_change() {
249

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

    
256
function ntp_server_change() {
257

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

    
264
function netbios_change() {
265

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

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

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

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

    
649
			<?php else: ?>
650

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

    
705
			<? endif; ?>
706

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

    
722
<?php
723

    
724
/* local utility functions */
725

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

    
733
?>
734

    
(205-205/214)