Project

General

Profile

Download (24.3 KB) Statistics
| Branch: | Tag: | Revision:
1 d799787e Matthew Grooms
<?php 
2
/*
3
	vpn_openvpn_csc.php
4
5
	Copyright (C) 2008 Shrew Soft Inc.
6
	All rights reserved. 
7
8
	Redistribution and use in source and binary forms, with or without
9
	modification, are permitted provided that the following conditions are met:
10
	
11
	1. Redistributions of source code must retain the above copyright notice,
12
	   this list of conditions and the following disclaimer.
13
	
14
	2. Redistributions in binary form must reproduce the above copyright
15
	   notice, this list of conditions and the following disclaimer in the
16
	   documentation and/or other materials provided with the distribution.
17
	
18
	THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
19
	INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
20
	AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
21
	AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
22
	OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
23
	SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
24
	INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
25
	CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
26
	ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
27
	POSSIBILITY OF SUCH DAMAGE.
28
*/
29
30
##|+PRIV
31
##|*IDENT=page-openvpn-csc
32
##|*NAME=OpenVPN: Client Specific Override page
33
##|*DESCR=Allow access to the 'OpenVPN: Client Specific Override' page.
34
##|*MATCH=vpn_openvpn_csc.php*
35
##|-PRIV
36
37
require("guiconfig.inc");
38 d84bd468 Ermal Lu?i
require_once("openvpn.inc");
39 d799787e Matthew Grooms
40
$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 dc408939 Matthew Grooms
	openvpn_delete_csc($$a_csc[$id]);
63 d799787e Matthew Grooms
	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 72d51890 Scott Ullrich
		$pconfig['custom_options'] = $a_csc[$id]['custom_options'];
72 d799787e Matthew Grooms
		$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 872d9195 Matthew Grooms
	$reqdfields[] = 'common_name';
162
	$reqdfieldsn[] = 'Common name';
163 d799787e Matthew Grooms
164
    do_input_validation($_POST, $reqdfields, $reqdfieldsn, &$input_errors);
165
166
	if (!$input_errors) {
167
168
		$csc = array();
169
170 72d51890 Scott Ullrich
		$csc['custom_options'] = $pconfig['custom_options'];
171 d799787e Matthew Grooms
		$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 dc408939 Matthew Grooms
		openvpn_resync_csc($csc);
217 d799787e Matthew Grooms
		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 5540aee6 Ermal Lu?i
				$tab_array[] = array(gettext("Wizards"), false, "wizard.php?xml=openvpn_wizard.xml");
294 b63f2e8b Matthew Grooms
				add_package_tabs("OpenVPN", $tab_array);
295 d799787e Matthew Grooms
				display_top_tabs($tab_array);
296
			?>
297
			</ul>
298
		</td>
299
	</tr>    
300
	<tr>
301
		<td class="tabcont">
302
303
			<?php if($act=="new" || $act=="edit"): ?>
304
305
			<form action="vpn_openvpn_csc.php" method="post" name="iform" id="iform" onsubmit="presubmit()">
306
				<table width="100%" border="0" cellpadding="6" cellspacing="0">
307 47c00c09 Scott Ullrich
					<tr>
308
						<td colspan="2" valign="top" class="listtopic">General information</td>
309
					</tr>	
310 d799787e Matthew Grooms
					<tr>
311
						<td width="22%" valign="top" class="vncellreq">Disabled</td>
312
						<td width="78%" class="vtable">
313
							<table border="0" cellpadding="0" cellspacing="0">
314
								<tr>
315
									<td>
316
										<?php set_checked($pconfig['disable'],$chk); ?>
317
										<input name="disable" type="checkbox" value="yes" <?=$chk;?>/>
318
									</td>
319
									<td>
320
										&nbsp;
321
										<span class="vexpl">
322
											<strong>Disable this override</strong><br>
323
										</span>
324
									</td>
325
								</tr>
326
							</table>
327
							Set this option to disable this client specific override without removing it from the list.
328
						</td>
329
					</tr>
330
					<tr> 
331
						<td width="22%" valign="top" class="vncellreq">Common name</td>
332
						<td width="78%" class="vtable"> 
333
							<input name="common_name" type="text" class="formfld unknown" size="30" value="<?=htmlspecialchars($pconfig['common_name']);?>">
334
							<br>
335
							Enter the client's X.509 common name here.
336
						</td>
337
					</tr>
338
					<tr> 
339
						<td width="22%" valign="top" class="vncell">Description</td>
340
						<td width="78%" class="vtable"> 
341
							<input name="description" type="text" class="formfld unknown" size="30" value="<?=htmlspecialchars($pconfig['description']);?>">
342
							<br>
343
							You may enter a description here for your reference (not parsed).
344
						</td>
345
					</tr>
346
					<tr>
347
						<td width="22%" valign="top" class="vncell">Connection blocking</td>
348
						<td width="78%" class="vtable">
349
							<table border="0" cellpadding="2" cellspacing="0">
350
								<tr>
351
									<td>
352
										<?php set_checked($pconfig['block'],$chk); ?>
353
										<input name="block" type="checkbox" value="yes" <?=$chk;?>/>
354
									</td>
355
									<td>
356
										<span class="vexpl">
357
											Block this client connection based on its common name.
358
										</span>
359
									</td>
360
								</tr>
361
							</table>
362
							Don't use this option to permenently disable a
363
							client due to a compromised key or password.
364
							Use a CRL (certificate revocation list) instead.
365
						</td>
366
					</tr>
367
					<tr>
368
						<td colspan="2" class="list" height="12"></td>
369
					</tr>
370
					<tr>
371
						<td colspan="2" valign="top" class="listtopic">Tunnel Settings</td>
372
					</tr>
373
					<tr>
374
						<td width="22%" valign="top" class="vncell">Tunnel Network</td>
375
						<td width="78%" class="vtable">
376
							<input name="tunnel_network" type="text" class="formfld unknown" size="20" value="<?=htmlspecialchars($pconfig['tunnel_network']);?>">
377
							<br>
378
							This is the virtual network used for private
379
							communications between this client and the
380
							server expressed using CIDR (eg. 10.0.8.0/24).
381
							The first network address is assumed to be the
382
							server address and the second network address
383
							will be assigned to the client virtual
384
							interface.
385
						</td>
386
					</tr>
387
					<tr>
388
						<td width="22%" valign="top" class="vncell">Redirect Gateway</td>
389
						<td width="78%" class="vtable">
390
							<table border="0" cellpadding="2" cellspacing="0">
391
								<tr>
392
									<td>
393
										<?php set_checked($pconfig['gwredir'],$chk); ?>
394
										<input name="gwredir" type="checkbox" value="yes" <?=$chk;?>/>
395
									</td>
396
									<td>
397
										<span class="vexpl">
398
											Force all client generated traffic through the tunnel.
399
										</span>
400
									</td>
401
								</tr>
402
							</table>
403
						</td>
404
					</tr>
405
					<tr>
406
						<td colspan="2" class="list" height="12"></td>
407
					</tr>
408
					<tr>
409
						<td colspan="2" valign="top" class="listtopic">Client Settings</td>
410
					</tr>
411
					<tr>
412
						<td width="22%" valign="top" class="vncell">Server Definitions</td>
413
						<td width="78%" class="vtable">
414
							<table border="0" cellpadding="2" cellspacing="0">
415
								<tr>
416
									<td>
417
										<?php set_checked($pconfig['push_reset'],$chk); ?>
418
										<input name="push_reset" type="checkbox" value="yes" <?=$chk;?>/>
419
									</td>
420
									<td>
421
										<span class="vexpl">
422
											Prevent this client from receiving any server defined client settings.
423
										</span>
424
									</td>
425
								</tr>
426
							</table>
427
						</td>
428
					</tr>
429
					<tr>
430
						<td width="22%" valign="top" class="vncell">DNS Default Domain</td>
431
						<td width="78%" class="vtable">
432
							<table border="0" cellpadding="2" cellspacing="0">
433
								<tr>
434
									<td>
435
										<?php set_checked($pconfig['dns_domain_enable'],$chk); ?>
436
										<input name="dns_domain_enable" type="checkbox" id="dns_domain_enable" value="yes" <?=$chk;?> onClick="dns_domain_change()">
437
									</td>
438
									<td>
439
										<span class="vexpl">
440
	                                        Provide a default domain name to clients<br>
441
										</span>
442
									</td>
443
								</tr>
444
							</table>
445
							<table border="0" cellpadding="2" cellspacing="0" id="dns_domain_data">
446
								<tr>
447
									<td>
448
										<input name="dns_domain" type="text" class="formfld unknown" id="dns_domain" size="30" value="<?=htmlspecialchars($pconfig['dns_domain']);?>">
449
									</td>
450
								</tr>
451
							</table>
452
						</td>
453
					</tr>
454
					<tr>
455
						<td width="22%" valign="top" class="vncell">DNS Servers</td>
456
						<td width="78%" class="vtable">
457
							<table border="0" cellpadding="2" cellspacing="0">
458
								<tr>
459
									<td>
460
										<?php set_checked($pconfig['dns_server_enable'],$chk); ?>
461
										<input name="dns_server_enable" type="checkbox" id="dns_server_enable" value="yes" <?=$chk;?> onClick="dns_server_change()">
462
									</td>
463
									<td>
464
										<span class="vexpl">
465
											Provide a DNS server list to clients<br>
466
										</span>
467
									</td>
468
								</tr>
469
							</table>
470
							<table border="0" cellpadding="2" cellspacing="0" id="dns_server_data">
471
								<tr>
472
									<td>
473
										<span class="vexpl">
474
											Server #1:&nbsp;
475
										</span>
476
										<input name="dns_server1" type="text" class="formfld unknown" id="dns_server1" size="20" value="<?=$pconfig['dns_server1'];?>">
477
									</td>
478
								</tr>
479
								<tr>
480
									<td>
481
										<span class="vexpl">
482
											Server #2:&nbsp;
483
										</span>
484
										<input name="dns_server2" type="text" class="formfld unknown" id="dns_server2" size="20" value="<?=$pconfig['dns_server2'];?>">
485
									</td>
486
								</tr>
487
								<tr>
488
									<td>
489
										<span class="vexpl">
490
											Server #3:&nbsp;
491
										</span>
492
										<input name="dns_server3" type="text" class="formfld unknown" id="dns_server3" size="20" value="<?=$pconfig['dns_server3'];?>">
493
									</td>
494
								</tr>
495
								<tr>
496
									<td>
497
										<span class="vexpl">
498
											Server #4:&nbsp;
499
										</span>
500
										<input name="dns_server4" type="text" class="formfld unknown" id="dns_server4" size="20" value="<?=$pconfig['dns_server4'];?>">
501
									</td>
502
								</tr>
503
							</table>
504
						</td>
505
					</tr>
506
					<tr>
507
						<td width="22%" valign="top" class="vncell">NTP Servers</td>
508
						<td width="78%" class="vtable">
509
							<table border="0" cellpadding="2" cellspacing="0">
510
								<tr>
511
									<td>
512
										<?php set_checked($pconfig['ntp_server_enable'],$chk); ?>
513
										<input name="ntp_server_enable" type="checkbox" id="ntp_server_enable" value="yes" <?=$chk;?> onClick="ntp_server_change()">
514
									</td>
515
									<td>
516
										<span class="vexpl">
517
											Provide a NTP server list to clients<br>
518
										</span>
519
									</td>
520
								</tr>
521
							</table>
522
							<table border="0" cellpadding="2" cellspacing="0" id="ntp_server_data">
523
								<tr>
524
									<td>
525
										<span class="vexpl">
526
											Server #1:&nbsp;
527
										</span>
528
										<input name="ntp_server1" type="text" class="formfld unknown" id="ntp_server1" size="20" value="<?=$pconfig['ntp_server1'];?>">
529
									</td>
530
								</tr>
531
								<tr>
532
									<td>
533
										<span class="vexpl">
534
											Server #2:&nbsp;
535
										</span>
536
										<input name="ntp_server2" type="text" class="formfld unknown" id="ntp_server2" size="20" value="<?=$pconfig['ntp_server2'];?>">
537
									</td>
538
								</tr>
539
							</table>
540
						</td>
541
					</tr>
542
					<tr>
543
						<td width="22%" valign="top" class="vncell">NetBIOS Options</td>
544
						<td width="78%" class="vtable">
545
							<table border="0" cellpadding="2" cellspacing="0">
546
								<tr>
547
									<td>
548
										<?php set_checked($pconfig['netbios_enable'],$chk); ?>
549
										<input name="netbios_enable" type="checkbox" id="netbios_enable" value="yes" <?=$chk;?> onClick="netbios_change()">
550
									</td>
551
									<td>
552
										<span class="vexpl">
553
											Enable NetBIOS over TCP/IP<br>
554
										</span>
555
									</td>
556
								</tr>
557
							</table>
558
							If this option is not set, all Netbios-over-TCP/IP options (includeing WINS) will be disabled.
559
							<br/>
560
							<table border="0" cellpadding="2" cellspacing="0" id="netbios_data">
561
								<tr>
562
									<td>
563
										<br/>
564
										<span class="vexpl">
565
											Node Type:&nbsp;
566
										</span>
567
										<select name='netbios_ntype' class="formselect">
568
										<?php
569
											foreach ($netbios_nodetypes as $type => $name):
570
												$selected = "";
571
												if ($pconfig['netbios_ntype'] == $type)
572
													$selected = "selected";
573
										?>
574
											<option value="<?=$type;?>" <?=$selected;?>><?=$name;?></option>
575
										<?php endforeach; ?>
576
										</select>
577
										<br/>
578
										Possible options: b-node (broadcasts), p-node
579
										(point-to-point name queries to a WINS server),
580
										m-node (broadcast then query name server), and
581
										h-node (query name server, then broadcast).
582
									</td>
583
								</tr>
584
								<tr>
585
									<td>
586
										<br/>
587
										<span class="vexpl">
588
											Scope ID:&nbsp;
589
										</span>
590
										<input name="netbios_scope" type="text" class="formfld unknown" id="netbios_scope" size="30" value="<?=htmlspecialchars($pconfig['netbios_scope']);?>">
591
										<br/>
592
										A NetBIOS Scope	ID provides an extended naming
593
										service for	NetBIOS over TCP/IP. The NetBIOS
594
										scope ID isolates NetBIOS traffic on a single
595
										network to only those nodes with the same
596
										NetBIOS scope ID.
597
									</td>
598
								</tr>
599
							</table>
600
						</td>
601
					</tr>
602
					<tr id="wins_opts">
603
						<td width="22%" valign="top" class="vncell">WINS Servers</td>
604
						<td width="78%" class="vtable">
605
							<table border="0" cellpadding="2" cellspacing="0">
606
								<tr>
607
									<td>
608
										<?php set_checked($pconfig['wins_server_enable'],$chk); ?>
609
										<input name="wins_server_enable" type="checkbox" id="wins_server_enable" value="yes" <?=$chk;?> onClick="wins_server_change()">
610
									</td>
611
									<td>
612
										<span class="vexpl">
613
											Provide a WINS server list to clients<br>
614
										</span>
615
									</td>
616
								</tr>
617
							</table>
618
							<table border="0" cellpadding="2" cellspacing="0" id="wins_server_data">
619
								<tr>
620
									<td>
621
										<span class="vexpl">
622
											Server #1:&nbsp;
623
										</span>
624
										<input name="wins_server1" type="text" class="formfld unknown" id="wins_server1" size="20" value="<?=$pconfig['wins_server1'];?>">
625
									</td>
626
								</tr>
627
								<tr>
628
									<td>
629
										<span class="vexpl">
630
											Server #2:&nbsp;
631
										</span>
632
										<input name="wins_server2" type="text" class="formfld unknown" id="wins_server2" size="20" value="<?=$pconfig['wins_server2'];?>">
633
									</td>
634
								</tr>
635
							</table>
636
						</td>
637
					</tr>
638 72d51890 Scott Ullrich
					<tr>
639
						<td width="22%" valign="top" class="vncell">Advanced</td>
640
						<td width="78%" class="vtable">
641
							<table border="0" cellpadding="2" cellspacing="0">
642
								<tr>
643
									<td>
644
										<textarea rows="6" cols="78" name="custom_options" id="custom_options"><?=$pconfig['custom_options'];?></textarea><br/>
645 1a4f9b42 Chris Buechler
										Enter any additional options you would like to add for this client specific override, separated by a semicolon<br/>
646 72d51890 Scott Ullrich
										EXAMPLE: push "route 10.0.0.0 255.255.255.0";
647
									</td>
648
								</tr>
649
							</table>
650
						</td>
651
					</tr>
652 d799787e Matthew Grooms
					<tr>
653
						<td width="22%" valign="top">&nbsp;</td>
654
						<td width="78%"> 
655
							<input name="save" type="submit" class="formbtn" value="Save"> 
656
							<input name="act" type="hidden" value="<?=$act;?>">
657
							<?php if (isset($id) && $a_csc[$id]): ?>
658
							<input name="id" type="hidden" value="<?=$id;?>">
659
							<?php endif; ?>
660
						</td>
661
					</tr>
662
				</table>
663
			</form>
664
665
			<?php else: ?>
666
667
			<table width="100%" border="0" cellpadding="0" cellspacing="0">
668
				<tr>
669
					<td width="10%" class="listhdrr">Disabled</td>
670
					<td width="40%" class="listhdrr">Common Name</td>
671
					<td width="40%" class="listhdrr">Description</td>
672
					<td width="10%" class="list"></td>
673
				</tr>
674
				<?php
675
					$i = 0;
676
					foreach($a_csc as $csc):
677
						$disabled = "NO";
678
						if ($csc['disable'])
679
							$disabled = "YES";
680
				?>
681
				<tr>
682
					<td class="listlr">
683
						<?=$disabled;?>
684
					</td>
685
					<td class="listr">
686
						<?=htmlspecialchars($csc['common_name']);?>
687
					</td>
688 296a3cb6 Scott Ullrich
					<td class="listbg">
689 d799787e Matthew Grooms
						<?=htmlspecialchars($csc['description']);?>
690
					</td>
691
					<td valign="middle" nowrap class="list">
692
						<a href="vpn_openvpn_csc.php?act=edit&id=<?=$i;?>">
693
							<img src="./themes/<?=$g['theme'];?>/images/icons/icon_e.gif" title="edit csc" width="17" height="17" border="0">
694
						</a>
695
						&nbsp;
696
						<a href="vpn_openvpn_csc.php?act=del&id=<?=$i;?>" onclick="return confirm('Do you really want to delete this csc?')">
697
							<img src="/themes/<?=$g['theme'];?>/images/icons/icon_x.gif" title="delete csc" width="17" height="17" border="0">
698
						</a>
699
					</td>
700
				</tr>
701
				<?php
702
					$i++;
703
					endforeach;
704
				?>
705
				<tr>
706
					<td class="list" colspan="3"></td>
707
					<td class="list">
708
						<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">
709
						</a>
710
					</td>
711
				</tr>
712
				<tr>
713
					<td colspan="3">
714
						<p>
715
							<?=gettext("Additional OpenVPN client specific overrides can be added here.");?>
716
						</p>
717
					</td>
718
				</tr>
719
			</table>
720
721
			<? endif; ?>
722
723
		</td>
724
	</tr>
725
</table>
726
<script language="JavaScript">
727
<!--
728
dns_domain_change();
729
dns_server_change();
730
wins_server_change();
731
ntp_server_change();
732
netbios_change();
733
//-->
734
</script>
735
</body>
736
<?php include("fend.inc"); ?>
737
738
<?php
739
740
/* local utility functions */
741
742
function set_checked($var,& $chk) {
743
    if($var)
744
        $chk = 'checked';
745
    else
746
        $chk = '';
747
}
748
749
?>