Project

General

Profile

Download (25.7 KB) Statistics
| Branch: | Tag: | Revision:
1
<?php 
2
/*
3
	vpn_openvpn_csc.php
4

    
5
	Copyright (C) 2008 Shrew Soft Inc.
6
	All rights reserved. 
7

    
8
	Redistribution and use in source and binary forms, with or without
9
	modification, are permitted provided that the following conditions are met:
10
	
11
	1. Redistributions of source code must retain the above copyright notice,
12
	   this list of conditions and the following disclaimer.
13
	
14
	2. Redistributions in binary form must reproduce the above copyright
15
	   notice, this list of conditions and the following disclaimer in the
16
	   documentation and/or other materials provided with the distribution.
17
	
18
	THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
19
	INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
20
	AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
21
	AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
22
	OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
23
	SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
24
	INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
25
	CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
26
	ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
27
	POSSIBILITY OF SUCH DAMAGE.
28
*/
29

    
30
##|+PRIV
31
##|*IDENT=page-openvpn-csc
32
##|*NAME=OpenVPN: Client Specific Override page
33
##|*DESCR=Allow access to the 'OpenVPN: Client Specific Override' page.
34
##|*MATCH=vpn_openvpn_csc.php*
35
##|-PRIV
36

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

    
40
$pgtitle = array(gettext("OpenVPN"), gettext("Client Specific Override"));
41
$shortcut_section = "openvpn";
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
		$pconfig['custom_options'] = $a_csc[$id]['custom_options'];
73
		$pconfig['disable'] = isset($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[] = gettext("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[] = gettext("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[] = gettext("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[] = gettext("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[] = gettext("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[] = gettext("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[] = gettext("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[] = gettext("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[] = gettext("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[] = gettext("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[] = gettext("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['custom_options'] = $pconfig['custom_options'];
172
		if ($_POST['disable'] == "yes")
173
			$csc['disable'] = true;
174
		$csc['common_name'] = $pconfig['common_name'];
175
		$csc['block'] = $pconfig['block'];
176
		$csc['description'] = $pconfig['description'];
177

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

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

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

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

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

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

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

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

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

    
219
		if (!empty($old_csc_cn))
220
			openvpn_cleanup_csc($old_csc_cn);
221
		openvpn_resync_csc($csc);
222
		write_config();
223
		
224
		header("Location: vpn_openvpn_csc.php");
225
		exit;
226
	}
227
}
228

    
229
include("head.inc");
230

    
231
?>
232

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

    
238
function dns_domain_change() {
239

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

    
246
function dns_server_change() {
247

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

    
254
function wins_server_change() {
255

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

    
262
function ntp_server_change() {
263

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

    
270
function netbios_change() {
271

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

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

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

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

    
670
			<?php else: ?>
671

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

    
726
			<?php endif; ?>
727

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

    
743
<?php
744

    
745
/* local utility functions */
746

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

    
754
?>
755

    
(238-238/246)