Project

General

Profile

Download (24.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
$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[] = "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[] = "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[] = "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[] = "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[] = "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[] = "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[] = "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[] = "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[] = "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[] = "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[] = "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
				$tab_array[] = array(gettext("Logs"), false, "diag_logs_openvpn.php");
298
				add_package_tabs("OpenVPN", $tab_array);
299
				display_top_tabs($tab_array);
300
			?>
301
			</ul>
302
		</td>
303
	</tr>    
304
	<tr>
305
		<td class="tabcont">
306

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

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

    
669
			<?php else: ?>
670

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

    
725
			<? endif; ?>
726

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

    
742
<?php
743

    
744
/* local utility functions */
745

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

    
753
?>
754

    
(209-209/218)