Projet

Général

Profil

Télécharger (26 ko) Statistiques
| Branche: | Tag: | Révision:

univnautes / usr / local / www / vpn_openvpn_csc.php @ 6b71ebb7

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
if (is_numericint($_GET['id']))
49
	$id = $_GET['id'];
50
if (isset($_POST['id']) && is_numericint($_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[] = gettext("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[] = gettext("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[] = gettext("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[] = gettext("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[] = gettext("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[] = gettext("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[] = gettext("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[] = gettext("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[] = gettext("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[] = gettext("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[] = gettext("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
			$old_csc_cn = $a_csc[$id]['common_name'];
216
			$a_csc[$id] = $csc;
217
		} else
218
			$a_csc[] = $csc;
219

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

    
230
include("head.inc");
231

    
232
?>
233

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

    
239
function dns_domain_change() {
240

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

    
247
function dns_server_change() {
248

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

    
255
function wins_server_change() {
256

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

    
263
function ntp_server_change() {
264

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

    
271
function netbios_change() {
272

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

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

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

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

    
671
			<?php else: ?>
672

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

    
729
			<?php endif; ?>
730

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

    
745
<?php
746

    
747
/* local utility functions */
748

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

    
756
?>
757
</body>
758
</html>
(238-238/246)